5-phase-workflow 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -101
- package/bin/install.js +168 -176
- package/bin/sync-agents.js +59 -54
- package/docs/workflow-guide.md +35 -79
- package/package.json +2 -2
- package/src/agents/step-executor-agent.md +5 -4
- package/src/agents/step-orchestrator-agent.md +12 -12
- package/src/agents/verification-agent.md +7 -8
- package/src/codex-commands/plan.md +65 -0
- package/src/commands/5/address-review-findings.md +43 -52
- package/src/commands/5/analyze-feature.md +1 -1
- package/src/commands/5/configure.md +75 -179
- package/src/commands/5/eject.md +0 -1
- package/src/commands/5/implement.md +78 -68
- package/src/commands/5/lean-check.md +75 -0
- package/src/commands/5/reconfigure.md +48 -129
- package/src/commands/5/review.md +42 -14
- package/src/commands/5/synchronize-agents.md +1 -1
- package/src/commands/5/update.md +2 -2
- package/src/hooks/dependency-guard.js +150 -0
- package/src/hooks/statusline.js +5 -3
- package/src/references/configure-tables.md +0 -33
- package/src/settings.json +3 -4
- package/src/skills/baseline-conventions/SKILL.md +37 -0
- package/src/skills/cognitive-load/SKILL.md +52 -0
- package/src/skills/configure-agents-md/SKILL.md +72 -0
- package/src/skills/configure-rules/SKILL.md +146 -0
- package/src/skills/documentation-style/SKILL.md +32 -0
- package/src/skills/fowler-code-smells/SKILL.md +25 -0
- package/src/skills/review-style/SKILL.md +142 -0
- package/src/templates/AGENTS.md +31 -31
- package/src/templates/workflow/REVIEW-FINDINGS.md +2 -9
- package/src/workflows/5-implement.js +67 -92
- package/docs/findings.md +0 -361
- package/docs/progress.md +0 -102
- package/src/commands/5/apply-review-findings.md +0 -66
- package/src/commands/5/commit.md +0 -43
- package/src/commands/5/plan.md +0 -189
- package/src/commands/5/reply-pr-comments.md +0 -48
- package/src/commands/5/split.md +0 -86
- package/src/commands/5/triage-pr-comments.md +0 -70
- package/src/hooks/config-guard.js +0 -30
- package/src/skills/configure-docs-index/SKILL.md +0 -243
- package/src/skills/configure-skills/SKILL.md +0 -311
- package/src/skills/generate-readme/EXAMPLES.md +0 -168
- package/src/skills/generate-readme/SKILL.md +0 -122
- package/src/skills/generate-readme/TEMPLATE.md +0 -141
- package/src/skills/use-index/SKILL.md +0 -49
- package/src/templates/ARCHITECTURE.md +0 -33
- package/src/templates/CONCERNS.md +0 -33
- package/src/templates/CONVENTIONS.md +0 -74
- package/src/templates/TESTING.md +0 -24
- package/src/templates/workflow/FIX-PLAN.md +0 -55
- package/src/templates/workflow/PLAN-COMPACT.md +0 -42
- package/src/templates/workflow/PLAN.md +0 -76
- package/src/templates/workflow/REVIEW-SUMMARY.md +0 -53
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configure-skills
|
|
3
|
-
description: Generates project-specific create-*/run-* skills and scoped rules from the current codebase. Used during /5:implement CONFIGURE.
|
|
4
|
-
allowed-tools: Read, Write, Bash, Glob, Grep, create-skill, scaffold-skill
|
|
5
|
-
model: sonnet
|
|
6
|
-
user-invocable: false
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Configure Skills Skill
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
This skill handles skill and rule generation during implementation for the CONFIGURE feature. It is called by step-executor to create project-specific skills and scoped rules.
|
|
14
|
-
|
|
15
|
-
It handles two tasks:
|
|
16
|
-
|
|
17
|
-
- **Generate Project-Specific Skills** - Creates SKILL.md files for common project patterns
|
|
18
|
-
- **Generate Scoped Rules** - Creates `.claude/rules/*.md` files with file-type-specific directives
|
|
19
|
-
|
|
20
|
-
Note: config.json is written directly by `/5:configure` during the Q&A phase.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Modes
|
|
25
|
-
|
|
26
|
-
This skill supports two modes. The skill generation and rule generation logic is the same in both modes — only the **input source** changes.
|
|
27
|
-
|
|
28
|
-
### Full Mode (default)
|
|
29
|
-
|
|
30
|
-
Used by `/5:configure` → `/5:implement CONFIGURE` flow.
|
|
31
|
-
|
|
32
|
-
- **Input:** Pattern/command selections from unified plan (`.5/features/CONFIGURE/plan.md`)
|
|
33
|
-
- **Behavior:** Creates all selected skills and rules from scratch based on unified plan requirements
|
|
34
|
-
|
|
35
|
-
### Refresh Mode
|
|
36
|
-
|
|
37
|
-
Used by `/5:reconfigure` for lightweight refresh.
|
|
38
|
-
|
|
39
|
-
- **Input:** The Task prompt lists which skills to refresh, create, and remove, and which rules to refresh or remove
|
|
40
|
-
- **Behavior:** Re-analyzes codebase, refreshes/creates/removes skills as specified, and refreshes workflow-generated rules
|
|
41
|
-
- **Trigger:** Task prompt includes "REFRESH MODE"
|
|
42
|
-
|
|
43
|
-
In both modes, the generation logic is identical — only where the requested skill/rule list comes from differs.
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## A. Generate Project-Specific Skills
|
|
48
|
-
|
|
49
|
-
### Using skill-creator plugin
|
|
50
|
-
|
|
51
|
-
If `tools.skillCreator.available` is `true` in `.5/config.json`, use the skill-creator plugin's tools (e.g., `create-skill`, `scaffold-skill`) to generate each SKILL.md instead of the template-based approach below. Pass the extracted patterns, conventions, and example file paths as context to the skill-creator tool so it can produce structured, high-quality skill files.
|
|
52
|
-
|
|
53
|
-
If skill-creator is not available, use the existing template-based generation below — no degradation in workflow behavior.
|
|
54
|
-
|
|
55
|
-
**Reads:** Pattern selections from unified plan (`.5/features/CONFIGURE/plan.md`)
|
|
56
|
-
|
|
57
|
-
**Creates:** SKILL.md files in `.claude/skills/{name}/SKILL.md`
|
|
58
|
-
|
|
59
|
-
### A1. Pattern-Based Skill Generation
|
|
60
|
-
|
|
61
|
-
Skills are determined by what patterns exist in the codebase (detected during `/5:configure`) and what the user selected — not by project type.
|
|
62
|
-
|
|
63
|
-
For EACH pattern selected by the user in the unified plan:
|
|
64
|
-
|
|
65
|
-
1. **Find examples** - Read 2-3 files from the pattern's location
|
|
66
|
-
2. **Extract conventions:**
|
|
67
|
-
- File naming (PascalCase, kebab-case, suffix patterns)
|
|
68
|
-
- Directory structure (flat, nested, co-located tests)
|
|
69
|
-
- Import patterns (absolute, relative, aliases)
|
|
70
|
-
- Export patterns (default, named, barrel files)
|
|
71
|
-
- Common boilerplate (decorators, annotations, base classes)
|
|
72
|
-
3. **Generate SKILL.md** with:
|
|
73
|
-
- Detected conventions as instructions
|
|
74
|
-
- Template derived from actual code
|
|
75
|
-
- Checklist based on common elements found
|
|
76
|
-
|
|
77
|
-
### A2. Skill Template Structure
|
|
78
|
-
|
|
79
|
-
For each skill, create `.claude/skills/{pattern}/SKILL.md`:
|
|
80
|
-
|
|
81
|
-
```yaml
|
|
82
|
-
---
|
|
83
|
-
name: {pattern}
|
|
84
|
-
description: Creates or updates a {Pattern} following project conventions at {location}.
|
|
85
|
-
allowed-tools: Read, Write, Glob, Grep
|
|
86
|
-
model: haiku
|
|
87
|
-
user-invocable: true
|
|
88
|
-
---
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
```markdown
|
|
92
|
-
# {Pattern}
|
|
93
|
-
|
|
94
|
-
## What This Skill Does
|
|
95
|
-
Creates or updates a {pattern} following this project's conventions.
|
|
96
|
-
|
|
97
|
-
## Detected Conventions
|
|
98
|
-
- **Location:** {detected-location}
|
|
99
|
-
- **Naming:** {detected-naming-pattern}
|
|
100
|
-
- **Structure:** {detected-structure}
|
|
101
|
-
- **Imports:** {detected-import-pattern}
|
|
102
|
-
|
|
103
|
-
## Template
|
|
104
|
-
Based on {example-file}, {patterns} should follow:
|
|
105
|
-
|
|
106
|
-
\`\`\`{language}
|
|
107
|
-
{template-derived-from-analysis}
|
|
108
|
-
\`\`\`
|
|
109
|
-
|
|
110
|
-
## Checklist
|
|
111
|
-
- [ ] File at correct location
|
|
112
|
-
- [ ] Naming convention followed
|
|
113
|
-
- [ ] Required imports added
|
|
114
|
-
- [ ] {pattern-specific-items}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### A3. Pattern to Skill Name Mapping
|
|
118
|
-
|
|
119
|
-
**Rule:** Skill name is `{pattern}` (e.g., `controller` → `controller`, `component` → `component`, `dto` → `dto`). For compound patterns, use the short form: `model/entity` → `model`, `api-route` → `api-route`.
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## B. Generate Command Skills (run-*)
|
|
124
|
-
|
|
125
|
-
**Reads:** Command selections from unified plan (`.5/features/CONFIGURE/plan.md`)
|
|
126
|
-
|
|
127
|
-
**Creates:** SKILL.md files in `.claude/skills/run-{command}/SKILL.md`
|
|
128
|
-
|
|
129
|
-
### B1. Command-Based Skill Generation
|
|
130
|
-
|
|
131
|
-
For EACH command selected by the user in the unified plan:
|
|
132
|
-
|
|
133
|
-
1. **Read the source** - Check package.json scripts, Makefile, etc.
|
|
134
|
-
2. **Document the command:**
|
|
135
|
-
- Exact command syntax
|
|
136
|
-
- Available variants (e.g., test:unit, test:e2e)
|
|
137
|
-
- Common flags and options
|
|
138
|
-
- Expected output format
|
|
139
|
-
3. **Generate SKILL.md** with:
|
|
140
|
-
- Command execution instructions
|
|
141
|
-
- Output parsing guidance
|
|
142
|
-
- Error handling patterns
|
|
143
|
-
|
|
144
|
-
### B2. Command Skill Template Structure
|
|
145
|
-
|
|
146
|
-
For each skill, create `.claude/skills/run-{command}/SKILL.md`:
|
|
147
|
-
|
|
148
|
-
```yaml
|
|
149
|
-
---
|
|
150
|
-
name: run-{command}
|
|
151
|
-
description: Runs {command} for this project using {source}.
|
|
152
|
-
allowed-tools: Bash
|
|
153
|
-
model: haiku
|
|
154
|
-
user-invocable: true
|
|
155
|
-
---
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
```markdown
|
|
159
|
-
# Run {Command}
|
|
160
|
-
|
|
161
|
-
## What This Skill Does
|
|
162
|
-
Executes the project's {command} command.
|
|
163
|
-
|
|
164
|
-
## Command
|
|
165
|
-
\`\`\`bash
|
|
166
|
-
{exact-command}
|
|
167
|
-
\`\`\`
|
|
168
|
-
|
|
169
|
-
## Variants
|
|
170
|
-
{if variants exist}
|
|
171
|
-
- `{variant1}` - {description}
|
|
172
|
-
- `{variant2}` - {description}
|
|
173
|
-
|
|
174
|
-
## Common Options
|
|
175
|
-
- `--watch` - Run in watch mode (if available)
|
|
176
|
-
- `--coverage` - Generate coverage report (for tests)
|
|
177
|
-
- `--fix` - Auto-fix issues (for lint/format)
|
|
178
|
-
|
|
179
|
-
## Expected Output
|
|
180
|
-
{describe what success/failure looks like}
|
|
181
|
-
|
|
182
|
-
## Error Handling
|
|
183
|
-
- If command fails, report the error output
|
|
184
|
-
- Common issues: {list common problems and solutions}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### B3. Command to Skill Name Mapping
|
|
188
|
-
|
|
189
|
-
**Rule:** Skill name is `run-{category}` (e.g., `build` → `run-build`, `test`/`spec` → `run-tests`, `lint` → `run-lint`). Group variants under the primary category name.
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## C. Generate Scoped Rules
|
|
194
|
-
|
|
195
|
-
If `rules.generate` is `true` in `.5/config.json`, generate `.claude/rules/` files with project-specific conventions scoped to relevant file types.
|
|
196
|
-
|
|
197
|
-
Rules are **concise directives** (15-40 lines each), not documentation. Documentation lives in `.5/*.md` files. Rules tell Claude what to do when working with specific file types.
|
|
198
|
-
|
|
199
|
-
### C1. Determine Which Rules to Generate
|
|
200
|
-
|
|
201
|
-
Based on the codebase analysis results, determine which rules apply:
|
|
202
|
-
|
|
203
|
-
| Rule File | Generate When | Source Analysis |
|
|
204
|
-
|-----------|---------------|-----------------|
|
|
205
|
-
| `code-style.md` | Always (if source files exist) | Conventions Analysis |
|
|
206
|
-
| `testing.md` | Test files detected | Testing Analysis |
|
|
207
|
-
| `api-patterns.md` | Controller/route/handler patterns detected | Architecture Analysis |
|
|
208
|
-
| `dependencies.md` | External integrations detected | Integration Analysis |
|
|
209
|
-
|
|
210
|
-
**Skip** any rule whose prerequisite patterns were not detected. Do not generate empty or placeholder rule files.
|
|
211
|
-
|
|
212
|
-
### C2. Extract Directives and Write Rules
|
|
213
|
-
|
|
214
|
-
For each applicable rule:
|
|
215
|
-
|
|
216
|
-
1. **Derive `paths:` globs** from detected file locations (e.g., if tests are at `src/**/*.test.ts` and `tests/**/*.spec.ts`, use those patterns)
|
|
217
|
-
2. **Convert analysis observations into imperative directives** — "Use X", "Always Y", "Never Z"
|
|
218
|
-
3. **Keep each file 15-40 lines** — be concise and actionable
|
|
219
|
-
4. **Do not repeat** the general guidance sections from `AGENTS.md`
|
|
220
|
-
|
|
221
|
-
Write files to `.claude/rules/`:
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
mkdir -p .claude/rules
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### C3. Rule File Format
|
|
228
|
-
|
|
229
|
-
Each rule file uses YAML frontmatter with `paths:` for scoping. Rules without `paths:` load unconditionally.
|
|
230
|
-
|
|
231
|
-
**Example — `testing.md`:**
|
|
232
|
-
|
|
233
|
-
```markdown
|
|
234
|
-
---
|
|
235
|
-
paths:
|
|
236
|
-
- "**/*.test.ts"
|
|
237
|
-
- "**/*.spec.ts"
|
|
238
|
-
---
|
|
239
|
-
|
|
240
|
-
# Testing Conventions
|
|
241
|
-
|
|
242
|
-
- Use `describe`/`it` blocks with descriptive names
|
|
243
|
-
- Mock external dependencies with jest.mock, never mock internal modules
|
|
244
|
-
- Use factory functions from `tests/factories/` for test data
|
|
245
|
-
- Each test file mirrors its source file path: `src/foo/Bar.ts` → `src/foo/__tests__/Bar.test.ts`
|
|
246
|
-
- Assert one behavior per test
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
**Example — `code-style.md`:**
|
|
250
|
-
|
|
251
|
-
```markdown
|
|
252
|
-
---
|
|
253
|
-
paths:
|
|
254
|
-
- "src/**/*.{ts,tsx}"
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
# Code Style
|
|
258
|
-
|
|
259
|
-
- Use PascalCase for classes and types, camelCase for functions and variables
|
|
260
|
-
- Import order: external packages → internal modules → relative imports
|
|
261
|
-
- Use absolute imports with `@/` alias
|
|
262
|
-
- Prefer named exports over default exports
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**Example — `dependencies.md` (unconditional):**
|
|
266
|
-
|
|
267
|
-
```markdown
|
|
268
|
-
# Dependency Conventions
|
|
269
|
-
|
|
270
|
-
- Database access through Prisma client only, never raw SQL
|
|
271
|
-
- HTTP requests use axios instance from `src/lib/http.ts`
|
|
272
|
-
- Environment variables accessed via `src/config/env.ts`, never `process.env` directly
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### Refresh Mode Behavior for Rules
|
|
276
|
-
|
|
277
|
-
When running in REFRESH MODE:
|
|
278
|
-
- Re-analyze codebase and overwrite all existing workflow-generated rule files with updated directives
|
|
279
|
-
- Remove rule files for patterns no longer detected in the codebase when instructed by the refresh prompt
|
|
280
|
-
- Create new rule files if new patterns are detected and selected
|
|
281
|
-
- Never modify or remove user-created rules outside the workflow-generated set
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
## Output Contract
|
|
286
|
-
|
|
287
|
-
Returns structured results for each component:
|
|
288
|
-
|
|
289
|
-
```
|
|
290
|
-
Component B (Pattern Skills): SUCCESS - Generated 3 create-* skills (create-component, create-hook, create-context)
|
|
291
|
-
Component C (Command Skills): SUCCESS - Generated 2 run-* skills (run-tests, run-lint)
|
|
292
|
-
Component D (Rules): SUCCESS - Generated 3 rule files (code-style, testing, dependencies)
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
Or on failure:
|
|
296
|
-
|
|
297
|
-
```
|
|
298
|
-
Component B (Pattern Skills): FAILED - No patterns found in codebase
|
|
299
|
-
Component D (Rules): SKIPPED - rules.generate is false in config
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## DO NOT
|
|
303
|
-
|
|
304
|
-
- DO NOT generate skills for patterns that don't exist in the project unless the refresh/configure prompt explicitly told you to create them
|
|
305
|
-
- DO NOT generate command skills for commands that don't exist in the project
|
|
306
|
-
- DO NOT generate rules for patterns not detected in the codebase
|
|
307
|
-
- DO NOT include `steps` in config.json
|
|
308
|
-
- DO NOT hardcode conventions - always derive from actual project analysis
|
|
309
|
-
- DO NOT generate empty or placeholder skill or rule files
|
|
310
|
-
- DO NOT assume command syntax - always read from actual config files (package.json, Makefile, etc.)
|
|
311
|
-
- DO NOT repeat the general guidance sections from `AGENTS.md` in rule files
|
|
@@ -1,168 +0,0 @@
|
|
|
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
|
|
@@ -1,122 +0,0 @@
|
|
|
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 and non-obvious conventions
|
|
80
|
-
- Check `.5/TESTING.md` for test patterns and conventions
|
|
81
|
-
- Fall back to AGENTS.md if `.5/` documentation not present
|
|
82
|
-
- Check module-specific documentation
|
|
83
|
-
|
|
84
|
-
Use these patterns to identify what's critical for the module README.
|
|
85
|
-
|
|
86
|
-
### 6. Generate README
|
|
87
|
-
|
|
88
|
-
Use the template from `TEMPLATE.md` to generate the README.
|
|
89
|
-
|
|
90
|
-
**Critical guidelines:**
|
|
91
|
-
|
|
92
|
-
- Keep Purpose to 1-3 sentences
|
|
93
|
-
- List only 3-5 Key Components (never exhaustive lists)
|
|
94
|
-
- Use package references instead of listing many files (e.g., "Validators in `validation/` package")
|
|
95
|
-
- Focus Critical Patterns on what developers must know to avoid breaking things
|
|
96
|
-
- Omit sections if not relevant (e.g., no Testing section if module has no fixtures)
|
|
97
|
-
|
|
98
|
-
### 7. Write README
|
|
99
|
-
|
|
100
|
-
Use the `Write` tool to create `README.md` in the module's root directory.
|
|
101
|
-
|
|
102
|
-
## What to Provide
|
|
103
|
-
|
|
104
|
-
When a user asks to generate a README, they should provide:
|
|
105
|
-
|
|
106
|
-
- The module name or path (e.g., "user-service" or "/path/to/services/user-service")
|
|
107
|
-
|
|
108
|
-
If not provided, ask for clarification.
|
|
109
|
-
|
|
110
|
-
## Examples
|
|
111
|
-
|
|
112
|
-
See [EXAMPLES.md](EXAMPLES.md) for complete examples of generated READMEs for different module types.
|
|
113
|
-
|
|
114
|
-
## Template Structure
|
|
115
|
-
|
|
116
|
-
See [TEMPLATE.md](TEMPLATE.md) for the standard README template structure.
|
|
117
|
-
|
|
118
|
-
## Important Notes
|
|
119
|
-
|
|
120
|
-
1. **Conciseness is key**: READMEs should be under 100 lines for most modules
|
|
121
|
-
2. **Top-level overview only**: Don't document every class or method
|
|
122
|
-
3. **Focus on "must know"**: What will break if developer doesn't know it?
|