hatch3r 1.0.0 → 1.2.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 (144) hide show
  1. package/README.md +93 -322
  2. package/agents/hatch3r-a11y-auditor.md +24 -6
  3. package/agents/hatch3r-architect.md +20 -1
  4. package/agents/hatch3r-ci-watcher.md +31 -8
  5. package/agents/hatch3r-context-rules.md +14 -2
  6. package/agents/hatch3r-dependency-auditor.md +21 -5
  7. package/agents/hatch3r-devops.md +37 -6
  8. package/agents/hatch3r-docs-writer.md +19 -3
  9. package/agents/hatch3r-fixer.md +171 -0
  10. package/agents/hatch3r-implementer.md +84 -11
  11. package/agents/hatch3r-learnings-loader.md +69 -13
  12. package/agents/hatch3r-lint-fixer.md +19 -14
  13. package/agents/hatch3r-perf-profiler.md +18 -1
  14. package/agents/hatch3r-researcher.md +440 -5
  15. package/agents/hatch3r-reviewer.md +97 -5
  16. package/agents/hatch3r-security-auditor.md +23 -5
  17. package/agents/hatch3r-test-writer.md +21 -10
  18. package/checks/README.md +49 -0
  19. package/checks/code-quality.md +49 -0
  20. package/checks/performance.md +58 -0
  21. package/checks/security.md +58 -0
  22. package/checks/testing.md +53 -0
  23. package/commands/board/pickup-azure-devops.md +81 -0
  24. package/commands/board/pickup-delegation-multi.md +197 -0
  25. package/commands/board/pickup-delegation.md +100 -0
  26. package/commands/board/pickup-github.md +82 -0
  27. package/commands/board/pickup-gitlab.md +81 -0
  28. package/commands/board/pickup-modes.md +143 -0
  29. package/commands/board/pickup-post-impl.md +120 -0
  30. package/commands/board/shared-azure-devops.md +149 -0
  31. package/commands/board/shared-board-overview.md +215 -0
  32. package/commands/board/shared-github.md +169 -0
  33. package/commands/board/shared-gitlab.md +142 -0
  34. package/commands/hatch3r-agent-customize.md +40 -2
  35. package/commands/hatch3r-api-spec.md +294 -32
  36. package/commands/hatch3r-benchmark.md +386 -32
  37. package/commands/hatch3r-board-fill.md +161 -25
  38. package/commands/hatch3r-board-groom.md +595 -0
  39. package/commands/hatch3r-board-init.md +203 -46
  40. package/commands/hatch3r-board-pickup.md +79 -457
  41. package/commands/hatch3r-board-refresh.md +98 -27
  42. package/commands/hatch3r-board-shared.md +87 -238
  43. package/commands/hatch3r-bug-plan.md +16 -3
  44. package/commands/hatch3r-codebase-map.md +43 -10
  45. package/commands/hatch3r-command-customize.md +6 -0
  46. package/commands/hatch3r-context-health.md +5 -0
  47. package/commands/hatch3r-cost-tracking.md +5 -0
  48. package/commands/hatch3r-debug.md +426 -0
  49. package/commands/hatch3r-dep-audit.md +7 -1
  50. package/commands/hatch3r-feature-plan.md +74 -12
  51. package/commands/hatch3r-healthcheck.md +17 -1
  52. package/commands/hatch3r-hooks.md +16 -10
  53. package/commands/hatch3r-learn.md +15 -9
  54. package/commands/hatch3r-migration-plan.md +333 -33
  55. package/commands/hatch3r-onboard.md +327 -38
  56. package/commands/hatch3r-project-spec.md +46 -10
  57. package/commands/hatch3r-quick-change.md +336 -0
  58. package/commands/hatch3r-recipe.md +6 -0
  59. package/commands/hatch3r-refactor-plan.md +29 -13
  60. package/commands/hatch3r-release.md +13 -3
  61. package/commands/hatch3r-revision.md +395 -0
  62. package/commands/hatch3r-roadmap.md +18 -3
  63. package/commands/hatch3r-rule-customize.md +6 -0
  64. package/commands/hatch3r-security-audit.md +17 -1
  65. package/commands/hatch3r-skill-customize.md +6 -0
  66. package/commands/hatch3r-test-plan.md +532 -0
  67. package/commands/hatch3r-workflow.md +113 -38
  68. package/dist/cli/index.js +5184 -2593
  69. package/dist/cli/index.js.map +1 -0
  70. package/github-agents/hatch3r-docs-agent.md +1 -0
  71. package/github-agents/hatch3r-lint-agent.md +1 -0
  72. package/github-agents/hatch3r-security-agent.md +1 -0
  73. package/github-agents/hatch3r-test-agent.md +1 -0
  74. package/hooks/hatch3r-ci-failure.md +30 -0
  75. package/hooks/hatch3r-file-save.md +22 -0
  76. package/hooks/hatch3r-post-merge.md +23 -0
  77. package/hooks/hatch3r-pre-commit.md +23 -0
  78. package/hooks/hatch3r-pre-push.md +22 -0
  79. package/hooks/hatch3r-session-start.md +22 -0
  80. package/mcp/mcp.json +22 -3
  81. package/package.json +4 -7
  82. package/prompts/hatch3r-bug-triage.md +1 -0
  83. package/prompts/hatch3r-code-review.md +1 -0
  84. package/prompts/hatch3r-pr-description.md +1 -0
  85. package/rules/hatch3r-accessibility-standards.md +1 -0
  86. package/rules/hatch3r-agent-orchestration.md +326 -53
  87. package/rules/hatch3r-agent-orchestration.mdc +225 -0
  88. package/rules/hatch3r-api-design.md +4 -1
  89. package/rules/hatch3r-browser-verification.md +33 -1
  90. package/rules/hatch3r-browser-verification.mdc +29 -0
  91. package/rules/hatch3r-ci-cd.md +5 -1
  92. package/rules/hatch3r-ci-cd.mdc +4 -1
  93. package/rules/hatch3r-code-standards.md +18 -0
  94. package/rules/hatch3r-code-standards.mdc +10 -1
  95. package/rules/hatch3r-component-conventions.md +4 -1
  96. package/rules/hatch3r-data-classification.md +1 -0
  97. package/rules/hatch3r-deep-context.md +94 -0
  98. package/rules/hatch3r-deep-context.mdc +69 -0
  99. package/rules/hatch3r-dependency-management.md +13 -0
  100. package/rules/hatch3r-feature-flags.md +4 -1
  101. package/rules/hatch3r-git-conventions.md +1 -0
  102. package/rules/hatch3r-i18n.md +4 -1
  103. package/rules/hatch3r-learning-consult.md +4 -2
  104. package/rules/hatch3r-learning-consult.mdc +3 -2
  105. package/rules/hatch3r-migrations.md +12 -0
  106. package/rules/hatch3r-observability.md +293 -1
  107. package/rules/hatch3r-performance-budgets.md +5 -2
  108. package/rules/hatch3r-performance-budgets.mdc +1 -1
  109. package/rules/hatch3r-secrets-management.md +11 -3
  110. package/rules/hatch3r-secrets-management.mdc +10 -3
  111. package/rules/hatch3r-security-patterns.md +23 -3
  112. package/rules/hatch3r-security-patterns.mdc +8 -2
  113. package/rules/hatch3r-testing.md +1 -0
  114. package/rules/hatch3r-theming.md +4 -1
  115. package/rules/hatch3r-tooling-hierarchy.md +42 -15
  116. package/rules/hatch3r-tooling-hierarchy.mdc +27 -4
  117. package/skills/hatch3r-a11y-audit/SKILL.md +1 -0
  118. package/skills/hatch3r-agent-customize/SKILL.md +3 -0
  119. package/skills/hatch3r-api-spec/SKILL.md +1 -0
  120. package/skills/hatch3r-architecture-review/SKILL.md +6 -2
  121. package/skills/hatch3r-bug-fix/SKILL.md +4 -1
  122. package/skills/hatch3r-ci-pipeline/SKILL.md +1 -0
  123. package/skills/hatch3r-command-customize/SKILL.md +1 -0
  124. package/skills/hatch3r-context-health/SKILL.md +2 -1
  125. package/skills/hatch3r-cost-tracking/SKILL.md +1 -0
  126. package/skills/hatch3r-dep-audit/SKILL.md +6 -2
  127. package/skills/hatch3r-feature/SKILL.md +9 -2
  128. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +130 -21
  129. package/skills/hatch3r-incident-response/SKILL.md +11 -5
  130. package/skills/hatch3r-issue-workflow/SKILL.md +12 -7
  131. package/skills/hatch3r-logical-refactor/SKILL.md +1 -0
  132. package/skills/hatch3r-migration/SKILL.md +1 -0
  133. package/skills/hatch3r-perf-audit/SKILL.md +2 -1
  134. package/skills/hatch3r-pr-creation/SKILL.md +20 -10
  135. package/skills/hatch3r-qa-validation/SKILL.md +2 -1
  136. package/skills/hatch3r-recipe/SKILL.md +1 -0
  137. package/skills/hatch3r-refactor/SKILL.md +7 -1
  138. package/skills/hatch3r-release/SKILL.md +15 -11
  139. package/skills/hatch3r-rule-customize/SKILL.md +1 -0
  140. package/skills/hatch3r-skill-customize/SKILL.md +1 -0
  141. package/skills/hatch3r-visual-refactor/SKILL.md +1 -0
  142. package/dist/cli/hooks-ZOTFDEA3.js +0 -59
  143. package/rules/hatch3r-error-handling.md +0 -17
  144. package/rules/hatch3r-error-handling.mdc +0 -15
