Agent skill
update-keyboard-shortcuts
Audits and synchronizes keyboard shortcuts across docs/keyboard_shortcuts.md, crates/regenerator2000-tui/src/ui/dialog_keyboard_shortcut.rs, crates/regenerator2000-tui/src/ui/menu.rs, and the view files (view_disassembly.rs, view_hexdump.rs, view_charset.rs, view_bitmap.rs, view_blocks.rs, view_sprites.rs).
Install this agent skill to your Project
npx add-skill https://github.com/ricardoquesada/regenerator2000/tree/main/.agent/skills/update-keyboard-shortcuts
SKILL.md
Update Keyboard Shortcuts Workflow
Use this skill when the user asks to:
- "check keyboard shortcuts are in sync"
- "add a new keyboard shortcut"
- "update the keyboard shortcuts documentation"
- "verify shortcuts are consistent"
Files to Keep in Sync
The following files all define or document keyboard shortcuts and must be consistent with each other:
| File | Role |
|---|---|
docs/keyboard_shortcuts.md |
User-facing documentation (MkDocs table format) |
crates/regenerator2000-tui/src/ui/dialog_keyboard_shortcut.rs |
In-app shortcuts dialog (get_shortcuts() fn) |
crates/regenerator2000-tui/src/ui/menu.rs |
Menu items with shortcut hints (MenuState::new()) |
crates/regenerator2000-tui/src/ui/view_disassembly.rs |
Disassembly view handle_input() |
crates/regenerator2000-tui/src/ui/view_hexdump.rs |
Hex dump view handle_input() |
crates/regenerator2000-tui/src/ui/view_charset.rs |
Charset view handle_input() |
crates/regenerator2000-tui/src/ui/view_bitmap.rs |
Bitmap view handle_input() |
crates/regenerator2000-tui/src/ui/view_blocks.rs |
Blocks view handle_input() |
crates/regenerator2000-tui/src/ui/view_sprites.rs |
Sprites view handle_input() |
1. Read All Relevant Files
Read all files listed above to get the current state of shortcuts in each location.
2. Audit for Discrepancies
Compare shortcuts across the three "declaration" layers:
Layer 1: handle_input() in view files (ground truth)
These are the actual key bindings. What the code does is what the user experiences.
Layer 2: menu.rs shortcut hints
These are displayed in the menu UI next to menu items. They should match what handle_input() actually handles.
Layer 3: dialog_keyboard_shortcut.rs → get_shortcuts()
These are shown in the in-app help dialog. They should match the actual behavior.
Layer 4: docs/keyboard_shortcuts.md
User-facing documentation. Should match all of the above.
Common Discrepancies to Look For
- A shortcut exists in the code but is missing from the docs or dialog.
- A shortcut is documented but not implemented in any view's
handle_input(). - The shortcut key string is formatted differently across files (e.g.,
"Ctrl+B"vs"Ctrl+b"). - A shortcut is listed under the wrong context/view in the docs.
- A shortcut exists in
menu.rsbut the correspondingMenuActionis never triggered by any key. - The
ToggleBlocksViewmenu showsAlt+6but the docs sayAlt+5.
3. Report Discrepancies
List all discrepancies found, grouped by type:
MISSING FROM DOCS:
- [key] [action] (found in: view_X.rs handle_input)
MISSING FROM DIALOG:
- [key] [action] (found in: view_X.rs handle_input)
WRONG KEY IN MENU:
- Menu shows "[key]" but handle_input uses "[key]" for [action]
WRONG KEY IN DOCS:
- Docs say "[key]" but handle_input uses "[key]" for [action]
UNDOCUMENTED SHORTCUTS:
- [key] in [file] has no corresponding entry in docs or dialog
4. Fix Discrepancies
For each discrepancy, update the appropriate file(s):
Updating docs/keyboard_shortcuts.md
The file uses MkDocs Material ++key++ notation. Format examples:
++ctrl+b++for Ctrl+B++alt+2++for Alt+2++shift+v++for Shift+V++open-bracket++for[++close-bracket++for]++less-than++for<++greater-than++for>++pipe++for|++semicolon++for;++colon++for:++comma++for,++period++for.++question-mark++for?
Updating crates/regenerator2000-tui/src/ui/dialog_keyboard_shortcut.rs
Edit the get_shortcuts() function. Each entry is a (&str, &str) tuple:
- First element: key string (human readable, e.g.
"Ctrl+b","Alt+2 (Ctrl+2)") - Second element: action description
- Empty
("", "")= blank separator line ("Section Header", "")= section header (rendered bold+underlined)
Updating crates/regenerator2000-tui/src/ui/menu.rs
Edit MenuState::new(). Each MenuItem::new() call has:
name: menu item labelshortcut:Some("Ctrl+B")orNoneaction: theMenuActionvariant
Updating view handle_input() functions
Add or modify KeyCode::Char(...) match arms. Follow the existing patterns:
KeyCode::Char('x') if key.modifiers.is_empty() => {
WidgetResult::Action(MenuAction::SomeAction)
}
KeyCode::Char('X') if key.modifiers == KeyModifiers::SHIFT => {
WidgetResult::Action(MenuAction::SomeOtherAction)
}
KeyCode::Char('x') if key.modifiers == KeyModifiers::CONTROL => {
WidgetResult::Action(MenuAction::SomeCtrlAction)
}
5. Verify
After making changes, do a final cross-check:
- Confirm every shortcut in
handle_input()appears inget_shortcuts()anddocs/keyboard_shortcuts.md. - Confirm every shortcut in the docs is actually implemented in some
handle_input(). - Confirm menu shortcut hints match the actual key bindings.
Known Quirks
ToggleBlocksView: The menu showsAlt+6but the docs sayAlt+5. The actual key handling is in the global event handler (not in a view'shandle_input()), so checkcrates/regenerator2000-tui/src/ui/menu.rsand the main event loop for this one.- Shifted characters: Some keys like
?,<,>,|,;,:are handled withkey.modifiers.is_empty() || key.modifiers == KeyModifiers::SHIFTbecause on some terminals/OSes, pressing Shift to get these characters sends a SHIFT modifier. This is intentional. - Global shortcuts (Ctrl+O, Ctrl+S, etc.) are handled in the main event loop, not in individual view
handle_input()functions. - Navigation shortcuts (Up/Down/j/k, PageUp/PageDown, Home/End, G) are handled by the
Navigabletrait viahandle_nav_input(), not directly inhandle_input().
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
verify-mcp
Verifies the MCP server functionality by running the integration test suite.
update-mcp-docs
Syncs `docs/mcp.md` with the actual tools exposed by `crates/regenerator2000-core/src/mcp/handler.rs`.
r2000-analyze-basic
Analyzes a sequence of memory containing Commodore BASIC tokens, formats address/word data types, and constructs side comments representing the plain BASIC commands.
bump-version
Automates the process of bumping the version and updating the changelog.
code-review
Reviews code changes for bugs, style issues, and best practices. Use when reviewing PRs or checking code quality.
add-mcp-tool
Streamlines the process of adding new tools to the MCP server.
Didn't find tool you were looking for?