Agent skill
keyboard-shortcuts
How keyboard shortcuts are wired globally and per-panel in this repo.
Install this agent skill to your Project
npx add-skill https://github.com/kcosr/assistant/tree/main/.agents/skills/keyboard-shortcuts
SKILL.md
Keyboard Shortcuts
Overview (registry + services)
- Registry implementation:
packages/web-client/src/utils/keyboardShortcuts.ts. - Registry is created in
packages/web-client/src/index.tsand wired with:isEnabled()(respects the keyboard shortcuts preference + open dialogs)getActivePanel()(for scope resolution)- binding overrides (from local storage via
clientPreferences)
- Core panel services expose
services.keyboardShortcuts.register(...)so plugins can register panel-scoped shortcuts.
Global shortcuts (app-level)
- Register in
KeyboardNavigationControllerviaKeyboardShortcutRegistry.register(...). - Registry attaches a single
documentkeydownlistener (capture phase) and dispatches by key. - Handlers should still guard on editable targets (e.g.,
isEditableTargetpattern inKeyboardNavigationController). - Examples: panel navigation (Ctrl+P / Ctrl+H), command palette (Cmd/Ctrl+K), panel cycling.
- Split placement uses
Ctrl+S(seesplit-panelshortcut inKeyboardNavigationController).
Focus history shortcuts
- Focus history is tracked in
PanelWorkspaceControllerand persisted in local storage (aiAssistantPanelFocusHistory). Ctrl+A/C/D/F/L/N/Tfocus the last-used artifacts/chat/diff/files/lists/notes/time-tracker panel.- If none exist, the shortcut opens a modal panel of that type.
Panel/plugin shortcuts (panel-scoped)
- Use
services.keyboardShortcuts.register(...)from the panel module (see lists/notes/time-tracker). - Set scope explicitly:
scope: 'panelType'+panelTypefor a shared binding across all instances of a panel.scope: 'panelInstance'+panelIdfor instance-specific bindings.
- Always provide a stable
bindingIdto support user-configurable overrides (defaults toidif omitted). - If a handler consumes the event, call
event.preventDefault()andevent.stopPropagation()before returningtrue.
Panel focus awareness
- Panels subscribe to
panel.activecontext and cacheisPanelSelected. - This is the de-facto signal for whether panel shortcuts should run.
Other global listeners to be aware of
CommandPaletteControllerattaches akeydownlistener while open and consumes keys like Escape.PanelWorkspaceControllerlistens for Escape to close modal panels, but blocks when certain overlays are open.
Common options on KeyboardShortcut
allowShift: match even when Shift is pressed but not part of the modifiers.allowWhenDisabled: allow handling even when global shortcuts are disabled (useful for dialogs).priority: resolve conflicts within the same scope.platform: restrict tomac,win,linux, orall.
When adding new shortcuts
- Prefer global shortcuts for true app-level actions.
- For panel behavior, register through
services.keyboardShortcutsso bindings can be overridden later. - Avoid stealing keys from text inputs; always check editable targets before acting.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
plugins-guide
Best practices for working with plugins in the kcosr/assistant repository.
git-guardrails-claude-code
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
scaffold-exercises
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
Didn't find tool you were looking for?