@@ -1,56 +1,345 @@
1
1
  ---
2
2
  id: hatch3r-onboard
3
3
  type: command
4
- description: Generate an onboarding guide for a new developer joining the project. Covers setup, architecture, conventions, and key workflows.
4
+ description: Generate a comprehensive onboarding guide for a new developer joining the project -- spawn parallel researchers to analyze codebase structure, architecture, and conventions, then produce a tailored onboarding document with setup instructions, architecture walkthrough, coding conventions, key workflows, tribal knowledge, and a quick-reference cheat sheet.
5
+ tags: [brownfield, team]
5
6
  ---
6
- # Onboarding Guide Generator
7
7
 
8
- ## Inputs
8
+ ## Agent Pipeline
9
9
 
10
- - **Role:** `frontend`, `backend`, `fullstack`, or `general` (default)
11
- - **Output:** `markdown` (default) or `issue` (create GitHub issue with guide)
10
+ | Stage | Agent(s) | Parallel | Required |
11
+ |-------|----------|----------|----------|
12
+ | 1. Project Analysis | `hatch3r-researcher` (3 parallel: codebase-overview, architecture, conventions) | Yes | Yes |
13
+ | 2. Setup Verification | Orchestrator (inline) | No | Yes |
14
+ | 3. Guide Generation | `hatch3r-docs-writer` | No | Yes |
12
15
 
13
- ## Procedure
16
+ # Onboarding Guide Generator — Tailored Developer Onboarding from Codebase Analysis to Ready-to-Work Guide
14
17
 
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
18
+ Take a new developer's role, experience level, and focus areas and produce a comprehensive onboarding guide covering project setup, architecture, coding conventions, key workflows, tribal knowledge, and a quick-reference cheat sheet. Spawns parallel researcher sub-agents (codebase overview, architecture mapping, conventions extraction) to analyze the project from multiple angles before generating a tailored guide document. AI proposes all outputs; user confirms before any files are written. Adapts depth and focus to the developer's experience level and role.
20
19
 
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
20
+ ---
21
+
22
+ ## Shared Context
23
+
24
+ **Read the `hatch3r-board-shared` command at the start of the run** if it exists. While this command does not perform board operations, it establishes patterns and context (GitHub owner/repo, tooling directives) that provide project metadata useful for the onboarding guide. Cache any values found.
25
+
26
+ ## Token-Saving Directives
27
+
28
+ 1. **Do not re-read files already cached.** Once researcher outputs are collected, reference them in memory — do not re-invoke sub-agents.
29
+ 2. **Limit documentation reads.** When reading existing project files for context, read TOC/headers first (~30 lines), expand only relevant sections.
30
+ 3. **Structured output only.** All sub-agent prompts require structured markdown output — no prose dumps.
31
+
32
+ ---
33
+
34
+ ## Workflow
35
+
36
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
37
+
38
+ ### Step 1: Gather Context
39
+
40
+ 1. **ASK:** "Tell me about the developer who will use this onboarding guide. I need:
41
+ - **Role:** `frontend`, `backend`, `fullstack`, `devops`, or `general` (default)
42
+ - **Experience level:** `junior`, `mid`, `senior`, or `staff` (adjusts depth and assumed knowledge)
43
+ - **Focus areas:** specific modules, features, or systems they'll work on first (or `all`)
44
+ - **Output format:** `markdown` (default), `issue` (create GitHub issue with guide), or `notion` (Notion-formatted markdown)
27
45
 
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
46
+ If you're onboarding yourself, just tell me your role and what you'll be working on."
47
+
48
+ 2. Present a structured summary:
49
+
50
+ ```
51
+ Onboarding Brief:
52
+ Role: {role}
53
+ Experience: {level}
54
+ Focus areas: {areas or "all"}
55
+ Output format: {format}
56
+ Depth: {derived — junior=detailed, mid=standard, senior=concise, staff=architecture-focused}
57
+ ```
58
+
59
+ **ASK:** "Does this capture the onboarding needs correctly? Adjust anything before I continue."
60
+
61
+ #### Step 1b: Dimension Probing (Team Context)
62
+
63
+ After the onboarding brief is confirmed, probe for team-specific context that cannot be discovered from the codebase. Generate targeted follow-up questions from the most relevant dimensions:
64
+
65
+ 1. Analyze the confirmed brief for missing information the codebase alone cannot provide.
66
+ 2. Generate 3–7 targeted questions from relevant dimensions:
67
+ - **Tooling:** What IDE, extensions, local tools, or services does the team use beyond the codebase?
68
+ - **Access & credentials:** What systems need access grants? (CI, cloud, staging, monitoring, secrets vault)
69
+ - **Communication:** Where does the team communicate? (Slack channels, standups, on-call rotation)
70
+ - **Review process:** Who reviews PRs? Any CODEOWNERS? Required approvals? Review SLA?
71
+ - **Deploy process:** Who can deploy? What's the release cadence? Feature flags?
72
+ - **Mentorship:** Is there a buddy system? Who should the new developer ask for help?
73
+ - **On-call & incidents:** Are new developers added to on-call? What's the incident process?
74
+ 3. Skip dimensions the user already addressed in the brief.
75
+
76
+ **ASK:** "Before I analyze the project, I have {N} questions about team context that the codebase can't tell me:
77
+ {numbered question list — each with the dimension label and why the answer matters}
78
+
79
+ Answer these now, or say 'skip' for any where you'd rather I omit that section from the guide."
80
+
81
+ 4. Record answers as **Team Context**. These are included in the guide and passed to the docs writer.
82
+ 5. For skipped questions, omit the relevant section from the guide rather than inventing answers.
83
+
84
+ ---
33
85
 
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
86
+ ### Step 2: Load Project Context
87
+
88
+ 1. Check for existing documentation:
89
+ - `README.md` existing setup instructions, project description
90
+ - `CONTRIBUTING.md` contribution guidelines
91
+ - `package.json` / `pyproject.toml` / `go.mod` / `Cargo.toml` — project metadata, scripts, dependencies
92
+ - `.env.example` — environment variable template
93
+ - `docs/` — any existing documentation
94
+ - `.agents/rules/` — coding standards and conventions
95
+ - `.agents/learnings/` — team learnings and institutional knowledge
96
+ - CI config (`.github/workflows/`, `.gitlab-ci.yml`, etc.) — CI/CD pipeline
97
+ 2. Scan the top-level directory structure to understand project organization.
98
+ 3. If `.agents/learnings/` exists, scan for learnings relevant to onboarding, common mistakes, and gotchas. Match by area and tags.
99
+ 4. Present a context summary:
100
+
101
+ ```
102
+ Context Loaded:
103
+ README: {found / not found — brief summary if found}
104
+ CONTRIBUTING: {found / not found}
105
+ Package manifest: {type — with N scripts, M dependencies}
106
+ Env template: {found / not found}
107
+ Docs: {N} files in docs/ ({key ones listed})
108
+ Rules: {N} files in .agents/rules/ ({areas covered})
109
+ Learnings: {N} relevant learnings
110
+ CI: {type — N workflows}
111
+ Gaps: {list any missing context — e.g., "no CONTRIBUTING.md", "no .env.example"}
112
+ ```
113
+
114
+ ---
115
+
116
+ ### Step 3: Spawn Parallel Researcher Sub-Agents
117
+
118
+ Spawn one sub-agent per research domain below concurrently, each following the **hatch3r-researcher agent protocol**. Each receives the confirmed onboarding brief from Step 1 (including role and experience level) and the context summary from Step 2.
119
+
120
+ **Each sub-agent prompt must include:**
121
+ - The full confirmed onboarding brief (role, experience, focus areas)
122
+ - The Team Context from Step 1b
123
+ - The project context summary from Step 2
124
+ - Instruction to follow the **hatch3r-researcher agent protocol**
125
+ - The assigned mode (one per sub-agent) and depth level `standard`
126
+ - Instruction to tailor findings to the specified experience level
127
+
128
+ | Sub-Agent | Researcher Mode | Focus |
129
+ |-----------|----------------|-------|
130
+ | 1 | `codebase-overview` | Map directory structure, entry points, tech stack, key dependencies, package scripts, build/test/run commands |
131
+ | 2 | `architecture` | Identify architectural patterns, data flow, module boundaries, API surface, state management, key abstractions |
132
+ | 3 | `conventions` | Extract coding standards from rules files and codebase patterns — naming, file organization, commit conventions, PR process, testing strategy |
133
+
134
+ Each sub-agent produces the structured output defined by its mode in the hatch3r-researcher agent specification.
135
+
136
+ Wait for all sub-agents to complete before proceeding.
137
+
138
+ ---
139
+
140
+ ### Step 4: Synthesize & Review Research
141
+
142
+ 1. Present a **merged summary** combining key findings from all researchers:
143
+
144
+ ```
145
+ Project Analysis Summary:
146
+
147
+ Project: {name}
148
+ Tech stack: {languages, frameworks, runtimes}
149
+ Architecture: {pattern — e.g., monolith, modular monolith, microservices}
150
+ Entry points: {N} ({list — API server, CLI, web app, etc.})
151
+ Key modules: {N} modules ({list top-level})
152
+ Scripts/commands: {N} available ({key ones listed})
153
+ Conventions found: {N} rules files, {M} patterns extracted
154
+ Test strategy: {unit / integration / e2e — tools used}
155
+ CI/CD: {pipeline type and key steps}
156
+ Documentation gaps: {list what's missing or outdated}
157
+ ```
158
+
159
+ 2. **Highlight areas that need human input** — things the researchers cannot discover from code:
160
+ - Undocumented deploy procedures or access provisioning steps
161
+ - Team norms not captured in rules files
162
+ - Historical context on architectural decisions
163
+ - Known issues or workarounds that live in team memory
164
+
165
+ **ASK:** "Here is what I found from analyzing the project. Before I generate the guide:
166
+ 1. Is anything above incorrect or outdated?
167
+ 2. Any undocumented context I should include? (deploy procedures, team norms, historical decisions)
168
+ 3. Anything I should emphasize or de-emphasize for this developer's role?
169
+
170
+ Confirm, or provide additional context."
171
+
172
+ ---
39
173
 
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
174
+ ### Step 5: Generate Onboarding Guide
45
175
 
46
- 6. **Generate the guide** as a single markdown document organized by section.
176
+ Spawn a `hatch3r-docs-writer` sub-agent via the Task tool (`subagent_type: "generalPurpose"`) to generate the onboarding guide from the merged research outputs. The docs writer receives the full research synthesis, team context, and the onboarding brief.
47
177
 
48
- ## Output
178
+ The guide is structured as a single markdown document following the **Onboarding Guide Template** (see Output Template below). The docs writer generates all sections, adapting depth to the developer's experience level:
49
179
 
50
- - Onboarding guide markdown document
51
- - Quick-reference cheat sheet (common commands, file locations, contacts)
180
+ | Experience Level | Depth Adjustments |
181
+ |-----------------|-------------------|
182
+ | Junior | Explain concepts, include "why" context, expand setup steps with expected output, add glossary of project-specific terms |
183
+ | Mid | Standard depth, focus on conventions and workflows, link to deeper docs where they exist |
184
+ | Senior | Concise setup, emphasize architecture and design decisions, highlight non-obvious patterns and trade-offs |
185
+ | Staff | Architecture-focused, include system-level context, integration boundaries, data flow diagrams, scaling considerations |
186
+
187
+ The docs writer generates these sections (all from researcher outputs and team context):
188
+
189
+ 1. **Project Overview** — what it does, who uses it, tech stack summary
190
+ 2. **Development Setup** — prerequisites, clone, install, environment config, first run, verification commands
191
+ 3. **Architecture Overview** — module map, data flow, key abstractions, entry points
192
+ 4. **Coding Conventions** — style, naming, file organization, rules summary
193
+ 5. **Git & PR Workflow** — branching, commits, PR process, review expectations
194
+ 6. **Testing Strategy** — test types, how to run, how to write, coverage expectations
195
+ 7. **Key Workflows** — feature development, bug fixing, deployment, incident response
196
+ 8. **Tribal Knowledge** — gotchas, common mistakes, non-obvious patterns, learnings
197
+ 9. **Quick Reference** — cheat sheet with commands, file locations, key contacts, links
198
+
199
+ For role-specific guides, emphasize the relevant sections:
200
+ - **Frontend:** UI components, design system, browser testing, bundle optimization
201
+ - **Backend:** API design, database, auth, performance, observability
202
+ - **DevOps:** CI/CD, deployment, monitoring, infrastructure, secrets management
203
+ - **Fullstack / General:** balanced coverage across all sections
204
+
205
+ Present the complete guide for review.
206
+
207
+ **ASK:** "Here is the generated onboarding guide ({N} sections, ~{M} lines). Review before I write:
208
+
209
+ {section titles with one-line summaries}
210
+
211
+ Options:
212
+ - **Confirm** to write the guide
213
+ - **Adjust** specific sections (tell me what to change)
214
+ - **Add** a section I missed
215
+ - **Remove** a section that's not relevant"
216
+
217
+ ---
218
+
219
+ ### Step 6: Write Output
220
+
221
+ After the guide is confirmed:
222
+
223
+ 1. **Markdown output** (default): Write the guide to `docs/onboarding/{role}-onboarding.md` (or `docs/onboarding/onboarding-guide.md` for general role). Create the `docs/onboarding/` directory if it does not exist.
224
+
225
+ 2. **Issue output** (`issue`): Create a GitHub issue via `issue_write` with:
226
+ - **Title:** `[Onboarding]: {Role} Developer Onboarding Guide`
227
+ - **Labels:** `type:docs`, `area:onboarding`
228
+ - **Body:** Full guide content
229
+
230
+ 3. **Notion output** (`notion`): Write the guide as Notion-compatible markdown to `docs/onboarding/{role}-onboarding.md` with Notion toggle and callout syntax.
231
+
232
+ 4. Present a summary of outputs:
233
+
234
+ ```
235
+ Output:
236
+ Guide: {path or issue number}
237
+ Sections: {N} sections
238
+ Role: {role}
239
+ Experience: {level}
240
+ Focus areas: {areas}
241
+ Gaps flagged: {N} documentation gaps discovered
242
+ ```
243
+
244
+ 5. If documentation gaps were discovered during analysis, present them as recommendations:
245
+
246
+ ```
247
+ Recommended Follow-ups:
248
+ - [ ] Create CONTRIBUTING.md (not found)
249
+ - [ ] Add .env.example (environment setup undocumented)
250
+ - [ ] Document deploy process (currently tribal knowledge only)
251
+ - [ ] Run hatch3r-codebase-map for detailed architecture documentation
252
+ - [ ] Run hatch3r-project-spec for full project specification
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Error Handling
258
+
259
+ - **Sub-agent failure:** Retry the failed sub-agent once. If it fails again, generate the affected guide sections from available context (README, package manifest, directory structure) and note reduced accuracy. ASK the user how to proceed.
260
+ - **No README or setup docs:** Generate setup instructions from package manifest scripts and dependency analysis. Flag prominently in the guide that setup instructions are inferred, not documented, and may be incomplete. Recommend creating a README as a follow-up.
261
+ - **Multiple languages/frameworks:** Generate setup sections for each language/framework detected. Organize by language with shared prerequisites listed first. Note which parts of the codebase use which stack.
262
+ - **Missing credentials or access documentation:** Never invent or guess credentials. Include placeholder sections marked `[ACTION REQUIRED]` with instructions on who to contact for access. Flag each missing credential in the Recommended Follow-ups.
263
+ - **File write failure:** Report the error and provide the full guide content so the user can create the file manually.
264
+ - **Missing project context:** If no shared board context or `.agents/hatch.json` exists, proceed without board context — this command does not require board configuration.
265
+ - **Empty or minimal codebase:** If the project has fewer than 10 source files, generate a condensed guide without the architecture and tribal knowledge sections. Note that the guide will be more useful after the project matures.
266
+ - **Conflicting documentation:** If README instructions conflict with actual project structure or scripts, flag both versions in the guide and note the discrepancy for the developer to verify.
267
+
268
+ ## Guardrails
269
+
270
+ - **Never skip ASK checkpoints.** Every step with an ASK must pause for user confirmation.
271
+ - **Never write files without user review and confirmation.** All generated content is presented first.
272
+ - **Never include secrets, credentials, API keys, or tokens in the guide.** Use `[ACTION REQUIRED: obtain from {source}]` placeholders instead. If `.env.example` exists, reference it — do not copy actual `.env` values.
273
+ - **Always delegate research to the hatch3r-researcher agent protocol.** Researcher sub-agents handle codebase exploration and the tooling hierarchy internally.
274
+ - **Adapt depth to the developer's experience level.** Do not over-explain fundamentals for senior developers or assume knowledge for junior developers. Use the depth adjustments table in Step 5.
275
+ - **Flag missing documentation that should exist.** If standard project files (README, CONTRIBUTING, .env.example, CI config) are missing, note them in the Recommended Follow-ups.
276
+ - **All 3 researchers must complete before proceeding to Step 4.** Do not generate the guide from partial research.
277
+ - **Respect the project's tooling hierarchy** for knowledge augmentation: project docs first, then codebase exploration, then Context7 MCP, then web research.
278
+ - **Do not invent team norms.** If the user skipped team context questions in Step 1b, omit those sections rather than fabricating information about team processes.
279
+ - **Keep the guide actionable.** Every section should help the developer do something — run a command, find a file, follow a process. Avoid generic advice that could apply to any project.
280
+ - **Use exact commands and file paths.** Setup instructions must use the actual package manager, actual script names, and actual directory paths from the project. Never use generic placeholders when specific values are available from the codebase.
281
+
282
+ ---
283
+
284
+ ## Output Template
285
+
286
+ ### Onboarding Guide Structure
287
+
288
+ ```markdown
289
+ # {Project Name} — Developer Onboarding Guide
290
+
291
+ > **Role:** {role} | **Level:** {experience} | **Focus:** {areas}
292
+ > **Generated:** {date}
293
+
294
+ ## 1. Project Overview
295
+ {What the project does, who uses it, tech stack table (Layer | Technology | Version)}
296
+
297
+ ## 2. Development Setup
298
+ - Prerequisites checklist (runtime, package manager, tools — with versions and install methods)
299
+ - First-time setup (exact clone, install, env config, build, verification commands)
300
+ - Environment variables table (Variable | Purpose | Where to Get)
301
+ - Common setup issues table (Issue | Resolution)
302
+
303
+ ## 3. Architecture Overview
304
+ - Annotated directory map (tree with purpose of each top-level dir)
305
+ - Data flow (how a typical request flows from entry point to response)
306
+ - Key abstractions table (Abstraction | Location | Purpose)
307
+
308
+ ## 4. Coding Conventions
309
+ - Style & naming rules, file organization patterns
310
+ - Code review checklist
311
+
312
+ ## 5. Git & PR Workflow
313
+ - Branch naming pattern with examples
314
+ - Commit message format with examples
315
+ - PR process steps (creation → review → merge — including CI requirements)
316
+
317
+ ## 6. Testing
318
+ - Test types & commands table (Type | Command | Location)
319
+ - How to write tests (conventions, fixtures, mocking, coverage expectations)
320
+
321
+ ## 7. Key Workflows
322
+ - Feature development (idea → merged PR)
323
+ - Bug fix (diagnose → fix → verify)
324
+ - Deployment (who, when, how, verification)
325
+
326
+ ## 8. Tribal Knowledge
327
+ - Gotchas, common mistakes, non-obvious patterns table (Topic | What to Know)
328
+
329
+ ## 9. Quick Reference
330
+ - Essential commands table (Action | Command)
331
+ - Key file locations table (What | Where)
332
+ - Contacts & resources table (Need Help With | Who / Where)
333
+
334
+ *Generated by hatch3r-onboard. Review and update as the project evolves.*
335
+ ```
336
+
337
+ ---
52
338
 
53
339
  ## Related
54
340
 
55
- - **Agent:** `hatch3r-docs-writer` — for maintaining documentation
56
- - **Skill:** `hatch3r-feature` — standard feature development workflow
341
+ - **Agent:** `hatch3r-researcher` — performs parallel codebase analysis
342
+ - **Agent:** `hatch3r-docs-writer` — generates the guide document
343
+ - **Command:** `hatch3r-codebase-map` — deeper architecture documentation
344
+ - **Command:** `hatch3r-project-spec` — full project specification
345
+ - **Skill:** `hatch3r-feature` — standard feature development workflow (referenced in guide)
@@ -2,11 +2,20 @@
2
2
  id: hatch3r-project-spec
3
3
  type: command
4
4
  description: Generate complete business and technical project documentation (specs, ADRs, todo.md) from a project vision using parallel researcher sub-agents with dual business/technical scoping.
5
+ tags: [planning, greenfield]
5
6
  ---
6
7
  # Project Spec — Greenfield Project Specification from Vision to Docs
7
8
 
8
9
  Take a project idea or vision and produce complete project documentation across **two dimensions**: business strategy and technical architecture. Spawns parallel researcher sub-agents (stack, features, architecture, pitfalls, UX, business model & market, production & scale) to analyze the vision from every angle before generating artifacts. Outputs business specs to `docs/specs/business/` (business model, competitive analysis, GTM strategy, production blueprint), technical specs to `docs/specs/technical/` (glossary, overview, per-module specs), ADRs to `docs/adr/`, and a `todo.md` ready for `hatch3r-board-fill`. Optionally generates a root-level `AGENTS.md` as the project's "README for agents." AI proposes all outputs; user confirms before any files are written.
9
10
 
11
+ ## Agent Pipeline
12
+
13
+ | Stage | Agent(s) | Parallel | Required |
14
+ |-------|----------|----------|----------|
15
+ | 1. Research | `hatch3r-researcher` (6 parallel: stack, features, architecture, pitfalls, UX, business model) | Yes | Yes |
16
+ | 2. Document Generation | `hatch3r-docs-writer` (parallel: business spec, technical spec, ADRs) | Yes | Yes |
17
+ | 3. AGENTS.md | `hatch3r-docs-writer` (AGENTS.md generation/rework) | No | Yes |
18
+
10
19
  ---
11
20
 
12
21
  ## Shared Context
@@ -996,7 +1005,24 @@ Confirm, or tell me what to adjust."
996
1005
 
997
1006
  ### Step 7: Write All Files
998
1007
 
999
- After all content is confirmed:
1008
+ Spawn parallel `hatch3r-docs-writer` sub-agents via the Task tool (`subagent_type: "generalPurpose"`) to generate and write the documentation. Each docs-writer receives the confirmed researcher outputs from Steps 3-6 and is responsible for one document category. All docs-writers run in parallel and follow the `hatch3r-docs-writer` agent protocol.
1009
+
1010
+ | Docs-Writer | Responsibility | Input |
1011
+ |-------------|---------------|-------|
1012
+ | Business Spec Writer | `docs/specs/business/` (glossary, overview, domain specs, competitive analysis, GTM strategy, production blueprint) | Sub-Agent 6 (Business Model & Market) and Sub-Agent 7 (Production & Scale) outputs, business context from Step 1 |
1013
+ | Technical Spec Writer | `docs/specs/technical/` (glossary, overview, module specs) | Sub-Agent 1 (Stack), Sub-Agent 2 (Feature), Sub-Agent 3 (Architecture) outputs |
1014
+ | ADR Writer | `docs/adr/` (all architectural decision records) | Architecture decisions from Step 5, business-driven decisions from Sub-Agent 6 |
1015
+
1016
+ Each docs-writer prompt must include:
1017
+ - The full confirmed researcher output relevant to its document category
1018
+ - The confirmed project vision, company stage, and business context from Step 1
1019
+ - The directory structure and file naming conventions below
1020
+ - Instruction to follow the `hatch3r-docs-writer` agent protocol
1021
+ - Instruction to create directories as needed before writing files
1022
+
1023
+ After all docs-writers complete, the orchestrator handles the remaining files (todo.md, .hatch3r-session.json) and presents the summary.
1024
+
1025
+ The docs-writers follow this file structure:
1000
1026
 
1001
1027
  1. Create `docs/specs/technical/` directory and write all technical spec files:
1002
1028
  - `docs/specs/technical/00_glossary.md`
@@ -1054,13 +1080,27 @@ Files Created:
1054
1080
 
1055
1081
  ---
1056
1082
 
1057
- ### Step 8: AGENTS.md Generation
1083
+ ### Step 8 AGENTS.md (Mandatory)
1058
1084
 
1059
- **ASK:** "Generate or update the root-level `AGENTS.md` with a project summary derived from the specs just created? This file serves as the 'README for agents' — consumed by OpenCode, Windsurf, and other AI coding tools so they understand your project's business context, architecture, and conventions from the first interaction.
1085
+ This step is MANDATORY, not optional.
1060
1086
 
1061
- (a) Yes generate it, (b) No — skip, (c) Let me review the content first."
1087
+ **If `AGENTS.md` exists at project root:**
1062
1088
 
1063
- If yes or review-first: generate `AGENTS.md` at the project root containing:
1089
+ **ASK:** "Your existing AGENTS.md may be outdated after generating new documentation. Would you like to rework it based on the new specs?"
1090
+
1091
+ - If **yes**: spawn a `hatch3r-docs-writer` sub-agent via the Task tool (`subagent_type: "generalPurpose"`) to regenerate AGENTS.md incorporating the newly generated specs, architecture overview, module map, and conventions. The docs-writer follows the `hatch3r-docs-writer` agent protocol.
1092
+ - If **no**: keep existing AGENTS.md unchanged. Log that the user declined the update.
1093
+
1094
+ **If no `AGENTS.md` exists:**
1095
+
1096
+ Generate AGENTS.md — there is no opt-out. Spawn a `hatch3r-docs-writer` sub-agent via the Task tool (`subagent_type: "generalPurpose"`) to create AGENTS.md following the `hatch3r-docs-writer` agent protocol. The docs-writer receives the confirmed researcher outputs and generates AGENTS.md with:
1097
+ - Project purpose and business context
1098
+ - Tech stack and architecture overview
1099
+ - Module map with responsibilities
1100
+ - Development conventions and patterns
1101
+ - Key specs and ADR references
1102
+
1103
+ The generated `AGENTS.md` should follow this structure:
1064
1104
 
1065
1105
  ```markdown
