Skip to content
Source
Sign inSign up
TanStack/hotkeys
Open History to see the last commit

skill_spec.md

163 lines20.0 KB

TanStack Hotkeys — Skill Spec

TanStack Hotkeys is a type-safe keyboard shortcut library with a framework-agnostic core (@tanstack/hotkeys) and adapters for React, Preact, Solid, Vue, Svelte, Angular, Lit, Alpine, Ember, and Octane. It owns listeners, platform modifiers, layout matching, input filtering, browser defaults, key repeat, scopes, a shortcut catalog (app hotkeys), recording, and held-key state.

The skills teach agents to use those APIs directly. The core skills hold the framework-neutral rules and the workarounds to replace; each adapter skill holds its bindings, reactivity rules, and framework-specific mistakes.

Domains

DomainDescriptionSkills
HotkeysRegistering, matching, scoping, and labeling shortcuts, and the keyboard behavior the library ownshotkeys-core
App hotkeysOne catalog of every shortcut for cheat sheets, rebinding, conflict checks, and saved custom hotkeysapp-hotkeys
Framework bindingsAdapter APIs, reactivity rules, provider or manager scopes, element targetsreact-hotkeys, preact-hotkeys, solid-hotkeys, vue-hotkeys, svelte-hotkeys, angular-hotkeys, lit-hotkeys, alpine-hotkeys, ember-hotkeys, octane-hotkeys

Skill Inventory

SkillTypeDomainWhat it coversFailure modes
hotkeys-corecorehotkeysWorkaround → adapter API table, enabled/lifetime/scope/target, non-obvious pitfalls, scopes and testing references11
app-hotkeyscoreapp-hotkeysDeclarations, provider, registration, custom hotkeys, persistence, conflicts, recording reference8
react-hotkeysframeworkframework-bindingsHooks, refs, providers, dialog scopes, app hotkey wiring2 + shared
preact-hotkeysframeworkframework-bindingsSame as React with Preact imports2 + shared
solid-hotkeysframeworkframework-bindingsPrimitives, accessor options, signal targets2 + shared
vue-hotkeysframeworkframework-bindingsComposables, refs and getters, provideHotkeysContext, recorder refs3 + shared
svelte-hotkeysframeworkframework-bindingsGetter options, attachments, setHotkeysContext, reactive getters3 + shared
angular-hotkeysframeworkframework-bindingsInject functions, signal options, provideHotkeys scopes, per-instance scope tokens4 + shared
lit-hotkeysframeworkframework-bindingsDecorator, controllers, manager scopes, decorator mode4 + shared
alpine-hotkeysframeworkframework-bindingsOwners, $hotkeys magic, getter options, manager scopes3 + shared
ember-hotkeysframeworkframework-bindingsTemplate helpers, modifiers, owner-bound readers, manager scopes3 + shared
octane-hotkeysframeworkframework-bindingsHooks in .tsrx, element-state targets, providers2 + shared

"Shared" failure modes are listed under hotkeys-core, app-hotkeys, and lit-hotkeys with a skills list in domain_map.yaml: hand-written listeners, facades, topmost-dialog tracking, reused exclusive scope names, registering an app hotkey's value, and loading custom hotkeys late.

Failure Mode Inventory

hotkeys-core (11 failure modes)

#MistakePrioritySourceCross-skill?
1Reading key events instead of registering hotkeysHIGHdocs/guides/sensible-defaults.mdall framework skills
2Wrapping the library in a shortcut facadeHIGHMaintainer report, 2026-10-18app-hotkeys, all framework skills
3Disabling a hotkey to skip its actionHIGHreact guides/hotkeys.md—
5Tracking the topmost dialog with enabledHIGHissue #42all framework skills
6Reusing one exclusive scope nameHIGHsrc/hotkey-manager.tsall framework skills
8Toggling without requireResetMEDIUMsensible-defaults.md—
9Letters for position-based controlsMEDIUMsensible-defaults.md—
10Expecting extra modifiers to matchMEDIUMsensible-defaults.md, runtime probe—
11Non-focusable element targetMEDIUMsensible-defaults.md—
12A second copy of @tanstack/hotkeysMEDIUMsrc/_manager-ref.ts—
13Testing without a fixed platformMEDIUMsrc/platform.ts, runtime probe—

app-hotkeys (8 failure modes)

