一键导入
kimchitdd
Use when implementing any feature, bugfix, or behavior change — before writing implementation code. Enforces RED-GREEN-REFACTOR cycle.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when implementing any feature, bugfix, or behavior change — before writing implementation code. Enforces RED-GREEN-REFACTOR cycle.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Convert the kimchi plugin into OpenCode and Codex compatible formats using the bundled converter CLI. Requires bun runtime.
This command should be used to run the Kimchi planning pipeline through refinement, transforming a vague idea into a draft plan ready for cross-model analysis. Orchestrates 6 stages: clarify, requirements, research, generate, review, refine. Use --full-auto to also run beads + validate after manual revise/synthesize.
Use when executing a bead task. Detects orchestration mode (ACFS or GasTown) from .beads/manifest.yaml and enforces the appropriate execution discipline.
This command should be used to convert the final plan into standalone bead YAML task specifications for multi-agent execution. Ninth stage of the Kimchi planning pipeline. Produces .beads/ directory. Supports both ACFS and GasTown orchestration modes.
This command should be used to run the Kimchi self-improvement system. Observes execution outcomes, proposes incremental improvements to skills/validators/personas, validates against history, and applies with versioning.
This command should be used to clear the Kimchi working directory (.kimchi/) and start fresh. Preserves .beads/ directory. Use when starting a new planning session or recovering from a bad state.
| name | kimchi:tdd |
| description | Use when implementing any feature, bugfix, or behavior change — before writing implementation code. Enforces RED-GREEN-REFACTOR cycle. |
Write the test first. Watch it fail. Write minimal code to pass.
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
Violating the letter of the rules is violating the spirit of the rules.
Always when writing code that has behavior:
Exceptions (ask your human partner):
Thinking "skip TDD just this once"? Stop. That's rationalization.
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? Delete it. Start over.
No exceptions:
Implement fresh from tests. Period.
Write one minimal test showing what should happen.
```ruby it "rejects file over 5MB with clear error" do large_file = fixture_file("6mb.jpg")result = AvatarUploadService.call(large_file, user_id: user.id)
expect(result).to be_failure expect(result.error).to eq("File too large (max 5MB)") end
Clear name, tests real behavior, one thing
</Good>
<Bad>
```ruby
it "works" do
mock = double("s3", upload: true)
allow(S3Client).to receive(:new).and_return(mock)
result = AvatarUploadService.call(file, user_id: 1)
expect(mock).to have_received(:upload)
end
Vague name, tests mock not code
Requirements:
MANDATORY. Never skip.
# Run the test, expect failure
bundle exec rspec spec/services/avatars/upload_service_spec.rb
Confirm:
Test passes? You're testing existing behavior. Fix test.
Test errors? Fix error, re-run until it fails correctly.
Write simplest code to pass the test.
```ruby def call(file, user_id:) return failure("File too large (max 5MB)") if file.size > 5.megabytesurl = s3_client.upload(file, key: "avatars/#{user_id}/#{SecureRandom.uuid}") success(url: url) end
Just enough to pass
</Good>
<Bad>
```ruby
def call(file, user_id:, options: {})
strategy = options.fetch(:resize_strategy, :vips)
validator = ValidatorFactory.for(file.content_type)
pipeline = ProcessingPipeline.new(strategy: strategy)
# YAGNI
end
Over-engineered
Don't add features, refactor other code, or "improve" beyond the test.
MANDATORY.
bundle exec rspec spec/services/avatars/upload_service_spec.rb
Confirm:
Test fails? Fix code, not test.
Other tests fail? Fix now.
After green only:
Keep tests green. Don't add behavior.
Next failing test for next feature.
| Excuse | Reality |
|---|---|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
| "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
| "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
| "Existing code has no tests" | You're improving it. Add tests for the code you touch. |
All of these mean: Delete code. Start over with TDD.
Before marking work complete:
Can't check all boxes? You skipped TDD. Start over.
Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
Never fix bugs without a test.
| Problem | Solution |
|---|---|
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
| Test too complicated | Design too complicated. Simplify interface. |
| Must mock everything | Code too coupled. Use dependency injection. |
| Test setup huge | Extract helpers. Still complex? Simplify design. |
Production code → test exists and failed first
Otherwise → not TDD
No exceptions without your human partner's permission.