Hotkey
Use for keyboard shortcuts, registration, key combinations, scope, conflicts and shortcut tooltips.
mkdir -p ~/.claude/skills/hotkey && curl -fsSL 'https://raw.githubusercontent.com/lobehub/lobehub/canary/.agents/skills/hotkey/SKILL.md' -o ~/.claude/skills/hotkey/SKILL.md
Get the complete skill folder, including its scripts and reference files.
When to use this skill
Use Hotkey when an AI agent needs a reusable SKILL.md workflow for this job: Use for keyboard shortcuts, registration, key combinations, scope, conflicts and shortcut tooltips.
When not to use it
Skip Hotkey when the task is outside the coding category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.
How to install
Where will you use it?
mkdir -p ~/.claude/skills/hotkey && curl -fsSL 'https://raw.githubusercontent.com/lobehub/lobehub/canary/.agents/skills/hotkey/SKILL.md' -o ~/.claude/skills/hotkey/SKILL.md
- Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/hotkey/SKILL.md. For a shared project, commit the folder at .claude/skills/hotkey/ instead.
- Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
- For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.
Full install guide for Claude, Cursor, and Codex →
Try a starter prompt
After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.
Use the Hotkey skill for this task: Use Hotkey when this documented workflow matches the task. Confirm any required inputs or files before making changes.
What supports this recommendation?
73/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.
- Documentation
- 77/100
- Practical detail
- 76/100
- Source evidence
- 63/100
- Source signals
- 70/100
Model compatibility evidence
- claudeuntested
No model-specific signal or recorded compatibility test was found.
- chatgptuntested
No model-specific signal or recorded compatibility test was found.
- geminiuntested
No model-specific signal or recorded compatibility test was found.
- copilotuntested
No model-specific signal or recorded compatibility test was found.
- llamauntested
No model-specific signal or recorded compatibility test was found.
- perplexityuntested
No model-specific signal or recorded compatibility test was found.
- mistraluntested
No model-specific signal or recorded compatibility test was found.
- grokuntested
No model-specific signal or recorded compatibility test was found.
Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.
What this skill does
# 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:
```typescript 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`:
```typescript 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`:
```typescript const hotkey: HotkeyI18nTranslations = { saveTopic: { desc: '保存当前话题并新建一个话题', title: '保存话题', }, }; ```
### 4. Create and Register Hook
In `src/hooks/useHotkeys/chatScope.ts`:
```typescript export const useSaveTopicHotkey = () => { const openNewTopicOrSaveTopic = useChatStore((s) => s.openNewTopicOrSaveTopic); return useHotkeyById(HotkeyEnum.SaveTopic, openNewTopicOrSaveTopic); };
export const useRegisterChatHotkeys = () => { useSaveTopicHotkey(); // ...other hotkeys }; ```
### 5. Add Tooltip (Optional)
```tsx 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
Intended uses
- Use Hotkey when this documented workflow matches the task.
Implementation notes
- Scope: Choose global or chat scope based on functionality
- Grouping: Place in appropriate group (System/Layout/Conversation)
- Conflict check: Ensure no conflict with system/browser shortcuts
- Platform: Use KeyEnum.Mod instead of hardcoded Ctrl or Cmd
- Clear description: Provide title and description for users
Try it, then tell us how it went
A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.