#MistakePrioritySourceCross-skill?
1Keeping a parallel shortcut registryHIGHguides/app-hotkeys.md—
2Registering the app hotkey valueHIGHsrc/adapter.ts, task checkall framework skills
3Loading custom hotkeys after the provider existsHIGHsrc/app-hotkeys.ts, every providerall framework skills
4Ignoring setCustomHotkey conflictsHIGHsrc/app-hotkeys.ts—
5Saving the effective listMEDIUMguides/app-hotkeys.md, task check—
6Sharing keys without declared scopesMEDIUMsrc/app-hotkeys.ts—
7A recorder built from keydown eventsHIGHguides/custom-hotkey-recording.md—
8Rewriting recorded physical bindingsMEDIUMsensible-defaults.md—

Framework skills

SkillMistakes
react-hotkeysref.current as target (HIGH, task check); hotkey above its own provider (HIGH, task check)
preact-hotkeysref.current as target (HIGH); hotkey above its own provider (HIGH)
solid-hotkeysplain options object (HIGH); unassigned element variable as target (HIGH)
vue-hotkeysref.value instead of the ref (HIGH); provider in the same component (HIGH); nested recorder refs in templates (MEDIUM)
svelte-hotkeysplain options object (HIGH); destructuring reactive getters (HIGH); hotkeys before setHotkeysContext (HIGH)
angular-hotkeys@HostListener (HIGH); plain options object (HIGH); shared exclusive scope across instances (HIGH); outside an injection context (MEDIUM)
lit-hotkeysunreleased manager scope (HIGH, also alpine and ember); HotkeyController not added to host (HIGH); @hotkey with standard decorators (MEDIUM); instance state in decorator options (MEDIUM)
alpine-hotkeysowner never destroyed (HIGH); createHotkeysScope mistaken for a scope (HIGH); plain options object (HIGH)
ember-hotkeysunbound method callback (HIGH); string sequence in a template (MEDIUM); createHotkeysScope mistaken for a scope (HIGH)
octane-hotkeysref object as target (HIGH); hooks in loops (MEDIUM)

Tensions

TensionSkillsAgent implication
Component lifetime versus one cataloghotkeys-core ↔ app-hotkeysAgents move callbacks into a central registry, or build cheat sheets from live registrations
Logical declarations versus physical recordingsapp-hotkeysA rebinding to Command+P passes conflict checks and then runs two actions

Cross-References

FromToReason
each framework skillhotkeys-coreRequired: hotkey format, defaults, workaround table
each framework skillapp-hotkeysIts app hotkeys reference shows wiring; app-hotkeys owns the rules
app-hotkeyshotkeys-coreSame hotkey format, scopes, and registration rules

Subsystems & Reference Candidates

SkillSubsystemsReference files
hotkeys-core—scopes, testing
app-hotkeys—recording
each framework skill—app-hotkeys (framework wiring)

Remaining Gaps

SkillQuestionStatus
app-hotkeysShould conflict checks treat Mod+[KeyP] as overlapping Mod+P? Today a recorded physical binding never conflicts with a logical declaration.open
lit-hotkeysDocument that @hotkey needs experimentalDecorators, or support standard decoratorsopen
octane-hotkeysdocs/installation.md says Octane 0.1.36 within 0.1; the peer range is >=0.12.0resolved
framework skills except react-hotkeysNo executable task checks yetopen
allFresh-consumer and discovery evaluations not runopen
  • Core skills: packages/hotkeys/skills/hotkeys-core and packages/hotkeys/skills/app-hotkeys. Every adapter depends on @tanstack/hotkeys, and Intent discovers skills in transitive dependencies, so consumers of any adapter get them.
  • Framework skills: one per adapter package, named <framework>-hotkeys so names stay unique when skills from several libraries are installed side by side.
  • Lifecycle and composition skills: none in this batch.
  • Reference files: conditional detail only, each linked from its skill with a reading condition.

Composition Opportunities

LibraryIntegration pointsComposition skill needed?
TanStack RouterNavigation hotkeys, route-level scopesNo; the core and framework skills cover registration
TanStack DevtoolsHotkeys devtools panelNo; one line per framework skill

Coverage and batch history

