pmp-gywd 3.3.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/LICENSE +27 -0
- package/README.md +567 -0
- package/bin/install.js +348 -0
- package/commands/gywd/add-phase.md +207 -0
- package/commands/gywd/anticipate.md +271 -0
- package/commands/gywd/bootstrap.md +336 -0
- package/commands/gywd/challenge.md +344 -0
- package/commands/gywd/check-drift.md +144 -0
- package/commands/gywd/complete-milestone.md +106 -0
- package/commands/gywd/consider-issues.md +202 -0
- package/commands/gywd/context.md +93 -0
- package/commands/gywd/create-roadmap.md +115 -0
- package/commands/gywd/deps.md +169 -0
- package/commands/gywd/digest.md +138 -0
- package/commands/gywd/discuss-milestone.md +47 -0
- package/commands/gywd/discuss-phase.md +60 -0
- package/commands/gywd/execute-plan.md +161 -0
- package/commands/gywd/extract-decisions.md +325 -0
- package/commands/gywd/health.md +150 -0
- package/commands/gywd/help.md +556 -0
- package/commands/gywd/history.md +278 -0
- package/commands/gywd/impact.md +317 -0
- package/commands/gywd/init.md +95 -0
- package/commands/gywd/insert-phase.md +227 -0
- package/commands/gywd/list-phase-assumptions.md +50 -0
- package/commands/gywd/map-codebase.md +84 -0
- package/commands/gywd/memory.md +159 -0
- package/commands/gywd/new-milestone.md +59 -0
- package/commands/gywd/new-project.md +315 -0
- package/commands/gywd/pause-work.md +123 -0
- package/commands/gywd/plan-fix.md +205 -0
- package/commands/gywd/plan-phase.md +93 -0
- package/commands/gywd/preview-plan.md +139 -0
- package/commands/gywd/profile.md +363 -0
- package/commands/gywd/progress.md +317 -0
- package/commands/gywd/remove-phase.md +338 -0
- package/commands/gywd/research-phase.md +91 -0
- package/commands/gywd/resume-work.md +40 -0
- package/commands/gywd/rollback.md +179 -0
- package/commands/gywd/status.md +42 -0
- package/commands/gywd/sync-github.md +234 -0
- package/commands/gywd/verify-work.md +71 -0
- package/commands/gywd/why.md +251 -0
- package/docs/COMMANDS.md +722 -0
- package/docs/CONTRIBUTING.md +342 -0
- package/docs/EXAMPLES.md +535 -0
- package/docs/GETTING-STARTED.md +262 -0
- package/docs/README.md +55 -0
- package/docs/RELEASING.md +159 -0
- package/get-your-work-done/core/agent-patterns.md +331 -0
- package/get-your-work-done/core/architecture.md +334 -0
- package/get-your-work-done/core/context-model-schema.json +154 -0
- package/get-your-work-done/core/decisions-schema.json +193 -0
- package/get-your-work-done/core/learning-state-schema.json +133 -0
- package/get-your-work-done/core/profile-schema.json +257 -0
- package/get-your-work-done/references/adaptive-decomposition.md +175 -0
- package/get-your-work-done/references/checkpoints.md +287 -0
- package/get-your-work-done/references/confidence-scoring.md +169 -0
- package/get-your-work-done/references/continuation-format.md +255 -0
- package/get-your-work-done/references/git-integration.md +254 -0
- package/get-your-work-done/references/plan-format.md +428 -0
- package/get-your-work-done/references/principles.md +157 -0
- package/get-your-work-done/references/questioning.md +162 -0
- package/get-your-work-done/references/research-pitfalls.md +215 -0
- package/get-your-work-done/references/scope-estimation.md +172 -0
- package/get-your-work-done/references/tdd.md +263 -0
- package/get-your-work-done/templates/codebase/architecture.md +255 -0
- package/get-your-work-done/templates/codebase/concerns.md +310 -0
- package/get-your-work-done/templates/codebase/conventions.md +307 -0
- package/get-your-work-done/templates/codebase/integrations.md +280 -0
- package/get-your-work-done/templates/codebase/stack.md +186 -0
- package/get-your-work-done/templates/codebase/structure.md +285 -0
- package/get-your-work-done/templates/codebase/testing.md +480 -0
- package/get-your-work-done/templates/config.json +18 -0
- package/get-your-work-done/templates/context.md +161 -0
- package/get-your-work-done/templates/continue-here.md +78 -0
- package/get-your-work-done/templates/discovery.md +146 -0
- package/get-your-work-done/templates/issues.md +32 -0
- package/get-your-work-done/templates/milestone-archive.md +123 -0
- package/get-your-work-done/templates/milestone-context.md +93 -0
- package/get-your-work-done/templates/milestone.md +115 -0
- package/get-your-work-done/templates/phase-prompt.md +303 -0
- package/get-your-work-done/templates/project.md +184 -0
- package/get-your-work-done/templates/research.md +529 -0
- package/get-your-work-done/templates/roadmap.md +196 -0
- package/get-your-work-done/templates/state.md +210 -0
- package/get-your-work-done/templates/summary.md +273 -0
- package/get-your-work-done/templates/uat-issues.md +143 -0
- package/get-your-work-done/workflows/complete-milestone.md +643 -0
- package/get-your-work-done/workflows/create-milestone.md +416 -0
- package/get-your-work-done/workflows/create-roadmap.md +481 -0
- package/get-your-work-done/workflows/discovery-phase.md +293 -0
- package/get-your-work-done/workflows/discuss-milestone.md +236 -0
- package/get-your-work-done/workflows/discuss-phase.md +247 -0
- package/get-your-work-done/workflows/execute-phase.md +1625 -0
- package/get-your-work-done/workflows/list-phase-assumptions.md +178 -0
- package/get-your-work-done/workflows/map-codebase.md +434 -0
- package/get-your-work-done/workflows/plan-phase.md +488 -0
- package/get-your-work-done/workflows/research-phase.md +436 -0
- package/get-your-work-done/workflows/resume-project.md +287 -0
- package/get-your-work-done/workflows/transition.md +580 -0
- package/get-your-work-done/workflows/verify-work.md +202 -0
- package/lib/automation/dependency-analyzer.js +635 -0
- package/lib/automation/doc-generator.js +643 -0
- package/lib/automation/index.js +42 -0
- package/lib/automation/test-generator.js +628 -0
- package/lib/context/context-analyzer.js +554 -0
- package/lib/context/context-cache.js +426 -0
- package/lib/context/context-predictor.js +622 -0
- package/lib/context/index.js +44 -0
- package/lib/memory/confidence-calibrator.js +484 -0
- package/lib/memory/feedback-collector.js +551 -0
- package/lib/memory/global-memory.js +465 -0
- package/lib/memory/index.js +75 -0
- package/lib/memory/pattern-aggregator.js +487 -0
- package/lib/memory/team-sync.js +501 -0
- package/lib/profile/index.js +24 -0
- package/lib/profile/pattern-learner.js +303 -0
- package/lib/profile/profile-manager.js +445 -0
- package/lib/questioning/index.js +49 -0
- package/lib/questioning/question-engine.js +311 -0
- package/lib/questioning/question-templates.js +315 -0
- package/lib/validators/command-validator.js +188 -0
- package/lib/validators/index.js +29 -0
- package/lib/validators/schema-validator.js +183 -0
- package/package.json +61 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<scope_estimation>
|
|
2
|
+
Plans must maintain consistent quality from first task to last. This requires understanding quality degradation and splitting aggressively.
|
|
3
|
+
|
|
4
|
+
<quality_insight>
|
|
5
|
+
Claude degrades when it *perceives* context pressure and enters "completion mode."
|
|
6
|
+
|
|
7
|
+
| Context Usage | Quality | Claude's State |
|
|
8
|
+
|---------------|---------|----------------|
|
|
9
|
+
| 0-30% | PEAK | Thorough, comprehensive |
|
|
10
|
+
| 30-50% | GOOD | Confident, solid work |
|
|
11
|
+
| 50-70% | DEGRADING | Efficiency mode begins |
|
|
12
|
+
| 70%+ | POOR | Rushed, minimal |
|
|
13
|
+
|
|
14
|
+
**The 40-50% inflection point:** Claude sees context mounting and thinks "I'd better conserve now." Result: "I'll complete the remaining tasks more concisely" = quality crash.
|
|
15
|
+
|
|
16
|
+
**The rule:** Stop BEFORE quality degrades, not at context limit.
|
|
17
|
+
</quality_insight>
|
|
18
|
+
|
|
19
|
+
<context_target>
|
|
20
|
+
**Plans should complete within ~50% of context usage.**
|
|
21
|
+
|
|
22
|
+
Why 50% not 80%?
|
|
23
|
+
- No context anxiety possible
|
|
24
|
+
- Quality maintained start to finish
|
|
25
|
+
- Room for unexpected complexity
|
|
26
|
+
- If you target 80%, you've already spent 40% in degradation mode
|
|
27
|
+
</context_target>
|
|
28
|
+
|
|
29
|
+
<task_rule>
|
|
30
|
+
**Each plan: 2-3 tasks maximum. Stay under 50% context.**
|
|
31
|
+
|
|
32
|
+
| Task Complexity | Tasks/Plan | Context/Task | Total |
|
|
33
|
+
|-----------------|------------|--------------|-------|
|
|
34
|
+
| Simple (CRUD, config) | 3 | ~10-15% | ~30-45% |
|
|
35
|
+
| Complex (auth, payments) | 2 | ~20-30% | ~40-50% |
|
|
36
|
+
| Very complex (migrations, refactors) | 1-2 | ~30-40% | ~30-50% |
|
|
37
|
+
|
|
38
|
+
**When in doubt: Default to 2 tasks.** Better to have an extra plan than degraded quality.
|
|
39
|
+
</task_rule>
|
|
40
|
+
|
|
41
|
+
<tdd_plans>
|
|
42
|
+
**TDD features get their own plans. Target ~40% context.**
|
|
43
|
+
|
|
44
|
+
TDD requires 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. This is fundamentally heavier than linear task execution.
|
|
45
|
+
|
|
46
|
+
| TDD Feature Complexity | Context Usage |
|
|
47
|
+
|------------------------|---------------|
|
|
48
|
+
| Simple utility function | ~25-30% |
|
|
49
|
+
| Business logic with edge cases | ~35-40% |
|
|
50
|
+
| Complex algorithm | ~40-50% |
|
|
51
|
+
|
|
52
|
+
**One feature per TDD plan.** If features are trivial enough to batch, they're trivial enough to skip TDD.
|
|
53
|
+
|
|
54
|
+
**Why TDD plans are separate:**
|
|
55
|
+
- TDD consumes 40-50% context for a single feature
|
|
56
|
+
- Dedicated plans ensure full quality throughout RED-GREEN-REFACTOR
|
|
57
|
+
- Each TDD feature gets fresh context, peak quality
|
|
58
|
+
|
|
59
|
+
See `~/.claude/get-your-work-done/references/tdd.md` for TDD plan structure.
|
|
60
|
+
</tdd_plans>
|
|
61
|
+
|
|
62
|
+
<split_signals>
|
|
63
|
+
|
|
64
|
+
<always_split>
|
|
65
|
+
- **More than 3 tasks** - Even if tasks seem small
|
|
66
|
+
- **Multiple subsystems** - DB + API + UI = separate plans
|
|
67
|
+
- **Any task with >5 file modifications** - Split by file groups
|
|
68
|
+
- **Checkpoint + implementation work** - Checkpoints in one plan, implementation after in separate plan
|
|
69
|
+
- **Discovery + implementation** - DISCOVERY.md in one plan, implementation in another
|
|
70
|
+
</always_split>
|
|
71
|
+
|
|
72
|
+
<consider_splitting>
|
|
73
|
+
- Estimated >5 files modified total
|
|
74
|
+
- Complex domains (auth, payments, data modeling)
|
|
75
|
+
- Any uncertainty about approach
|
|
76
|
+
- Natural semantic boundaries (Setup -> Core -> Features)
|
|
77
|
+
</consider_splitting>
|
|
78
|
+
</split_signals>
|
|
79
|
+
|
|
80
|
+
<splitting_strategies>
|
|
81
|
+
**By subsystem:** Auth → 01: DB models, 02: API routes, 03: Protected routes, 04: UI components
|
|
82
|
+
|
|
83
|
+
**By dependency:** Payments → 01: Stripe setup, 02: Subscription logic, 03: Frontend integration
|
|
84
|
+
|
|
85
|
+
**By complexity:** Dashboard → 01: Layout shell, 02: Data fetching, 03: Visualization
|
|
86
|
+
|
|
87
|
+
**By verification:** Deploy → 01: Vercel setup (checkpoint), 02: Env config (auto), 03: CI/CD (checkpoint)
|
|
88
|
+
</splitting_strategies>
|
|
89
|
+
|
|
90
|
+
<anti_patterns>
|
|
91
|
+
**Bad - Comprehensive plan:**
|
|
92
|
+
```
|
|
93
|
+
Plan: "Complete Authentication System"
|
|
94
|
+
Tasks: 8 (models, migrations, API, JWT, middleware, hashing, login form, register form)
|
|
95
|
+
Result: Task 1-3 good, Task 4-5 degrading, Task 6-8 rushed
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Good - Atomic plans:**
|
|
99
|
+
```
|
|
100
|
+
Plan 1: "Auth Database Models" (2 tasks)
|
|
101
|
+
Plan 2: "Auth API Core" (3 tasks)
|
|
102
|
+
Plan 3: "Auth API Protection" (2 tasks)
|
|
103
|
+
Plan 4: "Auth UI Components" (2 tasks)
|
|
104
|
+
Each: 30-40% context, peak quality, atomic commits (2-3 task commits + 1 metadata commit)
|
|
105
|
+
```
|
|
106
|
+
</anti_patterns>
|
|
107
|
+
|
|
108
|
+
<estimating_context>
|
|
109
|
+
| Files Modified | Context Impact |
|
|
110
|
+
|----------------|----------------|
|
|
111
|
+
| 0-3 files | ~10-15% (small) |
|
|
112
|
+
| 4-6 files | ~20-30% (medium) |
|
|
113
|
+
| 7+ files | ~40%+ (large - split) |
|
|
114
|
+
|
|
115
|
+
| Complexity | Context/Task |
|
|
116
|
+
|------------|--------------|
|
|
117
|
+
| Simple CRUD | ~15% |
|
|
118
|
+
| Business logic | ~25% |
|
|
119
|
+
| Complex algorithms | ~40% |
|
|
120
|
+
| Domain modeling | ~35% |
|
|
121
|
+
|
|
122
|
+
**2 tasks:** Simple ~30%, Medium ~50%, Complex ~80% (split)
|
|
123
|
+
**3 tasks:** Simple ~45%, Medium ~75% (risky), Complex 120% (impossible)
|
|
124
|
+
</estimating_context>
|
|
125
|
+
|
|
126
|
+
<depth_calibration>
|
|
127
|
+
**Depth controls compression tolerance, not artificial inflation.**
|
|
128
|
+
|
|
129
|
+
| Depth | Typical Phases | Typical Plans/Phase | Tasks/Plan |
|
|
130
|
+
|-------|----------------|---------------------|------------|
|
|
131
|
+
| Quick | 3-5 | 1-3 | 2-3 |
|
|
132
|
+
| Standard | 5-8 | 3-5 | 2-3 |
|
|
133
|
+
| Comprehensive | 8-12 | 5-10 | 2-3 |
|
|
134
|
+
|
|
135
|
+
Tasks/plan is CONSTANT at 2-3. The 50% context rule applies universally.
|
|
136
|
+
|
|
137
|
+
**Key principle:** Derive from actual work. Depth determines how aggressively you combine things, not a target to hit.
|
|
138
|
+
|
|
139
|
+
- Comprehensive auth = 8 plans (because auth genuinely has 8 concerns)
|
|
140
|
+
- Comprehensive "add favicon" = 1 plan (because that's all it is)
|
|
141
|
+
|
|
142
|
+
Don't pad small work to hit a number. Don't compress complex work to look efficient.
|
|
143
|
+
|
|
144
|
+
**Comprehensive depth example:**
|
|
145
|
+
Auth system at comprehensive depth = 8 plans (not 3 big ones):
|
|
146
|
+
- 01: DB models (2 tasks)
|
|
147
|
+
- 02: Password hashing (2 tasks)
|
|
148
|
+
- 03: JWT generation (2 tasks)
|
|
149
|
+
- 04: JWT validation middleware (2 tasks)
|
|
150
|
+
- 05: Login endpoint (2 tasks)
|
|
151
|
+
- 06: Register endpoint (2 tasks)
|
|
152
|
+
- 07: Protected route patterns (2 tasks)
|
|
153
|
+
- 08: Auth UI components (3 tasks)
|
|
154
|
+
|
|
155
|
+
Each plan: fresh context, peak quality. More plans = more thoroughness, same quality per plan.
|
|
156
|
+
</depth_calibration>
|
|
157
|
+
|
|
158
|
+
<summary>
|
|
159
|
+
**2-3 tasks, 50% context target:**
|
|
160
|
+
- All tasks: Peak quality
|
|
161
|
+
- Git: Atomic per-task commits (each task = 1 commit, plan = 1 metadata commit)
|
|
162
|
+
- Autonomous plans: Subagent execution (fresh context)
|
|
163
|
+
|
|
164
|
+
**The principle:** Aggressive atomicity. More plans, smaller scope, consistent quality.
|
|
165
|
+
|
|
166
|
+
**The rule:** If in doubt, split. Quality over consolidation. Always.
|
|
167
|
+
|
|
168
|
+
**Depth rule:** Depth increases plan COUNT, never plan SIZE.
|
|
169
|
+
|
|
170
|
+
**Commit rule:** Each plan produces 3-4 commits total (2-3 task commits + 1 docs commit). More granular history = better observability for Claude.
|
|
171
|
+
</summary>
|
|
172
|
+
</scope_estimation>
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<overview>
|
|
2
|
+
TDD is about design quality, not coverage metrics. The red-green-refactor cycle forces you to think about behavior before implementation, producing cleaner interfaces and more testable code.
|
|
3
|
+
|
|
4
|
+
**Principle:** If you can describe the behavior as `expect(fn(input)).toBe(output)` before writing `fn`, TDD improves the result.
|
|
5
|
+
|
|
6
|
+
**Key insight:** TDD work is fundamentally heavier than standard tasks—it requires 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. TDD features get dedicated plans to ensure full context is available throughout the cycle.
|
|
7
|
+
</overview>
|
|
8
|
+
|
|
9
|
+
<when_to_use_tdd>
|
|
10
|
+
## When TDD Improves Quality
|
|
11
|
+
|
|
12
|
+
**TDD candidates (create a TDD plan):**
|
|
13
|
+
- Business logic with defined inputs/outputs
|
|
14
|
+
- API endpoints with request/response contracts
|
|
15
|
+
- Data transformations, parsing, formatting
|
|
16
|
+
- Validation rules and constraints
|
|
17
|
+
- Algorithms with testable behavior
|
|
18
|
+
- State machines and workflows
|
|
19
|
+
- Utility functions with clear specifications
|
|
20
|
+
|
|
21
|
+
**Skip TDD (use standard plan with `type="auto"` tasks):**
|
|
22
|
+
- UI layout, styling, visual components
|
|
23
|
+
- Configuration changes
|
|
24
|
+
- Glue code connecting existing components
|
|
25
|
+
- One-off scripts and migrations
|
|
26
|
+
- Simple CRUD with no business logic
|
|
27
|
+
- Exploratory prototyping
|
|
28
|
+
|
|
29
|
+
**Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
|
|
30
|
+
→ Yes: Create a TDD plan
|
|
31
|
+
→ No: Use standard plan, add tests after if needed
|
|
32
|
+
</when_to_use_tdd>
|
|
33
|
+
|
|
34
|
+
<tdd_plan_structure>
|
|
35
|
+
## TDD Plan Structure
|
|
36
|
+
|
|
37
|
+
Each TDD plan implements **one feature** through the full RED-GREEN-REFACTOR cycle.
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
---
|
|
41
|
+
phase: XX-name
|
|
42
|
+
plan: NN
|
|
43
|
+
type: tdd
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
<objective>
|
|
47
|
+
[What feature and why]
|
|
48
|
+
Purpose: [Design benefit of TDD for this feature]
|
|
49
|
+
Output: [Working, tested feature]
|
|
50
|
+
</objective>
|
|
51
|
+
|
|
52
|
+
<context>
|
|
53
|
+
@.planning/PROJECT.md
|
|
54
|
+
@.planning/ROADMAP.md
|
|
55
|
+
@relevant/source/files.ts
|
|
56
|
+
</context>
|
|
57
|
+
|
|
58
|
+
<feature>
|
|
59
|
+
<name>[Feature name]</name>
|
|
60
|
+
<files>[source file, test file]</files>
|
|
61
|
+
<behavior>
|
|
62
|
+
[Expected behavior in testable terms]
|
|
63
|
+
Cases: input → expected output
|
|
64
|
+
</behavior>
|
|
65
|
+
<implementation>[How to implement once tests pass]</implementation>
|
|
66
|
+
</feature>
|
|
67
|
+
|
|
68
|
+
<verification>
|
|
69
|
+
[Test command that proves feature works]
|
|
70
|
+
</verification>
|
|
71
|
+
|
|
72
|
+
<success_criteria>
|
|
73
|
+
- Failing test written and committed
|
|
74
|
+
- Implementation passes test
|
|
75
|
+
- Refactor complete (if needed)
|
|
76
|
+
- All 2-3 commits present
|
|
77
|
+
</success_criteria>
|
|
78
|
+
|
|
79
|
+
<output>
|
|
80
|
+
After completion, create SUMMARY.md with:
|
|
81
|
+
- RED: What test was written, why it failed
|
|
82
|
+
- GREEN: What implementation made it pass
|
|
83
|
+
- REFACTOR: What cleanup was done (if any)
|
|
84
|
+
- Commits: List of commits produced
|
|
85
|
+
</output>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**One feature per TDD plan.** If features are trivial enough to batch, they're trivial enough to skip TDD—use a standard plan and add tests after.
|
|
89
|
+
</tdd_plan_structure>
|
|
90
|
+
|
|
91
|
+
<execution_flow>
|
|
92
|
+
## Red-Green-Refactor Cycle
|
|
93
|
+
|
|
94
|
+
**RED - Write failing test:**
|
|
95
|
+
1. Create test file following project conventions
|
|
96
|
+
2. Write test describing expected behavior (from `<behavior>` element)
|
|
97
|
+
3. Run test - it MUST fail
|
|
98
|
+
4. If test passes: feature exists or test is wrong. Investigate.
|
|
99
|
+
5. Commit: `test({phase}-{plan}): add failing test for [feature]`
|
|
100
|
+
|
|
101
|
+
**GREEN - Implement to pass:**
|
|
102
|
+
1. Write minimal code to make test pass
|
|
103
|
+
2. No cleverness, no optimization - just make it work
|
|
104
|
+
3. Run test - it MUST pass
|
|
105
|
+
4. Commit: `feat({phase}-{plan}): implement [feature]`
|
|
106
|
+
|
|
107
|
+
**REFACTOR (if needed):**
|
|
108
|
+
1. Clean up implementation if obvious improvements exist
|
|
109
|
+
2. Run tests - MUST still pass
|
|
110
|
+
3. Only commit if changes made: `refactor({phase}-{plan}): clean up [feature]`
|
|
111
|
+
|
|
112
|
+
**Result:** Each TDD plan produces 2-3 atomic commits.
|
|
113
|
+
</execution_flow>
|
|
114
|
+
|
|
115
|
+
<test_quality>
|
|
116
|
+
## Good Tests vs Bad Tests
|
|
117
|
+
|
|
118
|
+
**Test behavior, not implementation:**
|
|
119
|
+
- Good: "returns formatted date string"
|
|
120
|
+
- Bad: "calls formatDate helper with correct params"
|
|
121
|
+
- Tests should survive refactors
|
|
122
|
+
|
|
123
|
+
**One concept per test:**
|
|
124
|
+
- Good: Separate tests for valid input, empty input, malformed input
|
|
125
|
+
- Bad: Single test checking all edge cases with multiple assertions
|
|
126
|
+
|
|
127
|
+
**Descriptive names:**
|
|
128
|
+
- Good: "should reject empty email", "returns null for invalid ID"
|
|
129
|
+
- Bad: "test1", "handles error", "works correctly"
|
|
130
|
+
|
|
131
|
+
**No implementation details:**
|
|
132
|
+
- Good: Test public API, observable behavior
|
|
133
|
+
- Bad: Mock internals, test private methods, assert on internal state
|
|
134
|
+
</test_quality>
|
|
135
|
+
|
|
136
|
+
<framework_setup>
|
|
137
|
+
## Test Framework Setup (If None Exists)
|
|
138
|
+
|
|
139
|
+
When executing a TDD plan but no test framework is configured, set it up as part of the RED phase:
|
|
140
|
+
|
|
141
|
+
**1. Detect project type:**
|
|
142
|
+
```bash
|
|
143
|
+
# JavaScript/TypeScript
|
|
144
|
+
if [ -f package.json ]; then echo "node"; fi
|
|
145
|
+
|
|
146
|
+
# Python
|
|
147
|
+
if [ -f requirements.txt ] || [ -f pyproject.toml ]; then echo "python"; fi
|
|
148
|
+
|
|
149
|
+
# Go
|
|
150
|
+
if [ -f go.mod ]; then echo "go"; fi
|
|
151
|
+
|
|
152
|
+
# Rust
|
|
153
|
+
if [ -f Cargo.toml ]; then echo "rust"; fi
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**2. Install minimal framework:**
|
|
157
|
+
| Project | Framework | Install |
|
|
158
|
+
|---------|-----------|---------|
|
|
159
|
+
| Node.js | Jest | `npm install -D jest @types/jest ts-jest` |
|
|
160
|
+
| Node.js (Vite) | Vitest | `npm install -D vitest` |
|
|
161
|
+
| Python | pytest | `pip install pytest` |
|
|
162
|
+
| Go | testing | Built-in |
|
|
163
|
+
| Rust | cargo test | Built-in |
|
|
164
|
+
|
|
165
|
+
**3. Create config if needed:**
|
|
166
|
+
- Jest: `jest.config.js` with ts-jest preset
|
|
167
|
+
- Vitest: `vitest.config.ts` with test globals
|
|
168
|
+
- pytest: `pytest.ini` or `pyproject.toml` section
|
|
169
|
+
|
|
170
|
+
**4. Verify setup:**
|
|
171
|
+
```bash
|
|
172
|
+
# Run empty test suite - should pass with 0 tests
|
|
173
|
+
npm test # Node
|
|
174
|
+
pytest # Python
|
|
175
|
+
go test ./... # Go
|
|
176
|
+
cargo test # Rust
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**5. Create first test file:**
|
|
180
|
+
Follow project conventions for test location:
|
|
181
|
+
- `*.test.ts` / `*.spec.ts` next to source
|
|
182
|
+
- `__tests__/` directory
|
|
183
|
+
- `tests/` directory at root
|
|
184
|
+
|
|
185
|
+
Framework setup is a one-time cost included in the first TDD plan's RED phase.
|
|
186
|
+
</framework_setup>
|
|
187
|
+
|
|
188
|
+
<error_handling>
|
|
189
|
+
## Error Handling
|
|
190
|
+
|
|
191
|
+
**Test doesn't fail in RED phase:**
|
|
192
|
+
- Feature may already exist - investigate
|
|
193
|
+
- Test may be wrong (not testing what you think)
|
|
194
|
+
- Fix before proceeding
|
|
195
|
+
|
|
196
|
+
**Test doesn't pass in GREEN phase:**
|
|
197
|
+
- Debug implementation
|
|
198
|
+
- Don't skip to refactor
|
|
199
|
+
- Keep iterating until green
|
|
200
|
+
|
|
201
|
+
**Tests fail in REFACTOR phase:**
|
|
202
|
+
- Undo refactor
|
|
203
|
+
- Commit was premature
|
|
204
|
+
- Refactor in smaller steps
|
|
205
|
+
|
|
206
|
+
**Unrelated tests break:**
|
|
207
|
+
- Stop and investigate
|
|
208
|
+
- May indicate coupling issue
|
|
209
|
+
- Fix before proceeding
|
|
210
|
+
</error_handling>
|
|
211
|
+
|
|
212
|
+
<commit_pattern>
|
|
213
|
+
## Commit Pattern for TDD Plans
|
|
214
|
+
|
|
215
|
+
TDD plans produce 2-3 atomic commits (one per phase):
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
test(08-02): add failing test for email validation
|
|
219
|
+
|
|
220
|
+
- Tests valid email formats accepted
|
|
221
|
+
- Tests invalid formats rejected
|
|
222
|
+
- Tests empty input handling
|
|
223
|
+
|
|
224
|
+
feat(08-02): implement email validation
|
|
225
|
+
|
|
226
|
+
- Regex pattern matches RFC 5322
|
|
227
|
+
- Returns boolean for validity
|
|
228
|
+
- Handles edge cases (empty, null)
|
|
229
|
+
|
|
230
|
+
refactor(08-02): extract regex to constant (optional)
|
|
231
|
+
|
|
232
|
+
- Moved pattern to EMAIL_REGEX constant
|
|
233
|
+
- No behavior changes
|
|
234
|
+
- Tests still pass
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Comparison with standard plans:**
|
|
238
|
+
- Standard plans: 1 commit per task, 2-4 commits per plan
|
|
239
|
+
- TDD plans: 2-3 commits for single feature
|
|
240
|
+
|
|
241
|
+
Both follow same format: `{type}({phase}-{plan}): {description}`
|
|
242
|
+
|
|
243
|
+
**Benefits:**
|
|
244
|
+
- Each commit independently revertable
|
|
245
|
+
- Git bisect works at commit level
|
|
246
|
+
- Clear history showing TDD discipline
|
|
247
|
+
- Consistent with overall commit strategy
|
|
248
|
+
</commit_pattern>
|
|
249
|
+
|
|
250
|
+
<context_budget>
|
|
251
|
+
## Context Budget
|
|
252
|
+
|
|
253
|
+
TDD plans target **~40% context usage** (lower than standard plans' ~50%).
|
|
254
|
+
|
|
255
|
+
Why lower:
|
|
256
|
+
- RED phase: write test, run test, potentially debug why it didn't fail
|
|
257
|
+
- GREEN phase: implement, run test, potentially iterate on failures
|
|
258
|
+
- REFACTOR phase: modify code, run tests, verify no regressions
|
|
259
|
+
|
|
260
|
+
Each phase involves reading files, running commands, analyzing output. The back-and-forth is inherently heavier than linear task execution.
|
|
261
|
+
|
|
262
|
+
Single feature focus ensures full quality throughout the cycle.
|
|
263
|
+
</context_budget>
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Architecture Template
|
|
2
|
+
|
|
3
|
+
Template for `.planning/codebase/ARCHITECTURE.md` - captures conceptual code organization.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Document how the code is organized at a conceptual level. Complements STRUCTURE.md (which shows physical file locations).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## File Template
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# Architecture
|
|
13
|
+
|
|
14
|
+
**Analysis Date:** [YYYY-MM-DD]
|
|
15
|
+
|
|
16
|
+
## Pattern Overview
|
|
17
|
+
|
|
18
|
+
**Overall:** [Pattern name: e.g., "Monolithic CLI", "Serverless API", "Full-stack MVC"]
|
|
19
|
+
|
|
20
|
+
**Key Characteristics:**
|
|
21
|
+
- [Characteristic 1: e.g., "Single executable"]
|
|
22
|
+
- [Characteristic 2: e.g., "Stateless request handling"]
|
|
23
|
+
- [Characteristic 3: e.g., "Event-driven"]
|
|
24
|
+
|
|
25
|
+
## Layers
|
|
26
|
+
|
|
27
|
+
[Describe the conceptual layers and their responsibilities]
|
|
28
|
+
|
|
29
|
+
**[Layer Name]:**
|
|
30
|
+
- Purpose: [What this layer does]
|
|
31
|
+
- Contains: [Types of code: e.g., "route handlers", "business logic"]
|
|
32
|
+
- Depends on: [What it uses: e.g., "data layer only"]
|
|
33
|
+
- Used by: [What uses it: e.g., "API routes"]
|
|
34
|
+
|
|
35
|
+
**[Layer Name]:**
|
|
36
|
+
- Purpose: [What this layer does]
|
|
37
|
+
- Contains: [Types of code]
|
|
38
|
+
- Depends on: [What it uses]
|
|
39
|
+
- Used by: [What uses it]
|
|
40
|
+
|
|
41
|
+
## Data Flow
|
|
42
|
+
|
|
43
|
+
[Describe the typical request/execution lifecycle]
|
|
44
|
+
|
|
45
|
+
**[Flow Name] (e.g., "HTTP Request", "CLI Command", "Event Processing"):**
|
|
46
|
+
|
|
47
|
+
1. [Entry point: e.g., "User runs command"]
|
|
48
|
+
2. [Processing step: e.g., "Router matches path"]
|
|
49
|
+
3. [Processing step: e.g., "Controller validates input"]
|
|
50
|
+
4. [Processing step: e.g., "Service executes logic"]
|
|
51
|
+
5. [Output: e.g., "Response returned"]
|
|
52
|
+
|
|
53
|
+
**State Management:**
|
|
54
|
+
- [How state is handled: e.g., "Stateless - no persistent state", "Database per request", "In-memory cache"]
|
|
55
|
+
|
|
56
|
+
## Key Abstractions
|
|
57
|
+
|
|
58
|
+
[Core concepts/patterns used throughout the codebase]
|
|
59
|
+
|
|
60
|
+
**[Abstraction Name]:**
|
|
61
|
+
- Purpose: [What it represents]
|
|
62
|
+
- Examples: [e.g., "UserService, ProjectService"]
|
|
63
|
+
- Pattern: [e.g., "Singleton", "Factory", "Repository"]
|
|
64
|
+
|
|
65
|
+
**[Abstraction Name]:**
|
|
66
|
+
- Purpose: [What it represents]
|
|
67
|
+
- Examples: [Concrete examples]
|
|
68
|
+
- Pattern: [Pattern used]
|
|
69
|
+
|
|
70
|
+
## Entry Points
|
|
71
|
+
|
|
72
|
+
[Where execution begins]
|
|
73
|
+
|
|
74
|
+
**[Entry Point]:**
|
|
75
|
+
- Location: [Brief: e.g., "src/index.ts", "API Gateway triggers"]
|
|
76
|
+
- Triggers: [What invokes it: e.g., "CLI invocation", "HTTP request"]
|
|
77
|
+
- Responsibilities: [What it does: e.g., "Parse args, route to command"]
|
|
78
|
+
|
|
79
|
+
## Error Handling
|
|
80
|
+
|
|
81
|
+
**Strategy:** [How errors are handled: e.g., "Exception bubbling to top-level handler", "Per-route error middleware"]
|
|
82
|
+
|
|
83
|
+
**Patterns:**
|
|
84
|
+
- [Pattern: e.g., "try/catch at controller level"]
|
|
85
|
+
- [Pattern: e.g., "Error codes returned to user"]
|
|
86
|
+
|
|
87
|
+
## Cross-Cutting Concerns
|
|
88
|
+
|
|
89
|
+
[Aspects that affect multiple layers]
|
|
90
|
+
|
|
91
|
+
**Logging:**
|
|
92
|
+
- [Approach: e.g., "Winston logger, injected per-request"]
|
|
93
|
+
|
|
94
|
+
**Validation:**
|
|
95
|
+
- [Approach: e.g., "Zod schemas at API boundary"]
|
|
96
|
+
|
|
97
|
+
**Authentication:**
|
|
98
|
+
- [Approach: e.g., "JWT middleware on protected routes"]
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
*Architecture analysis: [date]*
|
|
103
|
+
*Update when major patterns change*
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
<good_examples>
|
|
107
|
+
```markdown
|
|
108
|
+
# Architecture
|
|
109
|
+
|
|
110
|
+
**Analysis Date:** 2025-01-20
|
|
111
|
+
|
|
112
|
+
## Pattern Overview
|
|
113
|
+
|
|
114
|
+
**Overall:** CLI Application with Plugin System
|
|
115
|
+
|
|
116
|
+
**Key Characteristics:**
|
|
117
|
+
- Single executable with subcommands
|
|
118
|
+
- Plugin-based extensibility
|
|
119
|
+
- File-based state (no database)
|
|
120
|
+
- Synchronous execution model
|
|
121
|
+
|
|
122
|
+
## Layers
|
|
123
|
+
|
|
124
|
+
**Command Layer:**
|
|
125
|
+
- Purpose: Parse user input and route to appropriate handler
|
|
126
|
+
- Contains: Command definitions, argument parsing, help text
|
|
127
|
+
- Location: `src/commands/*.ts`
|
|
128
|
+
- Depends on: Service layer for business logic
|
|
129
|
+
- Used by: CLI entry point (`src/index.ts`)
|
|
130
|
+
|
|
131
|
+
**Service Layer:**
|
|
132
|
+
- Purpose: Core business logic
|
|
133
|
+
- Contains: FileService, TemplateService, InstallService
|
|
134
|
+
- Location: `src/services/*.ts`
|
|
135
|
+
- Depends on: File system utilities, external tools
|
|
136
|
+
- Used by: Command handlers
|
|
137
|
+
|
|
138
|
+
**Utility Layer:**
|
|
139
|
+
- Purpose: Shared helpers and abstractions
|
|
140
|
+
- Contains: File I/O wrappers, path resolution, string formatting
|
|
141
|
+
- Location: `src/utils/*.ts`
|
|
142
|
+
- Depends on: Node.js built-ins only
|
|
143
|
+
- Used by: Service layer
|
|
144
|
+
|
|
145
|
+
## Data Flow
|
|
146
|
+
|
|
147
|
+
**CLI Command Execution:**
|
|
148
|
+
|
|
149
|
+
1. User runs: `GYWD new-project`
|
|
150
|
+
2. Commander parses args and flags
|
|
151
|
+
3. Command handler invoked (`src/commands/new-project.ts`)
|
|
152
|
+
4. Handler calls service methods (`src/services/project.ts` → `create()`)
|
|
153
|
+
5. Service reads templates, processes files, writes output
|
|
154
|
+
6. Results logged to console
|
|
155
|
+
7. Process exits with status code
|
|
156
|
+
|
|
157
|
+
**State Management:**
|
|
158
|
+
- File-based: All state lives in `.planning/` directory
|
|
159
|
+
- No persistent in-memory state
|
|
160
|
+
- Each command execution is independent
|
|
161
|
+
|
|
162
|
+
## Key Abstractions
|
|
163
|
+
|
|
164
|
+
**Service:**
|
|
165
|
+
- Purpose: Encapsulate business logic for a domain
|
|
166
|
+
- Examples: `src/services/file.ts`, `src/services/template.ts`, `src/services/project.ts`
|
|
167
|
+
- Pattern: Singleton-like (imported as modules, not instantiated)
|
|
168
|
+
|
|
169
|
+
**Command:**
|
|
170
|
+
- Purpose: CLI command definition
|
|
171
|
+
- Examples: `src/commands/new-project.ts`, `src/commands/plan-phase.ts`
|
|
172
|
+
- Pattern: Commander.js command registration
|
|
173
|
+
|
|
174
|
+
**Template:**
|
|
175
|
+
- Purpose: Reusable document structures
|
|
176
|
+
- Examples: PROJECT.md, PLAN.md templates
|
|
177
|
+
- Pattern: Markdown files with substitution variables
|
|
178
|
+
|
|
179
|
+
## Entry Points
|
|
180
|
+
|
|
181
|
+
**CLI Entry:**
|
|
182
|
+
- Location: `src/index.ts`
|
|
183
|
+
- Triggers: User runs `GYWD <command>`
|
|
184
|
+
- Responsibilities: Register commands, parse args, display help
|
|
185
|
+
|
|
186
|
+
**Commands:**
|
|
187
|
+
- Location: `src/commands/*.ts`
|
|
188
|
+
- Triggers: Matched command from CLI
|
|
189
|
+
- Responsibilities: Validate input, call services, format output
|
|
190
|
+
|
|
191
|
+
## Error Handling
|
|
192
|
+
|
|
193
|
+
**Strategy:** Throw exceptions, catch at command level, log and exit
|
|
194
|
+
|
|
195
|
+
**Patterns:**
|
|
196
|
+
- Services throw Error with descriptive messages
|
|
197
|
+
- Command handlers catch, log error to stderr, exit(1)
|
|
198
|
+
- Validation errors shown before execution (fail fast)
|
|
199
|
+
|
|
200
|
+
## Cross-Cutting Concerns
|
|
201
|
+
|
|
202
|
+
**Logging:**
|
|
203
|
+
- Console.log for normal output
|
|
204
|
+
- Console.error for errors
|
|
205
|
+
- Chalk for colored output
|
|
206
|
+
|
|
207
|
+
**Validation:**
|
|
208
|
+
- Zod schemas for config file parsing
|
|
209
|
+
- Manual validation in command handlers
|
|
210
|
+
- Fail fast on invalid input
|
|
211
|
+
|
|
212
|
+
**File Operations:**
|
|
213
|
+
- FileService abstraction over fs-extra
|
|
214
|
+
- All paths validated before operations
|
|
215
|
+
- Atomic writes (temp file + rename)
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
*Architecture analysis: 2025-01-20*
|
|
220
|
+
*Update when major patterns change*
|
|
221
|
+
```
|
|
222
|
+
</good_examples>
|
|
223
|
+
|
|
224
|
+
<guidelines>
|
|
225
|
+
**What belongs in ARCHITECTURE.md:**
|
|
226
|
+
- Overall architectural pattern (monolith, microservices, layered, etc.)
|
|
227
|
+
- Conceptual layers and their relationships
|
|
228
|
+
- Data flow / request lifecycle
|
|
229
|
+
- Key abstractions and patterns
|
|
230
|
+
- Entry points
|
|
231
|
+
- Error handling strategy
|
|
232
|
+
- Cross-cutting concerns (logging, auth, validation)
|
|
233
|
+
|
|
234
|
+
**What does NOT belong here:**
|
|
235
|
+
- Exhaustive file listings (that's STRUCTURE.md)
|
|
236
|
+
- Technology choices (that's STACK.md)
|
|
237
|
+
- Line-by-line code walkthrough (defer to code reading)
|
|
238
|
+
- Implementation details of specific features
|
|
239
|
+
|
|
240
|
+
**File paths ARE welcome:**
|
|
241
|
+
Include file paths as concrete examples of abstractions. Use backtick formatting: `src/services/user.ts`. This makes the architecture document actionable for Claude when planning.
|
|
242
|
+
|
|
243
|
+
**When filling this template:**
|
|
244
|
+
- Read main entry points (index, server, main)
|
|
245
|
+
- Identify layers by reading imports/dependencies
|
|
246
|
+
- Trace a typical request/command execution
|
|
247
|
+
- Note recurring patterns (services, controllers, repositories)
|
|
248
|
+
- Keep descriptions conceptual, not mechanical
|
|
249
|
+
|
|
250
|
+
**Useful for phase planning when:**
|
|
251
|
+
- Adding new features (where does it fit in the layers?)
|
|
252
|
+
- Refactoring (understanding current patterns)
|
|
253
|
+
- Identifying where to add code (which layer handles X?)
|
|
254
|
+
- Understanding dependencies between components
|
|
255
|
+
</guidelines>
|