@zigrivers/scaffold 2.28.1 → 2.38.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 +309 -136
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +94 -14
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/build.test.js +30 -5
- package/dist/cli/commands/build.test.js.map +1 -1
- package/dist/cli/commands/check.d.ts +12 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +311 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/check.test.d.ts +2 -0
- package/dist/cli/commands/check.test.d.ts.map +1 -0
- package/dist/cli/commands/check.test.js +412 -0
- package/dist/cli/commands/check.test.js.map +1 -0
- package/dist/cli/commands/complete.d.ts +12 -0
- package/dist/cli/commands/complete.d.ts.map +1 -0
- package/dist/cli/commands/complete.js +101 -0
- package/dist/cli/commands/complete.js.map +1 -0
- package/dist/cli/commands/complete.test.d.ts +2 -0
- package/dist/cli/commands/complete.test.d.ts.map +1 -0
- package/dist/cli/commands/complete.test.js +133 -0
- package/dist/cli/commands/complete.test.js.map +1 -0
- package/dist/cli/commands/dashboard.d.ts.map +1 -1
- package/dist/cli/commands/dashboard.js +12 -8
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +4 -0
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/knowledge.d.ts.map +1 -1
- package/dist/cli/commands/knowledge.js +6 -2
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/knowledge.test.js +16 -11
- package/dist/cli/commands/knowledge.test.js.map +1 -1
- package/dist/cli/commands/next.d.ts.map +1 -1
- package/dist/cli/commands/next.js +41 -13
- package/dist/cli/commands/next.js.map +1 -1
- package/dist/cli/commands/next.test.js +3 -0
- package/dist/cli/commands/next.test.js.map +1 -1
- package/dist/cli/commands/reset.d.ts +1 -0
- package/dist/cli/commands/reset.d.ts.map +1 -1
- package/dist/cli/commands/reset.js +179 -67
- package/dist/cli/commands/reset.js.map +1 -1
- package/dist/cli/commands/reset.test.js +360 -0
- package/dist/cli/commands/reset.test.js.map +1 -1
- package/dist/cli/commands/rework.d.ts +20 -0
- package/dist/cli/commands/rework.d.ts.map +1 -0
- package/dist/cli/commands/rework.js +332 -0
- package/dist/cli/commands/rework.js.map +1 -0
- package/dist/cli/commands/rework.test.d.ts +2 -0
- package/dist/cli/commands/rework.test.d.ts.map +1 -0
- package/dist/cli/commands/rework.test.js +297 -0
- package/dist/cli/commands/rework.test.js.map +1 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +59 -31
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/run.test.js +288 -6
- package/dist/cli/commands/run.test.js.map +1 -1
- package/dist/cli/commands/skill.d.ts +12 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +123 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/skill.test.d.ts +2 -0
- package/dist/cli/commands/skill.test.d.ts.map +1 -0
- package/dist/cli/commands/skill.test.js +297 -0
- package/dist/cli/commands/skill.test.js.map +1 -0
- package/dist/cli/commands/skip.d.ts +1 -1
- package/dist/cli/commands/skip.d.ts.map +1 -1
- package/dist/cli/commands/skip.js +123 -57
- package/dist/cli/commands/skip.js.map +1 -1
- package/dist/cli/commands/skip.test.js +91 -0
- package/dist/cli/commands/skip.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts +1 -0
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +57 -10
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +81 -0
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/commands/update.test.js +252 -0
- package/dist/cli/commands/update.test.js.map +1 -1
- package/dist/cli/commands/version.test.js +171 -1
- package/dist/cli/commands/version.test.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/adapters/adapter.d.ts +14 -0
- package/dist/core/adapters/adapter.d.ts.map +1 -1
- package/dist/core/adapters/adapter.js.map +1 -1
- package/dist/core/adapters/adapter.test.js +10 -0
- package/dist/core/adapters/adapter.test.js.map +1 -1
- package/dist/core/adapters/claude-code.d.ts.map +1 -1
- package/dist/core/adapters/claude-code.js +47 -10
- package/dist/core/adapters/claude-code.js.map +1 -1
- package/dist/core/adapters/claude-code.test.js +41 -20
- package/dist/core/adapters/claude-code.test.js.map +1 -1
- package/dist/core/adapters/codex.d.ts.map +1 -1
- package/dist/core/adapters/codex.js +5 -1
- package/dist/core/adapters/codex.js.map +1 -1
- package/dist/core/adapters/codex.test.js +5 -0
- package/dist/core/adapters/codex.test.js.map +1 -1
- package/dist/core/adapters/universal.d.ts.map +1 -1
- package/dist/core/adapters/universal.js +0 -1
- package/dist/core/adapters/universal.js.map +1 -1
- package/dist/core/adapters/universal.test.js +5 -0
- package/dist/core/adapters/universal.test.js.map +1 -1
- package/dist/core/assembly/context-gatherer.d.ts.map +1 -1
- package/dist/core/assembly/context-gatherer.js +5 -2
- package/dist/core/assembly/context-gatherer.js.map +1 -1
- package/dist/core/assembly/engine.d.ts.map +1 -1
- package/dist/core/assembly/engine.js +10 -2
- package/dist/core/assembly/engine.js.map +1 -1
- package/dist/core/assembly/engine.test.js +19 -0
- package/dist/core/assembly/engine.test.js.map +1 -1
- package/dist/core/assembly/knowledge-loader.d.ts +25 -0
- package/dist/core/assembly/knowledge-loader.d.ts.map +1 -1
- package/dist/core/assembly/knowledge-loader.js +75 -2
- package/dist/core/assembly/knowledge-loader.js.map +1 -1
- package/dist/core/assembly/knowledge-loader.test.js +388 -1
- package/dist/core/assembly/knowledge-loader.test.js.map +1 -1
- package/dist/core/assembly/meta-prompt-loader.d.ts +6 -0
- package/dist/core/assembly/meta-prompt-loader.d.ts.map +1 -1
- package/dist/core/assembly/meta-prompt-loader.js +41 -25
- package/dist/core/assembly/meta-prompt-loader.js.map +1 -1
- package/dist/core/assembly/preset-loader.d.ts +10 -0
- package/dist/core/assembly/preset-loader.d.ts.map +1 -1
- package/dist/core/assembly/preset-loader.js +26 -1
- package/dist/core/assembly/preset-loader.js.map +1 -1
- package/dist/core/assembly/preset-loader.test.js +65 -1
- package/dist/core/assembly/preset-loader.test.js.map +1 -1
- package/dist/core/assembly/update-mode.d.ts.map +1 -1
- package/dist/core/assembly/update-mode.js +10 -4
- package/dist/core/assembly/update-mode.js.map +1 -1
- package/dist/core/assembly/update-mode.test.js +47 -0
- package/dist/core/assembly/update-mode.test.js.map +1 -1
- package/dist/core/dependency/dependency.d.ts.map +1 -1
- package/dist/core/dependency/dependency.js +3 -2
- package/dist/core/dependency/dependency.js.map +1 -1
- package/dist/core/dependency/dependency.test.js +2 -0
- package/dist/core/dependency/dependency.test.js.map +1 -1
- package/dist/core/dependency/eligibility.js +3 -3
- package/dist/core/dependency/eligibility.js.map +1 -1
- package/dist/core/dependency/eligibility.test.js +2 -0
- package/dist/core/dependency/eligibility.test.js.map +1 -1
- package/dist/core/dependency/graph.d.ts.map +1 -1
- package/dist/core/dependency/graph.js +4 -0
- package/dist/core/dependency/graph.js.map +1 -1
- package/dist/core/dependency/graph.test.d.ts +2 -0
- package/dist/core/dependency/graph.test.d.ts.map +1 -0
- package/dist/core/dependency/graph.test.js +262 -0
- package/dist/core/dependency/graph.test.js.map +1 -0
- package/dist/core/rework/phase-selector.d.ts +24 -0
- package/dist/core/rework/phase-selector.d.ts.map +1 -0
- package/dist/core/rework/phase-selector.js +98 -0
- package/dist/core/rework/phase-selector.js.map +1 -0
- package/dist/core/rework/phase-selector.test.d.ts +2 -0
- package/dist/core/rework/phase-selector.test.d.ts.map +1 -0
- package/dist/core/rework/phase-selector.test.js +138 -0
- package/dist/core/rework/phase-selector.test.js.map +1 -0
- package/dist/dashboard/generator.d.ts +48 -17
- package/dist/dashboard/generator.d.ts.map +1 -1
- package/dist/dashboard/generator.js +75 -5
- package/dist/dashboard/generator.js.map +1 -1
- package/dist/dashboard/generator.test.js +213 -5
- package/dist/dashboard/generator.test.js.map +1 -1
- package/dist/dashboard/template.d.ts +1 -1
- package/dist/dashboard/template.d.ts.map +1 -1
- package/dist/dashboard/template.js +755 -114
- package/dist/dashboard/template.js.map +1 -1
- package/dist/e2e/knowledge.test.js +4 -3
- package/dist/e2e/knowledge.test.js.map +1 -1
- package/dist/e2e/pipeline.test.js +2 -0
- package/dist/e2e/pipeline.test.js.map +1 -1
- package/dist/e2e/rework.test.d.ts +6 -0
- package/dist/e2e/rework.test.d.ts.map +1 -0
- package/dist/e2e/rework.test.js +226 -0
- package/dist/e2e/rework.test.js.map +1 -0
- package/dist/index.js +0 -0
- package/dist/project/adopt.test.js +2 -0
- package/dist/project/adopt.test.js.map +1 -1
- package/dist/project/claude-md.js +2 -2
- package/dist/project/claude-md.js.map +1 -1
- package/dist/project/claude-md.test.js +4 -4
- package/dist/project/claude-md.test.js.map +1 -1
- package/dist/project/detector.d.ts.map +1 -1
- package/dist/project/detector.js +4 -1
- package/dist/project/detector.js.map +1 -1
- package/dist/project/frontmatter.d.ts.map +1 -1
- package/dist/project/frontmatter.js +54 -15
- package/dist/project/frontmatter.js.map +1 -1
- package/dist/project/frontmatter.test.js +2 -2
- package/dist/project/frontmatter.test.js.map +1 -1
- package/dist/state/rework-manager.d.ts +16 -0
- package/dist/state/rework-manager.d.ts.map +1 -0
- package/dist/state/rework-manager.js +126 -0
- package/dist/state/rework-manager.js.map +1 -0
- package/dist/state/rework-manager.test.d.ts +2 -0
- package/dist/state/rework-manager.test.d.ts.map +1 -0
- package/dist/state/rework-manager.test.js +191 -0
- package/dist/state/rework-manager.test.js.map +1 -0
- package/dist/state/state-manager.d.ts +13 -0
- package/dist/state/state-manager.d.ts.map +1 -1
- package/dist/state/state-manager.js +39 -2
- package/dist/state/state-manager.js.map +1 -1
- package/dist/state/state-manager.test.js +74 -1
- package/dist/state/state-manager.test.js.map +1 -1
- package/dist/state/state-migration.d.ts +23 -0
- package/dist/state/state-migration.d.ts.map +1 -0
- package/dist/state/state-migration.js +144 -0
- package/dist/state/state-migration.js.map +1 -0
- package/dist/state/state-migration.test.d.ts +2 -0
- package/dist/state/state-migration.test.d.ts.map +1 -0
- package/dist/state/state-migration.test.js +451 -0
- package/dist/state/state-migration.test.js.map +1 -0
- package/dist/types/assembly.d.ts +2 -0
- package/dist/types/assembly.d.ts.map +1 -1
- package/dist/types/dependency.d.ts +2 -2
- package/dist/types/dependency.d.ts.map +1 -1
- package/dist/types/frontmatter.d.ts +100 -7
- package/dist/types/frontmatter.d.ts.map +1 -1
- package/dist/types/frontmatter.js +89 -1
- package/dist/types/frontmatter.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/lock.d.ts +1 -1
- package/dist/types/lock.d.ts.map +1 -1
- package/dist/types/rework.d.ts +36 -0
- package/dist/types/rework.d.ts.map +1 -0
- package/dist/types/rework.js +2 -0
- package/dist/types/rework.js.map +1 -0
- package/dist/utils/errors.d.ts +1 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +8 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/fs.d.ts +6 -0
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +13 -0
- package/dist/utils/fs.js.map +1 -1
- package/dist/validation/config-validator.test.d.ts +2 -0
- package/dist/validation/config-validator.test.d.ts.map +1 -0
- package/dist/validation/config-validator.test.js +210 -0
- package/dist/validation/config-validator.test.js.map +1 -0
- package/dist/validation/dependency-validator.test.d.ts +2 -0
- package/dist/validation/dependency-validator.test.d.ts.map +1 -0
- package/dist/validation/dependency-validator.test.js +215 -0
- package/dist/validation/dependency-validator.test.js.map +1 -0
- package/dist/validation/frontmatter-validator.test.d.ts +2 -0
- package/dist/validation/frontmatter-validator.test.d.ts.map +1 -0
- package/dist/validation/frontmatter-validator.test.js +371 -0
- package/dist/validation/frontmatter-validator.test.js.map +1 -0
- package/dist/validation/state-validator.test.d.ts +2 -0
- package/dist/validation/state-validator.test.d.ts.map +1 -0
- package/dist/validation/state-validator.test.js +325 -0
- package/dist/validation/state-validator.test.js.map +1 -0
- package/dist/wizard/suggestion.test.d.ts +2 -0
- package/dist/wizard/suggestion.test.d.ts.map +1 -0
- package/dist/wizard/suggestion.test.js +115 -0
- package/dist/wizard/suggestion.test.js.map +1 -0
- package/dist/wizard/wizard.d.ts.map +1 -1
- package/dist/wizard/wizard.js +34 -1
- package/dist/wizard/wizard.js.map +1 -1
- package/knowledge/core/adr-craft.md +4 -0
- package/knowledge/core/api-design.md +4 -0
- package/knowledge/core/automated-review-tooling.md +203 -0
- package/knowledge/core/coding-conventions.md +1 -1
- package/knowledge/core/database-design.md +4 -0
- package/knowledge/core/design-system-tokens.md +4 -0
- package/knowledge/core/domain-modeling.md +4 -0
- package/knowledge/core/git-workflow-patterns.md +200 -0
- package/knowledge/core/operations-runbook.md +5 -1
- package/knowledge/core/security-best-practices.md +4 -0
- package/knowledge/core/system-architecture.md +5 -1
- package/knowledge/core/task-decomposition.md +118 -3
- package/knowledge/core/user-story-innovation.md +13 -0
- package/knowledge/core/ux-specification.md +13 -0
- package/knowledge/execution/enhancement-workflow.md +201 -0
- package/knowledge/execution/task-claiming-strategy.md +130 -0
- package/knowledge/execution/tdd-execution-loop.md +172 -0
- package/knowledge/execution/worktree-management.md +205 -0
- package/knowledge/finalization/apply-fixes-and-freeze.md +12 -0
- package/knowledge/finalization/developer-onboarding.md +4 -0
- package/knowledge/finalization/implementation-playbook.md +83 -5
- package/knowledge/product/gap-analysis.md +5 -1
- package/knowledge/product/prd-innovation.md +12 -0
- package/knowledge/product/vision-craft.md +213 -0
- package/knowledge/review/review-adr.md +12 -0
- package/knowledge/review/review-api-design.md +13 -0
- package/knowledge/review/review-database-design.md +13 -0
- package/knowledge/review/review-domain-modeling.md +5 -1
- package/knowledge/review/review-implementation-tasks.md +58 -1
- package/knowledge/review/review-methodology.md +11 -0
- package/knowledge/review/review-operations.md +12 -0
- package/knowledge/review/review-prd.md +13 -0
- package/knowledge/review/review-security.md +12 -0
- package/knowledge/review/review-system-architecture.md +4 -2
- package/knowledge/review/review-testing-strategy.md +11 -0
- package/knowledge/review/review-user-stories.md +11 -0
- package/knowledge/review/review-ux-specification.md +13 -1
- package/knowledge/review/review-vision.md +255 -0
- package/knowledge/tools/release-management.md +222 -0
- package/knowledge/tools/session-analysis.md +215 -0
- package/knowledge/tools/version-strategy.md +200 -0
- package/knowledge/validation/critical-path-analysis.md +1 -1
- package/knowledge/validation/cross-phase-consistency.md +12 -0
- package/knowledge/validation/decision-completeness.md +13 -1
- package/knowledge/validation/dependency-validation.md +12 -0
- package/knowledge/validation/scope-management.md +12 -0
- package/knowledge/validation/traceability.md +12 -0
- package/methodology/README.md +37 -0
- package/methodology/custom-defaults.yml +12 -1
- package/methodology/deep.yml +11 -0
- package/methodology/mvp.yml +11 -0
- package/package.json +3 -3
- package/pipeline/architecture/review-architecture.md +18 -7
- package/pipeline/architecture/system-architecture.md +11 -8
- package/pipeline/build/multi-agent-resume.md +245 -0
- package/pipeline/build/multi-agent-start.md +236 -0
- package/pipeline/build/new-enhancement.md +456 -0
- package/pipeline/build/quick-task.md +381 -0
- package/pipeline/build/single-agent-resume.md +210 -0
- package/pipeline/build/single-agent-start.md +207 -0
- package/pipeline/consolidation/claude-md-optimization.md +11 -8
- package/pipeline/consolidation/workflow-audit.md +15 -11
- package/pipeline/decisions/adrs.md +7 -5
- package/pipeline/decisions/review-adrs.md +14 -6
- package/pipeline/environment/ai-memory-setup.md +18 -12
- package/pipeline/environment/automated-pr-review.md +10 -4
- package/pipeline/environment/design-system.md +9 -7
- package/pipeline/environment/dev-env-setup.md +8 -5
- package/pipeline/environment/git-workflow.md +3 -1
- package/pipeline/finalization/apply-fixes-and-freeze.md +16 -5
- package/pipeline/finalization/developer-onboarding-guide.md +22 -8
- package/pipeline/finalization/implementation-playbook.md +40 -11
- package/pipeline/foundation/beads.md +10 -7
- package/pipeline/foundation/coding-standards.md +6 -3
- package/pipeline/foundation/project-structure.md +5 -1
- package/pipeline/foundation/tdd.md +10 -6
- package/pipeline/foundation/tech-stack.md +9 -9
- package/pipeline/integration/add-e2e-testing.md +21 -6
- package/pipeline/modeling/domain-modeling.md +10 -7
- package/pipeline/modeling/review-domain-modeling.md +17 -6
- package/pipeline/parity/platform-parity-review.md +31 -11
- package/pipeline/planning/implementation-plan-review.md +21 -10
- package/pipeline/planning/implementation-plan.md +52 -19
- package/pipeline/pre/create-prd.md +22 -7
- package/pipeline/pre/innovate-prd.md +10 -8
- package/pipeline/pre/innovate-user-stories.md +9 -7
- package/pipeline/pre/review-prd.md +11 -2
- package/pipeline/pre/review-user-stories.md +12 -3
- package/pipeline/pre/user-stories.md +12 -7
- package/pipeline/quality/create-evals.md +10 -6
- package/pipeline/quality/operations.md +16 -12
- package/pipeline/quality/review-operations.md +19 -10
- package/pipeline/quality/review-security.md +21 -11
- package/pipeline/quality/review-testing.md +23 -12
- package/pipeline/quality/security.md +17 -13
- package/pipeline/quality/story-tests.md +6 -4
- package/pipeline/specification/api-contracts.md +11 -6
- package/pipeline/specification/database-schema.md +12 -6
- package/pipeline/specification/review-api.md +18 -9
- package/pipeline/specification/review-database.md +18 -9
- package/pipeline/specification/review-ux.md +20 -10
- package/pipeline/specification/ux-spec.md +8 -5
- package/pipeline/validation/critical-path-walkthrough.md +14 -7
- package/pipeline/validation/cross-phase-consistency.md +14 -7
- package/pipeline/validation/decision-completeness.md +14 -7
- package/pipeline/validation/dependency-graph-validation.md +15 -7
- package/pipeline/validation/implementability-dry-run.md +15 -7
- package/pipeline/validation/scope-creep-check.md +15 -7
- package/pipeline/validation/traceability-matrix.md +20 -7
- package/pipeline/vision/create-vision.md +267 -0
- package/pipeline/vision/innovate-vision.md +157 -0
- package/pipeline/vision/review-vision.md +149 -0
- package/skills/scaffold-pipeline/SKILL.md +33 -18
- package/skills/scaffold-runner/SKILL.md +172 -18
|
@@ -4,6 +4,19 @@ description: Techniques for discovering UX enhancements and innovation opportuni
|
|
|
4
4
|
topics: [innovation, ux-enhancements, user-stories, gap-analysis, differentiators]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
# User Story Innovation
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
- **Scope**: UX-level improvements to existing features only (smart defaults, error handling, accessibility, progressive disclosure, AI-native enhancements). Feature-level innovation belongs in PRD innovation.
|
|
12
|
+
- **High-value low-effort patterns**: Smart defaults, inline validation, keyboard shortcuts, progressive disclosure, leveraging existing data, undo/redo, and batch operations.
|
|
13
|
+
- **Differentiators**: "Wow" moments, AI-native features (natural language search, auto-categorization, smart suggestions), and personalization without configuration.
|
|
14
|
+
- **Defensive gaps**: Accessibility (WCAG AA minimum), mobile responsiveness, offline/degraded mode, performance under load, error recovery, and empty states.
|
|
15
|
+
- **Evaluation framework**: Assess cost (trivial/moderate/significant) and impact (nice-to-have/noticeable/differentiator). Must-have for v1 = high impact + trivial or moderate cost.
|
|
16
|
+
- **Integration**: Approved innovations become additional acceptance criteria, new stories, or modified story scope. All must be traceable to PRD requirements.
|
|
17
|
+
|
|
18
|
+
## Deep Guidance
|
|
19
|
+
|
|
7
20
|
## Scope Boundary
|
|
8
21
|
|
|
9
22
|
This knowledge covers UX-level improvements only — making existing features better, not adding new features. Feature-level innovation belongs in PRD innovation (`innovate-prd`). If an enhancement requires a new PRD section, it is out of scope for user story innovation.
|
|
@@ -4,6 +4,19 @@ description: UX documentation patterns — user flows, interaction states, compo
|
|
|
4
4
|
topics: [ux, accessibility, wireframes, user-flows, responsive-design, components, interaction-states]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
# UX Specification
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
- **User flow documentation**: Map each story's Given/When/Then scenarios to screen states and transitions. Document entry points, preconditions, happy path, decision points, error paths, empty states, and exit points.
|
|
12
|
+
- **Component architecture**: Organize components as atoms (base), molecules (composite), organisms (feature), templates (layouts), and pages. Define prop/data flow with top-down props and events/callbacks up.
|
|
13
|
+
- **Design system reference**: Consume design tokens from `docs/design-system.md` by name (e.g., `--color-error`, `--space-4`). Never hard-code values.
|
|
14
|
+
- **Accessibility**: Target WCAG AA as baseline. Keyboard navigation for all interactive elements, semantic HTML, screen reader support with ARIA, 4.5:1 color contrast, and proper focus management.
|
|
15
|
+
- **Responsive design**: Mobile-first breakpoints (mobile < 640px, tablet 640-1024px, desktop 1024-1280px, large > 1280px). Touch targets minimum 44x44px. Document layout behavior per breakpoint.
|
|
16
|
+
- **Common pitfalls**: Designing for happy path only, accessibility as afterthought, missing loading states, breaking text on resize, and modal abuse for content that should be pages.
|
|
17
|
+
|
|
18
|
+
## Deep Guidance
|
|
19
|
+
|
|
7
20
|
## User Flow Documentation
|
|
8
21
|
|
|
9
22
|
### Journey Mapping
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: enhancement-workflow
|
|
3
|
+
description: Discovery and implementation workflow for adding features to existing projects
|
|
4
|
+
topics: [enhancement, features, planning, discovery]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Enhancement Workflow
|
|
8
|
+
|
|
9
|
+
Expert knowledge for discovering, planning, and implementing enhancements to existing projects. Covers the four-phase discovery flow, impact analysis, documentation updates, and task creation patterns.
|
|
10
|
+
|
|
11
|
+
## Summary
|
|
12
|
+
|
|
13
|
+
### 4-Phase Discovery Flow
|
|
14
|
+
|
|
15
|
+
1. **Discovery** — Understand the problem space, review existing docs, challenge scope, assess impact
|
|
16
|
+
2. **Documentation** — Update project docs with the new feature, add user stories
|
|
17
|
+
3. **Task Creation** — Break the enhancement into implementable tasks with dependencies
|
|
18
|
+
4. **Summary** — Produce an enhancement summary with implementation order and follow-up suggestions
|
|
19
|
+
|
|
20
|
+
### Impact Analysis
|
|
21
|
+
|
|
22
|
+
Before committing to an enhancement, assess its fit within the existing architecture, its scope relative to the project, and its technical impact on existing modules.
|
|
23
|
+
|
|
24
|
+
### Documentation Updates
|
|
25
|
+
|
|
26
|
+
Every enhancement must update the project's planning and story documents with traceability markers so the change history is auditable.
|
|
27
|
+
|
|
28
|
+
### Task Creation
|
|
29
|
+
|
|
30
|
+
One task per user story for small/medium enhancements. Larger enhancements decompose into data model, backend, frontend, and polish phases with explicit dependencies.
|
|
31
|
+
|
|
32
|
+
## Deep Guidance
|
|
33
|
+
|
|
34
|
+
### Phase 1: Discovery
|
|
35
|
+
|
|
36
|
+
Discovery is the most important phase. Skipping it leads to scope creep, architectural misalignment, and wasted implementation effort.
|
|
37
|
+
|
|
38
|
+
#### Review Existing Documentation
|
|
39
|
+
|
|
40
|
+
Read these documents in order before proposing any changes:
|
|
41
|
+
|
|
42
|
+
1. **Product vision** (`docs/vision.md` or equivalent) — understand the project's purpose and direction
|
|
43
|
+
2. **PRD** (`docs/prd.md`) — understand existing requirements and constraints
|
|
44
|
+
3. **User stories** (`docs/user-stories.md`) — understand who uses the system and how
|
|
45
|
+
4. **Architecture** (`docs/architecture.md` or ADRs) — understand the technical structure
|
|
46
|
+
5. **Coding standards** (`docs/coding-standards.md`) — understand conventions you must follow
|
|
47
|
+
6. **TDD standards** (`docs/tdd-standards.md`) — understand testing expectations
|
|
48
|
+
7. **Project structure** (`docs/project-structure.md`) — understand where code lives
|
|
49
|
+
8. **Source code** — read the modules most relevant to the enhancement
|
|
50
|
+
|
|
51
|
+
#### Understand the Problem
|
|
52
|
+
|
|
53
|
+
- What user problem does this enhancement solve?
|
|
54
|
+
- Is the problem validated (user feedback, metrics, strategic direction)?
|
|
55
|
+
- Are there existing features that partially solve this problem?
|
|
56
|
+
- Could an existing feature be extended instead of building something new?
|
|
57
|
+
|
|
58
|
+
#### Challenge Scope
|
|
59
|
+
|
|
60
|
+
Actively resist scope expansion:
|
|
61
|
+
|
|
62
|
+
- What is the minimum viable version of this enhancement?
|
|
63
|
+
- What can be deferred to a follow-up?
|
|
64
|
+
- Is this a single feature or actually multiple features bundled together?
|
|
65
|
+
- Would a simpler approach solve 80% of the problem?
|
|
66
|
+
|
|
67
|
+
#### Innovation Pass
|
|
68
|
+
|
|
69
|
+
After understanding the problem and challenging the scope:
|
|
70
|
+
|
|
71
|
+
- **Competitive analysis** — how do similar products solve this problem?
|
|
72
|
+
- **Enhancement opportunities** — are there adjacent improvements that are low-effort but high-value?
|
|
73
|
+
- **AI-native possibilities** — can AI capabilities enable a better solution than a traditional approach?
|
|
74
|
+
|
|
75
|
+
#### Impact Analysis
|
|
76
|
+
|
|
77
|
+
Assess the enhancement along three dimensions:
|
|
78
|
+
|
|
79
|
+
**Fit check:**
|
|
80
|
+
- Does this align with the product vision?
|
|
81
|
+
- Does it complement existing features or conflict with them?
|
|
82
|
+
- Is now the right time to build this?
|
|
83
|
+
|
|
84
|
+
**Scope assessment:**
|
|
85
|
+
- How many modules are affected?
|
|
86
|
+
- How many new entities or data models are needed?
|
|
87
|
+
- Estimate: small (1-2 tasks), medium (3-5 tasks), or large (6+ tasks)
|
|
88
|
+
|
|
89
|
+
**Technical impact:**
|
|
90
|
+
- Which existing modules need modification?
|
|
91
|
+
- Are there performance implications?
|
|
92
|
+
- Does this affect the API contract (breaking changes)?
|
|
93
|
+
- Are there security implications?
|
|
94
|
+
|
|
95
|
+
### Phase 2: Documentation
|
|
96
|
+
|
|
97
|
+
Every enhancement must leave a documentation trail.
|
|
98
|
+
|
|
99
|
+
#### Update Planning Documents
|
|
100
|
+
|
|
101
|
+
Update `docs/plan.md` (or equivalent planning document) with the new feature:
|
|
102
|
+
|
|
103
|
+
- Add a section describing the enhancement
|
|
104
|
+
- Include traceability markers: `[Enhancement added YYYY-MM-DD]`
|
|
105
|
+
- Reference the motivation (user feedback, strategic goal, bug report)
|
|
106
|
+
- List affected modules and components
|
|
107
|
+
|
|
108
|
+
#### Add User Stories
|
|
109
|
+
|
|
110
|
+
Add new user stories to `docs/user-stories.md` following INVEST criteria:
|
|
111
|
+
|
|
112
|
+
- **I**ndependent — can be implemented without other new stories
|
|
113
|
+
- **N**egotiable — details can be discussed during implementation
|
|
114
|
+
- **V**aluable — delivers value to a specific user role
|
|
115
|
+
- **E**stimable — small enough to estimate effort
|
|
116
|
+
- **S**mall — completable in one task or a small number of tasks
|
|
117
|
+
- **T**estable — has clear acceptance criteria that can be automated
|
|
118
|
+
|
|
119
|
+
**Story format:**
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
As a [role], I want [capability] so that [benefit].
|
|
123
|
+
|
|
124
|
+
Acceptance criteria:
|
|
125
|
+
- [ ] Given [context], when [action], then [result]
|
|
126
|
+
- [ ] Given [context], when [action], then [result]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Phase 3: Task Creation
|
|
130
|
+
|
|
131
|
+
Convert user stories into implementable tasks.
|
|
132
|
+
|
|
133
|
+
#### Small/Medium Enhancements (1-5 tasks)
|
|
134
|
+
|
|
135
|
+
- One task per user story
|
|
136
|
+
- Each task includes: description, acceptance criteria, test expectations, and affected files
|
|
137
|
+
- Set dependencies between tasks where ordering matters
|
|
138
|
+
|
|
139
|
+
#### Large Enhancements (6+ tasks)
|
|
140
|
+
|
|
141
|
+
Decompose into implementation phases:
|
|
142
|
+
|
|
143
|
+
1. **Data model** — schema changes, migrations, entity definitions
|
|
144
|
+
2. **Backend** — API endpoints, business logic, service layer
|
|
145
|
+
3. **Frontend** — UI components, pages, client-side logic
|
|
146
|
+
4. **Polish** — error handling edge cases, performance optimization, documentation
|
|
147
|
+
|
|
148
|
+
Each phase may contain multiple tasks. Dependencies flow downward: data model before backend, backend before frontend, frontend before polish.
|
|
149
|
+
|
|
150
|
+
#### Task Creation with Beads
|
|
151
|
+
|
|
152
|
+
If `.beads/` directory exists:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
bd create --title "Add user endpoint" --depends-on bd-41
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Task Creation Without Beads
|
|
159
|
+
|
|
160
|
+
Add tasks to the project's task tracking system (implementation plan, GitHub Issues, etc.) with:
|
|
161
|
+
- Unique ID
|
|
162
|
+
- Title and description
|
|
163
|
+
- Dependencies (list of blocking task IDs)
|
|
164
|
+
- Acceptance criteria
|
|
165
|
+
- Estimated scope (S/M/L)
|
|
166
|
+
|
|
167
|
+
### Phase 4: Summary
|
|
168
|
+
|
|
169
|
+
Produce an enhancement summary that includes:
|
|
170
|
+
|
|
171
|
+
1. **Enhancement description** — one paragraph summarizing what was planned
|
|
172
|
+
2. **Documentation changes** — list of docs updated and what was added
|
|
173
|
+
3. **Tasks created** — numbered list of tasks with IDs, titles, and dependencies
|
|
174
|
+
4. **Implementation order** — recommended sequence accounting for dependencies
|
|
175
|
+
5. **Follow-up suggestions** — reviews to schedule, related enhancements to consider, risks to monitor
|
|
176
|
+
|
|
177
|
+
### Complexity Gate
|
|
178
|
+
|
|
179
|
+
Not every change requires the full enhancement workflow. Use the quick-task path for simple changes and redirect to enhancement workflow when complexity exceeds a threshold.
|
|
180
|
+
|
|
181
|
+
**Redirect from quick-task to enhancement workflow when any of these are true:**
|
|
182
|
+
|
|
183
|
+
- Requires updates to planning or design documents
|
|
184
|
+
- Introduces a new user-facing feature (not just a fix or tweak)
|
|
185
|
+
- Affects 3 or more modules
|
|
186
|
+
- Requires new data entities, models, or schema changes
|
|
187
|
+
- Needs 4 or more implementation tasks
|
|
188
|
+
- Changes the API contract in a way that affects consumers
|
|
189
|
+
|
|
190
|
+
**Stay on quick-task path when:**
|
|
191
|
+
- Bug fix with clear root cause and limited scope
|
|
192
|
+
- Configuration change
|
|
193
|
+
- Documentation-only update
|
|
194
|
+
- Single-file refactor
|
|
195
|
+
- Test addition for existing behavior
|
|
196
|
+
|
|
197
|
+
## See Also
|
|
198
|
+
|
|
199
|
+
- [task-decomposition](../core/task-decomposition.md) — Breaking work into implementable tasks
|
|
200
|
+
- [user-stories](../core/user-stories.md) — User story writing patterns
|
|
201
|
+
- [task-claiming-strategy](./task-claiming-strategy.md) — How agents select and claim tasks
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task-claiming-strategy
|
|
3
|
+
description: Task selection and management patterns for AI agent execution
|
|
4
|
+
topics: [tasks, execution, agents, planning]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Task Claiming Strategy
|
|
8
|
+
|
|
9
|
+
Expert knowledge for how AI agents select, claim, and manage tasks during implementation. Covers deterministic selection algorithms, dependency awareness, and multi-agent conflict avoidance patterns.
|
|
10
|
+
|
|
11
|
+
## Summary
|
|
12
|
+
|
|
13
|
+
### Task Selection Algorithm
|
|
14
|
+
|
|
15
|
+
Select the lowest-ID unblocked task. This provides deterministic, conflict-free ordering when multiple agents operate on the same task list.
|
|
16
|
+
|
|
17
|
+
### Dependency Awareness
|
|
18
|
+
|
|
19
|
+
Before starting a task, verify all its blockers are resolved. After completing each task, re-check the dependency graph — your completion may have unblocked downstream tasks.
|
|
20
|
+
|
|
21
|
+
### Multi-Agent Conflict Avoidance
|
|
22
|
+
|
|
23
|
+
- Claim the task before starting work (branch creation = claim)
|
|
24
|
+
- Communicate via git branches — branch existence signals ownership
|
|
25
|
+
- Detect file overlap in implementation plans before starting — if two tasks modify the same files, they should not run in parallel
|
|
26
|
+
|
|
27
|
+
## Deep Guidance
|
|
28
|
+
|
|
29
|
+
### Task Selection — Extended
|
|
30
|
+
|
|
31
|
+
**The algorithm:**
|
|
32
|
+
1. List all tasks in the backlog
|
|
33
|
+
2. Filter to tasks with status "ready" or "unblocked"
|
|
34
|
+
3. Sort by task ID (ascending)
|
|
35
|
+
4. Select the first task in the sorted list
|
|
36
|
+
5. Claim it by creating a feature branch
|
|
37
|
+
|
|
38
|
+
**Why lowest-ID first:**
|
|
39
|
+
- Deterministic — two agents independently applying this rule will never pick the same task (the first agent claims it, the second sees it as taken)
|
|
40
|
+
- Dependency-friendly — lower IDs are typically earlier in the plan and have fewer blockers
|
|
41
|
+
- Predictable — humans can anticipate which tasks agents will pick next
|
|
42
|
+
|
|
43
|
+
**Exceptions:**
|
|
44
|
+
- If the lowest-ID task requires skills or context the agent doesn't have, skip it and document why
|
|
45
|
+
- If a task is labeled "high priority" or "urgent," it takes precedence over ID ordering
|
|
46
|
+
- If a human has assigned a specific task to the agent, honor the assignment
|
|
47
|
+
|
|
48
|
+
### Dependency Awareness — Extended
|
|
49
|
+
|
|
50
|
+
**Before starting a task:**
|
|
51
|
+
1. Read the task's dependency list (blockers, prerequisites)
|
|
52
|
+
2. Verify each blocker is in "done" or "merged" state
|
|
53
|
+
3. If any blocker is incomplete, skip this task and select the next eligible one
|
|
54
|
+
4. Pull the latest main branch to ensure you have the outputs from completed blockers
|
|
55
|
+
|
|
56
|
+
**After completing a task:**
|
|
57
|
+
1. Check which downstream tasks list the completed task as a blocker
|
|
58
|
+
2. If any downstream tasks are now fully unblocked, they become eligible for selection
|
|
59
|
+
3. If you're continuing work, re-run the selection algorithm — the next task may have changed
|
|
60
|
+
|
|
61
|
+
**Dependency types:**
|
|
62
|
+
- **Hard dependency** — cannot start until blocker is merged (e.g., "implement auth" blocks "implement protected routes")
|
|
63
|
+
- **Soft dependency** — can start with a stub/mock, but must integrate before PR (e.g., "design API" informs "implement client," but the client can start with a contract)
|
|
64
|
+
- **Data dependency** — needs output artifacts from another task (e.g., database schema must exist before writing queries)
|
|
65
|
+
|
|
66
|
+
### Multi-Agent Conflict Avoidance — Extended
|
|
67
|
+
|
|
68
|
+
**Claiming a task:**
|
|
69
|
+
- Creating a feature branch (e.g., `bd-42/add-user-endpoint`) is the claim signal
|
|
70
|
+
- Other agents should check for existing branches before claiming the same task
|
|
71
|
+
- If two agents accidentally claim the same task, the one with fewer commits yields
|
|
72
|
+
|
|
73
|
+
**Detecting file overlap:**
|
|
74
|
+
- Before starting, review the implementation plan for file-level scope
|
|
75
|
+
- If two tasks both modify `src/auth/middleware.ts`, they should not run in parallel
|
|
76
|
+
- When overlap is detected: serialize the tasks (one blocks the other), or split the overlapping file into two files first
|
|
77
|
+
|
|
78
|
+
**Communication via branches:**
|
|
79
|
+
- Branch exists = task claimed
|
|
80
|
+
- Branch merged = task complete
|
|
81
|
+
- Branch deleted without merge = task abandoned, available for re-claim
|
|
82
|
+
|
|
83
|
+
### What to Do When Blocked
|
|
84
|
+
|
|
85
|
+
When no eligible tasks remain (all are blocked or claimed):
|
|
86
|
+
|
|
87
|
+
1. **Document the blocker** — note which task you need and what it produces
|
|
88
|
+
2. **Skip to the next available task** — don't wait idle; there may be non-dependent tasks further down the list
|
|
89
|
+
3. **Look for prep work** — can you write tests, set up scaffolding, or create stubs for the blocked task?
|
|
90
|
+
4. **If truly nothing is available** — report status and wait for new tasks to become unblocked
|
|
91
|
+
|
|
92
|
+
**Never:**
|
|
93
|
+
- Start a blocked task hoping the blocker will finish soon
|
|
94
|
+
- Work on the same task as another agent without coordination
|
|
95
|
+
- Sit idle without communicating status
|
|
96
|
+
|
|
97
|
+
### Conditional Beads Integration
|
|
98
|
+
|
|
99
|
+
Beads is an optional task-tracking tool. Detect its presence and adapt.
|
|
100
|
+
|
|
101
|
+
**When `.beads/` directory exists:**
|
|
102
|
+
- Use `bd ready` to list tasks that are ready for work
|
|
103
|
+
- Use `bd claim <id>` to claim a task (if available)
|
|
104
|
+
- Use `bd close <id>` after PR is merged to mark task complete
|
|
105
|
+
- Task IDs come from Beads (`bd-42`, `bd-43`, etc.)
|
|
106
|
+
- Branch naming follows Beads convention: `bd-<id>/<short-desc>`
|
|
107
|
+
|
|
108
|
+
**Without Beads:**
|
|
109
|
+
- Parse `implementation-plan.md` task list for task IDs and dependencies
|
|
110
|
+
- Or use the project's task tracking system (GitHub Issues, Linear, Jira)
|
|
111
|
+
- Branch naming uses the project's convention (e.g., `feat/US-001-slug`)
|
|
112
|
+
- Task status is tracked via PR state: open PR = in progress, merged PR = done
|
|
113
|
+
|
|
114
|
+
### Task Completion Criteria
|
|
115
|
+
|
|
116
|
+
A task is complete when all of the following are true:
|
|
117
|
+
|
|
118
|
+
1. **All acceptance criteria met** — every criterion listed in the task description is satisfied
|
|
119
|
+
2. **Tests passing** — new tests written for the task, plus the full existing suite, all pass
|
|
120
|
+
3. **PR created** — code is pushed and a pull request is open with a structured description
|
|
121
|
+
4. **CI passing** — all automated quality gates pass on the PR
|
|
122
|
+
5. **No regressions** — existing functionality is unchanged unless the task explicitly modifies it
|
|
123
|
+
|
|
124
|
+
Only after all five criteria are met should the task be marked as done.
|
|
125
|
+
|
|
126
|
+
## See Also
|
|
127
|
+
|
|
128
|
+
- [tdd-execution-loop](./tdd-execution-loop.md) — Red-green-refactor cycle and commit timing
|
|
129
|
+
- [worktree-management](./worktree-management.md) — Parallel agent worktree setup
|
|
130
|
+
- [task-tracking](../core/task-tracking.md) — Task tracking systems and conventions
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd-execution-loop
|
|
3
|
+
description: Red-green-refactor execution cycle for AI agents
|
|
4
|
+
topics: [tdd, execution, testing, workflow]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# TDD Execution Loop
|
|
8
|
+
|
|
9
|
+
Expert knowledge for the core TDD execution loop that AI agents follow during implementation. This defines the disciplined red-green-refactor cycle, commit timing, and test-first practices that ensure every change is verified before it ships.
|
|
10
|
+
|
|
11
|
+
## Summary
|
|
12
|
+
|
|
13
|
+
### Red-Green-Refactor Cycle
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
RED GREEN REFACTOR
|
|
17
|
+
Write a → Write the → Clean up
|
|
18
|
+
failing minimal without
|
|
19
|
+
test code to changing
|
|
20
|
+
pass it behavior
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Each cycle produces one small, verified increment of functionality.
|
|
24
|
+
|
|
25
|
+
### Commit Timing
|
|
26
|
+
|
|
27
|
+
- **Commit after green** — every passing test is a safe checkpoint
|
|
28
|
+
- **Commit after refactor** — clean code locked in before the next feature
|
|
29
|
+
- **Never commit red** — a failing test in history breaks bisect and reverts
|
|
30
|
+
|
|
31
|
+
### Test-First Discipline
|
|
32
|
+
|
|
33
|
+
- Always write the test before the implementation
|
|
34
|
+
- Verify the test actually fails (red) before writing production code
|
|
35
|
+
- A test that never failed might not be testing anything meaningful
|
|
36
|
+
|
|
37
|
+
## Deep Guidance
|
|
38
|
+
|
|
39
|
+
### Red-Green-Refactor Cycle — Extended
|
|
40
|
+
|
|
41
|
+
#### Red Phase: Write a Failing Test
|
|
42
|
+
|
|
43
|
+
Write a test that describes the next small piece of behavior you want to add. Run it and confirm it fails. The failure message should clearly indicate what is missing.
|
|
44
|
+
|
|
45
|
+
**Key rules:**
|
|
46
|
+
- The test must fail for the right reason (missing function, wrong return value — not a syntax error or import failure)
|
|
47
|
+
- Write only one test at a time — don't batch multiple behaviors into a single red phase
|
|
48
|
+
- The test name should describe the expected behavior: `returns 404 when user not found`, not `test user endpoint`
|
|
49
|
+
|
|
50
|
+
#### Green Phase: Minimal Implementation
|
|
51
|
+
|
|
52
|
+
Write the smallest amount of production code that makes the failing test pass. Do not add logic for future tests, handle edge cases you haven't tested yet, or optimize.
|
|
53
|
+
|
|
54
|
+
**Key rules:**
|
|
55
|
+
- If you can make the test pass by returning a hard-coded value, that's valid — the next test will force generalization
|
|
56
|
+
- Don't refactor during the green phase — just make it pass
|
|
57
|
+
- Run the full relevant test suite (not just the new test) to confirm you haven't broken anything
|
|
58
|
+
|
|
59
|
+
#### Refactor Phase: Clean Up
|
|
60
|
+
|
|
61
|
+
With all tests green, improve the code's structure, readability, and design without changing its behavior. The tests are your safety net.
|
|
62
|
+
|
|
63
|
+
**Common refactors:**
|
|
64
|
+
- Extract duplicate code into helper functions
|
|
65
|
+
- Rename variables and functions for clarity
|
|
66
|
+
- Simplify conditionals
|
|
67
|
+
- Move code to better locations (closer to where it's used)
|
|
68
|
+
|
|
69
|
+
**Key rules:**
|
|
70
|
+
- All tests must remain green throughout refactoring
|
|
71
|
+
- If a refactor breaks a test, undo and take a smaller step
|
|
72
|
+
- Commit after a successful refactor before starting the next red phase
|
|
73
|
+
|
|
74
|
+
### When to Commit
|
|
75
|
+
|
|
76
|
+
| Event | Commit? | Why |
|
|
77
|
+
|-------|---------|-----|
|
|
78
|
+
| Test goes green | Yes | Safe checkpoint with verified behavior |
|
|
79
|
+
| Refactor complete, tests still green | Yes | Lock in clean code |
|
|
80
|
+
| Test is red (failing) | No | Broken state in history breaks bisect |
|
|
81
|
+
| Mid-implementation, nothing passes yet | No | Partial work has no verified value |
|
|
82
|
+
| Multiple tests green at once | Yes | But prefer smaller commits |
|
|
83
|
+
|
|
84
|
+
Ideal commit cadence: every 5-15 minutes during active TDD. If you haven't committed in 30 minutes, you're taking too large a step.
|
|
85
|
+
|
|
86
|
+
### PR Creation Patterns
|
|
87
|
+
|
|
88
|
+
- **One PR per task** — a PR should map to a single task, story, or unit of work
|
|
89
|
+
- **Descriptive titles** — `feat(auth): add password reset flow` not `auth changes`
|
|
90
|
+
- **Test evidence in description** — include which tests were added, what they cover, and that they pass
|
|
91
|
+
- **Link to task ID** — reference the task, story, or issue that motivated the work
|
|
92
|
+
- **Small PRs** — prefer 50-200 lines changed; split larger work into sequential PRs
|
|
93
|
+
|
|
94
|
+
### Test-First Discipline — Extended
|
|
95
|
+
|
|
96
|
+
**Why test-first matters:**
|
|
97
|
+
- Forces you to think about the interface before the implementation
|
|
98
|
+
- Prevents writing untestable code (if you can't test it first, the design needs work)
|
|
99
|
+
- Creates a failing test that proves your test actually exercises the code path
|
|
100
|
+
- Produces a test suite where every test has been observed to fail — higher confidence
|
|
101
|
+
|
|
102
|
+
**Common violations to avoid:**
|
|
103
|
+
- Writing implementation first, then adding tests after (tests may not cover the actual behavior)
|
|
104
|
+
- Writing a test that passes immediately (it might be testing the wrong thing)
|
|
105
|
+
- Skipping the red step "because you know the implementation is correct" (hubris)
|
|
106
|
+
|
|
107
|
+
### Handling Flaky Tests
|
|
108
|
+
|
|
109
|
+
Flaky tests — tests that pass sometimes and fail other times — are bugs. Treat them with urgency.
|
|
110
|
+
|
|
111
|
+
**Investigation steps:**
|
|
112
|
+
1. Run the test in isolation 10 times to confirm flakiness
|
|
113
|
+
2. Check for common causes: time-dependent logic, race conditions, shared mutable state, network calls, random data
|
|
114
|
+
3. Fix the root cause, don't add retries
|
|
115
|
+
|
|
116
|
+
**Never:**
|
|
117
|
+
- Add `retry(3)` to make a flaky test pass — this hides the bug
|
|
118
|
+
- Mark as `skip` without filing a tracking issue
|
|
119
|
+
- Ignore flaky tests in CI — they erode trust in the entire suite
|
|
120
|
+
|
|
121
|
+
### Slow Test Suites
|
|
122
|
+
|
|
123
|
+
When the full test suite takes too long for rapid TDD:
|
|
124
|
+
|
|
125
|
+
**During development:**
|
|
126
|
+
- Run only the focused subset (tests for the module you're changing)
|
|
127
|
+
- Use test runner watch mode to re-run on file change
|
|
128
|
+
- Tag tests by level (unit, integration, e2e) and run only unit during red-green-refactor
|
|
129
|
+
|
|
130
|
+
**Before PR creation:**
|
|
131
|
+
- Run the full test suite locally
|
|
132
|
+
- Confirm CI will run the complete suite
|
|
133
|
+
- Don't submit a PR if you haven't verified the full suite passes
|
|
134
|
+
|
|
135
|
+
**Reducing suite time:**
|
|
136
|
+
- Move logic tests from integration/e2e to unit level
|
|
137
|
+
- Parallelize test execution
|
|
138
|
+
- Use transaction rollback instead of database recreation
|
|
139
|
+
- Profile the slowest tests and optimize or split them
|
|
140
|
+
|
|
141
|
+
### Test Isolation
|
|
142
|
+
|
|
143
|
+
Each test must be independent — it should pass or fail regardless of what other tests run before it, after it, or alongside it.
|
|
144
|
+
|
|
145
|
+
**Rules:**
|
|
146
|
+
- No shared mutable state between tests (global variables, class-level state, database rows from a previous test)
|
|
147
|
+
- Each test sets up its own preconditions and cleans up after itself
|
|
148
|
+
- Tests should pass when run individually, in any order, or in parallel
|
|
149
|
+
- Use `beforeEach`/`setUp` for common setup, not test-to-test data flow
|
|
150
|
+
- Avoid `beforeAll`/`setUpClass` unless the shared resource is truly read-only
|
|
151
|
+
|
|
152
|
+
**Detecting isolation violations:**
|
|
153
|
+
- Run tests in random order — if they fail, they have hidden dependencies
|
|
154
|
+
- Run a single test in isolation — if it fails only when run alone, it depends on setup from another test
|
|
155
|
+
|
|
156
|
+
### When to Stop and Ask
|
|
157
|
+
|
|
158
|
+
TDD assumes clear requirements. When requirements are unclear, continuing to write tests is wasteful. Stop and ask when:
|
|
159
|
+
|
|
160
|
+
- **Unclear requirements** — the acceptance criteria are ambiguous or contradictory
|
|
161
|
+
- **Architectural ambiguity** — you're unsure which module should own the behavior
|
|
162
|
+
- **Conflicting documentation** — the PRD says one thing, the user stories say another
|
|
163
|
+
- **Scope creep** — the task is growing beyond what was originally planned
|
|
164
|
+
- **Blocked by another task** — you need output from a task that hasn't been completed yet
|
|
165
|
+
- **Unfamiliar domain** — you don't understand the business rules well enough to write a meaningful test
|
|
166
|
+
|
|
167
|
+
Document what you know, what you don't, and what decision you need — then ask.
|
|
168
|
+
|
|
169
|
+
## See Also
|
|
170
|
+
|
|
171
|
+
- [testing-strategy](../core/testing-strategy.md) — Test pyramid, coverage strategy, quality gates
|
|
172
|
+
- [task-claiming-strategy](./task-claiming-strategy.md) — Task selection and dependency awareness
|