Batch 1 — 2026-10-18 — initial skills

  • Scope: the basics and pitfalls of registering hotkeys, scopes, display, app hotkeys, recording, and testing, for the core package and all ten adapters. Devtools packages, the @tanstack/hotkeys/adapter entry point for adapter authors, and the formatter's layout-map options are out of scope.
  • Source: commit ad56a4b0 (@tanstack/hotkeys 0.16.0; React, Preact, Solid, Vue, Svelte, Angular 0.15.0; Lit 0.16.0; Alpine and Ember 0.4.0; Octane 0.5.0). Intent 0.5.5.
  • Maintainer decisions:
    • Skills teach basic patterns, then the mistakes and workarounds agents produce. Agents tend to build facades and wrappers around the library; the skills point to the native API for each workaround.
    • Keep volume low. Exact signatures come from the installed .d.ts files, not from the skills. Conditional detail lives in references.
    • Package-only distribution (distribution: none). Repository distribution can be added later with maintainer setup --distribution repo.
  • Authoring decisions:
    • Framework-neutral rules have one home in the core skills; framework skills require @tanstack/hotkeys#hotkeys-core and keep only their own bindings and mistakes.
    • Skill names carry the package name (react-hotkeys, not react) so flattened installs don't collide with other libraries' skills.
    • Guides are linked by URL pattern (https://tanstack.com/hotkeys/latest/docs/framework/<framework>/guides/<page>.md) instead of being copied.
  • Checks:
    • intent validate passes for all 12 skills.
    • Intent's example checker resolves bare imports from the repository root, where no framework is installed, and compiles with jsx: preserve and standard decorators. Fences it can't check are marked no-check: Preact and Solid JSX with provider children, Lit classes that extend LitElement, and Alpine components that use magics. Every ts and tsx fence, including those, also type-checks inside a matching project in examples/ (only names omitted on purpose were tolerated).
    • Executable task checks: packages/react-hotkeys/tests/skills/editor-shortcuts and packages/react-hotkeys/tests/skills/shortcut-settings. Each grader accepts the expected solution and rejects the starting fixture and every listed mistake for the documented reason.
    • Runtime probes on 2026-10-18 confirmed: aliases such as ctrl+k parse; comma lists keep only the first chord; string sequences never match; extra modifiers never match; disabled hotkeys don't call preventDefault; the recorder records Mod+[KeyS]-style physical bindings; happy-dom on macOS detects windows; app hotkey and live conflict checks don't match Mod+[KeyP] against Mod+P, and both registrations fire on Command+P.
    • Not run: fresh-consumer sessions and discovery evaluations.
  • Remaining work: the gaps above, task checks for the other adapters, and a fresh-consumer run of both React tasks.

Batch 1 revision — 2026-10-18 — maintainer review

  • Maintainer decisions:
    • Cut content an agent already knows or the tooling reports. Invalid hotkey strings are TypeScript errors, so the syntax pitfall and the other-library syntax reference were removed.
    • Don't mention the hotkey manager where the adapter has a provider: use the adapter's hooks and functions. Lit, Alpine, and Ember keep activateScope, because they have no provider for scopes.
  • Changes: hotkeys-core went from 293 to 73 lines: the vanilla setup, defaults table, hotkey format, display section, and code-pair mistakes were replaced by the workaround table, the on/off order, and one-line pitfalls. The sequences and from-other-libraries references were folded into two pitfalls and deleted. scopes and testing dropped manager code. app-hotkeys, the recording reference, every framework skill, and every framework app hotkeys reference were trimmed the same way. Total skill content fell from 4,529 to 1,767 lines.
  • Failure modes retired: other-library hotkey syntax (TypeScript reports it) and React's manager-in-useEffect (dropped so the skills don't introduce the manager). Unreleased manager scopes moved from hotkeys-core to the Lit, Alpine, and Ember skills.
  • Checks: intent validate passes; every fence type-checks in its example project; the React task checks still pass.

Batch 1 revision 2 — 2026-10-19 — full API lists

  • Maintainer decision: each framework skill lists every hook and function its adapter defines, with one sentence on what each is for, so agents see the whole surface before reaching for a workaround. The .d.ts files stay the source for signatures and options.
  • Changes: the short task-to-API table in each of the 10 framework skills became an ## API table with one row per export, 127 in all. Lit, Alpine, and Ember also list the two core calls they need, provideAppHotkeys and getHotkeyManager().activateScope; Alpine lists its 12 owner methods separately. Each table ends with a note that the adapter re-exports @tanstack/hotkeys. Core functions aren't repeated in each skill.
  • Source sync: the AltGr fix (#193) changed hotkey-recorder.ts and the AltGr notes in docs/guides/sensible-defaults.md. No skill covers AltGr, so hotkeys-core and app-hotkeys are unchanged.
  • Checks: a TypeScript export listing confirmed every adapter export appears in its skill; intent validate passes.