From kimchi
Enforces strict TDD workflow: RED (failing test first), GREEN (minimal passing code), REFACTOR for features, bug fixes, refactors, and behavior changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kimchi:tddThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Write the test first. Watch it fail. Write minimal code to pass.
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.
npx claudepluginhub tromml/kimchi --plugin kimchiEnforces TDD (Red-Green-Refactor) for every feature, bugfix, or refactor. Write failing tests first, never production code without a failing test.
Enforces test-driven development: write failing test first, then minimal code. Use when implementing features or bugfixes before writing production code.