🎯

hotkey

🎯Skill

A step-by-step guide for adding keyboard shortcuts to the LobeHub app's code. It shows where to register a shortcut, add its translated name, connect it to an action and show it in a tooltip, while avoiding key conflicts.

lobehub/lobehub61 Installs79,496Last Updated Jul 6, 2026

Installation

$npx skills add lobehub/lobehub --skill hotkey

Run it in a terminal; it asks which AI coding tools to install it for (Claude Code, Codex, Cursor and more).

Uses skills.sh Β· Node.js 22.20+

After installing

Ask for related work and the agent uses it on its own.

Install by hand

Copy the whole skill folder from GitHub to the place below. Copying only SKILL.md can leave out files the skill uses.

Open the skill folder β†’
  • This project .claude/skills/hotkey/
  • All projects ~/.claude/skills/hotkey/

These paths are for Claude Code. For other tools, the command above puts it in the right place.

Use for keyboard shortcuts, registration, key combinations, scope, conflicts and shortcut tooltips.

Adding Keyboard Shortcuts Guide

Steps to Add a New Hotkey

1. Update Hotkey Constant

In packages/types/src/hotkey.ts, add the new id to the HotkeyId union β€” it's the source of truth HotkeyEnum is typed against:

export type HotkeyId =
  | 'addUserMessage'
  // existing...
  | 'saveTopic';

2. Register Default Hotkey

In packages/const/src/hotkeys.ts, KeyEnum and combineKeys are already defined locally in this file, so no import is needed β€” add the entry to HotkeyEnum and to HOTKEYS_REGISTRATION:

export const HotkeyEnum = {
  // existing...
  SaveTopic: 'saveTopic',
} as const satisfies Record<string, HotkeyId>;

export const HOTKEYS_REGISTRATION: HotkeyRegistration = [
  // existing...
  {
    group: HotkeyGroupEnum.Conversation,
    id: HotkeyEnum.SaveTopic,
    keys: combineKeys([KeyEnum.Alt, 'n']),
    scopes: [HotkeyScopeEnum.Chat],
  },
];

3. Add i18n Translation

In packages/locales/src/default/hotkey.ts:

const hotkey: HotkeyI18nTranslations = {
  saveTopic: {
    desc: 'δΏε­˜ε½“ε‰θ―ι’˜εΉΆζ–°ε»ΊδΈ€δΈͺ话钘',
    title: '保存话钘',
  },
};

4. Create and Register Hook

In src/hooks/useHotkeys/chatScope.ts:

export const useSaveTopicHotkey = () => {
  const openNewTopicOrSaveTopic = useChatStore((s) => s.openNewTopicOrSaveTopic);
  return useHotkeyById(HotkeyEnum.SaveTopic, openNewTopicOrSaveTopic);
};

export const useRegisterChatHotkeys = () => {
  useSaveTopicHotkey();
  // ...other hotkeys
};

5. Add Tooltip (Optional)

const saveTopicHotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.SaveTopic));

<Tooltip hotkey={saveTopicHotkey} title={t('saveTopic.title', { ns: 'hotkey' })}>
  <Button icon={<SaveOutlined />} onClick={openNewTopicOrSaveTopic} />
</Tooltip>;

Best Practices

  1. Scope: Choose global or chat scope based on functionality
  2. Grouping: Place in appropriate group (System/Layout/Conversation)
  3. Conflict check: Ensure no conflict with system/browser shortcuts
  4. Platform: Use KeyEnum.Mod instead of hardcoded Ctrl or Cmd
  5. Clear description: Provide title and description for users

Troubleshooting

  • Not working: Check scope and RegisterHotkeys hook
  • Not in settings: Verify HOTKEYS_REGISTRATION config
  • Conflict: HotkeyInput component shows warnings
  • Page-specific: Ensure correct scope activation

More from this repository10

🎯
typescript🎯Skill

A style guide the AI follows when editing TypeScript files. It sets rules for safe types, imports, async code for file and network work, and how to export code so it stays easy to rename and reuse.

🎯
desktop🎯Skill

A guide for developers working on the LobeHub desktop app, which is built with Electron, a tool for making desktop apps with web code. It explains step by step where to put code when adding a desktop feature, and how to read the app's logs.

🎯
project-overview🎯Skill

A map of the LobeHub open-source code for AI agents working on it. It explains which tools the project uses and where the apps, shared packages and main code live.

🎯
add-provider-doc🎯Skill

Automatically generates documentation for AI providers by extracting and formatting relevant details from provider configuration files.

🎯
version-release🎯Skill

Guides maintainers through releasing a new version of the project. It covers preparing the release pull request, following the rules that start an automatic release, and writing the GitHub Release notes. It does not write website changelog pages.

🎯
debug🎯Skill

Skills for LobeHub, an open-source platform for building and collaborating with AI agent teammates. Covers React, TypeScript, Zustand state management, testing, and desktop app development within the LobeHub ecosystem.

🎯
vercel-react-best-practices🎯Skill

Provides guidance and recommendations for implementing React best practices and optimizing web development workflows on Vercel

🎯
db-migrations🎯Skill

A guide for safely changing a database's structure with Drizzle, a TypeScript database tool. It covers schema rules, adding indexes without downtime, filling in existing data, SQL that can run twice safely, and fixing merge conflicts in change files.

🎯
react🎯Skill

A React coding guide for the LobeHub project that tells the AI how to write screen components. It explains which styling method to use, how to move old styles to StyleX, and how to keep screens fast.

🎯
zustand🎯Skill

Coding rules for managing app data with Zustand, a JavaScript library for shared app data, inside the LobeHub project. It explains how to shape data, write update logic, cache server data and test it.