|
| 1 | +--- |
| 2 | +targets: |
| 3 | + - '*' |
| 4 | +description: Create Logseq Keyshort pages with #card flashcards using the <Scope>/Keyshort/<Action> (and optional <Subscope>) format |
| 5 | +argument-hint: Scope (required); Action (required); optional Subscope; Shortcut; Description; optional Grouped cards |
| 6 | +--- |
| 7 | +# Create a Logseq Keyshort Page (with #card flashcards) |
| 8 | + |
| 9 | +This command creates or updates Logseq Keyshort pages using the canonical `<Scope>/Keyshort/<Action>` format, with optional `<Subscope>` segments. It ensures `#card` flashcards are children of a parent block that carries the needed ancestry tags for Logseq's `{{cards ...}}` queries. |
| 10 | + |
| 11 | +## Variables |
| 12 | + |
| 13 | +- **Scope** – **Required**: The tool or domain (e.g., `VSCode`, `Lazygit`, `tmux`). |
| 14 | +- **Action** – **Required**: The shortcut action (e.g., `Open the Source Control Panel`). |
| 15 | +- **Subscope** – Optional: A subgroup within the scope (e.g., `Git`, `Terminal`, `Pane`). |
| 16 | +- **Shortcut** – Optional: Key chord(s) for the action (e.g., `Cmd+Shift+P`). |
| 17 | +- **Description** – Optional: Short explanation of what it does. |
| 18 | +- **Grouped cards** – Optional: If multiple related shortcuts should live on one page (e.g., Next/Previous), list them. |
| 19 | + |
| 20 | +## Conventions |
| 21 | + |
| 22 | +- **Page naming**: |
| 23 | + - Without subscope: `pages/<Scope>___Keyshort___<Action>.md` |
| 24 | + - With subscope: `pages/<Scope>___Keyshort___<Subscope>___<Action>.md` |
| 25 | +- **Link format**: |
| 26 | + - `[[<Scope>/Keyshort]]` and optionally `[[<Scope>/Keyshort/<Subscope>]]` |
| 27 | + - Always include `[[Keyshort]]` and `[[<Scope>]]` in the parent block. |
| 28 | +- **Flashcards**: |
| 29 | + - Use `#card` blocks only. |
| 30 | + - Avoid `Question :: Answer` blocks and any "Flashcard Questions" section. |
| 31 | +- **Frontmatter**: |
| 32 | + - Do not add or remove `tags::` on existing pages. |
| 33 | + |
| 34 | +## Workflow |
| 35 | + |
| 36 | +### Step 1: Normalize inputs |
| 37 | + |
| 38 | +- Confirm Scope, Action, and optional Subscope. |
| 39 | +- If shortcut or description is missing, ask for it (or leave placeholders if the user wants a stub). |
| 40 | +- If grouped cards are requested, list each card's action, shortcut, and description. |
| 41 | + |
| 42 | +### Step 2: Determine target page path |
| 43 | + |
| 44 | +- If Subscope is provided, use: `pages/<Scope>___Keyshort___<Subscope>___<Action>.md` |
| 45 | +- Otherwise, use: `pages/<Scope>___Keyshort___<Action>.md` |
| 46 | + |
| 47 | +### Step 3: Check for existing pages (dedup) |
| 48 | + |
| 49 | +- Search for existing pages matching the intended title and close variants. |
| 50 | +- If a matching page exists, update it rather than creating a new page. |
| 51 | + |
| 52 | +### Step 4: Create or update content (LFM) |
| 53 | + |
| 54 | +- Use Logseq Flavored Markdown (bulleted blocks, no blank lines). |
| 55 | +- Create a parent block that includes ancestry tags: |
| 56 | + - `[[Keyshort]] [[<Scope>]] [[<Scope>/Keyshort]]` |
| 57 | + - Add `[[<Scope>/Keyshort/<Subscope>]]` if applicable. |
| 58 | +- Add `#card` blocks as children of that parent block. |
| 59 | +- For grouped cards, place multiple `#card` blocks under the same tagged parent block. |
| 60 | + |
| 61 | +#### Example (single card) |
| 62 | + |
| 63 | +~~~markdown |
| 64 | +- [[Keyshort]] [[VSCode]] [[VSCode/Keyshort]] [[VSCode/Keyshort/Git]] |
| 65 | + - **Open the Source Control Panel** #card |
| 66 | + - Shortcut: `Ctrl+Shift+G` |
| 67 | + - Description: Opens the Source Control panel. |
| 68 | +~~~ |
| 69 | + |
| 70 | +#### Example (grouped cards) |
| 71 | + |
| 72 | +~~~markdown |
| 73 | +- [[Keyshort]] [[tmux]] [[tmux/Keyshort]] [[tmux/Keyshort/Pane]] |
| 74 | + - **Move Pane Up** #card |
| 75 | + - Shortcut: `<keys>` |
| 76 | + - Description: Moves the pane up. |
| 77 | + - **Move Pane Down** #card |
| 78 | + - Shortcut: `<keys>` |
| 79 | + - Description: Moves the pane down. |
| 80 | +~~~ |
| 81 | + |
| 82 | +## Report |
| 83 | + |
| 84 | +- Report the created/updated page path. |
| 85 | +- Summarize the cards added or updated. |
| 86 | + |
| 87 | +## Related |
| 88 | + |
| 89 | +Use the prefix that matches the type: `rule:` for rules, `command:` for commands, `skill:` for skills. |
| 90 | + |
| 91 | +- rule: `logseq-page-naming-reference` – File naming and link conventions |
| 92 | +- rule: `logseq-flavored-markdown` – LFM formatting rules |
| 93 | +- command: `logseq-manage-shortcut-flashcards` – Audit and maintain Keyshort pages |
0 commit comments