From attacca
TDD workflow skill enforcing RED → GREEN → REFACTOR. Use when: implementing any feature test-first, writing unit or integration tests, building with a test-heavy stack (Jest, Vitest, pytest, RSpec, etc.). Prevents writing implementation before a failing test exists.
How this skill is triggered — by the user, by Claude, or both
Slash command
/attacca:tddThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- Any feature implementation when tests are in scope
RED → Write a failing test first. It MUST fail before you write code.
GREEN → Write the minimum code to make the test pass. No more.
REFACTOR → Clean up the code. Tests must stay green after refactor.
Never skip to GREEN. Never write implementation before a failing test exists.
Before writing a single line of test code, define the contract:
Write this contract as a comment block at the top of the test file.
it("returns 401 when token is expired") not it("works")// Example (Vitest / Jest)
it("rejects login when password is wrong", async () => {
// Arrange
const user = await createTestUser({ password: "correct-password" });
// Act
const result = await loginService({ email: user.email, password: "wrong" });
// Assert
expect(result.success).toBe(false);
expect(result.error).toBe("INVALID_CREDENTIALS");
});
Run the test suite. Confirm the test fails for the right reason.
Do not proceed to GREEN until the test fails for the correct reason.
Write only what's needed to make the failing test pass. Do not add:
The ugliest code that makes the test green is correct at this stage.
Don't just run the new test. Run the entire test suite to catch regressions.
All tests must pass. Then and only then proceed to REFACTOR.
Run the full test suite after each refactor step. Tests must remain green.
npx claudepluginhub adihebbalae/attacca --plugin attaccaGuides Test-Driven Development with Red-Green-Refactor cycle for writing code, implementing features, or fixing bugs in TDD projects.
Red-Green-Refactor cycle for test-first development. Write failing test, implement minimal code, refactor safely. Use when developing new features or fixing bugs in test-driven projects.