universal-dev-standards 4.2.0 → 5.0.0-beta.10
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 +3 -3
- package/bin/uds.js +165 -5
- package/bundled/core/acceptance-test-driven-development.md +19 -721
- package/bundled/core/accessibility-standards.md +862 -0
- package/bundled/core/ai-agreement-standards.md +95 -0
- package/bundled/core/ai-friendly-architecture.md +2 -0
- package/bundled/core/ai-instruction-standards.md +2 -0
- package/bundled/core/anti-hallucination.md +90 -637
- package/bundled/core/behavior-driven-development.md +20 -735
- package/bundled/core/changelog-standards.md +4 -0
- package/bundled/core/checkin-standards.md +21 -4
- package/bundled/core/code-review-checklist.md +3 -0
- package/bundled/core/commit-message-guide.md +14 -3
- package/bundled/core/deployment-standards.md +296 -0
- package/bundled/core/developer-memory.md +568 -0
- package/bundled/core/documentation-structure.md +114 -18
- package/bundled/core/documentation-writing-standards.md +272 -2
- package/bundled/core/error-code-standards.md +3 -0
- package/bundled/core/forward-derivation-standards.md +134 -8
- package/bundled/core/git-workflow.md +72 -686
- package/bundled/core/guides/anti-hallucination-guide.md +517 -0
- package/bundled/core/guides/git-workflow-guide.md +954 -0
- package/bundled/core/guides/performance-guide.md +508 -0
- package/bundled/core/guides/refactoring-guide.md +608 -0
- package/bundled/core/guides/security-guide.md +485 -0
- package/bundled/core/logging-standards.md +337 -2
- package/bundled/core/performance-standards.md +231 -0
- package/bundled/core/project-context-memory.md +180 -0
- package/bundled/core/project-structure.md +315 -2
- package/bundled/core/refactoring-standards.md +81 -761
- package/bundled/core/requirement-engineering.md +39 -0
- package/bundled/core/reverse-engineering-standards.md +6 -4
- package/bundled/core/security-standards.md +244 -0
- package/bundled/core/spec-driven-development.md +20 -319
- package/bundled/core/test-completeness-dimensions.md +213 -11
- package/bundled/core/test-driven-development.md +22 -978
- package/bundled/core/testing-standards.md +222 -2903
- package/bundled/core/versioning.md +16 -55
- package/bundled/core/virtual-organization-standards.md +85 -0
- package/bundled/locales/README.md +4 -4
- package/bundled/locales/zh-CN/CHANGELOG.md +18 -18
- package/bundled/locales/zh-CN/CLAUDE.md +3 -3
- package/bundled/locales/zh-CN/MAINTENANCE.md +7 -7
- package/bundled/locales/zh-CN/README.md +2 -2
- package/bundled/locales/zh-CN/STANDARDS-MAPPING.md +1 -1
- package/bundled/locales/zh-CN/adoption/ADOPTION-GUIDE.md +3 -3
- package/bundled/locales/zh-CN/adoption/DAILY-WORKFLOW-GUIDE.md +66 -7
- package/bundled/locales/zh-CN/adoption/STATIC-DYNAMIC-GUIDE.md +22 -22
- package/bundled/locales/zh-CN/adoption/checklists/enterprise.md +5 -5
- package/bundled/locales/zh-CN/adoption/checklists/minimal.md +4 -4
- package/bundled/locales/zh-CN/adoption/checklists/recommended.md +5 -5
- package/bundled/locales/zh-CN/ai/MAINTENANCE.md +13 -13
- package/bundled/locales/zh-CN/core/ai-instruction-standards.md +1 -1
- package/bundled/locales/zh-CN/core/anti-hallucination.md +39 -3
- package/bundled/locales/zh-CN/core/checkin-standards.md +18 -5
- package/bundled/locales/zh-CN/core/commit-message-guide.md +1 -1
- package/bundled/locales/zh-CN/core/developer-memory.md +576 -0
- package/bundled/locales/zh-CN/core/documentation-structure.md +43 -5
- package/bundled/locales/zh-CN/core/documentation-writing-standards.md +146 -5
- package/bundled/locales/zh-CN/core/git-workflow.md +179 -4
- package/bundled/locales/zh-CN/core/logging-standards.md +177 -4
- package/bundled/locales/zh-CN/core/project-structure.md +117 -5
- package/bundled/locales/zh-CN/core/refactoring-standards.md +3 -3
- package/bundled/locales/zh-CN/core/reverse-engineering-standards.md +6 -6
- package/bundled/locales/zh-CN/core/spec-driven-development.md +516 -14
- package/bundled/locales/zh-CN/core/test-completeness-dimensions.md +155 -24
- package/bundled/locales/zh-CN/core/test-driven-development.md +71 -20
- package/bundled/locales/zh-CN/core/testing-standards.md +4 -4
- package/bundled/locales/zh-CN/core/versioning.md +1 -1
- package/bundled/locales/zh-CN/docs/AI-AGENT-ROADMAP.md +90 -51
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +184 -0
- package/bundled/locales/zh-CN/docs/CLI-FLOW.md +239 -0
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +320 -0
- package/bundled/locales/zh-CN/docs/OPERATION-WORKFLOW.md +43 -43
- package/bundled/locales/zh-CN/docs/STANDARDS-REFERENCE.md +440 -0
- package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +1 -1
- package/bundled/locales/zh-CN/docs/WINDOWS-GUIDE.md +1 -1
- package/bundled/locales/zh-CN/integrations/codex/README.md +3 -3
- package/bundled/locales/zh-CN/integrations/gemini-cli/README.md +3 -3
- package/bundled/locales/zh-CN/integrations/github-copilot/README.md +5 -5
- package/bundled/locales/zh-CN/integrations/github-copilot/copilot-instructions.md +9 -9
- package/bundled/locales/zh-CN/integrations/github-copilot/skills-mapping.md +18 -6
- package/bundled/locales/zh-CN/integrations/google-antigravity/README.md +2 -2
- package/bundled/locales/zh-CN/integrations/opencode/README.md +3 -3
- package/bundled/locales/zh-CN/integrations/opencode/skills-mapping.md +22 -10
- package/bundled/locales/zh-CN/integrations/openspec/README.md +1 -1
- package/bundled/locales/zh-CN/integrations/spec-kit/AGENTS.md +3 -3
- package/bundled/locales/zh-CN/integrations/spec-kit/README.md +1 -1
- package/bundled/locales/zh-CN/options/commit-message/bilingual.md +1 -1
- package/bundled/locales/zh-CN/options/commit-message/english.md +1 -1
- package/bundled/locales/zh-CN/options/commit-message/traditional-chinese.md +1 -1
- package/bundled/locales/zh-CN/options/git-workflow/gitflow.md +1 -1
- package/bundled/locales/zh-CN/options/git-workflow/github-flow.md +1 -1
- package/bundled/locales/zh-CN/options/git-workflow/merge-commit.md +1 -1
- package/bundled/locales/zh-CN/options/git-workflow/rebase-ff.md +1 -1
- package/bundled/locales/zh-CN/options/git-workflow/squash-merge.md +1 -1
- package/bundled/locales/zh-CN/options/git-workflow/trunk-based.md +1 -1
- package/bundled/locales/zh-CN/options/project-structure/dotnet.md +1 -1
- package/bundled/locales/zh-CN/options/project-structure/go.md +1 -1
- package/bundled/locales/zh-CN/options/project-structure/java.md +1 -1
- package/bundled/locales/zh-CN/options/project-structure/nodejs.md +1 -1
- package/bundled/locales/zh-CN/options/project-structure/python.md +1 -1
- package/bundled/locales/zh-CN/options/testing/e2e-testing.md +1 -1
- package/bundled/locales/zh-CN/options/testing/integration-testing.md +1 -1
- package/bundled/locales/zh-CN/options/testing/system-testing.md +1 -1
- package/bundled/locales/zh-CN/options/testing/unit-testing.md +1 -1
- package/bundled/locales/zh-CN/skills/{claude-code/CONTRIBUTING.template.md → CONTRIBUTING.template.md} +2 -2
- package/bundled/locales/zh-CN/skills/README.md +131 -81
- package/bundled/locales/zh-CN/skills/agents/README.md +281 -0
- package/bundled/locales/zh-CN/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/SKILL.md +10 -10
- package/bundled/locales/zh-CN/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/anti-hallucination.md +8 -8
- package/bundled/locales/zh-CN/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/certainty-labels.md +8 -8
- package/bundled/locales/zh-CN/skills/ai-friendly-architecture/SKILL.md +221 -0
- package/bundled/locales/zh-CN/skills/ai-instruction-standards/SKILL.md +214 -0
- package/bundled/locales/zh-CN/skills/atdd-assistant/SKILL.md +71 -0
- package/bundled/locales/zh-CN/skills/atdd-assistant/acceptance-criteria-guide.md +428 -0
- package/bundled/locales/zh-CN/skills/atdd-assistant/atdd-workflow.md +484 -0
- package/bundled/locales/zh-CN/skills/atdd-assistant/guide.md +368 -0
- package/bundled/locales/zh-CN/skills/bdd-assistant/SKILL.md +68 -0
- package/bundled/locales/zh-CN/skills/bdd-assistant/bdd-workflow.md +406 -0
- package/bundled/locales/zh-CN/skills/bdd-assistant/gherkin-guide.md +454 -0
- package/bundled/locales/zh-CN/skills/bdd-assistant/guide.md +324 -0
- package/bundled/locales/zh-CN/skills/changelog-guide/SKILL.md +64 -0
- package/bundled/locales/zh-CN/skills/{claude-code/changelog-guide/SKILL.md → changelog-guide/guide.md} +6 -7
- package/bundled/locales/zh-CN/skills/checkin-assistant/SKILL.md +56 -0
- package/bundled/locales/zh-CN/skills/{claude-code/checkin-assistant/SKILL.md → checkin-assistant/guide.md} +6 -7
- package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +56 -0
- package/bundled/locales/zh-CN/skills/{claude-code/code-review-assistant → code-review-assistant}/checkin-checklist.md +4 -4
- package/bundled/locales/zh-CN/skills/{claude-code/code-review-assistant/SKILL.md → code-review-assistant/guide.md} +5 -6
- package/bundled/locales/zh-CN/skills/{claude-code/code-review-assistant → code-review-assistant}/review-checklist.md +4 -4
- package/bundled/locales/zh-CN/skills/{claude-code/commands → commands}/bdd.md +2 -2
- package/bundled/locales/zh-CN/skills/{claude-code/commands → commands}/methodology.md +3 -3
- package/bundled/locales/zh-CN/skills/{claude-code/commands → commands}/refactor.md +3 -3
- package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +61 -0
- package/bundled/locales/zh-CN/skills/{claude-code/commit-standards → commit-standards}/conventional-commits.md +4 -4
- package/bundled/locales/zh-CN/skills/{claude-code/commit-standards/SKILL.md → commit-standards/guide.md} +5 -6
- package/bundled/locales/zh-CN/skills/{claude-code/commit-standards → commit-standards}/language-options.md +3 -3
- package/bundled/locales/zh-CN/skills/docs-generator/SKILL.md +59 -0
- package/bundled/locales/zh-CN/skills/docs-generator/guide.md +262 -0
- package/bundled/locales/zh-CN/skills/{claude-code/documentation-guide → documentation-guide}/SKILL.md +7 -8
- package/bundled/locales/zh-CN/skills/{claude-code/documentation-guide → documentation-guide}/documentation-structure.md +4 -4
- package/bundled/locales/zh-CN/skills/{claude-code/documentation-guide → documentation-guide}/readme-template.md +3 -3
- package/bundled/locales/zh-CN/skills/{claude-code/error-code-guide → error-code-guide}/SKILL.md +6 -6
- package/bundled/locales/zh-CN/skills/forward-derivation/SKILL.md +62 -0
- package/bundled/locales/zh-CN/skills/forward-derivation/guide.md +130 -0
- package/bundled/locales/zh-CN/skills/{claude-code/git-workflow-guide → git-workflow-guide}/SKILL.md +6 -6
- package/bundled/locales/zh-CN/skills/{claude-code/git-workflow-guide → git-workflow-guide}/branch-naming.md +3 -3
- package/bundled/locales/zh-CN/skills/{claude-code/git-workflow-guide → git-workflow-guide}/git-workflow.md +4 -4
- package/bundled/locales/zh-CN/skills/{claude-code/logging-guide → logging-guide}/SKILL.md +6 -6
- package/bundled/locales/zh-CN/skills/methodology-system/SKILL.md +78 -0
- package/bundled/locales/zh-CN/skills/{claude-code/methodology-system → methodology-system}/create-methodology.md +2 -2
- package/bundled/locales/zh-CN/skills/{claude-code/methodology-system/SKILL.md → methodology-system/guide.md} +2 -2
- package/bundled/locales/zh-CN/skills/{claude-code/methodology-system → methodology-system}/runtime.md +3 -3
- package/bundled/locales/zh-CN/skills/project-discovery/SKILL.md +66 -0
- package/bundled/locales/zh-CN/skills/project-discovery/guide.md +371 -0
- package/bundled/locales/zh-CN/skills/{claude-code/project-structure-guide → project-structure-guide}/SKILL.md +4 -4
- package/bundled/locales/zh-CN/skills/{claude-code/project-structure-guide → project-structure-guide}/language-patterns.md +1 -1
- package/bundled/locales/zh-CN/skills/refactoring-assistant/SKILL.md +67 -0
- package/bundled/locales/zh-CN/skills/{claude-code/refactoring-assistant/SKILL.md → refactoring-assistant/guide.md} +7 -8
- package/bundled/locales/zh-CN/skills/release-standards/SKILL.md +64 -0
- package/bundled/locales/zh-CN/skills/{claude-code/release-standards → release-standards}/changelog-format.md +3 -3
- package/bundled/locales/zh-CN/skills/{claude-code/release-standards/SKILL.md → release-standards/guide.md} +5 -6
- package/bundled/locales/zh-CN/skills/{claude-code/release-standards → release-standards}/release-workflow.md +7 -7
- package/bundled/locales/zh-CN/skills/{claude-code/release-standards → release-standards}/semantic-versioning.md +3 -3
- package/bundled/locales/zh-CN/skills/requirement-assistant/SKILL.md +67 -0
- package/bundled/locales/zh-CN/skills/{claude-code/requirement-assistant/SKILL.md → requirement-assistant/guide.md} +4 -5
- package/bundled/locales/zh-CN/skills/{claude-code/requirement-assistant → requirement-assistant}/requirement-checklist.md +3 -3
- package/bundled/locales/zh-CN/skills/{claude-code/requirement-assistant → requirement-assistant}/requirement-writing.md +3 -3
- package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +67 -0
- package/bundled/locales/zh-CN/skills/{claude-code/reverse-engineer → reverse-engineer}/bdd-extraction.md +2 -2
- package/bundled/locales/zh-CN/skills/{claude-code/reverse-engineer/SKILL.md → reverse-engineer/guide.md} +17 -18
- package/bundled/locales/zh-CN/skills/{claude-code/reverse-engineer → reverse-engineer}/tdd-analysis.md +2 -2
- package/bundled/locales/zh-CN/skills/{claude-code/reverse-engineer → reverse-engineer}/workflow.md +3 -3
- package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +75 -0
- package/bundled/locales/zh-CN/skills/{claude-code/spec-driven-dev/SKILL.md → spec-driven-dev/guide.md} +10 -11
- package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +66 -0
- package/bundled/locales/zh-CN/skills/{claude-code/tdd-assistant/SKILL.md → tdd-assistant/guide.md} +12 -16
- package/bundled/locales/zh-CN/skills/{claude-code/tdd-assistant → tdd-assistant}/language-examples.md +3 -3
- package/bundled/locales/zh-CN/skills/{claude-code/tdd-assistant → tdd-assistant}/tdd-workflow.md +3 -3
- package/bundled/locales/zh-CN/skills/test-coverage-assistant/SKILL.md +65 -0
- package/bundled/locales/zh-CN/skills/test-coverage-assistant/guide.md +284 -0
- package/bundled/locales/zh-CN/skills/{claude-code/testing-guide → testing-guide}/SKILL.md +8 -8
- package/bundled/locales/zh-CN/skills/{claude-code/testing-guide → testing-guide}/testing-pyramid.md +4 -4
- package/bundled/locales/zh-CN/skills/{cline → tools/cline}/README.md +1 -1
- package/bundled/locales/zh-CN/skills/{copilot → tools/copilot}/README.md +1 -1
- package/bundled/locales/zh-CN/skills/{copilot → tools/copilot}/copilot-instructions.md +1 -1
- package/bundled/locales/zh-CN/skills/{cursor → tools/cursor}/README.md +1 -1
- package/bundled/locales/zh-CN/skills/{windsurf → tools/windsurf}/README.md +1 -1
- package/bundled/locales/zh-TW/CHANGELOG.md +16 -16
- package/bundled/locales/zh-TW/CLAUDE.md +3 -3
- package/bundled/locales/zh-TW/MAINTENANCE.md +7 -7
- package/bundled/locales/zh-TW/README.md +13 -7
- package/bundled/locales/zh-TW/STANDARDS-MAPPING.md +1 -1
- package/bundled/locales/zh-TW/adoption/ADOPTION-GUIDE.md +4 -4
- package/bundled/locales/zh-TW/adoption/DAILY-WORKFLOW-GUIDE.md +66 -7
- package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +22 -22
- package/bundled/locales/zh-TW/adoption/checklists/enterprise.md +5 -5
- package/bundled/locales/zh-TW/adoption/checklists/minimal.md +4 -4
- package/bundled/locales/zh-TW/adoption/checklists/recommended.md +5 -5
- package/bundled/locales/zh-TW/ai/MAINTENANCE.md +13 -13
- package/bundled/locales/zh-TW/ai/standards/anti-hallucination.ai.yaml +3 -2
- package/bundled/locales/zh-TW/ai/standards/git-workflow.ai.yaml +4 -3
- package/bundled/locales/zh-TW/ai/standards/spec-driven-development.ai.yaml +3 -3
- package/bundled/locales/zh-TW/ai/standards/testing.ai.yaml +1 -0
- package/bundled/locales/zh-TW/core/ai-instruction-standards.md +1 -1
- package/bundled/locales/zh-TW/core/anti-hallucination.md +38 -701
- package/bundled/locales/zh-TW/core/changelog-standards.md +1 -1
- package/bundled/locales/zh-TW/core/checkin-standards.md +18 -5
- package/bundled/locales/zh-TW/core/code-review-checklist.md +1 -1
- package/bundled/locales/zh-TW/core/commit-message-guide.md +1 -1
- package/bundled/locales/zh-TW/core/developer-memory.md +576 -0
- package/bundled/locales/zh-TW/core/documentation-structure.md +115 -22
- package/bundled/locales/zh-TW/core/documentation-writing-standards.md +126 -5
- package/bundled/locales/zh-TW/core/forward-derivation-standards.md +2 -2
- package/bundled/locales/zh-TW/core/git-workflow.md +38 -812
- package/bundled/locales/zh-TW/core/guides/anti-hallucination-guide.md +779 -0
- package/bundled/locales/zh-TW/core/guides/git-workflow-guide.md +1016 -0
- package/bundled/locales/zh-TW/core/guides/refactoring-guide.md +864 -0
- package/bundled/locales/zh-TW/core/guides/testing-guide.md +2280 -0
- package/bundled/locales/zh-TW/core/logging-standards.md +159 -4
- package/bundled/locales/zh-TW/core/project-structure.md +102 -9
- package/bundled/locales/zh-TW/core/refactoring-standards.md +37 -823
- package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +6 -6
- package/bundled/locales/zh-TW/core/spec-driven-development.md +17 -268
- package/bundled/locales/zh-TW/core/test-completeness-dimensions.md +128 -14
- package/bundled/locales/zh-TW/core/test-driven-development.md +20 -983
- package/bundled/locales/zh-TW/core/testing-standards.md +120 -2105
- package/bundled/locales/zh-TW/core/versioning.md +13 -55
- package/bundled/locales/zh-TW/docs/AI-AGENT-ROADMAP.md +90 -51
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +184 -0
- package/bundled/locales/zh-TW/docs/CLI-FLOW.md +239 -0
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +320 -0
- package/bundled/locales/zh-TW/docs/MIGRATION-V5.md +71 -0
- package/bundled/locales/zh-TW/docs/OPERATION-WORKFLOW.md +42 -42
- package/bundled/locales/zh-TW/docs/STANDARDS-REFERENCE.md +440 -0
- package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +1 -1
- package/bundled/locales/zh-TW/docs/WINDOWS-GUIDE.md +1 -1
- package/bundled/locales/zh-TW/integrations/claude-code/README.md +44 -0
- package/bundled/locales/zh-TW/integrations/github-copilot/copilot-instructions.md +3 -3
- package/bundled/locales/zh-TW/integrations/github-copilot/skills-mapping.md +18 -6
- package/bundled/locales/zh-TW/integrations/opencode/skills-mapping.md +22 -10
- package/bundled/locales/zh-TW/methodologies/guides/sdd-guide.md +338 -0
- package/bundled/locales/zh-TW/methodologies/guides/tdd-guide.md +1055 -0
- package/bundled/locales/zh-TW/options/commit-message/bilingual.md +1 -1
- package/bundled/locales/zh-TW/options/commit-message/english.md +1 -1
- package/bundled/locales/zh-TW/options/commit-message/traditional-chinese.md +1 -1
- package/bundled/locales/zh-TW/options/git-workflow/gitflow.md +1 -1
- package/bundled/locales/zh-TW/options/git-workflow/github-flow.md +1 -1
- package/bundled/locales/zh-TW/options/git-workflow/merge-commit.md +1 -1
- package/bundled/locales/zh-TW/options/git-workflow/rebase-ff.md +1 -1
- package/bundled/locales/zh-TW/options/git-workflow/squash-merge.md +1 -1
- package/bundled/locales/zh-TW/options/git-workflow/trunk-based.md +1 -1
- package/bundled/locales/zh-TW/options/project-structure/dotnet.md +1 -1
- package/bundled/locales/zh-TW/options/project-structure/go.md +1 -1
- package/bundled/locales/zh-TW/options/project-structure/java.md +1 -1
- package/bundled/locales/zh-TW/options/project-structure/nodejs.md +1 -1
- package/bundled/locales/zh-TW/options/project-structure/python.md +1 -1
- package/bundled/locales/zh-TW/options/testing/e2e-testing.md +1 -1
- package/bundled/locales/zh-TW/options/testing/integration-testing.md +1 -1
- package/bundled/locales/zh-TW/options/testing/system-testing.md +1 -1
- package/bundled/locales/zh-TW/options/testing/unit-testing.md +1 -1
- package/bundled/locales/zh-TW/skills/{claude-code/CONTRIBUTING.template.md → CONTRIBUTING.template.md} +2 -2
- package/bundled/locales/zh-TW/skills/README.md +131 -79
- package/bundled/locales/zh-TW/skills/agents/README.md +281 -0
- package/bundled/locales/zh-TW/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/SKILL.md +7 -7
- package/bundled/locales/zh-TW/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/anti-hallucination.md +8 -8
- package/bundled/locales/zh-TW/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/certainty-labels.md +8 -8
- package/bundled/locales/zh-TW/skills/ai-friendly-architecture/SKILL.md +221 -0
- package/bundled/locales/zh-TW/skills/ai-instruction-standards/SKILL.md +214 -0
- package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +71 -0
- package/bundled/locales/zh-TW/skills/atdd-assistant/acceptance-criteria-guide.md +428 -0
- package/bundled/locales/zh-TW/skills/atdd-assistant/atdd-workflow.md +484 -0
- package/bundled/locales/zh-TW/skills/atdd-assistant/guide.md +368 -0
- package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +68 -0
- package/bundled/locales/zh-TW/skills/bdd-assistant/bdd-workflow.md +406 -0
- package/bundled/locales/zh-TW/skills/bdd-assistant/gherkin-guide.md +454 -0
- package/bundled/locales/zh-TW/skills/bdd-assistant/guide.md +324 -0
- package/bundled/locales/zh-TW/skills/changelog-guide/SKILL.md +64 -0
- package/bundled/locales/zh-TW/skills/{claude-code/changelog-guide/SKILL.md → changelog-guide/guide.md} +6 -7
- package/bundled/locales/zh-TW/skills/checkin-assistant/SKILL.md +56 -0
- package/bundled/locales/zh-TW/skills/{claude-code/checkin-assistant/SKILL.md → checkin-assistant/guide.md} +6 -7
- package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +56 -0
- package/bundled/locales/zh-TW/skills/{claude-code/code-review-assistant → code-review-assistant}/checkin-checklist.md +4 -4
- package/bundled/locales/zh-TW/skills/{claude-code/code-review-assistant/SKILL.md → code-review-assistant/guide.md} +2 -3
- package/bundled/locales/zh-TW/skills/{claude-code/code-review-assistant → code-review-assistant}/review-checklist.md +4 -4
- package/bundled/locales/zh-TW/skills/{claude-code/commands → commands}/bdd.md +2 -2
- package/bundled/locales/zh-TW/skills/{claude-code/commands → commands}/methodology.md +3 -3
- package/bundled/locales/zh-TW/skills/{claude-code/commands → commands}/refactor.md +3 -3
- package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +61 -0
- package/bundled/locales/zh-TW/skills/{claude-code/commit-standards → commit-standards}/conventional-commits.md +4 -4
- package/bundled/locales/zh-TW/skills/{claude-code/commit-standards/SKILL.md → commit-standards/guide.md} +5 -6
- package/bundled/locales/zh-TW/skills/{claude-code/commit-standards → commit-standards}/language-options.md +3 -3
- package/bundled/locales/zh-TW/skills/docs-generator/SKILL.md +59 -0
- package/bundled/locales/zh-TW/skills/docs-generator/guide.md +262 -0
- package/bundled/locales/zh-TW/skills/{claude-code/documentation-guide → documentation-guide}/SKILL.md +7 -8
- package/bundled/locales/zh-TW/skills/{claude-code/documentation-guide → documentation-guide}/documentation-structure.md +4 -4
- package/bundled/locales/zh-TW/skills/{claude-code/documentation-guide → documentation-guide}/readme-template.md +3 -3
- package/bundled/locales/zh-TW/skills/{claude-code/error-code-guide → error-code-guide}/SKILL.md +6 -6
- package/bundled/locales/zh-TW/skills/forward-derivation/SKILL.md +62 -0
- package/bundled/locales/zh-TW/skills/{claude-code/forward-derivation/SKILL.md → forward-derivation/guide.md} +24 -19
- package/bundled/locales/zh-TW/skills/{claude-code/git-workflow-guide → git-workflow-guide}/SKILL.md +3 -3
- package/bundled/locales/zh-TW/skills/{claude-code/git-workflow-guide → git-workflow-guide}/branch-naming.md +3 -3
- package/bundled/locales/zh-TW/skills/{claude-code/git-workflow-guide → git-workflow-guide}/git-workflow.md +4 -4
- package/bundled/locales/zh-TW/skills/{claude-code/logging-guide → logging-guide}/SKILL.md +6 -6
- package/bundled/locales/zh-TW/skills/methodology-system/SKILL.md +78 -0
- package/bundled/locales/zh-TW/skills/{claude-code/methodology-system → methodology-system}/create-methodology.md +2 -2
- package/bundled/locales/zh-TW/skills/{claude-code/methodology-system/SKILL.md → methodology-system/guide.md} +2 -2
- package/bundled/locales/zh-TW/skills/{claude-code/methodology-system → methodology-system}/runtime.md +3 -3
- package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +66 -0
- package/bundled/locales/zh-TW/skills/project-discovery/guide.md +371 -0
- package/bundled/locales/zh-TW/skills/project-discovery/workflow.md +574 -0
- package/bundled/locales/zh-TW/skills/{claude-code/project-structure-guide → project-structure-guide}/SKILL.md +4 -4
- package/bundled/locales/zh-TW/skills/{claude-code/project-structure-guide → project-structure-guide}/language-patterns.md +1 -1
- package/bundled/locales/zh-TW/skills/refactoring-assistant/SKILL.md +67 -0
- package/bundled/locales/zh-TW/skills/{claude-code/refactoring-assistant/SKILL.md → refactoring-assistant/guide.md} +7 -8
- package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +64 -0
- package/bundled/locales/zh-TW/skills/{claude-code/release-standards → release-standards}/changelog-format.md +3 -3
- package/bundled/locales/zh-TW/skills/{claude-code/release-standards/SKILL.md → release-standards/guide.md} +2 -3
- package/bundled/locales/zh-TW/skills/{claude-code/release-standards → release-standards}/release-workflow.md +60 -28
- package/bundled/locales/zh-TW/skills/{claude-code/release-standards → release-standards}/semantic-versioning.md +3 -3
- package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +67 -0
- package/bundled/locales/zh-TW/skills/{claude-code/requirement-assistant/SKILL.md → requirement-assistant/guide.md} +2 -3
- package/bundled/locales/zh-TW/skills/{claude-code/requirement-assistant → requirement-assistant}/requirement-checklist.md +3 -3
- package/bundled/locales/zh-TW/skills/{claude-code/requirement-assistant → requirement-assistant}/requirement-writing.md +3 -3
- package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +67 -0
- package/bundled/locales/zh-TW/skills/{claude-code/reverse-engineer → reverse-engineer}/bdd-extraction.md +2 -2
- package/bundled/locales/zh-TW/skills/{claude-code/reverse-engineer/SKILL.md → reverse-engineer/guide.md} +17 -18
- package/bundled/locales/zh-TW/skills/{claude-code/reverse-engineer → reverse-engineer}/tdd-analysis.md +2 -2
- package/bundled/locales/zh-TW/skills/{claude-code/reverse-engineer → reverse-engineer}/workflow.md +3 -3
- package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +75 -0
- package/bundled/locales/zh-TW/skills/{claude-code/spec-driven-dev/SKILL.md → spec-driven-dev/guide.md} +9 -10
- package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +66 -0
- package/bundled/locales/zh-TW/skills/{claude-code/tdd-assistant/SKILL.md → tdd-assistant/guide.md} +9 -10
- package/bundled/locales/zh-TW/skills/{claude-code/tdd-assistant → tdd-assistant}/language-examples.md +3 -3
- package/bundled/locales/zh-TW/skills/{claude-code/tdd-assistant → tdd-assistant}/tdd-workflow.md +3 -3
- package/bundled/locales/zh-TW/skills/test-coverage-assistant/SKILL.md +65 -0
- package/bundled/locales/zh-TW/skills/{claude-code/test-coverage-assistant/SKILL.md → test-coverage-assistant/guide.md} +27 -24
- package/bundled/locales/zh-TW/skills/{claude-code/testing-guide → testing-guide}/SKILL.md +6 -6
- package/bundled/locales/zh-TW/skills/{claude-code/testing-guide → testing-guide}/testing-pyramid.md +4 -4
- package/bundled/locales/zh-TW/skills/{cline → tools/cline}/README.md +1 -1
- package/bundled/locales/zh-TW/skills/{copilot → tools/copilot}/README.md +1 -1
- package/bundled/locales/zh-TW/skills/{copilot → tools/copilot}/copilot-instructions.md +1 -1
- package/bundled/locales/zh-TW/skills/{cursor → tools/cursor}/README.md +1 -1
- package/bundled/locales/zh-TW/skills/{windsurf → tools/windsurf}/README.md +1 -1
- package/bundled/skills/INTEGRATION-GUIDE.md +210 -0
- package/bundled/skills/README.md +95 -0
- package/bundled/skills/_shared/README.md +60 -0
- package/bundled/skills/{claude-code/agents → agents}/README.md +2 -2
- package/bundled/skills/{claude-code/agents → agents}/code-architect.md +1 -1
- package/bundled/skills/{claude-code/agents → agents}/doc-writer.md +1 -1
- package/bundled/skills/{claude-code/agents → agents}/reviewer.md +1 -1
- package/bundled/skills/{claude-code/agents → agents}/spec-analyst.md +1 -1
- package/bundled/skills/{claude-code/agents → agents}/test-specialist.md +1 -1
- package/bundled/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/SKILL.md +28 -5
- package/bundled/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/anti-hallucination.md +24 -5
- package/bundled/skills/{claude-code/ai-collaboration-standards → ai-collaboration-standards}/certainty-labels.md +31 -6
- package/bundled/skills/ai-friendly-architecture/SKILL.md +216 -0
- package/bundled/skills/ai-instruction-standards/SKILL.md +209 -0
- package/bundled/skills/atdd-assistant/SKILL.md +74 -0
- package/bundled/skills/{claude-code/atdd-assistant → atdd-assistant}/acceptance-criteria-guide.md +1 -1
- package/bundled/skills/{claude-code/atdd-assistant → atdd-assistant}/atdd-workflow.md +1 -1
- package/bundled/skills/{claude-code/atdd-assistant/SKILL.md → atdd-assistant/guide.md} +11 -11
- package/bundled/skills/bdd-assistant/SKILL.md +70 -0
- package/bundled/skills/{claude-code/bdd-assistant → bdd-assistant}/bdd-workflow.md +1 -1
- package/bundled/skills/{claude-code/bdd-assistant → bdd-assistant}/gherkin-guide.md +1 -1
- package/bundled/skills/{claude-code/bdd-assistant/SKILL.md → bdd-assistant/guide.md} +11 -11
- package/bundled/skills/changelog-guide/SKILL.md +66 -0
- package/bundled/skills/{claude-code/changelog-guide/SKILL.md → changelog-guide/guide.md} +8 -6
- package/bundled/skills/checkin-assistant/SKILL.md +52 -0
- package/bundled/skills/{claude-code/checkin-assistant/SKILL.md → checkin-assistant/guide.md} +6 -6
- package/bundled/skills/code-review-assistant/SKILL.md +53 -0
- package/bundled/skills/{claude-code/code-review-assistant → code-review-assistant}/checkin-checklist.md +3 -3
- package/bundled/skills/{claude-code/code-review-assistant/SKILL.md → code-review-assistant/guide.md} +7 -5
- package/bundled/skills/{claude-code/code-review-assistant → code-review-assistant}/review-checklist.md +3 -3
- package/bundled/skills/commands/COMMAND-FAMILY-OVERVIEW.md +290 -0
- package/bundled/skills/{claude-code/commands → commands}/README.md +13 -3
- package/bundled/skills/{claude-code/commands → commands}/atdd.md +3 -3
- package/bundled/skills/{claude-code/commands → commands}/bdd.md +2 -2
- package/bundled/skills/commands/changelog.md +58 -0
- package/bundled/skills/{claude-code/commands → commands}/check.md +1 -1
- package/bundled/skills/commands/checkin.md +53 -0
- package/bundled/skills/{claude-code/commands → commands}/commit.md +3 -3
- package/bundled/skills/{claude-code/commands → commands}/config.md +1 -1
- package/bundled/skills/{claude-code/commands → commands}/coverage.md +5 -4
- package/bundled/skills/commands/derive-all.md +53 -0
- package/bundled/skills/commands/derive-atdd.md +49 -0
- package/bundled/skills/commands/derive-bdd.md +47 -0
- package/bundled/skills/commands/derive-tdd.md +48 -0
- package/bundled/skills/commands/derive.md +72 -0
- package/bundled/skills/commands/discover.md +80 -0
- package/bundled/skills/commands/docgen.md +61 -0
- package/bundled/skills/commands/docs.md +59 -0
- package/bundled/skills/commands/guide.md +44 -0
- package/bundled/skills/{claude-code/commands → commands}/init.md +2 -2
- package/bundled/skills/{claude-code/commands → commands}/methodology.md +32 -16
- package/bundled/skills/{claude-code/commands → commands}/refactor.md +2 -2
- package/bundled/skills/commands/release.md +56 -0
- package/bundled/skills/{claude-code/commands → commands}/requirement.md +3 -3
- package/bundled/skills/commands/reverse-bdd.md +47 -0
- package/bundled/skills/commands/reverse-sdd.md +51 -0
- package/bundled/skills/commands/reverse-tdd.md +51 -0
- package/bundled/skills/commands/reverse.md +63 -0
- package/bundled/skills/{claude-code/commands → commands}/review.md +3 -3
- package/bundled/skills/commands/sdd.md +135 -0
- package/bundled/skills/{claude-code/commands → commands}/tdd.md +3 -3
- package/bundled/skills/{claude-code/commands → commands}/update.md +2 -2
- package/bundled/skills/commit-standards/SKILL.md +60 -0
- package/bundled/skills/{claude-code/commit-standards → commit-standards}/conventional-commits.md +3 -3
- package/bundled/skills/{claude-code/commit-standards/SKILL.md → commit-standards/guide.md} +17 -5
- package/bundled/skills/{claude-code/commit-standards → commit-standards}/language-options.md +2 -2
- package/bundled/skills/docs-generator/SKILL.md +69 -0
- package/bundled/skills/docs-generator/guide.md +258 -0
- package/bundled/skills/{claude-code/documentation-guide → documentation-guide}/SKILL.md +7 -7
- package/bundled/skills/{claude-code/documentation-guide → documentation-guide}/documentation-structure.md +3 -3
- package/bundled/skills/{claude-code/documentation-guide → documentation-guide}/readme-template.md +2 -2
- package/bundled/skills/{claude-code/error-code-guide → error-code-guide}/SKILL.md +7 -5
- package/bundled/skills/forward-derivation/SKILL.md +61 -0
- package/bundled/skills/{claude-code/forward-derivation/SKILL.md → forward-derivation/guide.md} +44 -29
- package/bundled/skills/{claude-code/git-workflow-guide → git-workflow-guide}/SKILL.md +7 -5
- package/bundled/skills/{claude-code/git-workflow-guide → git-workflow-guide}/branch-naming.md +2 -2
- package/bundled/skills/{claude-code/git-workflow-guide → git-workflow-guide}/git-workflow.md +3 -3
- package/bundled/skills/{claude-code/logging-guide → logging-guide}/SKILL.md +7 -5
- package/bundled/skills/methodology-system/SKILL.md +75 -0
- package/bundled/skills/{claude-code/methodology-system → methodology-system}/create-methodology.md +1 -1
- package/bundled/skills/{claude-code/methodology-system/SKILL.md → methodology-system/guide.md} +51 -16
- package/bundled/skills/methodology-system/integrated-flow.md +454 -0
- package/bundled/skills/{claude-code/methodology-system → methodology-system}/runtime.md +2 -2
- package/bundled/skills/project-discovery/SKILL.md +63 -0
- package/bundled/skills/project-discovery/guide.md +367 -0
- package/bundled/skills/project-discovery/workflow.md +566 -0
- package/bundled/skills/{claude-code/project-structure-guide → project-structure-guide}/SKILL.md +14 -4
- package/bundled/skills/refactoring-assistant/SKILL.md +78 -0
- package/bundled/skills/{claude-code/refactoring-assistant/SKILL.md → refactoring-assistant/guide.md} +7 -7
- package/bundled/skills/release-standards/SKILL.md +61 -0
- package/bundled/skills/{claude-code/release-standards → release-standards}/changelog-format.md +2 -2
- package/bundled/skills/{claude-code/release-standards/SKILL.md → release-standards/guide.md} +7 -5
- package/bundled/skills/{claude-code/release-standards → release-standards}/release-workflow.md +59 -24
- package/bundled/skills/{claude-code/release-standards → release-standards}/semantic-versioning.md +2 -2
- package/bundled/skills/requirement-assistant/SKILL.md +66 -0
- package/bundled/skills/{claude-code/requirement-assistant/SKILL.md → requirement-assistant/guide.md} +14 -6
- package/bundled/skills/{claude-code/requirement-assistant → requirement-assistant}/requirement-checklist.md +2 -2
- package/bundled/skills/{claude-code/requirement-assistant → requirement-assistant}/requirement-writing.md +2 -2
- package/bundled/skills/reverse-engineer/SKILL.md +64 -0
- package/bundled/skills/{claude-code/reverse-engineer → reverse-engineer}/bdd-extraction.md +1 -1
- package/bundled/skills/{claude-code/reverse-engineer/SKILL.md → reverse-engineer/guide.md} +21 -18
- package/bundled/skills/{claude-code/reverse-engineer → reverse-engineer}/tdd-analysis.md +1 -1
- package/bundled/skills/{claude-code/reverse-engineer → reverse-engineer}/workflow.md +2 -2
- package/bundled/skills/spec-driven-dev/SKILL.md +80 -0
- package/bundled/skills/{claude-code/spec-driven-dev/SKILL.md → spec-driven-dev/guide.md} +50 -8
- package/bundled/skills/tdd-assistant/SKILL.md +65 -0
- package/bundled/skills/{claude-code/tdd-assistant/SKILL.md → tdd-assistant/guide.md} +10 -10
- package/bundled/skills/{claude-code/tdd-assistant → tdd-assistant}/language-examples.md +3 -3
- package/bundled/skills/{claude-code/tdd-assistant → tdd-assistant}/tdd-workflow.md +2 -2
- package/bundled/skills/test-coverage-assistant/SKILL.md +63 -0
- package/bundled/skills/{claude-code/test-coverage-assistant/SKILL.md → test-coverage-assistant/guide.md} +39 -24
- package/bundled/skills/{claude-code/testing-guide → testing-guide}/SKILL.md +12 -7
- package/bundled/skills/{claude-code/testing-guide → testing-guide}/testing-pyramid.md +3 -3
- package/bundled/skills/testing-guide/testing-theory.md +2291 -0
- package/bundled/skills/tools/cline/.clinerules +79 -0
- package/bundled/skills/tools/cline/README.md +50 -0
- package/bundled/skills/tools/copilot/README.md +99 -0
- package/bundled/skills/tools/copilot/copilot-instructions.md +71 -0
- package/bundled/skills/tools/cursor/.cursorrules +101 -0
- package/bundled/skills/tools/cursor/README.md +50 -0
- package/bundled/skills/tools/windsurf/.windsurfrules +76 -0
- package/bundled/skills/tools/windsurf/README.md +51 -0
- package/bundled/skills/{claude-code/workflows → workflows}/README.md +1 -1
- package/bundled/skills/workflows/release.workflow.yaml +893 -0
- package/package.json +4 -1
- package/src/commands/check.js +195 -130
- package/src/commands/config.js +1262 -0
- package/src/commands/configure.js +3 -950
- package/src/commands/fix.js +53 -0
- package/src/commands/hitl.js +19 -0
- package/src/commands/init.js +320 -1030
- package/src/commands/list.js +1 -1
- package/src/commands/simulate.js +61 -0
- package/src/commands/spec.js +288 -0
- package/src/commands/start.js +373 -0
- package/src/commands/sweep.js +142 -0
- package/src/commands/update.js +136 -19
- package/src/commands/workflow.js +265 -1
- package/src/config/ai-agent-paths.js +89 -29
- package/src/core/constants.js +7 -1
- package/src/core/manifest.js +1 -0
- package/src/flows/init-flow.js +243 -0
- package/src/hitl/checkpoint.js +80 -0
- package/src/hitl/classifier.js +54 -0
- package/src/hitl/manager.js +88 -0
- package/src/i18n/messages.js +907 -99
- package/src/index.js +1 -0
- package/src/installers/integration-installer.js +237 -0
- package/src/installers/manifest-installer.js +131 -0
- package/src/installers/skills-installer.js +286 -0
- package/src/installers/standards-installer.js +193 -0
- package/src/missions/MissionManager.js +501 -0
- package/src/prompts/init.js +228 -130
- package/src/prompts/integrations.js +13 -1
- package/src/schemas/standard.schema.json +117 -0
- package/src/utils/agents-installer.js +2 -2
- package/src/utils/config-loader.js +47 -0
- package/src/utils/config-manager.js +108 -0
- package/src/utils/config-merger.js +47 -0
- package/src/utils/github.js +22 -18
- package/src/utils/inquirer-patch.js +98 -0
- package/src/utils/integration-generator.js +392 -58
- package/src/utils/reference-sync.js +69 -19
- package/src/utils/skills-installer.js +6 -3
- package/src/utils/standard-fixer.js +141 -0
- package/src/utils/standard-validator.js +329 -0
- package/src/utils/workflow-executor.js +886 -0
- package/src/utils/workflow-state.js +404 -0
- package/src/utils/workflows-installer.js +2 -2
- package/src/vibe/auto-sweep.js +349 -0
- package/src/vibe/micro-spec.js +428 -0
- package/standards-registry.json +278 -102
- package/bundled/locales/zh-CN/skills/claude-code/README.md +0 -174
- package/bundled/locales/zh-CN/skills/claude-code/test-coverage-assistant/SKILL.md +0 -282
- package/bundled/locales/zh-TW/skills/claude-code/README.md +0 -174
- package/bundled/skills/claude-code/README.md +0 -215
- package/bundled/skills/claude-code/commands/changelog.md +0 -57
- package/bundled/skills/claude-code/commands/derive-all.md +0 -214
- package/bundled/skills/claude-code/commands/derive-atdd.md +0 -177
- package/bundled/skills/claude-code/commands/derive-bdd.md +0 -158
- package/bundled/skills/claude-code/commands/derive-tdd.md +0 -259
- package/bundled/skills/claude-code/commands/docs.md +0 -75
- package/bundled/skills/claude-code/commands/release.md +0 -50
- package/bundled/skills/claude-code/commands/reverse-bdd.md +0 -264
- package/bundled/skills/claude-code/commands/reverse-spec.md +0 -185
- package/bundled/skills/claude-code/commands/reverse-tdd.md +0 -351
- package/bundled/skills/claude-code/commands/spec.md +0 -69
- package/bundled/skills/claude-code/methodology-system/integrated-flow.md +0 -322
- /package/bundled/skills/{claude-code/CONTRIBUTING.template.md → CONTRIBUTING.template.md} +0 -0
- /package/bundled/skills/{claude-code/ai → ai}/standards/checkin.ai.yaml +0 -0
- /package/bundled/skills/{claude-code/ai → ai}/standards/commit.ai.yaml +0 -0
- /package/bundled/skills/{claude-code/ai → ai}/standards/refactoring.ai.yaml +0 -0
- /package/bundled/skills/{claude-code/ai → ai}/standards/testing.ai.yaml +0 -0
- /package/bundled/skills/{claude-code/project-structure-guide → project-structure-guide}/language-patterns.md +0 -0
- /package/bundled/skills/{claude-code/workflows → workflows}/code-review.workflow.yaml +0 -0
- /package/bundled/skills/{claude-code/workflows → workflows}/feature-dev.workflow.yaml +0 -0
- /package/bundled/skills/{claude-code/workflows → workflows}/integrated-flow.workflow.yaml +0 -0
- /package/bundled/skills/{claude-code/workflows → workflows}/large-codebase-analysis.workflow.yaml +0 -0
|
@@ -1,997 +1,41 @@
|
|
|
1
1
|
# Test-Driven Development (TDD) Standards
|
|
2
2
|
|
|
3
|
-
**Version**: 1.
|
|
4
|
-
**Last Updated**: 2026-01-
|
|
3
|
+
**Version**: 1.2.0
|
|
4
|
+
**Last Updated**: 2026-01-25
|
|
5
5
|
**Applicability**: All projects adopting Test-Driven Development
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Purpose
|
|
12
|
-
|
|
13
|
-
This standard defines the principles, workflows, and best practices for Test-Driven Development (TDD), ensuring that tests drive the design and implementation of software features.
|
|
14
|
-
|
|
15
|
-
**Key Benefits**:
|
|
16
|
-
- Design emerges from tests, leading to more testable and modular code
|
|
17
|
-
- Immediate feedback on code correctness
|
|
18
|
-
- Tests serve as living documentation
|
|
19
|
-
- Reduced debugging time and defect rates
|
|
20
|
-
- Confidence in refactoring
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Table of Contents
|
|
25
|
-
|
|
26
|
-
1. [TDD Core Cycle](#tdd-core-cycle)
|
|
27
|
-
2. [TDD Principles](#tdd-principles)
|
|
28
|
-
3. [Applicability Guide](#applicability-guide)
|
|
29
|
-
4. [TDD vs BDD vs ATDD](#tdd-vs-bdd-vs-atdd)
|
|
30
|
-
5. [Integration with SDD](#integration-with-sdd)
|
|
31
|
-
6. [TDD Workflow](#tdd-workflow)
|
|
32
|
-
7. [Test Design Guidelines](#test-design-guidelines)
|
|
33
|
-
8. [Refactoring Strategies](#refactoring-strategies)
|
|
34
|
-
9. [Test Doubles in TDD](#test-doubles-in-tdd)
|
|
35
|
-
10. [Anti-Patterns and Remediation](#anti-patterns-and-remediation)
|
|
36
|
-
11. [Language/Framework Practices](#languageframework-practices)
|
|
37
|
-
12. [Metrics and Assessment](#metrics-and-assessment)
|
|
38
|
-
13. [Related Standards](#related-standards)
|
|
39
|
-
14. [References](#references)
|
|
40
|
-
15. [Version History](#version-history)
|
|
41
|
-
16. [License](#license)
|
|
6
|
+
**Scope**: universal
|
|
7
|
+
**Industry Standards**: None (Kent Beck practice, 1999)
|
|
42
8
|
|
|
43
9
|
---
|
|
44
10
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
### The Red-Green-Refactor Loop
|
|
48
|
-
|
|
49
|
-
TDD follows a simple but powerful iterative cycle:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
53
|
-
│ TDD Core Cycle │
|
|
54
|
-
├─────────────────────────────────────────────────────────────────────────────┤
|
|
55
|
-
│ │
|
|
56
|
-
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
57
|
-
│ │ 🔴 RED │────────▶│ 🟢 GREEN│────────▶│🔵 REFACTOR│ │
|
|
58
|
-
│ └─────────┘ └─────────┘ └─────────┘ │
|
|
59
|
-
│ ▲ │ │
|
|
60
|
-
│ │ │ │
|
|
61
|
-
│ └────────────────────────────────────────┘ │
|
|
62
|
-
│ │
|
|
63
|
-
│ 🔴 RED Phase (1-5 minutes) │
|
|
64
|
-
│ ├─ Write a failing test that describes expected behavior │
|
|
65
|
-
│ ├─ Test should fail for the RIGHT reason │
|
|
66
|
-
│ └─ Verify the test actually fails │
|
|
67
|
-
│ │
|
|
68
|
-
│ 🟢 GREEN Phase (1-10 minutes) │
|
|
69
|
-
│ ├─ Write the MINIMUM code to make the test pass │
|
|
70
|
-
│ ├─ "Fake it till you make it" is acceptable │
|
|
71
|
-
│ └─ Don't over-engineer; just make it work │
|
|
72
|
-
│ │
|
|
73
|
-
│ 🔵 REFACTOR Phase (5-15 minutes) │
|
|
74
|
-
│ ├─ Improve code quality while keeping tests green │
|
|
75
|
-
│ ├─ Remove duplication (DRY) │
|
|
76
|
-
│ ├─ Improve naming, structure, readability │
|
|
77
|
-
│ └─ Run tests after each refactoring step │
|
|
78
|
-
│ │
|
|
79
|
-
└─────────────────────────────────────────────────────────────────────────────┘
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Cycle Timing Guidelines
|
|
83
|
-
|
|
84
|
-
| Phase | Recommended Time | Warning Signs |
|
|
85
|
-
|-------|-----------------|---------------|
|
|
86
|
-
| 🔴 RED | 1-5 minutes | If >10 min, test scope is too large |
|
|
87
|
-
| 🟢 GREEN | 1-10 minutes | If >15 min, break down the problem |
|
|
88
|
-
| 🔵 REFACTOR | 5-15 minutes | If skipped, technical debt accumulates |
|
|
89
|
-
|
|
90
|
-
### The Mantra
|
|
91
|
-
|
|
92
|
-
> **Red → Green → Refactor → Repeat**
|
|
93
|
-
|
|
94
|
-
Each iteration should be small. If you find yourself spending too long in any phase, the test is probably too ambitious.
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## TDD Principles
|
|
99
|
-
|
|
100
|
-
### FIRST Principles
|
|
101
|
-
|
|
102
|
-
High-quality tests follow the FIRST principles:
|
|
103
|
-
|
|
104
|
-
| Principle | Description | Practical Guidelines |
|
|
105
|
-
|-----------|-------------|---------------------|
|
|
106
|
-
| **F**ast | Tests should run quickly | Unit tests < 100ms each; total suite < 10s |
|
|
107
|
-
| **I**ndependent | Tests don't depend on each other | No shared state; each test sets up its own data |
|
|
108
|
-
| **R**epeatable | Same result every time | No randomness; no time dependencies; no external I/O |
|
|
109
|
-
| **S**elf-validating | Clear pass/fail result | No manual inspection; explicit assertions |
|
|
110
|
-
| **T**imely | Written before production code | This is the essence of TDD |
|
|
111
|
-
|
|
112
|
-
### Uncle Bob's Three Rules of TDD
|
|
113
|
-
|
|
114
|
-
Robert C. Martin (Uncle Bob) defines TDD with three strict rules:
|
|
115
|
-
|
|
116
|
-
1. **Rule 1 (Red Rule)**: You are not allowed to write any production code unless it is to make a failing unit test pass.
|
|
11
|
+
## Summary
|
|
117
12
|
|
|
118
|
-
|
|
13
|
+
Test-Driven Development (TDD) is a traditional development methodology (1999) where tests drive the design and implementation of software features. The core workflow follows the **Red-Green-Refactor** cycle:
|
|
119
14
|
|
|
120
|
-
|
|
15
|
+
1. **Red**: Write a failing test that describes expected behavior
|
|
16
|
+
2. **Green**: Write the minimum code to make the test pass
|
|
17
|
+
3. **Refactor**: Improve code quality while keeping tests green
|
|
121
18
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Each test should verify ONE behavior:
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
✅ Good: test_calculate_total_with_discount_applies_percentage()
|
|
128
|
-
❌ Bad: test_calculate_total_and_tax_and_discount_and_shipping()
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Tests as Documentation
|
|
132
|
-
|
|
133
|
-
Well-written tests serve as executable documentation:
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
✅ Good test names:
|
|
137
|
-
- should_return_empty_list_when_no_users_found
|
|
138
|
-
- should_throw_validation_error_when_email_is_invalid
|
|
139
|
-
- should_calculate_discount_when_order_exceeds_threshold
|
|
140
|
-
|
|
141
|
-
❌ Bad test names:
|
|
142
|
-
- test1
|
|
143
|
-
- testCalculate
|
|
144
|
-
- itWorks
|
|
145
|
-
```
|
|
19
|
+
TDD is part of the traditional test-driven development family (alongside BDD and ATDD) and can be used during the Implementation phase of AI-era SDD (Spec-Driven Development) workflows. The methodology promotes testable, modular code design and provides immediate feedback on code correctness.
|
|
146
20
|
|
|
147
21
|
---
|
|
148
22
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
### TDD Applicability by Scenario
|
|
152
|
-
|
|
153
|
-
| Scenario | Rating | Notes |
|
|
154
|
-
|----------|--------|-------|
|
|
155
|
-
| **New feature development** | ⭐⭐⭐⭐⭐ | Best TDD use case; design emerges from tests |
|
|
156
|
-
| **Bug fixing** | ⭐⭐⭐⭐⭐ | Write failing test to reproduce bug first |
|
|
157
|
-
| **API design** | ⭐⭐⭐⭐⭐ | Tests serve as API usage documentation |
|
|
158
|
-
| **Core business logic** | ⭐⭐⭐⭐⭐ | High-value code must have test protection |
|
|
159
|
-
| **Algorithm implementation** | ⭐⭐⭐⭐ | Many edge cases; TDD helps think through them |
|
|
160
|
-
| **Refactoring existing code** | ⭐⭐⭐⭐ | Add tests first, then refactor safely |
|
|
161
|
-
| **UI components** | ⭐⭐⭐ | Partially applicable; combine with BDD |
|
|
162
|
-
| **Exploratory prototypes** | ⭐⭐ | TDD may slow down uncertain exploration |
|
|
163
|
-
| **One-off scripts** | ⭐ | Low cost-benefit ratio |
|
|
164
|
-
| **Third-party integrations** | ⭐⭐ | Hard to mock; use integration tests instead |
|
|
165
|
-
|
|
166
|
-
### TDD by Project Type
|
|
167
|
-
|
|
168
|
-
| Project Type | TDD | BDD | ATDD | Recommendation |
|
|
169
|
-
|--------------|-----|-----|------|----------------|
|
|
170
|
-
| **Startup MVP** | ⚠️ Optional | ✅ Recommended | ❌ | Rapid iteration priority |
|
|
171
|
-
| **Enterprise Application** | ✅ Recommended | ✅ Recommended | ✅ Recommended | Quality and maintainability critical |
|
|
172
|
-
| **Open Source Project** | ✅ Recommended | ⚠️ Optional | ❌ | Contributors need test documentation |
|
|
173
|
-
| **Legacy System Renovation** | ✅ Required | ⚠️ Optional | ❌ | Use Golden Master strategy (see below) |
|
|
174
|
-
| **Microservices** | ✅ Recommended | ✅ Recommended | ✅ Recommended | Contract testing important |
|
|
175
|
-
| **Data Pipelines** | ⚠️ Optional | ❌ | ❌ | Integration tests as primary |
|
|
176
|
-
| **Machine Learning** | 🔶 Varies | ❌ | ❌ | See ML testing boundaries below |
|
|
177
|
-
|
|
178
|
-
### Machine Learning (ML) Testing Boundaries
|
|
179
|
-
|
|
180
|
-
**Important**: ML projects require distinguishing between "model performance" and "data engineering":
|
|
181
|
-
|
|
182
|
-
| Aspect | TDD Applicability | Explanation |
|
|
183
|
-
|--------|-------------------|-------------|
|
|
184
|
-
| **Model Accuracy** | ❌ Not applicable | Non-deterministic results; hard to predefine expectations |
|
|
185
|
-
| **Feature Engineering** | ✅ Required | Avoid Garbage In, Garbage Out |
|
|
186
|
-
| **Data Cleaning** | ✅ Required | Data quality directly affects model performance |
|
|
187
|
-
| **Data Transformation** | ✅ Required | Ensure transformation logic is correct |
|
|
188
|
-
| **Pipeline Integration** | ⚠️ Optional | Integration tests as primary |
|
|
189
|
-
|
|
190
|
-
### Legacy System Strategy: Golden Master Testing
|
|
191
|
-
|
|
192
|
-
**Problem**: In legacy systems without tests, "adding tests" itself risks breaking existing logic.
|
|
193
|
-
|
|
194
|
-
**Golden Master Testing Workflow**:
|
|
195
|
-
|
|
196
|
-
```
|
|
197
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
198
|
-
│ Golden Master Testing Workflow │
|
|
199
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
200
|
-
│ │
|
|
201
|
-
│ 1️⃣ RECORD Phase (Don't modify code) │
|
|
202
|
-
│ ├─ Execute system with many inputs │
|
|
203
|
-
│ ├─ Record all outputs as "golden baseline" │
|
|
204
|
-
│ └─ Use automation tools or AI to generate test cases │
|
|
205
|
-
│ │
|
|
206
|
-
│ 2️⃣ VERIFY Phase │
|
|
207
|
-
│ ├─ Create Snapshot/Approval tests │
|
|
208
|
-
│ └─ Ensure pre/post refactoring outputs match │
|
|
209
|
-
│ │
|
|
210
|
-
│ 3️⃣ REFACTOR Phase │
|
|
211
|
-
│ ├─ Safely refactor under Golden Master protection │
|
|
212
|
-
│ ├─ Run Golden Master tests after each modification │
|
|
213
|
-
│ └─ Gradually convert Golden Masters to proper unit tests │
|
|
214
|
-
│ │
|
|
215
|
-
│ 4️⃣ EVOLVE Phase │
|
|
216
|
-
│ └─ New features use standard TDD │
|
|
217
|
-
│ │
|
|
218
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
**Tool Support**:
|
|
222
|
-
- ApprovalTests (multi-language support)
|
|
223
|
-
- Jest Snapshot Testing
|
|
224
|
-
- Python: pytest-snapshot
|
|
225
|
-
- AI-assisted test input generation
|
|
226
|
-
|
|
227
|
-
### Decision Tree
|
|
228
|
-
|
|
229
|
-
```
|
|
230
|
-
Requirement Source?
|
|
231
|
-
├─ Technical (performance, refactoring) → TDD
|
|
232
|
-
├─ Business Requirement
|
|
233
|
-
│ ├─ Has clear acceptance criteria?
|
|
234
|
-
│ │ ├─ Yes → ATDD → BDD → TDD
|
|
235
|
-
│ │ └─ No → BDD → TDD
|
|
236
|
-
│ └─ Complex business flow?
|
|
237
|
-
│ ├─ Yes → BDD (scenario description) → TDD
|
|
238
|
-
│ └─ No → TDD
|
|
239
|
-
└─ Exploratory/Prototype → Skip TDD temporarily
|
|
240
|
-
```
|
|
23
|
+
**Full Guide: [TDD Guide](../methodologies/guides/tdd-guide.md)**
|
|
241
24
|
|
|
242
25
|
---
|
|
243
26
|
|
|
244
|
-
##
|
|
245
|
-
|
|
246
|
-
### Comparison Overview
|
|
247
|
-
|
|
248
|
-
| Aspect | TDD | BDD | ATDD |
|
|
249
|
-
|--------|-----|-----|------|
|
|
250
|
-
| **Focus** | Code units | Behavior | Acceptance criteria |
|
|
251
|
-
| **Language** | Programming code | Natural language (Gherkin) | Business language |
|
|
252
|
-
| **Participants** | Developers | Developers + BA + QA | Entire team + stakeholders |
|
|
253
|
-
| **Test Level** | Unit/Integration | Feature/Scenario | System/Acceptance |
|
|
254
|
-
| **Tools** | xUnit frameworks | Cucumber, Behave, SpecFlow | FitNesse, Concordion |
|
|
255
|
-
| **When** | During coding | Before coding | Before development starts |
|
|
256
|
-
|
|
257
|
-
### Integration Pyramid
|
|
258
|
-
|
|
259
|
-
```
|
|
260
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
261
|
-
│ Complete Test-Driven Development Stack │
|
|
262
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
263
|
-
│ │
|
|
264
|
-
│ Requirements ATDD - Acceptance Test-Driven Development │
|
|
265
|
-
│ Layer (Receive business acceptance criteria) │
|
|
266
|
-
│ ↓ │
|
|
267
|
-
│ Feature BDD - Behavior-Driven Development │
|
|
268
|
-
│ Layer (Scenario → Step Definitions) │
|
|
269
|
-
│ ↓ │
|
|
270
|
-
│ Development TDD - Test-Driven Development │
|
|
271
|
-
│ Layer (Unit Tests → Code) │
|
|
272
|
-
│ ↓ │
|
|
273
|
-
│ Integration Integration & System Tests │
|
|
274
|
-
│ Layer │
|
|
275
|
-
│ │
|
|
276
|
-
│ Key: ATDD → BDD → TDD → Integration Tests (top-down flow) │
|
|
277
|
-
│ │
|
|
278
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
### BDD Gherkin Syntax Overview
|
|
282
|
-
|
|
283
|
-
```gherkin
|
|
284
|
-
Feature: User Login
|
|
285
|
-
As a registered user
|
|
286
|
-
I want to log into my account
|
|
287
|
-
So that I can access my personalized content
|
|
288
|
-
|
|
289
|
-
Scenario: Successful login with valid credentials
|
|
290
|
-
Given I am on the login page
|
|
291
|
-
And I have a registered account with email "user@example.com"
|
|
292
|
-
When I enter email "user@example.com"
|
|
293
|
-
And I enter password "correctpassword"
|
|
294
|
-
And I click the login button
|
|
295
|
-
Then I should be redirected to the dashboard
|
|
296
|
-
And I should see a welcome message with my name
|
|
297
|
-
|
|
298
|
-
Scenario: Failed login with invalid password
|
|
299
|
-
Given I am on the login page
|
|
300
|
-
When I enter email "user@example.com"
|
|
301
|
-
And I enter password "wrongpassword"
|
|
302
|
-
And I click the login button
|
|
303
|
-
Then I should see an error message "Invalid credentials"
|
|
304
|
-
And I should remain on the login page
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### ATDD Acceptance Criteria Format
|
|
308
|
-
|
|
309
|
-
```markdown
|
|
310
|
-
## Feature: Shopping Cart Checkout
|
|
311
|
-
|
|
312
|
-
### Acceptance Criteria:
|
|
313
|
-
|
|
314
|
-
**AC-1: Calculate Order Total**
|
|
315
|
-
- GIVEN items in cart with prices [$10, $20, $15]
|
|
316
|
-
- WHEN user proceeds to checkout
|
|
317
|
-
- THEN total should be $45
|
|
318
|
-
|
|
319
|
-
**AC-2: Apply Discount Code**
|
|
320
|
-
- GIVEN cart total is $100
|
|
321
|
-
- AND valid discount code "SAVE20" for 20% off
|
|
322
|
-
- WHEN user applies discount code
|
|
323
|
-
- THEN total should be $80
|
|
324
|
-
|
|
325
|
-
**AC-3: Validate Minimum Order**
|
|
326
|
-
- GIVEN cart total is below $25
|
|
327
|
-
- WHEN user attempts checkout
|
|
328
|
-
- THEN system should show "Minimum order is $25" error
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Choosing the Right Approach
|
|
332
|
-
|
|
333
|
-
| Use Case | Primary Approach | Supporting Approach |
|
|
334
|
-
|----------|-----------------|---------------------|
|
|
335
|
-
| Algorithm implementation | TDD | - |
|
|
336
|
-
| User authentication flow | BDD | TDD |
|
|
337
|
-
| Payment processing | ATDD | BDD + TDD |
|
|
338
|
-
| API endpoint | TDD | BDD for integration |
|
|
339
|
-
| UI component | BDD | TDD for logic |
|
|
340
|
-
| Business rule validation | ATDD | TDD |
|
|
341
|
-
| Performance optimization | TDD | - |
|
|
342
|
-
| External service integration | TDD | BDD for contract |
|
|
343
|
-
|
|
344
|
-
---
|
|
345
|
-
|
|
346
|
-
## Integration with SDD
|
|
347
|
-
|
|
348
|
-
### SDD + TDD Unified Workflow
|
|
349
|
-
|
|
350
|
-
Spec-Driven Development (SDD) and Test-Driven Development (TDD) are complementary:
|
|
351
|
-
|
|
352
|
-
- **SDD**: "Spec First, Code Second" - Define WHAT to build
|
|
353
|
-
- **TDD**: "Test First, Code Second" - Define HOW to verify
|
|
354
|
-
|
|
355
|
-
```
|
|
356
|
-
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
357
|
-
│ SDD + TDD Integrated Workflow │
|
|
358
|
-
├─────────────────────────────────────────────────────────────────────────────┤
|
|
359
|
-
│ │
|
|
360
|
-
│ 1️⃣ SDD: PROPOSAL Phase │
|
|
361
|
-
│ ├─ Write Spec: Define feature, acceptance criteria, edge cases │
|
|
362
|
-
│ ├─ Include Acceptance Criteria (convert to ATDD scenarios) │
|
|
363
|
-
│ └─ Get stakeholder approval │
|
|
364
|
-
│ (Spec ID: SPEC-001) │
|
|
365
|
-
│ │
|
|
366
|
-
│ 2️⃣ TDD: RED Phase │
|
|
367
|
-
│ ├─ Based on Spec's Acceptance Criteria, write tests │
|
|
368
|
-
│ ├─ Write failing tests describing expected behavior │
|
|
369
|
-
│ ├─ Tests implement Spec: One Criterion = Multiple Tests │
|
|
370
|
-
│ └─ Reference SPEC-001 in test file comments │
|
|
371
|
-
│ │
|
|
372
|
-
│ 3️⃣ TDD: GREEN + REFACTOR Phase │
|
|
373
|
-
│ ├─ Iterative development, implementing one small feature at a time │
|
|
374
|
-
│ ├─ Refactor after tests pass │
|
|
375
|
-
│ └─ Keep all Spec acceptance criteria tests passing │
|
|
376
|
-
│ │
|
|
377
|
-
│ 4️⃣ SDD: VERIFICATION Phase │
|
|
378
|
-
│ ├─ Confirm implementation matches Spec │
|
|
379
|
-
│ ├─ Acceptance test suite passes │
|
|
380
|
-
│ └─ All Acceptance Criteria implemented ✓ │
|
|
381
|
-
│ │
|
|
382
|
-
│ 5️⃣ Commit PR and Write Commit Message │
|
|
383
|
-
│ ├─ Commit: "feat(auth): implement login" │
|
|
384
|
-
│ ├─ Body: "Implements SPEC-001 with OAuth2" │
|
|
385
|
-
│ ├─ Refs: SPEC-001 │
|
|
386
|
-
│ └─ Include test coverage report │
|
|
387
|
-
│ │
|
|
388
|
-
│ 6️⃣ SDD: ARCHIVE Phase │
|
|
389
|
-
│ └─ Archive Spec, link to PR/commits │
|
|
390
|
-
│ │
|
|
391
|
-
└─────────────────────────────────────────────────────────────────────────────┘
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
### Mapping Spec Acceptance Criteria to TDD Tests
|
|
395
|
-
|
|
396
|
-
| Spec Acceptance Criteria | TDD Tests |
|
|
397
|
-
|--------------------------|-----------|
|
|
398
|
-
| "User can login with valid credentials" | `test_login_with_valid_credentials_succeeds()` |
|
|
399
|
-
| "Invalid password shows error" | `test_login_with_invalid_password_shows_error()` |
|
|
400
|
-
| "Account locked after 3 failed attempts" | `test_account_locks_after_three_failed_attempts()` |
|
|
401
|
-
| "Locked account cannot login" | `test_locked_account_cannot_login()` |
|
|
402
|
-
|
|
403
|
-
### Referencing Spec in Tests
|
|
404
|
-
|
|
405
|
-
```typescript
|
|
406
|
-
/**
|
|
407
|
-
* Tests for SPEC-001: User Authentication
|
|
408
|
-
* @see specs/SPEC-001-user-authentication.md
|
|
409
|
-
*/
|
|
410
|
-
describe('User Authentication (SPEC-001)', () => {
|
|
411
|
-
// AC-1: User can login with valid credentials
|
|
412
|
-
test('should login successfully with valid credentials', async () => {
|
|
413
|
-
// ...
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
// AC-2: Invalid password shows error
|
|
417
|
-
test('should show error message for invalid password', async () => {
|
|
418
|
-
// ...
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
---
|
|
424
|
-
|
|
425
|
-
## TDD Workflow
|
|
426
|
-
|
|
427
|
-
### Individual Level TDD
|
|
428
|
-
|
|
429
|
-
```
|
|
430
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
431
|
-
│ Individual TDD Session Workflow │
|
|
432
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
433
|
-
│ │
|
|
434
|
-
│ 1. Understand the requirement │
|
|
435
|
-
│ ├─ Read the spec/user story │
|
|
436
|
-
│ └─ Identify acceptance criteria │
|
|
437
|
-
│ │
|
|
438
|
-
│ 2. List test cases (on paper or TODO comments) │
|
|
439
|
-
│ ├─ Happy path scenarios │
|
|
440
|
-
│ ├─ Edge cases │
|
|
441
|
-
│ ├─ Error scenarios │
|
|
442
|
-
│ └─ Boundary conditions │
|
|
443
|
-
│ │
|
|
444
|
-
│ 3. Pick the simplest test case │
|
|
445
|
-
│ └─ Start with the most basic happy path │
|
|
446
|
-
│ │
|
|
447
|
-
│ 4. RED: Write the test │
|
|
448
|
-
│ ├─ Write test with clear Arrange-Act-Assert │
|
|
449
|
-
│ ├─ Use descriptive test name │
|
|
450
|
-
│ └─ Run test, verify it fails │
|
|
451
|
-
│ │
|
|
452
|
-
│ 5. GREEN: Make it pass │
|
|
453
|
-
│ ├─ Write minimum code to pass │
|
|
454
|
-
│ ├─ "Fake it" is acceptable │
|
|
455
|
-
│ └─ Run test, verify it passes │
|
|
456
|
-
│ │
|
|
457
|
-
│ 6. REFACTOR: Clean up │
|
|
458
|
-
│ ├─ Remove duplication │
|
|
459
|
-
│ ├─ Improve names │
|
|
460
|
-
│ ├─ Extract methods/functions │
|
|
461
|
-
│ └─ Run all tests after each change │
|
|
462
|
-
│ │
|
|
463
|
-
│ 7. Repeat from step 3 until all tests complete │
|
|
464
|
-
│ │
|
|
465
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
### Team Level TDD
|
|
469
|
-
|
|
470
|
-
#### Pair Programming with TDD
|
|
471
|
-
|
|
472
|
-
**Ping-Pong Pattern**:
|
|
473
|
-
1. Developer A writes a failing test
|
|
474
|
-
2. Developer B writes code to pass the test
|
|
475
|
-
3. Developer B writes the next failing test
|
|
476
|
-
4. Developer A writes code to pass the test
|
|
477
|
-
5. Either developer can refactor at any time
|
|
478
|
-
6. Repeat
|
|
479
|
-
|
|
480
|
-
**Driver-Navigator Pattern**:
|
|
481
|
-
1. Navigator thinks about design and test cases
|
|
482
|
-
2. Driver writes the test and code
|
|
483
|
-
3. Switch roles every 15-30 minutes
|
|
484
|
-
|
|
485
|
-
#### Mob Programming with TDD
|
|
486
|
-
|
|
487
|
-
- One driver (types), multiple navigators (guide)
|
|
488
|
-
- Rotate driver every 5-10 minutes
|
|
489
|
-
- Collectively decide on test cases and implementation
|
|
490
|
-
- Higher quality through diverse perspectives
|
|
491
|
-
|
|
492
|
-
### CI/CD Integration
|
|
493
|
-
|
|
494
|
-
```yaml
|
|
495
|
-
# Example GitHub Actions workflow for TDD
|
|
496
|
-
name: TDD CI Pipeline
|
|
497
|
-
|
|
498
|
-
on: [push, pull_request]
|
|
499
|
-
|
|
500
|
-
jobs:
|
|
501
|
-
test:
|
|
502
|
-
runs-on: ubuntu-latest
|
|
503
|
-
steps:
|
|
504
|
-
- uses: actions/checkout@v4
|
|
505
|
-
|
|
506
|
-
- name: Setup Node.js
|
|
507
|
-
uses: actions/setup-node@v4
|
|
508
|
-
with:
|
|
509
|
-
node-version: '20'
|
|
510
|
-
|
|
511
|
-
- name: Install dependencies
|
|
512
|
-
run: npm ci
|
|
513
|
-
|
|
514
|
-
- name: Run unit tests
|
|
515
|
-
run: npm run test:unit
|
|
516
|
-
|
|
517
|
-
- name: Run integration tests
|
|
518
|
-
run: npm run test:integration
|
|
519
|
-
|
|
520
|
-
- name: Check coverage threshold
|
|
521
|
-
run: npm run test:coverage -- --coverage-threshold=80
|
|
522
|
-
|
|
523
|
-
- name: Upload coverage report
|
|
524
|
-
uses: codecov/codecov-action@v4
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
---
|
|
528
|
-
|
|
529
|
-
## Test Design Guidelines
|
|
530
|
-
|
|
531
|
-
### AAA Pattern (Arrange-Act-Assert)
|
|
532
|
-
|
|
533
|
-
```typescript
|
|
534
|
-
test('should calculate total with discount', () => {
|
|
535
|
-
// Arrange - Set up test data and dependencies
|
|
536
|
-
const cart = new ShoppingCart();
|
|
537
|
-
cart.addItem({ name: 'Widget', price: 100 });
|
|
538
|
-
cart.setDiscountCode('SAVE20'); // 20% discount
|
|
539
|
-
|
|
540
|
-
// Act - Execute the behavior being tested
|
|
541
|
-
const total = cart.calculateTotal();
|
|
542
|
-
|
|
543
|
-
// Assert - Verify the result
|
|
544
|
-
expect(total).toBe(80);
|
|
545
|
-
});
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
### Given-When-Then Pattern (BDD Style)
|
|
549
|
-
|
|
550
|
-
```typescript
|
|
551
|
-
test('given a cart with items, when discount applied, then total is reduced', () => {
|
|
552
|
-
// Given
|
|
553
|
-
const cart = new ShoppingCart();
|
|
554
|
-
cart.addItem({ name: 'Widget', price: 100 });
|
|
555
|
-
|
|
556
|
-
// When
|
|
557
|
-
cart.applyDiscount('SAVE20');
|
|
558
|
-
const total = cart.calculateTotal();
|
|
559
|
-
|
|
560
|
-
// Then
|
|
561
|
-
expect(total).toBe(80);
|
|
562
|
-
});
|
|
563
|
-
```
|
|
27
|
+
## Quick Reference
|
|
564
28
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
|
568
|
-
|
|
569
|
-
|
|
|
570
|
-
|
|
|
571
|
-
|
|
|
572
|
-
| `it_[does something]` | `it_calculates_total_correctly` |
|
|
573
|
-
|
|
574
|
-
### Test Data Best Practices
|
|
575
|
-
|
|
576
|
-
```typescript
|
|
577
|
-
// ✅ Good: Clear, meaningful test data
|
|
578
|
-
const validUser = {
|
|
579
|
-
email: 'john.doe@example.com',
|
|
580
|
-
password: 'SecureP@ss123',
|
|
581
|
-
role: 'admin'
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
// ❌ Bad: Magic strings without context
|
|
585
|
-
const user = {
|
|
586
|
-
email: 'a@b.c',
|
|
587
|
-
password: '123',
|
|
588
|
-
role: 'x'
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
// ✅ Good: Use test data builders
|
|
592
|
-
const user = UserBuilder.create()
|
|
593
|
-
.withEmail('john.doe@example.com')
|
|
594
|
-
.withRole('admin')
|
|
595
|
-
.build();
|
|
596
|
-
|
|
597
|
-
// ✅ Good: Use constants for boundary values
|
|
598
|
-
const MAX_PASSWORD_LENGTH = 128;
|
|
599
|
-
const MIN_PASSWORD_LENGTH = 8;
|
|
600
|
-
|
|
601
|
-
test('should reject password exceeding max length', () => {
|
|
602
|
-
const longPassword = 'a'.repeat(MAX_PASSWORD_LENGTH + 1);
|
|
603
|
-
expect(() => validatePassword(longPassword)).toThrow();
|
|
604
|
-
});
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
### Testing Edge Cases
|
|
608
|
-
|
|
609
|
-
Ensure tests cover all seven dimensions from [Test Completeness Dimensions](test-completeness-dimensions.md):
|
|
610
|
-
|
|
611
|
-
1. **Happy Path** - Normal expected behavior
|
|
612
|
-
2. **Boundary Conditions** - Min/max values, limits
|
|
613
|
-
3. **Error Handling** - Invalid input, exceptions
|
|
614
|
-
4. **Authorization** - Role-based access control
|
|
615
|
-
5. **State Changes** - Before/after verification
|
|
616
|
-
6. **Validation** - Format, business rules
|
|
617
|
-
7. **Integration** - Real query verification
|
|
618
|
-
|
|
619
|
-
---
|
|
620
|
-
|
|
621
|
-
## Refactoring Strategies
|
|
622
|
-
|
|
623
|
-
### When to Refactor
|
|
624
|
-
|
|
625
|
-
Refactor when you see code smells. Use the comprehensive catalog below to identify issues and their solutions.
|
|
626
|
-
|
|
627
|
-
### Code Smell Catalog
|
|
628
|
-
|
|
629
|
-
Based on Martin Fowler's "Refactoring" (2nd Edition), code smells are grouped into five categories:
|
|
630
|
-
|
|
631
|
-
#### 1. Bloaters
|
|
632
|
-
|
|
633
|
-
Code that has grown too large and becomes difficult to work with.
|
|
634
|
-
|
|
635
|
-
| Smell | Description | Refactoring |
|
|
636
|
-
|-------|-------------|-------------|
|
|
637
|
-
| **Long Method** | Method >20 lines, doing too much | Extract Method, Replace Temp with Query, Introduce Parameter Object |
|
|
638
|
-
| **Large Class** | Class with too many responsibilities | Extract Class, Extract Subclass, Extract Interface |
|
|
639
|
-
| **Primitive Obsession** | Using primitives instead of small objects for simple tasks | Replace Primitive with Object, Replace Type Code with Class, Introduce Parameter Object |
|
|
640
|
-
| **Long Parameter List** | More than 3 parameters | Introduce Parameter Object, Preserve Whole Object, Replace Parameter with Method Call |
|
|
641
|
-
| **Data Clumps** | Same group of data appearing together in multiple places | Extract Class, Introduce Parameter Object, Preserve Whole Object |
|
|
642
|
-
|
|
643
|
-
#### 2. Object-Orientation Abusers
|
|
644
|
-
|
|
645
|
-
Incomplete or incorrect application of OO principles.
|
|
646
|
-
|
|
647
|
-
| Smell | Description | Refactoring |
|
|
648
|
-
|-------|-------------|-------------|
|
|
649
|
-
| **Switch Statements** | Complex switch/if-else chains based on type | Replace Conditional with Polymorphism, Replace Type Code with Strategy, Replace Type Code with State |
|
|
650
|
-
| **Temporary Field** | Fields only set in certain circumstances | Extract Class, Introduce Null Object, Introduce Special Case |
|
|
651
|
-
| **Refused Bequest** | Subclass doesn't use inherited methods | Push Down Method, Push Down Field, Replace Inheritance with Delegation |
|
|
652
|
-
| **Alternative Classes with Different Interfaces** | Classes doing the same thing with different method signatures | Rename Method, Move Method, Extract Superclass |
|
|
653
|
-
| **Parallel Inheritance Hierarchies** | Creating subclass requires creating another in a different hierarchy | Move Method, Move Field |
|
|
654
|
-
|
|
655
|
-
#### 3. Change Preventers
|
|
656
|
-
|
|
657
|
-
Code that makes changes harder than necessary.
|
|
658
|
-
|
|
659
|
-
| Smell | Description | Refactoring |
|
|
660
|
-
|-------|-------------|-------------|
|
|
661
|
-
| **Divergent Change** | One class changed for many different reasons | Extract Class, Split Phase |
|
|
662
|
-
| **Shotgun Surgery** | One change requires modifying many classes | Move Method, Move Field, Inline Function, Inline Class |
|
|
663
|
-
| **Parallel Inheritance Hierarchies** | (See above) | Move Method, Move Field |
|
|
664
|
-
|
|
665
|
-
#### 4. Dispensables
|
|
666
|
-
|
|
667
|
-
Unnecessary code that could be removed.
|
|
668
|
-
|
|
669
|
-
| Smell | Description | Refactoring |
|
|
670
|
-
|-------|-------------|-------------|
|
|
671
|
-
| **Comments** | Excessive comments hiding bad code | Extract Method, Rename Method, Introduce Assertion |
|
|
672
|
-
| **Duplicate Code** | Same or similar code in multiple places | Extract Method, Pull Up Method, Extract Class, Slide Statements |
|
|
673
|
-
| **Dead Code** | Unused code (variables, methods, classes) | Remove Dead Code |
|
|
674
|
-
| **Lazy Class** | Class doing too little to justify its existence | Inline Class, Collapse Hierarchy |
|
|
675
|
-
| **Speculative Generality** | Unused abstraction "for future use" | Collapse Hierarchy, Inline Function, Inline Class, Remove Dead Code |
|
|
676
|
-
| **Data Class** | Class with only fields and getters/setters | Move Method, Encapsulate Field, Encapsulate Collection |
|
|
677
|
-
|
|
678
|
-
#### 5. Couplers
|
|
679
|
-
|
|
680
|
-
Code with excessive coupling between classes.
|
|
681
|
-
|
|
682
|
-
| Smell | Description | Refactoring |
|
|
683
|
-
|-------|-------------|-------------|
|
|
684
|
-
| **Feature Envy** | Method uses another class's data more than its own | Move Method, Extract Method |
|
|
685
|
-
| **Inappropriate Intimacy** | Classes too tightly coupled, accessing each other's private parts | Move Method, Move Field, Hide Delegate, Replace Delegation with Inheritance |
|
|
686
|
-
| **Message Chains** | `a.getB().getC().getD().getValue()` | Hide Delegate, Extract Method, Move Method |
|
|
687
|
-
| **Middle Man** | Class just delegates to another | Remove Middle Man, Inline Function, Replace Superclass with Delegate |
|
|
688
|
-
|
|
689
|
-
### Code Smell Detection Checklist
|
|
690
|
-
|
|
691
|
-
Quick checklist to identify common smells:
|
|
692
|
-
|
|
693
|
-
```
|
|
694
|
-
Method/Function Level:
|
|
695
|
-
□ Method > 20 lines? → Extract Method
|
|
696
|
-
□ > 3 parameters? → Introduce Parameter Object
|
|
697
|
-
□ Deeply nested (> 3 levels)? → Extract Method, Replace Nested Conditional with Guard Clauses
|
|
698
|
-
□ Multiple return statements? → Consider refactoring
|
|
699
|
-
|
|
700
|
-
Class Level:
|
|
701
|
-
□ Class > 200 lines? → Extract Class
|
|
702
|
-
□ > 10 methods? → Consider splitting responsibilities
|
|
703
|
-
□ God class (does everything)? → Extract Class
|
|
704
|
-
□ Data class (only fields)? → Move behavior in
|
|
705
|
-
|
|
706
|
-
Code Patterns:
|
|
707
|
-
□ Switch on type? → Replace with Polymorphism
|
|
708
|
-
□ Copy-paste code? → Extract Method/Class
|
|
709
|
-
□ Unused code? → Delete it
|
|
710
|
-
□ Magic numbers? → Replace with Named Constant
|
|
711
|
-
```
|
|
712
|
-
|
|
713
|
-
### Safe Refactoring Checklist
|
|
714
|
-
|
|
715
|
-
```
|
|
716
|
-
Before refactoring:
|
|
717
|
-
□ All tests are passing (green)
|
|
718
|
-
□ Sufficient test coverage exists
|
|
719
|
-
□ You understand what the code does
|
|
720
|
-
|
|
721
|
-
During refactoring:
|
|
722
|
-
□ Make ONE small change at a time
|
|
723
|
-
□ Run tests after EVERY change
|
|
724
|
-
□ If tests fail, immediately revert
|
|
725
|
-
□ Don't add new functionality while refactoring
|
|
726
|
-
|
|
727
|
-
After refactoring:
|
|
728
|
-
□ All tests still pass
|
|
729
|
-
□ Code is cleaner/simpler
|
|
730
|
-
□ No new functionality was added
|
|
731
|
-
```
|
|
732
|
-
|
|
733
|
-
### Common Refactoring Techniques
|
|
734
|
-
|
|
735
|
-
| Technique | When to Use | Example |
|
|
736
|
-
|-----------|-------------|---------|
|
|
737
|
-
| **Extract Method** | Long method, repeated code | Extract 10 lines into `calculateDiscount()` |
|
|
738
|
-
| **Rename** | Unclear names | `calc()` → `calculateOrderTotal()` |
|
|
739
|
-
| **Inline** | Over-abstraction | Remove unnecessary wrapper function |
|
|
740
|
-
| **Extract Variable** | Complex expressions | `const isEligible = age >= 18 && hasLicense` |
|
|
741
|
-
| **Replace Conditional with Polymorphism** | Complex switch/if chains | Use strategy pattern |
|
|
742
|
-
| **Introduce Parameter Object** | Many parameters | `(x, y, width, height)` → `Rectangle rect` |
|
|
743
|
-
|
|
744
|
-
---
|
|
745
|
-
|
|
746
|
-
## Test Doubles in TDD
|
|
747
|
-
|
|
748
|
-
### Types of Test Doubles
|
|
749
|
-
|
|
750
|
-
| Type | Purpose | When to Use |
|
|
751
|
-
|------|---------|-------------|
|
|
752
|
-
| **Dummy** | Fill parameter lists | Required parameter not used in test |
|
|
753
|
-
| **Stub** | Return predefined values | Simulate specific scenarios |
|
|
754
|
-
| **Spy** | Record interactions | Verify method was called |
|
|
755
|
-
| **Mock** | Verify interactions + return values | Test behavior and collaboration |
|
|
756
|
-
| **Fake** | Simplified working implementation | In-memory database |
|
|
757
|
-
|
|
758
|
-
### Test Double Usage by Test Level
|
|
759
|
-
|
|
760
|
-
| Level | Recommended Doubles |
|
|
761
|
-
|-------|---------------------|
|
|
762
|
-
| **Unit Test** | Mocks, Stubs for all external dependencies |
|
|
763
|
-
| **Integration Test** | Fakes for DB, Stubs for external APIs |
|
|
764
|
-
| **System Test** | Real components, Fakes only for external services |
|
|
765
|
-
| **E2E Test** | Real everything |
|
|
766
|
-
|
|
767
|
-
### Example: Using Mocks and Stubs
|
|
768
|
-
|
|
769
|
-
```typescript
|
|
770
|
-
// Stub example - predefined return value
|
|
771
|
-
const paymentGateway = {
|
|
772
|
-
processPayment: jest.fn().mockResolvedValue({ success: true, transactionId: 'TXN123' })
|
|
773
|
-
};
|
|
774
|
-
|
|
775
|
-
// Mock example - verify interaction
|
|
776
|
-
const emailService = {
|
|
777
|
-
sendConfirmation: jest.fn()
|
|
778
|
-
};
|
|
779
|
-
|
|
780
|
-
test('should send confirmation email after successful payment', async () => {
|
|
781
|
-
const order = new OrderService(paymentGateway, emailService);
|
|
782
|
-
|
|
783
|
-
await order.checkout({ amount: 100, email: 'user@example.com' });
|
|
784
|
-
|
|
785
|
-
// Verify the mock was called with correct arguments
|
|
786
|
-
expect(emailService.sendConfirmation).toHaveBeenCalledWith(
|
|
787
|
-
'user@example.com',
|
|
788
|
-
expect.objectContaining({ transactionId: 'TXN123' })
|
|
789
|
-
);
|
|
790
|
-
});
|
|
791
|
-
```
|
|
792
|
-
|
|
793
|
-
### Avoiding Over-Mocking
|
|
794
|
-
|
|
795
|
-
```
|
|
796
|
-
❌ Over-mocking (testing implementation details):
|
|
797
|
-
- Mocking private methods
|
|
798
|
-
- Mocking every single dependency
|
|
799
|
-
- Verifying every internal method call
|
|
800
|
-
|
|
801
|
-
✅ Appropriate mocking:
|
|
802
|
-
- Mock external services (APIs, databases)
|
|
803
|
-
- Mock slow operations (file I/O, network)
|
|
804
|
-
- Mock non-deterministic operations (time, random)
|
|
805
|
-
```
|
|
806
|
-
|
|
807
|
-
---
|
|
808
|
-
|
|
809
|
-
## Anti-Patterns and Remediation
|
|
810
|
-
|
|
811
|
-
### Code-Level Anti-Patterns
|
|
812
|
-
|
|
813
|
-
| Anti-Pattern | Description | Impact | Remediation |
|
|
814
|
-
|--------------|-------------|--------|-------------|
|
|
815
|
-
| **Testing Implementation Details** | Testing private methods or internal state | Brittle tests, refactoring breaks tests | Test public behavior only |
|
|
816
|
-
| **Over-Mocking** | Mocking everything, losing reality | False confidence, bugs in production | Balance mocks with real components |
|
|
817
|
-
| **Test Interdependence** | Tests depend on execution order | Random failures, hard to isolate | Each test sets up its own state |
|
|
818
|
-
| **Magic Numbers/Strings** | Hardcoded values without meaning | Poor readability, maintenance nightmare | Use named constants, builders |
|
|
819
|
-
| **Missing Assertions** | Tests without proper assertions | False positives | Every test needs clear assertions |
|
|
820
|
-
| **Flaky Tests** | Sometimes pass, sometimes fail | Eroded trust in test suite | Eliminate time/order dependencies |
|
|
821
|
-
| **Large Arrange Section** | Complex setup for each test | Hard to understand, maintain | Extract setup to builders/fixtures |
|
|
822
|
-
| **Conditional Logic in Tests** | if/else in test code | Multiple tests in one | Split into separate tests |
|
|
823
|
-
| **Test Code Duplication** | Same setup in many tests | Maintenance burden | Extract shared setup |
|
|
824
|
-
| **Overly Specific Assertions** | Asserting every single field | Brittle tests | Assert only relevant fields |
|
|
825
|
-
| **Ignoring Test Failures** | Skipping or commenting out failing tests | Hidden bugs | Fix or remove failing tests |
|
|
826
|
-
| **Testing Third-Party Code** | Testing library/framework behavior | Wasted effort | Trust third-party, test your code |
|
|
827
|
-
| **One Giant Test** | Single test covering everything | Hard to diagnose failures | Split into focused tests |
|
|
828
|
-
| **No Test Names** | `test1`, `test2` | Impossible to understand | Use descriptive names |
|
|
829
|
-
| **Catching All Exceptions** | `catch (Exception e)` in tests | Hidden failures | Catch specific exceptions |
|
|
830
|
-
|
|
831
|
-
### Process-Level Anti-Patterns
|
|
832
|
-
|
|
833
|
-
| Anti-Pattern | Description | Impact | Remediation |
|
|
834
|
-
|--------------|-------------|--------|-------------|
|
|
835
|
-
| **Skipping Red Phase** | Writing code before test | Lose TDD design benefits | Discipline: always write failing test first |
|
|
836
|
-
| **Skipping Refactor Phase** | Never cleaning up | Technical debt accumulates | Schedule refactoring time |
|
|
837
|
-
| **Test After Development (TAD)** | Writing tests after code complete | Not TDD, miss design feedback | True TDD: test first |
|
|
838
|
-
| **Big Bang Test Writing** | Writing all tests at once | Overwhelmed, poor coverage | One test at a time |
|
|
839
|
-
| **100% Coverage Obsession** | Chasing coverage metrics | Meaningless tests | Focus on behavior coverage |
|
|
840
|
-
| **No Test Review** | Tests not reviewed in PR | Poor test quality | Include tests in code review |
|
|
841
|
-
| **Delayed Test Runs** | Running tests infrequently | Late feedback | Run tests constantly |
|
|
842
|
-
| **Ignoring Slow Tests** | Letting test suite become slow | Developers skip tests | Optimize or parallelize |
|
|
843
|
-
| **TDD Zealotry** | Forcing TDD everywhere | Team frustration | Apply TDD pragmatically |
|
|
844
|
-
| **No Test Maintenance** | Letting tests rot | False positives/negatives | Treat tests as production code |
|
|
845
|
-
|
|
846
|
-
### Diagnosis and Remediation Steps
|
|
847
|
-
|
|
848
|
-
```
|
|
849
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
850
|
-
│ Anti-Pattern Diagnosis Workflow │
|
|
851
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
852
|
-
│ │
|
|
853
|
-
│ Symptom: Tests frequently break when refactoring │
|
|
854
|
-
│ ├─ Possible cause: Testing implementation details │
|
|
855
|
-
│ └─ Remediation: Review tests, ensure testing behavior only │
|
|
856
|
-
│ │
|
|
857
|
-
│ Symptom: Tests pass but bugs reach production │
|
|
858
|
-
│ ├─ Possible cause: Over-mocking, missing edge cases │
|
|
859
|
-
│ └─ Remediation: Add integration tests, review coverage gaps │
|
|
860
|
-
│ │
|
|
861
|
-
│ Symptom: Tests randomly fail │
|
|
862
|
-
│ ├─ Possible cause: Test interdependence, timing issues │
|
|
863
|
-
│ └─ Remediation: Isolate tests, mock time-dependent operations │
|
|
864
|
-
│ │
|
|
865
|
-
│ Symptom: Test suite takes too long │
|
|
866
|
-
│ ├─ Possible cause: Too many integration tests, slow I/O │
|
|
867
|
-
│ └─ Remediation: Increase unit test ratio, parallelize │
|
|
868
|
-
│ │
|
|
869
|
-
│ Symptom: Team avoids writing tests │
|
|
870
|
-
│ ├─ Possible cause: Tests too complex, poor tooling │
|
|
871
|
-
│ └─ Remediation: Simplify test setup, improve test utilities │
|
|
872
|
-
│ │
|
|
873
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
874
|
-
```
|
|
875
|
-
|
|
876
|
-
---
|
|
877
|
-
|
|
878
|
-
## Language/Framework Practices
|
|
879
|
-
|
|
880
|
-
For detailed language-specific TDD examples, see the TDD Assistant skill:
|
|
881
|
-
- [Language Examples](../skills/claude-code/tdd-assistant/language-examples.md)
|
|
882
|
-
|
|
883
|
-
### Quick Reference by Language
|
|
884
|
-
|
|
885
|
-
| Language | Test Framework | Mock Library | BDD Tool |
|
|
886
|
-
|----------|---------------|--------------|----------|
|
|
887
|
-
| **JavaScript/TypeScript** | Jest, Vitest | jest.mock, vitest.mock | Cucumber.js |
|
|
888
|
-
| **Python** | pytest, unittest | unittest.mock, pytest-mock | Behave |
|
|
889
|
-
| **C#** | xUnit, NUnit, MSTest | Moq, NSubstitute | SpecFlow |
|
|
890
|
-
| **Java** | JUnit 5, TestNG | Mockito, EasyMock | Cucumber-JVM |
|
|
891
|
-
| **Go** | testing | testify/mock | godog |
|
|
892
|
-
| **Ruby** | RSpec, minitest | rspec-mocks | Cucumber |
|
|
893
|
-
|
|
894
|
-
### Framework Selection Guidelines
|
|
895
|
-
|
|
896
|
-
| Consideration | Recommendation |
|
|
897
|
-
|---------------|----------------|
|
|
898
|
-
| **New project** | Use framework with best IDE support |
|
|
899
|
-
| **Team experience** | Use what team knows best |
|
|
900
|
-
| **Existing codebase** | Match existing test framework |
|
|
901
|
-
| **BDD required** | Choose framework with BDD integration |
|
|
902
|
-
| **Speed critical** | Consider parallel execution support |
|
|
903
|
-
|
|
904
|
-
---
|
|
905
|
-
|
|
906
|
-
## Metrics and Assessment
|
|
907
|
-
|
|
908
|
-
### TDD Maturity Model
|
|
909
|
-
|
|
910
|
-
| Level | Name | Characteristics |
|
|
911
|
-
|-------|------|-----------------|
|
|
912
|
-
| **Level 0** | No TDD | Tests written after code, if at all |
|
|
913
|
-
| **Level 1** | Test-First | Tests written before code sometimes |
|
|
914
|
-
| **Level 2** | TDD Practitioner | Consistent Red-Green-Refactor cycle |
|
|
915
|
-
| **Level 3** | TDD Expert | Effective test doubles, clean tests |
|
|
916
|
-
| **Level 4** | TDD Master | TDD drives design, mentors others |
|
|
917
|
-
|
|
918
|
-
### Key Metrics
|
|
919
|
-
|
|
920
|
-
| Metric | Target | Warning Threshold |
|
|
921
|
-
|--------|--------|-------------------|
|
|
922
|
-
| **Code Coverage** | > 80% | < 60% |
|
|
923
|
-
| **Test-to-Code Ratio** | 1:1 to 2:1 | < 0.5:1 |
|
|
924
|
-
| **Test Execution Time** | < 30 seconds (unit) | > 2 minutes |
|
|
925
|
-
| **Flaky Test Rate** | 0% | > 1% |
|
|
926
|
-
| **Test Maintenance Cost** | < 15% of dev time | > 30% |
|
|
927
|
-
| **Defect Escape Rate** | Decreasing | Increasing |
|
|
928
|
-
|
|
929
|
-
### Assessment Checklist
|
|
930
|
-
|
|
931
|
-
```
|
|
932
|
-
Team TDD Assessment:
|
|
933
|
-
|
|
934
|
-
□ Tests written before production code
|
|
935
|
-
□ Red-Green-Refactor cycle followed
|
|
936
|
-
□ Test names clearly describe behavior
|
|
937
|
-
□ Tests are independent and repeatable
|
|
938
|
-
□ Test suite runs quickly (< 2 minutes)
|
|
939
|
-
□ No flaky tests
|
|
940
|
-
□ Adequate coverage (> 80%)
|
|
941
|
-
□ Tests reviewed in code reviews
|
|
942
|
-
□ Refactoring done regularly
|
|
943
|
-
□ CI/CD runs tests automatically
|
|
944
|
-
```
|
|
945
|
-
|
|
946
|
-
---
|
|
29
|
+
| Aspect | Description |
|
|
30
|
+
|--------|-------------|
|
|
31
|
+
| **Core Cycle** | Red → Green → Refactor → Repeat |
|
|
32
|
+
| **FIRST Principles** | Fast, Independent, Repeatable, Self-validating, Timely |
|
|
33
|
+
| **Test Level** | Unit/Integration tests |
|
|
34
|
+
| **Participants** | Developers |
|
|
35
|
+
| **Tools** | xUnit frameworks (Jest, pytest, JUnit, etc.) |
|
|
947
36
|
|
|
948
37
|
## Related Standards
|
|
949
38
|
|
|
950
|
-
- [Testing Standards](testing-standards.md)
|
|
951
|
-
- [
|
|
952
|
-
- [
|
|
953
|
-
- [Acceptance Test-Driven Development](acceptance-test-driven-development.md) - ATDD workflow with specification workshops
|
|
954
|
-
- [Spec-Driven Development](spec-driven-development.md) - SDD workflow
|
|
955
|
-
- [Code Check-in Standards](checkin-standards.md) - Check-in requirements
|
|
956
|
-
- [Code Review Checklist](code-review-checklist.md) - Review guidelines
|
|
957
|
-
|
|
958
|
-
---
|
|
959
|
-
|
|
960
|
-
## References
|
|
961
|
-
|
|
962
|
-
### Books
|
|
963
|
-
|
|
964
|
-
- Kent Beck - "Test Driven Development: By Example" (2002)
|
|
965
|
-
- Robert C. Martin - "Clean Code" Chapter 9: Unit Tests (2008)
|
|
966
|
-
- Michael Feathers - "Working Effectively with Legacy Code" (2004)
|
|
967
|
-
- Steve Freeman & Nat Pryce - "Growing Object-Oriented Software, Guided by Tests" (2009)
|
|
968
|
-
|
|
969
|
-
### Standards
|
|
970
|
-
|
|
971
|
-
- [IEEE 29119 - Software Testing Standards](https://www.iso.org/standard/81291.html)
|
|
972
|
-
- [SWEBOK v4.0 - Chapter 5: Software Construction](https://www.computer.org/education/bodies-of-knowledge/software-engineering)
|
|
973
|
-
- [ISTQB Certified Tester Foundation Level](https://www.istqb.org/)
|
|
974
|
-
|
|
975
|
-
### Online Resources
|
|
976
|
-
|
|
977
|
-
- [TDD by Example - Martin Fowler](https://martinfowler.com/bliki/TestDrivenDevelopment.html)
|
|
978
|
-
- [The Three Rules of TDD - Uncle Bob](http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd)
|
|
979
|
-
- [Test Pyramid - Martin Fowler](https://martinfowler.com/bliki/TestPyramid.html)
|
|
980
|
-
- [Approval Tests](https://approvaltests.com/)
|
|
981
|
-
|
|
982
|
-
---
|
|
983
|
-
|
|
984
|
-
## Version History
|
|
985
|
-
|
|
986
|
-
| Version | Date | Changes |
|
|
987
|
-
|---------|------|---------|
|
|
988
|
-
| 1.1.0 | 2026-01-12 | Added: Comprehensive Code Smell Catalog (22+ smells in 5 categories based on Martin Fowler's Refactoring 2nd Ed.), Code Smell Detection Checklist |
|
|
989
|
-
| 1.0.0 | 2026-01-07 | Initial TDD standard definition |
|
|
990
|
-
|
|
991
|
-
---
|
|
992
|
-
|
|
993
|
-
## License
|
|
994
|
-
|
|
995
|
-
This standard is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
996
|
-
|
|
997
|
-
**Source**: [universal-dev-standards](https://github.com/AsiaOstrich/universal-dev-standards)
|
|
39
|
+
- [Testing Standards](testing-standards.md)
|
|
40
|
+
- [Behavior-Driven Development](behavior-driven-development.md)
|
|
41
|
+
- [Spec-Driven Development](spec-driven-development.md)
|