@sumrco/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +36 -0
  2. package/ai/modules/kontract/resources/configuration.rf.md +123 -0
  3. package/ai/modules/kontract/resources/generated-output.rf.md +179 -0
  4. package/ai/modules/kontract/resources/openapi-generator-lessons.rf.md +61 -0
  5. package/ai/modules/kontract/resources/overview.md +115 -0
  6. package/ai/modules/kontract/resources/performance.rf.md +90 -0
  7. package/ai/modules/kontract/resources/schema-reuse.rf.md +233 -0
  8. package/ai/modules/kontract/resources/scope-and-splitting.rf.md +147 -0
  9. package/ai/modules/kontract/resources/spec-layout.rf.md +69 -0
  10. package/ai/modules/kontract/resources/team-members/contract-author.tm.md +52 -0
  11. package/ai/modules/kontract/resources/workflows/contract-change.wf.md +60 -0
  12. package/ai/modules/kontract/sumr.module.yaml +42 -0
  13. package/ai/modules/mission/resources/flow-actions.rf.md +40 -0
  14. package/ai/modules/mission/resources/flow-config.rf.md +39 -0
  15. package/ai/modules/mission/resources/flow-safety-boundaries.rf.md +23 -0
  16. package/ai/modules/mission/resources/overview.md +69 -0
  17. package/ai/modules/mission/resources/stage-closeout.rf.md +21 -0
  18. package/ai/modules/mission/resources/stage-delivery.rf.md +36 -0
  19. package/ai/modules/mission/resources/stage-intake.rf.md +39 -0
  20. package/ai/modules/mission/resources/stage-planning.rf.md +21 -0
  21. package/ai/modules/mission/resources/stage-pull-request.rf.md +50 -0
  22. package/ai/modules/mission/resources/stage-quality.rf.md +22 -0
  23. package/ai/modules/mission/resources/team-members/delivery-lead.tm.md +39 -0
  24. package/ai/modules/mission/resources/team-members/implementer.tm.md +25 -0
  25. package/ai/modules/mission/resources/team-members/planner.tm.md +102 -0
  26. package/ai/modules/mission/resources/team-members/pr-writer.tm.md +57 -0
  27. package/ai/modules/mission/resources/team-members/product-owner.tm.md +37 -0
  28. package/ai/modules/mission/resources/team-members/quality-lead.tm.md +34 -0
  29. package/ai/modules/mission/resources/workflows/daily-triage.wf.md +117 -0
  30. package/ai/modules/mission/resources/workflows/full-delivery.wf.md +18 -0
  31. package/ai/modules/mission/resources/workflows/mission-cycle.wf.md +30 -0
  32. package/ai/modules/mission/resources/workflows/planning-only.wf.md +68 -0
  33. package/ai/modules/mission/resources/workflows/pr-assist.wf.md +21 -0
  34. package/ai/modules/mission/resources/workflows/standard-delivery.wf.md +18 -0
  35. package/ai/modules/mission/sumr.module.yaml +78 -0
  36. package/ai/modules/playbook/resources/authoring/content-structure.rf.md +148 -0
  37. package/ai/modules/playbook/resources/authoring/cross-referencing.rf.md +57 -0
  38. package/ai/modules/playbook/resources/authoring/descriptions.rf.md +71 -0
  39. package/ai/modules/playbook/resources/authoring/extraction.rf.md +81 -0
  40. package/ai/modules/playbook/resources/authoring/flows.rf.md +55 -0
  41. package/ai/modules/playbook/resources/authoring/folder-structure.rf.md +148 -0
  42. package/ai/modules/playbook/resources/authoring/frontmatter.rf.md +251 -0
  43. package/ai/modules/playbook/resources/authoring/markdown.rf.md +108 -0
  44. package/ai/modules/playbook/resources/authoring/overview.md +213 -0
  45. package/ai/modules/playbook/resources/team-members/playbook-technical-writer.tm.md +31 -0
  46. package/ai/modules/playbook/sumr.module.yaml +47 -0
  47. package/ai/registry.json +18 -0
  48. package/bin/_sumr +4 -0
  49. package/bin/sumr +7 -0
  50. package/index.js +410 -0
  51. package/package.json +52 -0
