tdd
Test-driven development loop (red-green-refactor) with commit-based phase state and Jira traceability. Use when the user wants to build a feature or fix a bug test-first, mentions "tdd", "red-green-refactor", or "test-first". Replaces the tdg plugin — combines its commit/phase discipline with seam-based test quality rules from kb Testing Standards.
- License 许可
- MIT
- 所属仓库
- goffity/dev-km
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- tdd
- description
- Test-driven development loop (red-green-refactor) with commit-based phase state and Jira traceability. Use when the user wants to build a feature or fix a bug test-first, mentions "tdd", "red-green-refactor", or "test-first". Replaces the tdg plugin — combines its commit/phase discipline with seam-based test quality rules from kb Testing Standards.
- argument-hint
- [feature/bug description or RUAYS-XXXX]
02 资源文件 59
- 参考文档editing.md6.7 KB
- 许可证LICENSE.txt1.4 KB
- 参考文档pptxgenjs.md12.5 KB
- 脚本scripts/__init__.py—
- 脚本scripts/add_slide.py6.7 KB
- 脚本scripts/clean.py9.4 KB
- 脚本scripts/office/helpers/__init__.py—
- 脚本scripts/office/helpers/merge_runs.py5.4 KB
- 脚本scripts/office/helpers/simplify_redlines.py5.6 KB
- 脚本scripts/office/pack.py4.9 KB
- 脚本scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd1.9 KB
- 脚本scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd2.5 KB
- 脚本scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd2.8 KB
- 脚本scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd1.3 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd73.2 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd6.8 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd50.1 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd624 B
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd148.5 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd1.2 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd8.7 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd14.4 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd81.7 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd1.2 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd7.2 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd6.2 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd1.2 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd880 B
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd2.5 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd3.4 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd7.3 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd22.8 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd1.3 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd236.6 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd25.5 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd24.7 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd535 B
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd5.6 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd3.9 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd167.4 KB
- 脚本scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd4.5 KB
- 脚本scripts/office/schemas/mce/mc.xsd3.1 KB
- 脚本scripts/office/schemas/microsoft/wml-2010.xsd25.9 KB
- 脚本scripts/office/schemas/microsoft/wml-2012.xsd3.7 KB
- 脚本scripts/office/schemas/microsoft/wml-2018.xsd901 B
- 脚本scripts/office/schemas/microsoft/wml-cex-2018.xsd1.7 KB
- 脚本scripts/office/schemas/microsoft/wml-cid-2016.xsd1002 B
- 脚本scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd600 B
- 脚本scripts/office/schemas/microsoft/wml-symex-2015.xsd745 B
- 脚本scripts/office/soffice.py5.2 KB
- 脚本scripts/office/unpack.py4.0 KB
- 脚本scripts/office/validate.py3.6 KB
- 脚本scripts/office/validators/__init__.py336 B
- 脚本scripts/office/validators/base.py31.9 KB
- 脚本scripts/office/validators/docx.py16.0 KB
- 脚本scripts/office/validators/pptx.py9.6 KB
- 脚本scripts/office/validators/redlining.py8.7 KB
- 脚本scripts/tdd-phase.sh1.5 KB
- 脚本scripts/thumbnail.py8.6 KB
03 SKILL.md 正文
TDD Loop
Red → green loop engine with recoverable state (git commits) and issue traceability.
This skill owns the loop mechanics only. What makes a good test — seams, anti-patterns (tautological, implementation-coupled), mocking boundaries — is defined in one place: kb/02-patterns/standards/Testing Standards.md §Test Quality (kol-brain vault, reachable via the kb/ symlink in kol-architecture or ~/Development/kol/kol-brain/). Read that section before the first cycle and follow it on every cycle. Do not restate its rules here.
Step 0: Project Config
Discover how to run tests from the repo itself (no config file needed):
- Read the repo's
CLAUDE.mdandMakefile— kol convention:make test,make build - Single test:
go test ./<pkg>/... -run '<TestName>'(usego.workat workspace root when the module lacks test deps — e.g. game-repository) - Coverage:
go test ./<pkg>/... -cover - If a legacy
TDG.mdexists, honor it (backward compat)
Step 1: Traceability
Identify the Jira ticket before starting:
- Check the user's message for
RUAYS-XXXX - Check the branch name (e.g.
feature/RUAYS-2041-slip-only-flag) - If not found, ask the user
Every commit in the loop ends with the ticket: (RUAYS-XXXX).
Step 2: Agree Seams (GATE — before any test)
List the seams under test — the public interfaces where behavior will be observed (service interface, handler HTTP contract, repository query layer) — per the seam table in kb §Test Quality. Confirm with the user via AskUserQuestion before writing any test. No test is written at an unconfirmed seam. This is how testing effort lands on critical paths instead of every edge case.
Then break the work into vertical slices: one behavior per cycle. Do not draft implementation code first — the failing test at the seam is the design step.
Step 3: Check Phase
bash ~/.claude/skills/tdd/scripts/tdd-phase.sh
Reads commits since merge-base with develop/main, so state survives session restarts and ignores unrelated commits. Resume from the phase it reports:
| Phase | Meaning | Next action |
|---|---|---|
unknown / refactor |
No cycle in progress | Start RED for the next slice |
red |
Failing test committed | Go GREEN |
green |
Implementation committed | Next slice (RED) or refactor |
The Loop
RED — failing test first
- Write one test for the current slice, at an agreed seam, following kb §Test Quality (expected values from an independent source; name says WHAT not HOW)
- Run that single test — it must fail for the right reason (assertion, not compile error you didn't intend)
- Commit (only the files you edited, never
git add .):test(red): <behavior> (RUAYS-XXXX)
GREEN — minimal implementation
- Verify the last phase is
red(script) - Write only enough code to pass the test — no speculative features, no anticipating future tests
- Run the single test (pass), then the package's tests (no regressions)
- Commit:
feat(green): <behavior> (RUAYS-XXXX)— usefix(green):for bug fixes
REFACTOR — optional, light only
Small cleanups (naming, extraction) while green: commit as refactor: <what> (RUAYS-XXXX). Structural redesign belongs to the review stage (/code-review, /pr), not the loop — don't let refactoring grow the cycle.
Then loop back to RED for the next slice, or finish.
Rules
- One slice per cycle: one seam, one test, one minimal implementation
- Red before green, always — never commit implementation without a preceding
test(red)commit for it - Commit format is Conventional Commits (passes commitlint); phase lives in the scope. Squash-merge via
/prkeeps red/green history out of main - Bug fixes: the RED test is the regression test (must fail on the unfixed code) — satisfies kb "fix bug ต้องมี regression test"
- Track cycles with the Todo list:
☐ RED: <slice>→☐ GREEN: <slice>per slice
Finish
When all slices are done: run the full make test + coverage on touched packages (kb: ≥ 80% for touched functions), then hand off to /pr.
04 同仓库更多 Skills
wait-what
Stop. That last message did not land: re-pitch it.
td
Creates post-task retrospectives with Before/After context and session documentation.
summary
Generates weekly or monthly session summaries from retrospectives and activity logs.
share
Shares knowledge across projects by copying to shared-knowledge directory with cross-project metadata.
session-analyzer
Analyzes git changes and creates retrospective drafts with Before/After context.
security-auditor
Audits code for security vulnerabilities including OWASP Top 10 and authentication issues.