一键导入
lfe-tdd
Red-green-refactor quality pass on code the Builder just wrote. Use in the Builder sub-pipeline after lfe-builder completes implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Red-green-refactor quality pass on code the Builder just wrote. Use in the Builder sub-pipeline after lfe-builder completes implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Act as the Archivist for an LFE-compliant project. Use when a change is approved and needs documentation sync, changelog updates, or pipeline status cleanup.
Act as the Architect for an LFE-compliant project. Design solutions and draft high-fidelity plans.
Act as the Builder for an LFE-compliant project. Use when implementing an approved plan, writing code in src/**, or running unit tests.
Inspector sub-skill. Analyses changed code for cyclomatic complexity, excessive nesting, oversized functions, and cognitive load indicators. Pure LLM reasoning — no external tooling. Writes .plans/checks/complexity_findings.md. Called by lfe-inspector when enabled in inspector-config.md.
Inspector sub-skill. Reviews dependency manifest files (package.json, requirements.txt, go.mod, Cargo.toml, pom.xml) changed in the current diff for risky version patterns and stale majors. Emits a human-run audit instruction rather than executing tools. Writes .plans/checks/dep_findings.md. Called by lfe-inspector when enabled in inspector-config.md.
Disciplined bug-diagnosis loop. Reproduce → Hypothesise → Fix. Use in the Inspector sub-pipeline (Step 3, conditional) when verification fails.
| name | lfe-tdd |
| description | Red-green-refactor quality pass on code the Builder just wrote. Use in the Builder sub-pipeline after lfe-builder completes implementation. |
active_plan.md + .plans/builder_done.md (resume marker — confirms implementation phase completed) + code written by lfe-builder.plans/tdd_report.mdCore principle: Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
Good tests are integration-style: they exercise real code paths through public APIs. They describe what the system does, not how. A good test reads like a specification.
Bad tests are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means. Warning sign: your test breaks when you refactor, but behavior hasn't changed.
See tests.md, mocking.md for examples.
Write incrementally — one test, then its implementation — rather than all tests up front. Writing all tests first is "horizontal slicing."
Correct approach: Vertical slices via tracer bullets. One test → one implementation → repeat.
WRONG (horizontal):
RED: test1, test2, test3, test4, test5
GREEN: impl1, impl2, impl3, impl4, impl5
RIGHT (vertical):
RED→GREEN: test1→impl1
RED→GREEN: test2→impl2
RED→GREEN: test3→impl3
Read active_plan.md and review what the Builder implemented. Identify behaviors that need test coverage. Use the project's domain glossary for test names.
Confirm with the human which behaviors to prioritize for testing. Testing everything is impossible — prioritize.
Write ONE test that confirms ONE thing:
RED: Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passes
For each remaining behavior:
RED: Write next test → fails
GREEN: Minimal code to pass → passes
Rules:
After all tests pass, look for refactor candidates (see refactoring.md):
Refactor only once GREEN. Reach green first, then refactor.
[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Test would survive internal refactor
[ ] Code is minimal for this test
[ ] No speculative features added
When TDD pass completes, write .plans/tdd_report.md:
---
phase: builder
step: tdd
status: complete
timestamp: <ISO-8601>
source: .plans/active_plan.md
slice: <copied from active_plan.md>
tests_passed: <N>
tests_failed: 0
---
## Behaviors Tested
- <behavior 1>: PASS
- <behavior 2>: PASS
## Refactors Applied
- <refactor 1>
## Coverage Notes
- <any gaps or deferred items>
Update pipeline_status.md coordination tracker to mark tdd step as ✅.
The TDD step's signature claim is "the tests pass" — so it always ships with the pasted run counts that prove it.
A completion claim earns its place only when fresh tool output from this session backs it.
Confidence routing (per claim).
| Confidence | Basis | Action |
|---|---|---|
| High | Tool-verified this session | State it plainly. |
| Medium | Inferred from context | State it with the caveat that it is inferred. |
| Low | Recalled from training or memory | Verify first (read or run), then state. |
Hallucination-signal checklist. Pause → Verify → Correct the moment you catch yourself: