5-phase-workflow 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 (33) hide show
  1. package/README.md +332 -0
  2. package/bin/install.js +408 -0
  3. package/docs/workflow-guide.md +1024 -0
  4. package/package.json +34 -0
  5. package/src/agents/integration-agent.md +219 -0
  6. package/src/agents/review-processor.md +160 -0
  7. package/src/agents/step-executor.md +108 -0
  8. package/src/agents/step-fixer.md +132 -0
  9. package/src/agents/step-verifier.md +125 -0
  10. package/src/agents/verification-agent.md +411 -0
  11. package/src/commands/5/configure.md +309 -0
  12. package/src/commands/5/discuss-feature.md +393 -0
  13. package/src/commands/5/implement-feature.md +502 -0
  14. package/src/commands/5/plan-feature.md +285 -0
  15. package/src/commands/5/plan-implementation.md +376 -0
  16. package/src/commands/5/quick-implement.md +263 -0
  17. package/src/commands/5/review-code.md +583 -0
  18. package/src/commands/5/verify-implementation.md +277 -0
  19. package/src/hooks/statusline.js +53 -0
  20. package/src/settings.json +6 -0
  21. package/src/skills/build-project/SKILL.md +277 -0
  22. package/src/skills/configure-project/SKILL.md +355 -0
  23. package/src/skills/generate-readme/EXAMPLES.md +168 -0
  24. package/src/skills/generate-readme/SKILL.md +123 -0
  25. package/src/skills/generate-readme/TEMPLATE.md +141 -0
  26. package/src/skills/run-tests/SKILL.md +365 -0
  27. package/src/templates/ARCHITECTURE.md +64 -0
  28. package/src/templates/CONCERNS.md +75 -0
  29. package/src/templates/CONVENTIONS.md +75 -0
  30. package/src/templates/INTEGRATIONS.md +65 -0
  31. package/src/templates/STACK.md +60 -0
  32. package/src/templates/STRUCTURE.md +60 -0
  33. package/src/templates/TESTING.md +107 -0
@@ -0,0 +1,355 @@
1
+ ---
2
+ name: configure-project
3
+ description: Creates project configuration files, analyzes codebase for CLAUDE.md, and generates project-specific skills. Used during /5:implement-feature CONFIGURE.
4
+ allowed-tools: Read, Write, Bash, Glob, Grep
5
+ model: sonnet
6
+ context: fork
7
+ user-invocable: false
8
+ ---
9
+
10
+ # Configure Project Skill
11
+
12
+ ## Overview
13
+
14
+ This skill does the heavy lifting during Phase 3 (implement-feature) for the CONFIGURE feature. It is called by step-executor to create the actual configuration files.
15
+
16
+ It handles three distinct tasks, invoked with different parameters per component:
17
+
18
+ - **A. Write config.json** - Creates the project configuration file
19
+ - **B. Analyze Codebase and Create/Update CLAUDE.md** - Maps codebase and documents conventions
20
+ - **C. Generate Project-Specific Skills** - Creates SKILL.md files for common project patterns
21
+
22
+ ---
23
+
24
+ ## A. Write config.json
25
+
26
+ **Receives:** project type, ticket config, branch config, build/test commands, tool availability
27
+
28
+ **Creates:** `.claude/.5/config.json`
29
+
30
+ **Schema (no `steps` array):**
31
+
32
+ ```json
33
+ {
34
+ "projectType": "{type}",
35
+ "ticket": {
36
+ "pattern": "{regex-pattern-or-null}",
37
+ "extractFromBranch": true
38
+ },
39
+ "branch": {
40
+ "convention": "{convention}"
41
+ },
42
+ "build": {
43
+ "command": "{build-command}",
44
+ "testCommand": "{test-command}",
45
+ "timeout": {
46
+ "compile": 120000,
47
+ "test": 300000
48
+ }
49
+ },
50
+ "tools": {
51
+ "coderabbit": {
52
+ "available": false,
53
+ "authenticated": false
54
+ },
55
+ "ide": {
56
+ "available": false,
57
+ "type": null
58
+ }
59
+ },
60
+ "reviewTool": "coderabbit" or "none"
61
+ }
62
+ ```
63
+
64
+ **Process:**
65
+ 1. Read all values from the feature spec (`.5/CONFIGURE/feature.md`)
66
+ 2. Ensure `.claude/.5/` directory exists (create with `mkdir -p` if needed)
67
+ 3. Write `config.json` with pretty-printed JSON
68
+ 4. Read back to verify correctness
69
+
70
+ ---
71
+
72
+ ## B. Analyze Codebase and Create/Update CLAUDE.md
73
+
74
+ **Process:**
75
+
76
+ ### B1. Unified Codebase Analysis
77
+
78
+ Perform comprehensive analysis once to gather data for ALL templates:
79
+
80
+ **Structure Analysis** (for STRUCTURE.md):
81
+ - Use Glob to map directory tree: `**/*` (with depth limits to avoid overwhelming results)
82
+ - Identify source directories (`src/`, `lib/`, `app/`, etc.)
83
+ - Identify test directories and their organization
84
+ - Identify configuration directories
85
+ - Determine file naming conventions (camelCase, kebab-case, PascalCase)
86
+ - Locate key files (entry points, configurations)
87
+
88
+ **Stack Analysis** (for STACK.md):
89
+ - Read package manifests: `package.json`, `Cargo.toml`, `go.mod`, `pom.xml`, `requirements.txt`, `Gemfile`
90
+ - Extract: language, version, runtime, package manager
91
+ - Identify frameworks in dependencies (React, Express, Django, Rails, etc.)
92
+ - List critical dependencies and their versions
93
+ - Find config files: `tsconfig.json`, `.eslintrc`, etc.
94
+
95
+ **Architecture Analysis** (for ARCHITECTURE.md):
96
+ - Identify architectural pattern (MVC, layered, modular, microservices) from directory structure
97
+ - Map layers by directory structure (controllers/, services/, models/, routes/, etc.)
98
+ - Trace data flow patterns (read 2-3 example files from different layers)
99
+ - Identify key abstractions (interfaces, base classes, common patterns)
100
+ - Find entry points (`index.ts`, `main.go`, `app.py`, `server.js`)
101
+ - Analyze error handling strategy (try/catch, Result types, middleware, error boundaries)
102
+
103
+ **Conventions Analysis** (for CONVENTIONS.md):
104
+ - Sample 5-10 files from main source directory
105
+ - Extract naming patterns: files, functions, variables, types/classes
106
+ - Find formatters/linters: `.prettierrc`, `.eslintrc`, `black.toml`, `.rubocop.yml`
107
+ - Identify import organization patterns (order, grouping, aliases)
108
+ - Determine logging approach (console, winston, log4j, etc.)
109
+ - Check comment/documentation patterns (JSDoc, Javadoc, etc.)
110
+
111
+ **Testing Analysis** (for TESTING.md):
112
+ - Find test files: `**/*.test.{ts,js}`, `**/*.spec.{ts,js}`, `**/*_test.go`, `test_*.py`, `*_spec.rb`
113
+ - Read test config: `jest.config.js`, `vitest.config.ts`, `pytest.ini`, `spec/spec_helper.rb`
114
+ - Determine test organization (co-located vs separate `test/` or `spec/`)
115
+ - Extract test naming patterns
116
+ - Identify mocking framework (jest.mock, sinon, pytest-mock, etc.)
117
+ - Find fixture/factory patterns
118
+ - Extract test run commands from package.json, Makefile, or similar
119
+
120
+ **Integration Analysis** (for INTEGRATIONS.md):
121
+ - Scan dependencies for SDK packages (axios, @aws-sdk, stripe, @google-cloud, etc.)
122
+ - Identify database clients/ORMs (prisma, mongoose, sqlalchemy, activerecord, etc.)
123
+ - Find auth providers (passport, next-auth, devise, etc.)
124
+ - Detect monitoring/logging services (datadog, sentry, newrelic)
125
+ - Read CI/CD config: `.github/workflows/`, `.gitlab-ci.yml`, `.circleci/config.yml`
126
+ - Grep for environment variables: `process.env`, `os.getenv`, `ENV[`, etc.
127
+
128
+ **Concerns Analysis** (for CONCERNS.md):
129
+ - Grep for TODO/FIXME/HACK/XXX/DEPRECATED comments across all code
130
+ - Check for common security issues (SQL injection patterns, XSS vulnerabilities)
131
+ - Identify deprecated dependencies (check for warnings in package manifests)
132
+ - Look for complex code sections (deeply nested conditionals, long functions)
133
+
134
+ ### B2. Fill Templates
135
+
136
+ For each template in `src/templates/`:
137
+
138
+ 1. Read template content with Read tool
139
+ 2. Replace placeholders with analyzed data:
140
+ - Date placeholders: `{YYYY-MM-DD}`, `{date}` → current date (format: YYYY-MM-DD)
141
+ - Template-specific placeholders → actual project data from B1 analysis
142
+ 3. Handle missing data gracefully: mark sections as "Not detected" or "None found" rather than omitting
143
+
144
+ **Placeholder mapping examples**:
145
+
146
+ ARCHITECTURE.md:
147
+ - `{Pattern name}` → "Layered Architecture" or "MVC" or "Modular Monolith"
148
+ - `{Layer Name}` → "Controllers", "Services", "Repositories"
149
+ - `{path}` → "src/controllers/", "src/services/"
150
+
151
+ STACK.md:
152
+ - `{Language} {Version}` → "TypeScript 5.3.3", "Python 3.11"
153
+ - `{Framework} {Version}` → "Express 4.18.2", "Django 4.2"
154
+ - `{Package} {Version}` → "axios 1.6.0"
155
+
156
+ CONVENTIONS.md:
157
+ - `{Pattern observed}` → "PascalCase for classes, camelCase for functions"
158
+ - `{Tool used}` → "Prettier with 2-space indent"
159
+
160
+ TESTING.md:
161
+ - `{Framework} {Version}` → "Jest 29.5.0"
162
+ - `{command}` → "npm test", "pytest"
163
+
164
+ INTEGRATIONS.md:
165
+ - `{Service}` → "PostgreSQL", "Stripe API"
166
+ - `{package}` → "@stripe/stripe-js"
167
+
168
+ CONCERNS.md:
169
+ - `{file paths}` → Actual file paths from grep results
170
+
171
+ ### B3. Write Documentation Files
172
+
173
+ Write filled templates to `.5/` folder:
174
+
175
+ 1. Ensure `.5/` directory exists: `mkdir -p .5`
176
+ 2. Write each filled template:
177
+ - `.5/ARCHITECTURE.md`
178
+ - `.5/STACK.md`
179
+ - `.5/STRUCTURE.md`
180
+ - `.5/CONVENTIONS.md`
181
+ - `.5/TESTING.md`
182
+ - `.5/INTEGRATIONS.md`
183
+ - `.5/CONCERNS.md`
184
+
185
+ ### B4. Create Master CLAUDE.md
186
+
187
+ Generate CLAUDE.md as a navigation hub:
188
+
189
+ ```markdown
190
+ # {Project Name}
191
+
192
+ > Generated: {YYYY-MM-DD}
193
+ > Documentation is organized into focused files for better maintainability
194
+
195
+ ## Quick Reference
196
+
197
+ - [Technology Stack](./.5/STACK.md) - Languages, frameworks, dependencies
198
+ - [Codebase Structure](./.5/STRUCTURE.md) - Directory layout and organization
199
+ - [Architecture](./.5/ARCHITECTURE.md) - Patterns, layers, and data flow
200
+ - [Coding Conventions](./.5/CONVENTIONS.md) - Naming, style, and patterns
201
+ - [Testing Patterns](./.5/TESTING.md) - Test framework and patterns
202
+ - [External Integrations](./.5/INTEGRATIONS.md) - APIs, databases, services
203
+ - [Codebase Concerns](./.5/CONCERNS.md) - Tech debt, bugs, and risks
204
+
205
+ ## Project Overview
206
+
207
+ {1-2 paragraph summary from README or package.json description}
208
+
209
+ ## Build & Run Commands
210
+
211
+ - Build: `{build-command}`
212
+ - Test: `{test-command}`
213
+ - {Other detected scripts}
214
+
215
+ ## Coding Guidelines
216
+
217
+ When working with this codebase, follow these principles:
218
+
219
+ 1. Types should be clear and types should be available when possible
220
+ 2. Use doc (jsdoc, javadoc, pydoc, etc) concisely. No doc is better than meaningless doc
221
+ 3. Keep files short and structured
222
+ 4. Extract methods, classes
223
+ 5. Respect SRP and DRY
224
+ 6. Make code maintainable and modular
225
+
226
+ ## Getting Started
227
+
228
+ **For new developers:**
229
+ 1. Review [Stack](./.5/STACK.md) for technology overview
230
+ 2. Read [Structure](./.5/STRUCTURE.md) to understand organization
231
+ 3. Study [Conventions](./.5/CONVENTIONS.md) for coding standards
232
+ 4. Check [Architecture](./.5/ARCHITECTURE.md) for design patterns
233
+
234
+ **For specific tasks:**
235
+ - Adding features → See [Architecture](./.5/ARCHITECTURE.md)
236
+ - Writing tests → See [Testing](./.5/TESTING.md)
237
+ - Integration work → See [Integrations](./.5/INTEGRATIONS.md)
238
+ - Reviewing concerns → See [Concerns](./.5/CONCERNS.md)
239
+ ```
240
+
241
+ ### B5. Preserve Existing Content
242
+
243
+ If CLAUDE.md already exists:
244
+ - Read current content
245
+ - Identify user-written custom sections (not matching template structure)
246
+ - Preserve under "Custom Documentation" section in new CLAUDE.md
247
+ - Ensure 6 mandatory coding guidelines are retained
248
+
249
+ ---
250
+
251
+ ## C. Generate Project-Specific Skills
252
+
253
+ **Creates:** SKILL.md files in `.claude/skills/{name}/SKILL.md`
254
+
255
+ Each skill follows the standard frontmatter pattern and contains instructions derived from analyzing the actual project structure (reads existing files to derive patterns/templates).
256
+
257
+ ### Skill Detection by Project Type
258
+
259
+ | Project Type | Skills |
260
+ |---|---|
261
+ | Next.js | create-page, create-api-route, create-component |
262
+ | NestJS | create-module, create-service, create-controller |
263
+ | Express | create-route, create-middleware, create-service |
264
+ | React | create-component, create-hook, create-context |
265
+ | Django | create-model, create-view, create-serializer |
266
+ | Flask | create-blueprint, create-model |
267
+ | Java (Gradle/Maven) | create-entity, create-service, create-controller, create-repository |
268
+ | Rust | create-module |
269
+ | Go | create-handler, create-service |
270
+ | Rails | create-model, create-controller |
271
+ | Generic | create-module |
272
+
273
+ ### Skill Generation Process
274
+
275
+ For each skill to generate:
276
+ 1. Identify existing examples of that pattern in the codebase (e.g., find existing components for `create-component`)
277
+ 2. Read 1-2 examples to extract the project's conventions and structure
278
+ 3. Create a SKILL.md that instructs the agent to follow those conventions
279
+ 4. Each generated SKILL.md should include:
280
+ - Standard frontmatter (name, description, allowed-tools, model: sonnet, context: fork, user-invocable: false)
281
+ - What the skill creates
282
+ - File naming and location conventions (derived from existing code)
283
+ - Template/pattern to follow (derived from existing code)
284
+ - Checklist of what to include
285
+
286
+ ### Example Generated Skill
287
+
288
+ ```yaml
289
+ ---
290
+ name: create-component
291
+ description: Creates a React component following project conventions.
292
+ allowed-tools: Read, Write, Glob, Grep
293
+ model: sonnet
294
+ context: fork
295
+ user-invocable: false
296
+ ---
297
+ ```
298
+
299
+ ```markdown
300
+ # Create Component
301
+
302
+ ## What This Skill Creates
303
+ A React component following this project's conventions.
304
+
305
+ ## Conventions (from project analysis)
306
+ - Location: `src/components/{ComponentName}/`
307
+ - Files: `index.tsx`, `{ComponentName}.tsx`, `{ComponentName}.test.tsx`
308
+ - Style: CSS Modules at `{ComponentName}.module.css`
309
+ - Exports: Named export from component file, re-exported from index
310
+
311
+ ## Template
312
+ {Derived from existing components in the project}
313
+
314
+ ## Checklist
315
+ - [ ] Component file created
316
+ - [ ] Props interface defined
317
+ - [ ] Test file created
318
+ - [ ] Index file with re-export
319
+ - [ ] Follows naming conventions
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Output Contract
325
+
326
+ Returns structured results for each component:
327
+
328
+ ```
329
+ Component A (config.json): SUCCESS - Created .claude/.5/config.json
330
+ Component B (Documentation): SUCCESS - Created 7 documentation files + index
331
+ - .5/ARCHITECTURE.md (Pattern: Layered, 4 layers identified)
332
+ - .5/STACK.md (TypeScript + Express, 23 dependencies)
333
+ - .5/STRUCTURE.md (8 top-level directories mapped)
334
+ - .5/CONVENTIONS.md (PascalCase/camelCase, Prettier formatting)
335
+ - .5/TESTING.md (Jest framework, 45 test files)
336
+ - .5/INTEGRATIONS.md (PostgreSQL, 2 APIs, GitHub Actions)
337
+ - .5/CONCERNS.md (3 TODO items, 1 deprecated dependency)
338
+ - CLAUDE.md (index with references)
339
+ Component C (Skills): SUCCESS - Generated 3 skills (create-component, create-hook, create-context)
340
+ ```
341
+
342
+ Or on failure:
343
+
344
+ ```
345
+ Component A (config.json): FAILED - Permission denied writing to .claude/.5/
346
+ Component B (Documentation): FAILED - Unable to read template files
347
+ ```
348
+
349
+ ## DO NOT
350
+
351
+ - DO NOT overwrite existing user-written CLAUDE.md sections
352
+ - DO NOT generate skills for patterns that don't exist in the project
353
+ - DO NOT include `steps` in config.json
354
+ - DO NOT hardcode conventions - always derive from actual project analysis
355
+ - DO NOT generate empty or placeholder skill files
@@ -0,0 +1,168 @@
1
+ # README Examples
2
+
3
+ This file contains approved examples of concise READMEs for different module types.
4
+
5
+ ---
6
+
7
+ ## Example 1: Model Module (user-model)
8
+
9
+ **Module Type:** Model layer
10
+ **Characteristics:** Domain entities, factory, CQRS requests, validators
11
+ **Length:** 54 lines
12
+
13
+ ```markdown
14
+ # user-model
15
+
16
+ ## Purpose
17
+
18
+ This module contains the core Mission domain model, including the Mission aggregate root, Order, UnitOrder, and related
19
+ entities. It provides the MissionFactory for creating and modifying missions according to business rules, along with
20
+ validators, queries, and CQRS request objects for mission operations.
21
+
22
+ ## Key Components
23
+
24
+ - `Mission` - Root aggregate containing orders, mission units, and mission unit groups
25
+ - `MissionFactory` - Factory for all mission operations (create, addOrder, addUnitOrders, updateQuoteTerms)
26
+ - CQRS requests in `request/` package for commands and queries
27
+ - Validators in `validation/` package
28
+ - Predicates in `model/*/Is*Predicate.ts` for business rules
29
+
30
+ ## Testing
31
+
32
+ Test fixtures available in `src/testFixtures/`:
33
+
34
+ \`\`\`java
35
+ // Simple
36
+ var mission = this.missionTestFixture.create();
37
+
38
+ // Customized
39
+ var mission = this.missionTestFixture.createBuilder()
40
+ .withOrderTemplateType(OrderTemplateType.DOOR_DOOR)
41
+ .withNumberOfUnitOrders(3)
42
+ .build();
43
+
44
+ // Customization of sub objects
45
+ var mission = this.missionTestFixture.create(
46
+ CreateMissionTestParameters.builderWithOrder(
47
+ CreateOrderTestParameters.builderWithUnitOrders(
48
+ CreateUnitOrderTestParameters.builder()
49
+ .collectionHandoverGroup(collectionHandoverGroup)
50
+ .deliveryHandoverGroup(deliveryHandoverGroup)
51
+ .build())
52
+ .id(orderId)
53
+ .orderTemplateType(orderTemplateType)
54
+ .build())
55
+ .build());
56
+
57
+ // Add order
58
+ var result = missionTestFixture.addOrder(this.mission, addOrderParameters);
59
+ \`\`\`
60
+
61
+ ## Critical Patterns
62
+
63
+ 1. **Always use MissionFactory** - Never manually create Mission/Order/UnitOrder connections
64
+ 2. **Factory manages state** - Offsets, aliases, and IDs are calculated automatically
65
+ 3. **Result objects** - Factory operations return result objects with both created entity and updated aggregate
66
+ 4. **Handovers regenerated** - Template type changes recreate entire handover structure
67
+ ```
68
+
69
+ **Key observations:**
70
+
71
+ - Purpose is 3 sentences, clear and specific
72
+ - Only 5 key components listed (not exhaustive)
73
+ - Uses package references ("Validators in `validation/` package")
74
+ - Testing section shows fixture usage with real examples
75
+ - Critical Patterns focus on what will break if not followed
76
+ - No Dependencies, Local Development, or Related Documentation sections (not needed)
77
+ - Total: 54 lines
78
+
79
+ ---
80
+
81
+ ## Example 2: Handler Module (user-handler)
82
+
83
+ **Module Type:** Handler layer
84
+ **Characteristics:** Handlers, validators, repository, storage models
85
+ **Length:** ~60-70 lines
86
+
87
+ ```markdown
88
+ # user-handler
89
+
90
+ ## Purpose
91
+
92
+ This module contains the Mission domain handlers, validators, and repository implementations. It provides the business
93
+ logic layer for mission operations, including CQRS command/query handlers, comprehensive validation, and both InMemory
94
+ and MongoDB repository implementations for persistence.
95
+
96
+ ## Key Components
97
+
98
+ - `MissionHandlerActive` - Handles write operations (insert, update, upsert, delete)
99
+ - `MissionHandlerPassive` - Handles read operations (query, read by ID, read by alias)
100
+ - `MissionRepository` - Repository interface with InMemory and MongoDB implementations
101
+ - `MissionValidator` - Composite validator with 30+ business rules
102
+ - Storage models in `storage/v1/model/` for persistence layer
103
+
104
+ ## Testing
105
+
106
+ Test fixtures are primarily in `user-model` module's testFixtures.
107
+
108
+ For repository testing:
109
+
110
+ - Use `InMemoryMissionRepository` for unit tests
111
+ - Use `MongoMissionRepository` with test container for integration tests
112
+
113
+ ## Critical Patterns
114
+
115
+ 1. **Use validator factories** - Don't instantiate validators directly, use `MissionValidatorFactory`
116
+ 2. **Repository creation** - Use static factory methods: `inMemory()`, `mongo(config)`, `create(config)`
117
+ 3. **Storage model versioning** - V1 models for backward compatibility, create V2 for breaking changes
118
+ 4. **Query conversion** - Use `MissionQueryConverter` to convert domain queries to storage queries
119
+ 5. **Validation is comprehensive** - Mission validation runs 30+ validators, can be slow for complex missions
120
+ ```
121
+
122
+ **Key observations:**
123
+
124
+ - Purpose clearly describes the handler layer responsibilities
125
+ - Only 5 key components listed (handlers, repository, validator, storage models)
126
+ - Uses package reference for storage models ("Storage models in `storage/v1/model/`")
127
+ - Testing section mentions where fixtures are located and testing approach
128
+ - Critical Patterns focus on how to use the module correctly
129
+ - No exhaustive list of validators (just mentions "30+ business rules")
130
+ - Concise and focused
131
+
132
+ ---
133
+
134
+ ## Example 3: ID Module Pattern
135
+
136
+ **Module Type:** ID layer
137
+ **Characteristics:** Only ID types, no dependencies
138
+ **Length:** ~20-30 lines
139
+
140
+ ```markdown
141
+ # user-id
142
+
143
+ ## Purpose
144
+
145
+ This module contains ID types for the Mission domain, including MissionId, OrderId, UnitOrderId, MissionUnitId, and
146
+ MissionUnitGroupId.
147
+
148
+ ## Key Components
149
+
150
+ - `MissionId` - Mission aggregate identifier
151
+ - `OrderId` - Order entity identifier
152
+ - `UnitOrderId` - Unit order entity identifier
153
+ - `MissionUnitId` - Mission unit identifier
154
+ - `MissionUnitGroupId` - Mission unit group identifier
155
+
156
+ ## Critical Patterns
157
+
158
+ 1. **Use factory methods** - Always use `OrderId.of(value)`, never construct directly
159
+ 2. **Immutable** - All ID types are immutable value objects
160
+ ```
161
+
162
+ **Key observations:**
163
+
164
+ - Very simple, minimal structure
165
+ - Lists the ID types (these are the key components)
166
+ - Only 2 critical patterns (factory methods, immutability)
167
+ - No Testing section (ID modules rarely have fixtures)
168
+ - Total: ~25 lines
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: generate-readme
3
+ description: Generates concise README.md files for monorepo modules by analyzing module structure, dependencies, key components, and testing patterns. Use when creating module documentation, documenting architecture, updating READMEs, or when user asks to generate/create README for a module.
4
+ allowed-tools: Read, Glob, Grep, Write
5
+ ---
6
+
7
+ # Generate Module README
8
+
9
+ ## Overview
10
+
11
+ Analyzes a module's structure, dependencies, build configuration, and code patterns to generate concise, focused
12
+ README.md files following the standardized template.
13
+
14
+ READMEs should be **top-level overviews only** - not exhaustive documentation. Focus on:
15
+
16
+ - Module purpose (1-3 sentences)
17
+ - 3-5 key components only
18
+ - Critical patterns that developers must know
19
+ - Testing approach
20
+
21
+ ## Instructions
22
+
23
+ When generating a README, follow these steps:
24
+
25
+ ### 1. Identify Module Information
26
+
27
+ - **Module path**: Determine the full path to the module
28
+ - **Module name**: Extract from path (e.g., `user-service`, `auth-middleware`)
29
+ - **Module type**: Determine layer/purpose (models, services, controllers, routes, middleware, utils, etc.)
30
+ - **Domain**: Extract domain/feature name (e.g., `user` from `user-service`)
31
+
32
+ ### 2. Analyze Module Structure
33
+
34
+ Use `Glob` or `Read` to understand:
35
+
36
+ - Key source files (detect from project structure: `src/`, `lib/`, `app/`, etc.)
37
+ - Test files (`.test.ts`, `.spec.ts`, `_test.go`, `test_*.py`, etc.)
38
+ - Build/config files (`package.json`, `Cargo.toml`, `go.mod`, `setup.py`, etc.)
39
+
40
+ ### 3. Identify Key Components (3-5 only)
41
+
42
+ **DO NOT list every file.** Only identify the most important components:
43
+
44
+ For **model/entity** modules:
45
+
46
+ - Main data models or entities
47
+ - Schema definitions
48
+ - Validation logic
49
+
50
+ For **service/business logic** modules:
51
+
52
+ - Core service classes or functions
53
+ - Repository/data access interfaces
54
+ - Key business logic components
55
+
56
+ For **API/route** modules:
57
+
58
+ - Main route handlers or controllers
59
+ - Request/response types
60
+ - Middleware components
61
+
62
+ For **utility** modules:
63
+
64
+ - Main utility functions or helpers
65
+ - Configuration handlers
66
+
67
+ ### 4. Document Testing Approach
68
+
69
+ Check for:
70
+
71
+ - Test files colocated with source or in separate test directory
72
+ - Test fixtures or factories
73
+ - Key test patterns (unit tests, integration tests)
74
+
75
+ ### 5. Identify Critical Patterns
76
+
77
+ Look for patterns in project documentation:
78
+
79
+ - Check `.5/ARCHITECTURE.md` for architectural patterns (MVC, Clean Architecture, etc.)
80
+ - Check `.5/CONVENTIONS.md` for coding conventions and design patterns
81
+ - Check `.5/TESTING.md` for test patterns and conventions
82
+ - Fall back to CLAUDE.md if `.5/` documentation not present
83
+ - Check module-specific documentation
84
+
85
+ Use these patterns to identify what's critical for the module README.
86
+
87
+ ### 6. Generate README
88
+
89
+ Use the template from `TEMPLATE.md` to generate the README.
90
+
91
+ **Critical guidelines:**
92
+
93
+ - Keep Purpose to 1-3 sentences
94
+ - List only 3-5 Key Components (never exhaustive lists)
95
+ - Use package references instead of listing many files (e.g., "Validators in `validation/` package")
96
+ - Focus Critical Patterns on what developers must know to avoid breaking things
97
+ - Omit sections if not relevant (e.g., no Testing section if module has no fixtures)
98
+
99
+ ### 7. Write README
100
+
101
+ Use the `Write` tool to create `README.md` in the module's root directory.
102
+
103
+ ## What to Provide
104
+
105
+ When a user asks to generate a README, they should provide:
106
+
107
+ - The module name or path (e.g., "user-service" or "/path/to/services/user-service")
108
+
109
+ If not provided, ask for clarification.
110
+
111
+ ## Examples
112
+
113
+ See [EXAMPLES.md](EXAMPLES.md) for complete examples of generated READMEs for different module types.
114
+
115
+ ## Template Structure
116
+
117
+ See [TEMPLATE.md](TEMPLATE.md) for the standard README template structure.
118
+
119
+ ## Important Notes
120
+
121
+ 1. **Conciseness is key**: READMEs should be under 100 lines for most modules
122
+ 2. **Top-level overview only**: Don't document every class or method
123
+ 3. **Focus on "must know"**: What will break if developer doesn't know it?