hatch3r 1.0.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 (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +437 -0
  3. package/agents/hatch3r-a11y-auditor.md +126 -0
  4. package/agents/hatch3r-architect.md +160 -0
  5. package/agents/hatch3r-ci-watcher.md +123 -0
  6. package/agents/hatch3r-context-rules.md +97 -0
  7. package/agents/hatch3r-dependency-auditor.md +164 -0
  8. package/agents/hatch3r-devops.md +138 -0
  9. package/agents/hatch3r-docs-writer.md +97 -0
  10. package/agents/hatch3r-implementer.md +162 -0
  11. package/agents/hatch3r-learnings-loader.md +108 -0
  12. package/agents/hatch3r-lint-fixer.md +104 -0
  13. package/agents/hatch3r-perf-profiler.md +123 -0
  14. package/agents/hatch3r-researcher.md +642 -0
  15. package/agents/hatch3r-reviewer.md +81 -0
  16. package/agents/hatch3r-security-auditor.md +119 -0
  17. package/agents/hatch3r-test-writer.md +134 -0
  18. package/commands/hatch3r-agent-customize.md +146 -0
  19. package/commands/hatch3r-api-spec.md +49 -0
  20. package/commands/hatch3r-benchmark.md +50 -0
  21. package/commands/hatch3r-board-fill.md +504 -0
  22. package/commands/hatch3r-board-init.md +315 -0
  23. package/commands/hatch3r-board-pickup.md +672 -0
  24. package/commands/hatch3r-board-refresh.md +198 -0
  25. package/commands/hatch3r-board-shared.md +369 -0
  26. package/commands/hatch3r-bug-plan.md +410 -0
  27. package/commands/hatch3r-codebase-map.md +1182 -0
  28. package/commands/hatch3r-command-customize.md +94 -0
  29. package/commands/hatch3r-context-health.md +112 -0
  30. package/commands/hatch3r-cost-tracking.md +139 -0
  31. package/commands/hatch3r-dep-audit.md +171 -0
  32. package/commands/hatch3r-feature-plan.md +379 -0
  33. package/commands/hatch3r-healthcheck.md +307 -0
  34. package/commands/hatch3r-hooks.md +282 -0
  35. package/commands/hatch3r-learn.md +217 -0
  36. package/commands/hatch3r-migration-plan.md +51 -0
  37. package/commands/hatch3r-onboard.md +56 -0
  38. package/commands/hatch3r-project-spec.md +1153 -0
  39. package/commands/hatch3r-recipe.md +179 -0
  40. package/commands/hatch3r-refactor-plan.md +426 -0
  41. package/commands/hatch3r-release.md +328 -0
  42. package/commands/hatch3r-roadmap.md +556 -0
  43. package/commands/hatch3r-rule-customize.md +114 -0
  44. package/commands/hatch3r-security-audit.md +370 -0
  45. package/commands/hatch3r-skill-customize.md +93 -0
  46. package/commands/hatch3r-workflow.md +377 -0
  47. package/dist/cli/hooks-ZOTFDEA3.js +59 -0
  48. package/dist/cli/index.d.ts +2 -0
  49. package/dist/cli/index.js +3584 -0
  50. package/github-agents/hatch3r-docs-agent.md +46 -0
  51. package/github-agents/hatch3r-lint-agent.md +41 -0
  52. package/github-agents/hatch3r-security-agent.md +54 -0
  53. package/github-agents/hatch3r-test-agent.md +66 -0
  54. package/hooks/hatch3r-ci-failure.md +10 -0
  55. package/hooks/hatch3r-file-save.md +11 -0
  56. package/hooks/hatch3r-post-merge.md +10 -0
  57. package/hooks/hatch3r-pre-commit.md +11 -0
  58. package/hooks/hatch3r-pre-push.md +10 -0
  59. package/hooks/hatch3r-session-start.md +10 -0
  60. package/mcp/mcp.json +62 -0
  61. package/package.json +84 -0
  62. package/prompts/hatch3r-bug-triage.md +155 -0
  63. package/prompts/hatch3r-code-review.md +131 -0
  64. package/prompts/hatch3r-pr-description.md +173 -0
  65. package/rules/hatch3r-accessibility-standards.md +77 -0
  66. package/rules/hatch3r-accessibility-standards.mdc +75 -0
  67. package/rules/hatch3r-agent-orchestration.md +160 -0
  68. package/rules/hatch3r-api-design.md +176 -0
  69. package/rules/hatch3r-api-design.mdc +176 -0
  70. package/rules/hatch3r-browser-verification.md +73 -0
  71. package/rules/hatch3r-browser-verification.mdc +73 -0
  72. package/rules/hatch3r-ci-cd.md +70 -0
  73. package/rules/hatch3r-ci-cd.mdc +68 -0
  74. package/rules/hatch3r-code-standards.md +102 -0
  75. package/rules/hatch3r-code-standards.mdc +100 -0
  76. package/rules/hatch3r-component-conventions.md +102 -0
  77. package/rules/hatch3r-component-conventions.mdc +102 -0
  78. package/rules/hatch3r-data-classification.md +85 -0
  79. package/rules/hatch3r-data-classification.mdc +83 -0
  80. package/rules/hatch3r-dependency-management.md +17 -0
  81. package/rules/hatch3r-dependency-management.mdc +15 -0
  82. package/rules/hatch3r-error-handling.md +17 -0
  83. package/rules/hatch3r-error-handling.mdc +15 -0
  84. package/rules/hatch3r-feature-flags.md +112 -0
  85. package/rules/hatch3r-feature-flags.mdc +112 -0
  86. package/rules/hatch3r-git-conventions.md +47 -0
  87. package/rules/hatch3r-git-conventions.mdc +45 -0
  88. package/rules/hatch3r-i18n.md +90 -0
  89. package/rules/hatch3r-i18n.mdc +90 -0
  90. package/rules/hatch3r-learning-consult.md +29 -0
  91. package/rules/hatch3r-learning-consult.mdc +27 -0
  92. package/rules/hatch3r-migrations.md +17 -0
  93. package/rules/hatch3r-migrations.mdc +15 -0
  94. package/rules/hatch3r-observability.md +165 -0
  95. package/rules/hatch3r-observability.mdc +165 -0
  96. package/rules/hatch3r-performance-budgets.md +109 -0
  97. package/rules/hatch3r-performance-budgets.mdc +109 -0
  98. package/rules/hatch3r-secrets-management.md +76 -0
  99. package/rules/hatch3r-secrets-management.mdc +74 -0
  100. package/rules/hatch3r-security-patterns.md +211 -0
  101. package/rules/hatch3r-security-patterns.mdc +211 -0
  102. package/rules/hatch3r-testing.md +89 -0
  103. package/rules/hatch3r-testing.mdc +87 -0
  104. package/rules/hatch3r-theming.md +51 -0
  105. package/rules/hatch3r-theming.mdc +51 -0
  106. package/rules/hatch3r-tooling-hierarchy.md +92 -0
  107. package/rules/hatch3r-tooling-hierarchy.mdc +79 -0
  108. package/skills/hatch3r-a11y-audit/SKILL.md +131 -0
  109. package/skills/hatch3r-agent-customize/SKILL.md +75 -0
  110. package/skills/hatch3r-api-spec/SKILL.md +66 -0
  111. package/skills/hatch3r-architecture-review/SKILL.md +96 -0
  112. package/skills/hatch3r-bug-fix/SKILL.md +129 -0
  113. package/skills/hatch3r-ci-pipeline/SKILL.md +76 -0
  114. package/skills/hatch3r-command-customize/SKILL.md +67 -0
  115. package/skills/hatch3r-context-health/SKILL.md +76 -0
  116. package/skills/hatch3r-cost-tracking/SKILL.md +65 -0
  117. package/skills/hatch3r-dep-audit/SKILL.md +82 -0
  118. package/skills/hatch3r-feature/SKILL.md +129 -0
  119. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +150 -0
  120. package/skills/hatch3r-incident-response/SKILL.md +86 -0
  121. package/skills/hatch3r-issue-workflow/SKILL.md +139 -0
  122. package/skills/hatch3r-logical-refactor/SKILL.md +73 -0
  123. package/skills/hatch3r-migration/SKILL.md +76 -0
  124. package/skills/hatch3r-perf-audit/SKILL.md +114 -0
  125. package/skills/hatch3r-pr-creation/SKILL.md +85 -0
  126. package/skills/hatch3r-qa-validation/SKILL.md +86 -0
  127. package/skills/hatch3r-recipe/SKILL.md +67 -0
  128. package/skills/hatch3r-refactor/SKILL.md +86 -0
  129. package/skills/hatch3r-release/SKILL.md +93 -0
  130. package/skills/hatch3r-rule-customize/SKILL.md +70 -0
  131. package/skills/hatch3r-skill-customize/SKILL.md +67 -0
  132. package/skills/hatch3r-visual-refactor/SKILL.md +89 -0
@@ -0,0 +1,282 @@
1
+ ---
2
+ id: hatch3r-hooks
3
+ type: command
4
+ description: Define and manage event-driven hooks that activate agents on project events
5
+ ---
6
+ # Hooks — Event-Driven Agent Activation
7
+
8
+ Define, edit, and manage event-driven hooks that automatically activate hatch3r agents when specific project events occur. Hook definitions are tool-agnostic — the adapter pipeline translates them into tool-native configurations during `npx hatch3r sync`.
9
+
10
+ ---
11
+
12
+ ## Workflow
13
+
14
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
15
+
16
+ ### Step 1: Discover Current State
17
+
18
+ 1. Check `/.agents/hooks/` for existing hook definition files (`.md` files with frontmatter).
19
+ 2. Read `/.agents/hatch.json` for configured tools and features.
20
+ 3. List existing hooks with their event, agent, and conditions.
21
+
22
+ Present the current state:
23
+
24
+ ```
25
+ Current Hooks: {list with id, event, agent — or "none"}
26
+ Configured Tools: {tools from hatch.json}
27
+ Hooks Feature: {enabled/disabled}
28
+ ```
29
+
30
+ **ASK:** "Current hooks: {list or 'none'}. Tools: {list}. What would you like to do? (a) Add a new hook, (b) Edit existing hook, (c) Remove a hook, (d) List all hooks, (e) Sync hooks to tools"
31
+
32
+ ---
33
+
34
+ ### Step 2: Define Hook
35
+
36
+ For adding a new hook:
37
+
38
+ #### 2a. Select Event
39
+
40
+ Present available events with descriptions:
41
+
42
+ | Event | Description | Use Cases |
43
+ |-------|-------------|-----------|
44
+ | `pre-commit` | Triggered before a commit is created | Lint checks, secret scanning, test running |
45
+ | `post-merge` | Triggered after a branch merge | Dependency updates, migration checks, notification |
46
+ | `ci-failure` | Triggered when CI/CD pipeline fails | Auto-diagnosis, fix suggestions |
47
+ | `file-save` | Triggered when a file is saved | Auto-formatting, auto-testing, live validation |
48
+ | `session-start` | Triggered when a new coding session starts | Context loading, status checks |
49
+ | `pre-push` | Triggered before pushing to remote | Full test suite, build verification |
50
+ | `pre-implementation` | Triggered before implementing a sub-issue | Context loading, spec review, learning consultation |
51
+ | `post-implementation` | Triggered after implementing a sub-issue | Learning capture, code quality check, doc updates |
52
+ | `pre-review` | Triggered before code review starts | Checklist generation, context preparation |
53
+ | `post-review` | Triggered after code review completes | Fix tracking, learning capture, approval notifications |
54
+ | `pre-release` | Triggered before a release workflow | Changelog verification, version validation, dependency audit |
55
+ | `post-release` | Triggered after a release completes | Monitoring setup, notification, deploy verification |
56
+ | `pre-test` | Triggered before test execution | Test environment setup, fixture preparation |
57
+ | `post-test` | Triggered after test execution completes | Coverage reporting, flaky test detection, result analysis |
58
+ | `on-error` | Triggered when any workflow step fails | Error diagnosis, auto-retry, escalation, incident logging |
59
+ | `on-context-switch` | Triggered when agent context is refreshed or delegated | State persistence, handoff documentation |
60
+ | `on-dependency-change` | Triggered when dependencies are added/updated/removed | Security audit, compatibility check, license validation |
61
+ | `on-security-finding` | Triggered when a security issue is discovered | Alert escalation, auto-fix suggestions, incident creation |
62
+
63
+ **ASK:** "Select an event for this hook."
64
+
65
+ #### 2b. Select Agent
66
+
67
+ Present available hatch3r agents:
68
+
69
+ - `lint-fixer` — Automatic lint error resolution
70
+ - `test-writer` — Test generation for new or changed code
71
+ - `reviewer` — Code review and quality checks
72
+ - `security-auditor` — Security vulnerability scanning
73
+ - `ci-watcher` — CI/CD pipeline monitoring and diagnosis
74
+ - `a11y-auditor` — Accessibility compliance checks
75
+ - `perf-profiler` — Performance analysis and optimization
76
+ - `dependency-auditor` — Dependency security and update checks
77
+ - `docs-writer` — Documentation generation and updates
78
+
79
+ If the user wants a custom agent name not in this list, accept it but warn that the agent must exist in `/.agents/agents/`.
80
+
81
+ **ASK:** "Select an agent to activate when this event fires."
82
+
83
+ #### 2c. Define Conditions (Optional)
84
+
85
+ - **Glob patterns:** Which files trigger this hook (e.g., `src/**/*.ts`, `*.css`)
86
+ - **Branch patterns:** Which branches (e.g., `main`, `release/*`)
87
+
88
+ **ASK:** "Add conditions? (glob patterns, branch patterns, or skip for 'always activate')"
89
+
90
+ #### 2d. Write Hook Definition File
91
+
92
+ Generate the hook definition file at `/.agents/hooks/{event}-{agent-short-name}.md`:
93
+
94
+ ```markdown
95
+ ---
96
+ id: {event}-{agent-short-name}
97
+ type: hook
98
+ event: {selected-event}
99
+ agent: {selected-agent}
100
+ description: {user-provided or auto-generated description}
101
+ globs: {comma-separated glob patterns, if any}
102
+ branches: {comma-separated branch patterns, if any}
103
+ ---
104
+ # Hook: {event} → {agent}
105
+
106
+ {Description of what this hook does and when it activates.}
107
+
108
+ ## Activation
109
+
110
+ - **Event:** {event}
111
+ - **Agent:** {agent}
112
+ - **Conditions:** {glob patterns, branch patterns, or "always"}
113
+
114
+ ## Tool-Specific Behavior
115
+
116
+ - **Claude Code:** For session-start → SessionStart. For pre-commit, post-merge, ci-failure, file-save, pre-push: no native mapping — adapter may use no-op or alternative strategy (see mapping note below).
117
+ - **Cursor:** Maps to glob-based rule activation in `.cursor/rules/`
118
+ - **Others:** Hook definition stored; sync when adapter support is added
119
+ ```
120
+
121
+ Claude Code event mapping: **Claude Code's native hook events (PreToolUse, PostToolUse, SubagentStart, SessionStart) are tool-lifecycle events and do NOT map to git/project events.** PreToolUse fires before every tool call; PostToolUse fires after every tool completes; SubagentStart fires when a subagent spawns. Only `session-start` → `SessionStart` is semantically correct. For pre-commit, post-merge, ci-failure, file-save, and pre-push, the Claude Code adapter may use a no-op or alternative strategy (e.g., Cursor rules) — do not map these to PreToolUse/PostToolUse/SubagentStart, as that would cause hooks to fire on every tool invocation instead of the intended event.
122
+
123
+ **ASK:** "Hook definition: {summary}. Create? (yes / adjust / cancel)"
124
+
125
+ ---
126
+
127
+ ### Step 3: Edit Existing Hook
128
+
129
+ For editing an existing hook:
130
+
131
+ 1. List all hooks and ask which to edit.
132
+ 2. Show current definition.
133
+ 3. Ask what to change (event, agent, conditions, description).
134
+ 4. Update the hook file in `/.agents/hooks/`.
135
+
136
+ **ASK:** "Updated hook: {summary}. Save? (yes / revert / cancel)"
137
+
138
+ ---
139
+
140
+ ### Step 4: Remove a Hook
141
+
142
+ 1. List all hooks and ask which to remove.
143
+ 2. Show the hook definition.
144
+
145
+ **ASK:** "Remove hook '{id}'? This will delete `/.agents/hooks/{filename}`. (yes / cancel)"
146
+
147
+ 3. Delete the file. Warn that tool-specific generated files (e.g., `.cursor/rules/hatch3r-hook-*.mdc`) will be cleaned up on the next `npx hatch3r sync`.
148
+
149
+ ---
150
+
151
+ ### Step 5: Sync Hooks to Tools
152
+
153
+ 1. Read all hook definitions from `/.agents/hooks/`.
154
+ 2. For each configured tool in `hatch.json`, describe what will be generated:
155
+ - **Claude Code:** Hook documentation appended to managed section of `CLAUDE.md`
156
+ - **Cursor:** Glob-based `.mdc` rule files in `.cursor/rules/hatch3r-hook-*.mdc`
157
+ - **Others:** No-op (hook definitions stored for future adapter support)
158
+ 3. Present the list of files that will be generated/updated.
159
+
160
+ **ASK:** "Hooks will generate these files: {list}. Run `npx hatch3r sync` to apply. (understood / sync now)"
161
+
162
+ If user chooses "sync now", instruct them to run `npx hatch3r sync` in the terminal.
163
+
164
+ ---
165
+
166
+ ## Custom Events
167
+
168
+ Define project-specific hook events beyond the built-in types:
169
+
170
+ - **Event naming**: `custom:{domain}:{action}` (e.g., `custom:billing:subscription-change`)
171
+ - **Event registration**: Add custom events to `hatch.json` under `hooks.customEvents`
172
+ - **Event triggering**: Agents trigger custom events via `emit-hook custom:{name}` in their workflows
173
+ - **Event payload**: Custom events can pass structured data to hook handlers via JSON payload
174
+
175
+ ### Custom Event Definition
176
+
177
+ In `hatch.json`:
178
+
179
+ ```json
180
+ {
181
+ "hooks": {
182
+ "customEvents": [
183
+ {
184
+ "name": "custom:billing:subscription-change",
185
+ "description": "Fired when a subscription plan changes",
186
+ "payload": { "userId": "string", "oldPlan": "string", "newPlan": "string" }
187
+ }
188
+ ]
189
+ }
190
+ }
191
+ ```
192
+
193
+ Custom events follow the same hook definition format as built-in events — create a hook file in `/.agents/hooks/` with `event: custom:{domain}:{action}`.
194
+
195
+ ---
196
+
197
+ ## Hook Chaining
198
+
199
+ Hooks can trigger other hooks in sequence:
200
+
201
+ - **Chain definition**: Define ordered hook chains in `hatch.json` under `hooks.chains`
202
+ - **Execution order**: Hooks in a chain execute sequentially; failure in any hook stops the chain
203
+ - **Error handling**: Chain-level error handlers can catch and handle failures from individual hooks
204
+ - **Conditional chaining**: Hooks can conditionally trigger next hook based on output (pass/fail/skip)
205
+
206
+ ### Chain Definition
207
+
208
+ In `hatch.json`:
209
+
210
+ ```json
211
+ {
212
+ "hooks": {
213
+ "chains": [
214
+ {
215
+ "id": "pre-release-pipeline",
216
+ "description": "Full pre-release validation chain",
217
+ "steps": [
218
+ { "hook": "pre-release-security-auditor", "on_fail": "stop" },
219
+ { "hook": "pre-release-test-writer", "on_fail": "stop" },
220
+ { "hook": "pre-release-docs-writer", "on_fail": "warn" }
221
+ ],
222
+ "on_error": "notify"
223
+ }
224
+ ]
225
+ }
226
+ }
227
+ ```
228
+
229
+ Chains are triggered by referencing the chain ID as the hook target. Individual hook results (`pass`, `fail`, `skip`) determine whether the chain continues.
230
+
231
+ ---
232
+
233
+ ## Hook Execution Ordering
234
+
235
+ When multiple hooks are registered for the same event:
236
+
237
+ - **Priority**: Hooks have a priority field (1-100, lower runs first, default 50)
238
+ - **Parallel vs Sequential**: Hooks at the same priority level run in parallel; different priority levels run sequentially
239
+ - **Timeout**: Each hook has a configurable timeout (default 30 seconds). Timed-out hooks are reported as failures.
240
+ - **Isolation**: Each hook runs in its own context. Hook outputs are collected but don't affect other hooks unless chained.
241
+
242
+ ### Priority Configuration
243
+
244
+ Add `priority` and `timeout` to hook frontmatter:
245
+
246
+ ```markdown
247
+ ---
248
+ id: pre-commit-lint-fixer
249
+ type: hook
250
+ event: pre-commit
251
+ agent: lint-fixer
252
+ priority: 10
253
+ timeout: 60
254
+ ---
255
+ ```
256
+
257
+ ### Execution Example
258
+
259
+ For `pre-commit` with three hooks:
260
+ 1. `lint-fixer` (priority 10) — runs first
261
+ 2. `security-auditor` (priority 20) — runs second
262
+ 3. `test-writer` (priority 50) and `reviewer` (priority 50) — run in parallel, third
263
+
264
+ ---
265
+
266
+ ## Error Handling
267
+
268
+ - `/.agents/hooks/` doesn't exist: create it automatically.
269
+ - Invalid event type: warn and show the valid events table.
270
+ - Agent not found in `/.agents/agents/`: warn but allow (agent may be added later).
271
+ - Adapter doesn't support hooks: generate hook definition file anyway, warn that sync for that tool is a no-op.
272
+ - Duplicate hook ID: warn and ask the user to choose a different name or overwrite.
273
+
274
+ ## Guardrails
275
+
276
+ - **Never skip ASK checkpoints.**
277
+ - Hook definitions are tool-agnostic — the adapters handle translation.
278
+ - Never delete hook files without explicit user confirmation.
279
+ - Always validate event names against the known events list.
280
+ - Hook IDs must be unique across all hook definitions.
281
+ - The command creates hook DEFINITIONS only — actual hook registration happens via `npx hatch3r sync`.
282
+ - Do not modify adapter output files directly — they are managed by the sync pipeline.
@@ -0,0 +1,217 @@
1
+ ---
2
+ id: hatch3r-learn
3
+ type: command
4
+ description: Capture learnings from development sessions into reusable knowledge files for future consultation.
5
+ ---
6
+ # Learning Capture -- Extract and Store Development Insights
7
+
8
+ Capture learnings from completed development sessions. Can be invoked manually after finishing work, automatically by board-pickup after PR merge, or with a specific issue number for targeted reflection.
9
+
10
+ ---
11
+
12
+ ## Workflow
13
+
14
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
15
+
16
+ ### Step 1: Gather Learning Context
17
+
18
+ 1. Check what was recently completed:
19
+ - If invoked with an issue number: read the issue, its PR, and changes via `gh issue view` and `gh pr list --search`.
20
+ - If invoked standalone: **ASK** the user what they just completed.
21
+ - If invoked from board-pickup: use the issue/PR context already available.
22
+ 2. Scan recent git history for context (`git log --oneline -20` on the current branch).
23
+
24
+ **ASK:** "What did you just complete? {auto-detected context}. Confirm or provide additional details."
25
+
26
+ ### Step 2: Extract Learnings
27
+
28
+ 1. Identify learnings in these categories:
29
+ - **Pattern Discovered**: A reusable approach that worked well.
30
+ - **Pitfall Encountered**: Something that caused problems or wasted time.
31
+ - **Decision Made**: An architectural or design decision with rationale.
32
+ - **Tool/Library Insight**: Something learned about a tool or library.
33
+ - **Process Improvement**: A workflow improvement suggestion.
34
+
35
+ 2. For each learning, capture:
36
+ - What happened (context).
37
+ - What was learned.
38
+ - When this applies in the future (trigger conditions).
39
+
40
+ **ASK:** "I identified these learnings: {list}. Add, remove, or adjust any? Confirm to save."
41
+
42
+ ### Step 3: Write Learning Files
43
+
44
+ For each confirmed learning, create a file in `/.agents/learnings/`.
45
+
46
+ If `/.agents/learnings/` does not exist, create it.
47
+
48
+ **Filename:** `{YYYY-MM-DD}_{short-slug}.md`
49
+
50
+ **Content format:**
51
+
52
+ ```markdown
53
+ ---
54
+ id: {short-slug}
55
+ date: {YYYY-MM-DD}
56
+ source-issue: #{issue-number} # or "manual" if standalone
57
+ category: pattern | pitfall | decision | tool-insight | process
58
+ tags: [{area-labels}, {tech-stack-tags}]
59
+ area: {module/subsystem affected}
60
+ ---
61
+ ## Context
62
+
63
+ {What was being done when this learning occurred}
64
+
65
+ ## Learning
66
+
67
+ {The actual insight -- what was learned}
68
+
69
+ ## Applies When
70
+
71
+ {Future trigger conditions -- when should this learning be consulted}
72
+
73
+ ## Evidence
74
+
75
+ {Links to relevant code, PRs, issues, or files}
76
+ ```
77
+
78
+ **Guardrails for learning files:**
79
+ - Never overwrite existing learning files.
80
+ - If a duplicate learning is detected (similar to an existing file), **ASK** whether to merge or create separate.
81
+ - Learnings must be specific and actionable, not generic advice.
82
+ - Always include the "Applies When" section -- learnings without trigger conditions are not useful.
83
+ - Tags should use the same vocabulary as the project's area labels.
84
+ - Keep learnings concise -- max ~20 lines per learning file body.
85
+
86
+ ### Step 4: Summary
87
+
88
+ Present all saved learnings with file paths.
89
+
90
+ ```
91
+ Learnings Captured:
92
+ /.agents/learnings/{filename1}.md -- {category}: {one-line summary}
93
+ /.agents/learnings/{filename2}.md -- {category}: {one-line summary}
94
+ ```
95
+
96
+ Remind user that these will be auto-consulted during future board-pickup and board-fill runs.
97
+
98
+ ---
99
+
100
+ ## Learning Lifecycle
101
+
102
+ ### Expiry & Deprecation
103
+ - Learnings have an optional `expires` field (ISO date). Expired learnings are flagged during `hatch3r status`.
104
+ - Learnings can be marked `deprecated: true` with a `superseded_by` reference to a newer learning.
105
+ - During `hatch3r sync`, expired/deprecated learnings are moved to an `archived/` subdirectory (not deleted).
106
+ - Quarterly review: agents prompt for learning review when > 50 active learnings exist.
107
+
108
+ ### Confidence Levels
109
+ - `proven` — validated across multiple implementations
110
+ - `experimental` — worked once, needs more validation
111
+ - `hypothesis` — untested assumption, use with caution
112
+
113
+ ### Lifecycle Frontmatter Fields
114
+
115
+ ```markdown
116
+ ---
117
+ id: {short-slug}
118
+ date: {YYYY-MM-DD}
119
+ source-issue: #{issue-number}
120
+ category: pattern | pitfall | decision | tool-insight | process
121
+ tags: [{area-labels}, {tech-stack-tags}]
122
+ area: {module/subsystem affected}
123
+ confidence: proven | experimental | hypothesis
124
+ expires: {YYYY-MM-DD} # optional
125
+ deprecated: false # set true to deprecate
126
+ superseded_by: {learning-id} # reference when deprecated
127
+ ---
128
+ ```
129
+
130
+ ### Archival
131
+
132
+ Archived learnings are moved to `/.agents/learnings/archived/` with their original filename. An archival notice is prepended:
133
+
134
+ ```markdown
135
+ > **Archived on {date}**: {reason — expired | deprecated | superseded by {id}}
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Search & Discovery
141
+
142
+ ### Tag System
143
+ - Learnings are tagged with categories: `performance`, `security`, `ux`, `architecture`, `testing`, `deployment`, `debugging`, `patterns`
144
+ - Tags are defined in the learning frontmatter: `tags: [performance, caching]`
145
+ - Agents search learnings by tag when starting relevant work (e.g., performance audit consults `performance`-tagged learnings)
146
+
147
+ ### Search Interface
148
+ - `hatch3r learn search {query}` — full-text search across learning titles and content
149
+ - `hatch3r learn list --tag={tag}` — filter by tag
150
+ - `hatch3r learn list --status={active|deprecated|expired}` — filter by lifecycle status
151
+ - `hatch3r learn list --recent` — show learnings added in last 30 days
152
+
153
+ ### Search Output Format
154
+
155
+ ```
156
+ Learnings matching "{query}":
157
+ [{confidence}] {title} ({date}, tags: {tags})
158
+ /.agents/learnings/{filename}.md
159
+ Applies when: {trigger summary}
160
+ ```
161
+
162
+ ### Agent Auto-Consultation
163
+
164
+ During `board-pickup` and `board-fill`, agents automatically consult learnings by:
165
+ 1. Matching area labels from the issue to learning tags
166
+ 2. Filtering to `active` status only (not expired/deprecated)
167
+ 3. Sorting by confidence (`proven` first) then by date (newest first)
168
+ 4. Presenting top 5 relevant learnings in the implementation context
169
+
170
+ ---
171
+
172
+ ## Learning Quality
173
+
174
+ ### Required Fields
175
+ Every learning must include:
176
+ - `title` — concise summary (< 80 chars)
177
+ - `context` — when this learning applies
178
+ - `insight` — what was learned
179
+ - `evidence` — how it was validated (PR link, test result, metric)
180
+ - `tags` — at least one category tag
181
+
182
+ ### Validation
183
+ - Learnings without `evidence` are automatically tagged `hypothesis`
184
+ - Learnings referenced in 3+ implementations are auto-promoted to `proven`
185
+ - Learnings contradicted by newer evidence are flagged for review
186
+
187
+ ### Quality Checks During Step 3
188
+
189
+ When writing learning files, validate:
190
+ 1. Title is under 80 characters
191
+ 2. At least one tag is present and matches project vocabulary
192
+ 3. "Applies When" section has specific trigger conditions (not vague)
193
+ 4. Evidence is present — if not, set `confidence: hypothesis` and warn the user
194
+ 5. Content does not duplicate an existing active learning (fuzzy match on title + tags)
195
+
196
+ ---
197
+
198
+ ## Error Handling
199
+
200
+ - `/.agents/learnings/` directory doesn't exist: create it silently.
201
+ - `/.agents/learnings/archived/` directory doesn't exist: create it when first archival occurs.
202
+ - Duplicate learning detected: warn and **ASK** whether to merge or create separate.
203
+ - No learnings identified: **ASK** user directly what they learned. If still nothing, skip silently.
204
+ - Learning exceeds quality thresholds: warn user with specific violations and suggest fixes.
205
+ - Search returns no results: suggest broader search terms or list all available tags.
206
+
207
+ ## Guardrails
208
+
209
+ - **Never skip ASK checkpoints.**
210
+ - **Never overwrite existing learning files.**
211
+ - **Never delete learnings.** Use archival (move to `archived/`) instead of deletion.
212
+ - **Learnings must be specific and actionable.** Reject generic advice like "write better tests."
213
+ - **Always include trigger conditions** in the "Applies When" section.
214
+ - **Tags must match project vocabulary** -- use area labels from `/.agents/hatch.json`.
215
+ - **Max ~20 lines per learning** file body (excluding frontmatter).
216
+ - **Learnings without evidence must be `hypothesis`.** Do not allow `proven` or `experimental` without evidence.
217
+ - **Expired learnings are archived, not deleted.** Preserve institutional knowledge.
@@ -0,0 +1,51 @@
1
+ ---
2
+ id: hatch3r-migration-plan
3
+ type: command
4
+ description: Create a phased migration plan for a major dependency or framework upgrade. Analyzes breaking changes and produces an actionable plan with rollback procedures.
5
+ ---
6
+ # Migration Plan Generator
7
+
8
+ ## Inputs
9
+
10
+ - **Migration target:** dependency name and target version, or framework/platform change description
11
+ - **Current version:** auto-detected from lockfile or specified manually
12
+ - **Scope:** `full` (default) or `assessment-only` (just the analysis, no plan)
13
+
14
+ ## Procedure
15
+
16
+ 1. **Detect current state:**
17
+ - Read `package.json`, lockfile, or equivalent for current version
18
+ - Identify all direct and transitive dependents of the migration target
19
+ - Count usage sites in the codebase (imports, API calls)
20
+
21
+ 2. **Research breaking changes:**
22
+ - Read the changelog/release notes between current and target versions
23
+ - Use web research for migration guides, known issues, and community solutions
24
+ - Identify deprecated APIs, removed features, and behavioral changes
25
+
26
+ 3. **Impact analysis:**
27
+ - Map each breaking change to affected files in the codebase
28
+ - Classify impact: `trivial` (find-replace), `moderate` (logic change), `significant` (architectural change)
29
+ - Estimate effort per change (hours)
30
+ - Identify risk areas (data loss potential, security implications, performance impact)
31
+
32
+ 4. **Generate phased plan:**
33
+ - Phase 0: Preparation (add compatibility shims, increase test coverage on affected areas)
34
+ - Phase 1: Non-breaking updates (update config, add new imports alongside old)
35
+ - Phase 2: Migrate consumers (update code to use new APIs)
36
+ - Phase 3: Remove old code (delete shims, deprecated usage, old dependencies)
37
+ - Each phase includes: files to change, validation criteria, rollback steps
38
+
39
+ 5. **Output the plan** as a markdown document or GitHub issue(s).
40
+
41
+ ## Output
42
+
43
+ - Migration assessment with breaking change inventory
44
+ - Phased migration plan with effort estimates
45
+ - Rollback procedure for each phase
46
+ - Checklist of validation steps
47
+
48
+ ## Related
49
+
50
+ - **Skill:** `hatch3r-migration` — execution workflow for the plan
51
+ - **Skill:** `hatch3r-dep-audit` — dependency health check
@@ -0,0 +1,56 @@
1
+ ---
2
+ id: hatch3r-onboard
3
+ type: command
4
+ description: Generate an onboarding guide for a new developer joining the project. Covers setup, architecture, conventions, and key workflows.
5
+ ---
6
+ # Onboarding Guide Generator
7
+
8
+ ## Inputs
9
+
10
+ - **Role:** `frontend`, `backend`, `fullstack`, or `general` (default)
11
+ - **Output:** `markdown` (default) or `issue` (create GitHub issue with guide)
12
+
13
+ ## Procedure
14
+
15
+ 1. **Project overview:**
16
+ - Read `package.json` (or equivalent) for project name, description, tech stack
17
+ - Read `README.md` for existing setup instructions
18
+ - Read `.agents/AGENTS.md` for agent architecture overview
19
+ - Summarize: what the project does, who uses it, primary tech stack
20
+
21
+ 2. **Development setup:**
22
+ - Detect package manager and runtime (Node, Python, Go, etc.)
23
+ - List prerequisites: runtime version, system dependencies, required tools
24
+ - Generate exact setup commands: clone, install, configure environment, run
25
+ - Include `.env.example` setup instructions if present
26
+ - Verify the setup works by listing the build/test commands
27
+
28
+ 3. **Architecture walkthrough:**
29
+ - Map the directory structure with purpose of each top-level directory
30
+ - Identify the main entry points (API server, CLI, web app)
31
+ - Document the data flow for a typical request/operation
32
+ - List key dependencies and their roles
33
+
34
+ 4. **Conventions and standards:**
35
+ - Read `.agents/rules/` for coding standards
36
+ - Summarize branch naming, commit message, and PR conventions
37
+ - Document the testing strategy (unit, integration, e2e) and how to run tests
38
+ - List available scripts/commands from the project's task runner
39
+
40
+ 5. **Key workflows:**
41
+ - How to create a feature branch and open a PR
42
+ - How to run the CI pipeline locally
43
+ - How to deploy (if applicable)
44
+ - Who to ask for help and where to find documentation
45
+
46
+ 6. **Generate the guide** as a single markdown document organized by section.
47
+
48
+ ## Output
49
+
50
+ - Onboarding guide markdown document
51
+ - Quick-reference cheat sheet (common commands, file locations, contacts)
52
+
53
+ ## Related
54
+
55
+ - **Agent:** `hatch3r-docs-writer` — for maintaining documentation
56
+ - **Skill:** `hatch3r-feature` — standard feature development workflow