1066
1106
  # {Project Name} — Agent Instructions
@@ -1110,10 +1150,6 @@ If yes or review-first: generate `AGENTS.md` at the project root containing:
1110
1150
  - Architecture decisions: `docs/adr/`
1111
1151
  ```
1112
1152
 
1113
- If the user chose "review first," present the content and **ASK** for confirmation before writing.
1114
-
1115
- If `AGENTS.md` already exists, **ASK** before overwriting: "Root `AGENTS.md` already exists. (a) Replace entirely, (b) Append hatch3r section, (c) Skip."
1116
-
1117
1153
  ---
1118
1154
 
1119
1155
  ### Step 9: Cross-Command Handoff
@@ -1131,7 +1167,7 @@ Which would you like to run next? (or none)"
1131
1167
  - **Sub-agent failure:** Retry the failed sub-agent once. If it fails again, present partial results from the remaining sub-agents and ask the user how to proceed (continue without that researcher's input / provide the missing information manually / abort).
1132
1168
  - **Conflicting researcher outputs:** Present both options side by side with trade-offs. Ask the user to decide. Do not silently pick one.
1133
1169
  - **File write failure:** Report the error and provide the full file content so the user can create the file manually.
1134
- - **Missing project context:** If no `hatch3r-board-shared` or `/.agents/hatch.json` exists, proceed without board context — this command does not require board configuration.
1170
+ - **Missing project context:** If no `hatch3r-board-shared` or `.agents/hatch.json` exists, proceed without board context — this command does not require board configuration.
1135
1171
  - **Business context gaps:** If the user cannot answer business discovery questions, proceed with "TBD" markers and flag these as open items in the business specs.
1136
1172
  - **Stage assessment unclear:** Default to "early-revenue" if the user is unsure. This provides balanced analysis depth without over- or under-engineering recommendations.
1137
1173
  - **Competitor research gaps:** If web search returns insufficient data for a competitor, note it as "limited public information" and present what was found.