@@ -0,0 +1,81 @@
1
+ ---
2
+ category: reference
3
+ name: playbook-authoring-extraction
4
+ title: Content Extraction
5
+ description: "extract:examples marker syntax, code block classification, and size guidelines for SUMR docs."
6
+ label: Extraction
7
+ when: Adding examples sections to a doc, deciding whether to extract a code block, checking size limits, classifying a fenced code block
8
+ order: 20
9
+ ---
10
+
11
+ # Content Extraction
12
+
13
+ ## Marker Syntax
14
+
15
+ Wrap dedicated examples sections with extraction markers:
16
+
17
+ ```markdown
18
+ <!-- extract:examples -->
19
+ ## Examples
20
+
21
+ \`\`\`text
22
+ {{PLAYBOOK_PATH}}/standards/testing/
23
+ ├── overview.md
24
+ └── playwright/
25
+ ├── overview.md
26
+ ├── locators.md
27
+ └── fixtures.md
28
+ \`\`\`
29
+ <!-- /extract:examples -->
30
+ ```
31
+
32
+ Skill-folder channels remove the extracted block from `SKILL.md`, write it to `examples.md`, and add an `## Additional resources` link. Flat-file channels keep extracted content inline because they cannot attach supporting files.
33
+
34
+ Multiple `<!-- extract:examples -->` blocks in the same file are **merged** into one output. Each block must be self-contained — include any intro or title inside the marker, not outside it.
35
+
36
+ > [!CAUTION]
37
+ > Do not leave an intro sentence outside the marker with nothing below it:
38
+ > ```markdown
39
+ > Use the following pattern: ← orphaned intro — BAD
40
+ > <!-- extract:examples -->
41
+ > \`\`\`ts
42
+ > const roleByStatus = { draft: 'writer', ready: 'reviewer' } as const;
43
+ > \`\`\`
44
+ > <!-- /extract:examples -->
45
+ > ```
46
+ > Put the intro inside the block so the generated file is self-contained.
47
+
48
+ ## Mandatory Default
49
+
50
+ In any file, if you create a dedicated `## Examples` section or equivalent sample/template section, wrap the whole section with `<!-- extract:examples -->` unless the snippet is truly inline and central to the instruction flow.
51
+
52
+ Do not leave standalone examples sections unwrapped. Do not wrap marker examples shown inside fenced code blocks; the renderer treats those as literal documentation and does not extract them.
53
+
54
+ ## Code Block Classification
55
+
56
+ Before wrapping any `` ``` `` block, classify it:
57
+
58
+ | Purpose | Description | Action |
59
+ |---------|-------------|--------|
60
+ | **Example** | Demonstrates a usage pattern or flow | `extract:examples` |
61
+ | **Sample** | Minimal runnable snippet | `extract:examples` |
62
+ | **Template** | Boilerplate to copy | `extract:examples` |
63
+ | **Config** | Short config snippet | Keep inline |
64
+ | **Config** | Long config block | `extract:examples` |
65
+ | **File structure / schema** | Directory tree, schema outline | Keep in main doc |
66
+ | **ASCII diagram** | Decision tree, flow diagram | Keep in main doc |
67
+ | **Inline snippet** | Core instruction, short 2-5 line example | Keep in main doc |
68
+
69
+ **Default:** Short inline snippets, file structure trees, and core-instruction diagrams stay in the main doc without markers. Use `extract:examples` only when the block is supplementary and long enough to warrant a separate reference.
70
+
71
+ Before wrapping any block, ask whether the generated `SKILL.md` should still be complete without the block. If yes, extract it. If no, keep it inline.
72
+
73
+ ## Size Guidelines
74
+
75
+ | Threshold | Action |
76
+ |-----------|--------|
77
+ | ~60-120 lines | Ideal main doc size |
78
+ | ~180 lines | Soft cap — consider splitting to references |
79
+ | 500 lines | Hard cap — must split |
80
+
81
+ When a main doc exceeds the soft cap, move detailed sections (deep examples, exhaustive rule tables, long walkthroughs) into `category: reference` files in the same folder.
@@ -0,0 +1,55 @@
1
+ ---
2
+ category: reference
3
+ name: playbook-authoring-flows
4
+ title: Flow Documentation
5
+ description: "Flow documentation patterns for Playbook docs, including compact arrow flows, human approval gates, Mermaid diagrams, and transition rules."
6
+ label: Flows
7
+ when: Writing workflows, documenting lifecycle states, explaining approval gates, choosing between arrow flows and Mermaid diagrams
8
+ order: 55
9
+ ---
10
+
11
+ # Flow Documentation
12
+
13
+ Use flow notation when a doc needs to show order, responsibility, gates, or allowed state transitions.
14
+
15
+ ## Simple Flow
16
+
17
+ Use one compact arrow flow when the process is mostly linear:
18
+
19
+ ```text
20
+ 🕐 intake -> [researcher] -> 📝 draft -> ⏸ HUMAN APPROVES -> ✅ ready -> [implementer] -> review -> done
21
+ ```
22
+
23
+ Rules:
24
+
25
+ - Keep state names short and concrete.
26
+ - Use `[role-or-agent]` for the actor responsible for a transition.
27
+ - Label human decision gates explicitly, for example `⏸ HUMAN APPROVES`.
28
+ - Keep emojis optional and functional; use them for state scanning, not decoration.
29
+ - Put the flow near the top of workflow or lifecycle docs before detailed steps.
30
+
31
+ ## Complex Flow
32
+
33
+ Use Mermaid when the process branches, loops, or has failure paths:
34
+
35
+ ```mermaid
36
+ flowchart LR
37
+ intake["intake"] --> research["researcher"]
38
+ research --> draft["draft plan"]
39
+ draft --> approval{"Human approves?"}
40
+ approval -->|yes| ready["ready"]
41
+ approval -->|changes requested| draft
42
+ ready --> implement["implementer"]
43
+ implement --> review["review"]
44
+ review --> done["done"]
45
+ ```
46
+
47
+ Add short transition rules below the diagram when an AI must know what is forbidden:
48
+
49
+ - Do not enter implementation until the approval gate is satisfied.
50
+ - If review finds missing context, return to draft instead of continuing.
51
+ - If a blocker appears, stop and record the blocker instead of guessing.
52
+
53
+ ## When to Avoid Diagrams
54
+
55
+ Avoid diagrams when a numbered list is clearer. If there is no meaningful state change, gate, or actor handoff, write concise steps instead.
@@ -0,0 +1,148 @@
1
+ ---
2
+ category: reference
3
+ name: playbook-authoring-folder-structure
4
+ title: Folder Structure
5
+ description: "Recommended Playbook folder layout, top-level naming, team-member placement patterns (root vs domain-embedded), and standards folder naming alternatives."
6
+ label: Folder Structure
7
+ when: Planning a docs folder, naming a standards folder, deciding where to put a team-member doc, restructuring an existing docs tree
8
+ order: 70
9
+ ---
10
+
11
+ # Folder Structure
12
+
13
+ ## Recommended Top-Level Folders
14
+
15
+ Start with these root folders under `{{PLAYBOOK_PATH}}/` and add more as the codebase grows.
16
+
17
+ | Folder | Purpose |
18
+ |--------|---------|
19
+ | `architecture/` | System design, diagrams, ADRs, infrastructure topology |
20
+ | `standards/` | Domain-specific technical rules (backend, frontend, security…) |
21
+ | `team-members/` | Orchestrators and cross-domain AI agents |
22
+ | `workflows/` | User-invoked AI workflows (`.wf.md` files), such as issue triage or UI review |
23
+ | `lifecycle/` | Lifecycle automation scripts (`.lc.md` files) that guard or enrich AI sessions |
24
+ | `processes/` | Workflows, release checklists, incident runbooks, repeatable procedures |
25
+
26
+ Keep `team-members/`, `workflows/`, and `lifecycle/` separate from `standards/` when they are repo-wide — they generate different output types and have different audiences.
27
+
28
+ ## Full Structure Example
29
+
30
+ ```
31
+ {{PLAYBOOK_PATH}}/
32
+ ├── architecture/ ← system design, diagrams, ADRs
33
+ │ ├── system/
34
+ │ │ └── overview.md
35
+ │ └── auth/
36
+ │ ├── overview.md
37
+ │ └── session-model.md (category: reference, order: 10)
38
+ ├── standards/ ← domain-specific rules
39
+ │ ├── backend/
40
+ │ │ ├── overview.md
41
+ │ │ ├── testing.md (category: reference, order: 20)
42
+ │ │ └── backend-worker.tm.md
43
+ │ ├── frontend/
44
+ │ │ ├── overview.md
45
+ │ │ └── frontend-worker.tm.md
46
+ │ └── security/
47
+ │ └── overview.md
48
+ ├── team-members/ ← orchestrators and cross-domain agents
49
+ │ ├── orchestrator.tm.md
50
+ │ └── code-audit-runner.tm.md
51
+ ├── workflows/ ← user-invoked AI workflows
52
+ │ └── ui-review.wf.md
53
+ └── lifecycle/ ← optional lifecycle automations
54
+ └── session-start.lc.md
55
+ ```
56
+
57
+ ## Topic Folder Decision
58
+
59
+ Every split starts by choosing the context owner.
60
+
61
+ Use a same-folder reference when the new file only supports the current topic:
62
+
63
+ ```text
64
+ {{PLAYBOOK_PATH}}/standards/testing/
65
+ ├── overview.md
66
+ └── playwright.md (category: reference, order: 30)
67
+ ```
68
+
69
+ Use a child topic folder when the split content is a standalone topic with its own rules and references:
70
+
71
+ ```text
72
+ {{PLAYBOOK_PATH}}/standards/testing/
73
+ ├── overview.md
74
+ └── playwright/
75
+ ├── overview.md
76
+ ├── locators.md (category: reference, order: 10)
77
+ └── fixtures.md (category: reference, order: 20)
78
+ ```
79
+
80
+ Decision rules:
81
+
82
+ - If the parent folder is broad, avoid piling up many peer main docs. Create child topic folders.
83
+ - If a file is really supporting detail for the current `overview.md`, keep it as a same-folder `category: reference`.
84
+ - If a file belongs to a different domain, move it to that domain instead of keeping it near the source file.
85
+ - If a folder is missing `overview.md`, create the entry point before adding references.
86
+
87
+ Split flow:
88
+
89
+ 1. Analyze context.
90
+ 2. Choose same-folder reference or child topic folder.
91
+ 3. Split content into concise `overview.md` plus references.
92
+ 4. Check naming and frontmatter.
93
+ 5. Run `sumr playbook validate --source docs`.
94
+ 6. Run `sumr playbook sync --source docs --dry-run --json`.
95
+
96
+ ## Team-Member Placement
97
+
98
+ Team-members can live in two places. Use the pattern that best fits the agent's scope.
99
+
100
+ ### Root folder — orchestrators and generalist agents
101
+
102
+ Place agents that coordinate multiple domains or have no natural domain home in `{{PLAYBOOK_PATH}}/team-members/`:
103
+
104
+ ```
105
+ {{PLAYBOOK_PATH}}/
106
+ ├── team-members/
107
+ │ ├── orchestrator.tm.md ← drives multi-domain tasks
108
+ │ ├── code-audit-runner.tm.md ← repo-wide quality agent
109
+ │ └── quality-lead.tm.md ← gate-keeper, not domain-specific
110
+ └── standards/
111
+ └── backend/
112
+ └── overview.md
113
+ ```
114
+
115
+ ### Domain-embedded — domain-specific workers
116
+
117
+ Place agents that are tightly coupled to one domain's standards beside the docs they follow:
118
+
119
+ ```
120
+ {{PLAYBOOK_PATH}}/
121
+ ├── standards/
122
+ │ ├── backend/
123
+ │ │ ├── overview.md
124
+ │ │ ├── testing.md
125
+ │ │ └── backend-worker.tm.md ← lives beside the standards it follows
126
+ │ └── frontend/
127
+ │ ├── overview.md
128
+ │ └── frontend-worker.tm.md ← updated when frontend docs change
129
+ └── team-members/
130
+ └── orchestrator.tm.md ← cross-domain, stays at root
131
+ ```
132
+
133
+ **Rule of thumb:** If removing an agent breaks only one domain, embed it there. If removing it would affect the whole repo, put it in `team-members/`.
134
+
135
+ ## Standards Folder Naming
136
+
137
+ The folder that holds technical rules can use any of these names. Pick one that fits your team's vocabulary and stick with it.
138
+
139
+ | Name | Best when… |
140
+ |------|-----------|
141
+ | `standards/` | Rules are hard constraints the team must follow |
142
+ | `guidelines/` | Recommendations where judgment calls are allowed |
143
+ | `playbook/` | Mixing process, culture, and technical conventions in one place |
144
+ | `handbook/` | Including onboarding, culture, and practices alongside tech rules |
145
+ | `conventions/` | The primary focus is naming and structural consistency |
146
+ | `practices/` | Framing rules as lived engineering habits rather than mandates |
147
+
148
+ > All names work equally well with SUMR — the folder name is just a path segment. Only the frontmatter `name` field determines the generated skill identity.
@@ -0,0 +1,251 @@
1
+ ---
2
+ category: reference
3
+ name: playbook-authoring-frontmatter
4
+ title: Frontmatter Schema
5
+ description: "Required and optional frontmatter fields, category values, and per-category validation rules for SUMR Playbook docs."
6
+ label: Frontmatter
7
+ when: Adding frontmatter to a new doc, checking which fields are required, converting a file to a reference, choosing a category value
8
+ order: 10
9
+ ---
10
+
11
+ # Frontmatter Schema
12
+
13
+ ## Required Fields (All Files)
14
+
15
+ These fields are mandatory on every canonical Playbook `.md` file:
16
+
17
+ | Field | Rule |
18
+ |-------|------|
19
+ | `name` | Unique kebab-case identifier across all docs |
20
+ | `title` | Human-readable display name |
21
+ | `description` | Third-person, what + when, specific key terms. Always in double quotes. |
22
+
23
+ ```yaml
24
+ ---
25
+ name: testing
26
+ title: Testing Guidelines
27
+ description: "Test isolation rules, temp dir pattern, and integration test approach for the SUMR CLI."
28
+ ---
29
+ ```
30
+
31
+ ## Categories
32
+
33
+ | Value | Purpose | Required extra fields | AI output |
34
+ |-------|---------|----------------------|-----------|
35
+ | *(omitted)* | General how-to / main doc | — | Skill file |
36
+ | `reference` | Supporting detail for a main doc | `title`, `label`, `when`, `order` | Skill file (attached) |
37
+ | `team-member` | Tool-agnostic delegated role | — | Native agent/subagent profiles |
38
+ | `workflow` | User-invoked AI workflow | — | Claude slash command |
39
+ | `lifecycle` | Lifecycle automation script | `event` | Hook script + `hooks.json` |
40
+ | `hook` | Legacy alias for `lifecycle` | `event` | Hook script + `hooks.json` |
41
+
42
+ ### Optional Fields for Any Category
43
+
44
+ | Field | Type | Purpose |
45
+ |-------|------|---------|
46
+ | `tags` | `string[]` | Freeform labels for human scanning only |
47
+ | `modelTier` | `reasoning \| coding \| fast` | Preferred model tier for team-member/agent topics |
48
+ | `channels` | object | Legacy-compatible per-channel overrides. Prefer top-level native channel blocks in new docs. |
49
+ | `target` | string | Output filename override (basename only, extension inferred) |
50
+
51
+ ### `modelTier` Values
52
+
53
+ | Value | Codex model |
54
+ |-------|-------------|
55
+ | `reasoning` | `o4-mini` |
56
+ | `coding` | `gpt-4.1` |
57
+ | `fast` | `gpt-4o-mini` |
58
+
59
+ ```yaml
60
+ modelTier: coding
61
+ ```
62
+
63
+ An explicit `codex.model` override always takes precedence over `modelTier`.
64
+
65
+ ## Native Channel Props
66
+
67
+ Use top-level channel blocks for tool-specific features instead of promoting every vendor option into the SUMR schema. Add a short comment above each block so humans can scan what tool the block configures.
68
+
69
+ Comments are authoring guidance only. Playbook does not parse or require them.
70
+
71
+ ```yaml
72
+ ---
73
+ category: team-member
74
+ name: codebase-reviewer
75
+ title: Codebase Reviewer
76
+ description: "Reviews code for correctness, security, behavior regressions, and missing tests."
77
+ modelTier: reasoning
78
+
79
+ # Codex CLI agent profile options
80
+ codex:
81
+ sandbox_mode: read-only
82
+ model_reasoning_effort: high
83
+
84
+ # Claude Code subagent options
85
+ claude:
86
+ tools: Read, Grep, Glob
87
+ mode: subagent
88
+
89
+ # Cursor project rule options
90
+ cursor:
91
+ globs: [src/**/*.ts, tests/**/*.ts]
92
+
93
+ # GitHub Copilot custom agent options
94
+ copilot:
95
+ tools: read
96
+
97
+ # Gemini CLI subagent options
98
+ gemini:
99
+ kind: codebase_investigator
100
+ max_turns: 20
101
+
102
+ # OpenCode agent options
103
+ opencode:
104
+ mode: subagent
105
+ ---
106
+ ```
107
+
108
+ `channels:` remains supported as a legacy-compatible alias. If both shapes set the same channel property, the top-level channel block wins.
109
+
110
+ ## Team-Member Terminology Placeholder
111
+
112
+ Canonical source docs must use `{{TEAM-MEMBER}}` when prose means a generated delegated role. Do not hardcode `agent` or `subagent` in reusable source prose unless you are describing a specific vendor field such as `mode: subagent`.
113
+
114
+ Playbook replaces `{{TEAM-MEMBER}}` at render time because AI tools use different native names for the same SUMR concept:
115
+
116
+ | Channel | Rendered label |
117
+ | --- | --- |
118
+ | Claude Code | `Subagent` |
119
+ | Codex CLI | `Subagent` |
120
+ | Cursor | `Subagent` |
121
+ | Gemini CLI | `Subagent` |
122
+ | GitHub Copilot | `Agent` |
123
+ | OpenCode | `Agent` |
124
+
125
+ Use the placeholder in descriptions and body text:
126
+
127
+ ```yaml
128
+ description: "{{TEAM-MEMBER}} that reviews source code. Use after implementation."
129
+ ```
130
+
131
+ ```markdown
132
+ Delegate directly to the **codebase-reviewer** {{TEAM-MEMBER}}.
133
+ ```
134
+
135
+ ### Team-Member Role Archetypes
136
+
137
+ Use these as naming and writing guidance, not as a required `roleType` field:
138
+
139
+ | Archetype | Use when |
140
+ |---|---|
141
+ | `orchestrator` | Coordinating mission state and handoffs |
142
+ | `product-owner` | Clarifying problem, scope, and acceptance criteria |
143
+ | `researcher` | Exploring code/docs and reporting evidence |
144
+ | `planner` | Turning validated intent into an implementation plan |
145
+ | `implementer` | Editing code according to an approved plan |
146
+ | `reviewer` | Checking correctness, risks, and test gaps |
147
+ | `validator` | Running verification and recording outcome |
148
+
149
+ ## Reference File Fields
150
+
151
+ All six fields are mandatory for `category: reference` files:
152
+
153
+ | Field | Purpose | Example |
154
+ |-------|---------|---------|
155
+ | `name` | Unique identifier | `typescript-imports` |
156
+ | `description` | What it covers | `"Biome import ordering, type imports, #region rules."` |
157
+ | `title` | Display name | `Import Organization` |
158
+ | `label` | Short column label | `Imports` |
159
+ | `when` | Action phrases (present participle) that trigger loading this reference | `Organizing imports, adding new imports` |
160
+ | `order` | Sort position among siblings (integer) | `20` |
161
+
162
+ ```yaml
163
+ ---
164
+ category: reference
165
+ name: typescript-imports
166
+ title: Import Organization
167
+ description: "Biome distance-based import ordering, type imports, and #region rules."
168
+ label: Imports
169
+ when: Organizing imports, reviewing import order, adding new imports to a file
170
+ order: 20
171
+ ---
172
+ ```
173
+
174
+ ### Writing Effective `when` Fields
175
+
176
+ Use action phrases (present-participle -ing verbs) describing what the reader is doing, not keywords:
177
+
178
+ | Bad (keywords) | Good (action phrases) |
179
+ |---|---|
180
+ | `imports, type imports, ordering` | `Organizing imports, reviewing import order, adding new imports` |
181
+ | `atomic write, temp file, rename` | `Writing files safely, preventing partial writes on interruption` |
182
+ | `knip, dead code, unused exports` | `Running dead-code checks, finding unused exports, cleaning before a PR` |
183
+
184
+ ## Workflow File Fields
185
+
186
+ For `category: workflow` files, no extra frontmatter is required. Use `target` to control the output file name when needed.
187
+
188
+ Optional Claude command metadata can be stored under a top-level `claude:` block:
189
+
190
+ ```yaml
191
+ ---
192
+ category: workflow
193
+ name: ui-review
194
+ title: UI Review
195
+ description: "Runs browser UI review and reports pass/fail evidence."
196
+ target: ui-review.md
197
+
198
+ # Claude Code slash command options
199
+ claude:
200
+ model: opus
201
+ argument-hint: "[headed] [filename-filter]"
202
+ ---
203
+ ```
204
+
205
+ ## Lifecycle File Fields
206
+
207
+ For `category: lifecycle` files, one additional field is required:
208
+
209
+ | Field | Purpose | Example values |
210
+ |-------|---------|---------------|
211
+ | `event` | Lifecycle event that triggers this automation | `SessionStart`, `PreToolUse`, `PostToolUse`, `Stop` |
212
+
213
+ Optional fields for lifecycle automations:
214
+
215
+ | Field | Purpose |
216
+ |-------|---------|
217
+ | `matcher` | Regex or glob to filter which commands trigger the automation |
218
+ | `timeout` | Max seconds the automation may run |
219
+ | `statusMessage` | Message shown while the lifecycle command runs |
220
+
221
+ ```yaml
222
+ ---
223
+ category: lifecycle
224
+ name: lint-on-save
225
+ title: Lint on Save
226
+ description: "Run Biome lint after every file write. Use to keep code quality in sync."
227
+ event: post-exec
228
+ timeout: 30
229
+ statusMessage: Linting…
230
+ ---
231
+ ```
232
+
233
+ The body must contain a code-fenced script block (Python, Bash, or JS). The fence language determines the interpreter. Existing `category: hook` and `.hk.md` files still work as legacy aliases.
234
+
235
+ ## Tags (Optional)
236
+
237
+ `tags` is freeform and used only for human scanning — not parsed by the playbook sync. Keep them lowercase and concise.
238
+
239
+ ```yaml
240
+ tags: [typescript, biome, conventions]
241
+ ```
242
+
243
+ ## Validation Checklist for Reference Files
244
+
245
+ When reviewing a `category: reference` file, verify all of the following:
246
+
247
+ 1. All six required fields present: `name`, `description`, `title`, `label`, `when`, `order`
248
+ 2. No `## When to Use` section in the body — the `when` frontmatter field replaces it
249
+ 3. No `references:` field in frontmatter
250
+ 4. `when` field uses action phrases, not bare keywords
251
+ 5. `order` is an integer (10, 20, 30… — leave gaps for future inserts)
@@ -0,0 +1,108 @@
1
+ ---
2
+ category: reference
3
+ name: playbook-authoring-markdown
4
+ title: Markdown Formatting
5
+ description: "Markdown formatting rules: headings, callouts, emphasis, lists, code blocks, tables, and common anti-patterns."
6
+ label: Markdown
7
+ when: Writing or reviewing markdown, choosing heading levels, adding callouts or warnings, structuring lists and tables, fixing formatting anti-patterns
8
+ order: 40
9
+ ---
10
+
11
+ # Markdown Formatting
12
+
13
+ ## Headings
14
+
15
+ Headings are for **document structure**, not for emphasis or urgency.
16
+
17
+ - ATX-style only (`#`, `##`, `###`)
18
+ - One `#` (H1) per file, matching the title
19
+ - Never skip levels (H2 → H4 is wrong; H2 → H3 is correct)
20
+ - Blank line before and after every heading
21
+ - Space after `#` characters
22
+ - No trailing punctuation on headings (no `:` or `.`)
23
+ - No duplicate heading text within a file
24
+
25
+ Move urgency into the body using callouts — never into heading text:
26
+
27
+ | Bad | Good |
28
+ |-----|------|
29
+ | `## CRITICAL: Do Not Edit Output` | `## Do Not Edit Generated Output` |
30
+ | `## IMPORTANT: Test Isolation` | `## Test Isolation` |
31
+ | `## ⚠️ Breaking Changes` | `## Breaking Changes` |
32
+
33
+ ## Callouts
34
+
35
+ Use GitHub/GitLab alert syntax for urgency and importance:
36
+
37
+ ```markdown
38
+ > [!NOTE]
39
+ > Supplementary information the reader should notice.
40
+
41
+ > [!IMPORTANT]
42
+ > Essential information required for success.
43
+
44
+ > [!WARNING]
45
+ > Potential issue that could cause a problem.
46
+
47
+ > [!CAUTION]
48
+ > Action that could cause data loss or an irreversible change.
49
+ ```
50
+
51
+ Limit to **1-2 callouts per major section**. If everything is critical, nothing is. Integrate important information into prose instead of boxing it all.
52
+
53
+ ## Emphasis
54
+
55
+ - `**bold**` for strong importance inline
56
+ - `*italic*` sparingly for secondary emphasis
57
+ - Pick asterisks consistently — never mix `*` and `_`
58
+
59
+ ## Lists
60
+
61
+ - Ordered (`1.`) when sequence matters (steps, priority order)
62
+ - Unordered (`-`) for collections where order is irrelevant
63
+ - Consistent marker throughout a file (`-` preferred)
64
+ - Blank lines surrounding each list
65
+ - 2-space indent for nested items
66
+
67
+ ## Code Blocks
68
+
69
+ - Always fenced (triple backticks) — never indented
70
+ - Always specify the language identifier: ` ```ts `, ` ```bash `, ` ```yaml `
71
+ - Blank line before and after the block
72
+ - Inline code: single backticks, no internal spaces: `` `code` ``
73
+ - Do not prefix shell commands with `$` unless also showing output alongside
74
+
75
+ ## Tables
76
+
77
+ - Use only for genuinely tabular data (row/column scanning adds value)
78
+ - If data is sparse or unbalanced, use a list instead
79
+ - Keep cells concise
80
+ - Every row must have the same number of columns
81
+ - Blank lines surrounding the table
82
+
83
+ ## Whitespace
84
+
85
+ - End files with a single newline
86
+ - No trailing whitespace on lines
87
+ - No multiple consecutive blank lines
88
+ - Use spaces, not hard tabs
89
+
90
+ ## Links
91
+
92
+ - Descriptive link text — never `"click here"` or `"here"`
93
+ - For cross-doc references inside `{{PLAYBOOK_PATH}}/`, reference by **name** (main topics) or **label** (reference files) in bold — never by file path. See **Cross-Refs**.
94
+
95
+ ## Anti-Pattern Quick Reference
96
+
97
+ | Anti-pattern | Fix |
98
+ |---|---|
99
+ | Heading for emphasis (`## CRITICAL: ...`) | Structural heading + callout in body |
100
+ | ALL CAPS in headings | Sentence or title case |
101
+ | Skipped heading levels (H2 → H4) | Increment one level at a time |
102
+ | Generic link text (`"click here"`) | Descriptive link text |
103
+ | Indented code blocks | Fenced code blocks with language |
104
+ | Mixed emphasis markers (`*` and `_`) | Pick one, use consistently |
105
+ | Stacking many callouts | Limit 1-2 per section; integrate into prose |
106
+ | Trailing colon on heading (`## When to Use:`) | Remove trailing punctuation |
107
+ | Bare URLs | Wrap in `[text](url)` |
108
+ | Table for non-tabular data | Use a list instead |