ai-toolkit-rules
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
TDD with red-green-refactor loop and vertical slices. Triggers: TDD, test-first, red-green-refactor, test driving development.
$ npx -y skills add softspark/ai-toolkit --skill tdd --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/tddContext preview
The summary Claude sees to decide when to auto-load this skill.
TDD with red-green-refactor loop and vertical slices. Triggers: TDD, test-first, red-green-refactor, test driving development.
name: tdd description: "TDD with red-green-refactor loop and vertical slices. Triggers: TDD, test-first, red-green-refactor, test driving development." user-invocable: true effort: high argument-hint: "[feature or behavior to implement]" allowed-tools: Read, Write, Edit, Grep, Glob, Bash, Agent
$ARGUMENTS
Build features using strict RED → GREEN → REFACTOR cycles with vertical slices.
/tdd [feature or behavior to implement]
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? **Delete it. Start over.**
**No exceptions:**
Implement fresh from tests. Period.
**Violating the letter of this rule is violating the spirit of this rule.**
**Core principle**: Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
**Good tests**: Integration-style, exercise real code paths through public APIs. Describe _what_ the system does, not _how_. Read like specifications. Survive refactors.
**Bad tests**: Coupled to implementation. Mock internal collaborators, test private methods, verify through external means. Warning sign: test breaks on refactor but behavior is unchanged.
See [reference/tests.md](reference/tests.md) for examples, [reference/mocking.md](reference/mocking.md) for mocking guidelines.
**DO NOT write all tests first, then all implementation.**
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
Tests written in bulk test _imagined_ behavior. Vertical slices let each test respond to what you learned from the previous cycle.
Before writing any code:
Write ONE test that confirms ONE thing:
RED: Write test for first behavior → test fails GREEN: Write minimal code to pass → test passes
This proves the path works end-to-end.
For each remaining behavior:
RED: Write next test → fails GREEN: Minimal code to pass → passes
| Rule | Description | |------|-------------| | One at a time | One test per cycle | | Minimal | Only enough code to pass current test | | No anticipation | Don't code for future tests | | Behavioral | Tests focus on observable behavior |
After all tests pass, look for [refactor candidates](reference/refactoring.md):
**Never refactor while RED.** Get to GREEN first.
[ ] 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
If you catch yourself doing ANY of these, **delete the code and restart with TDD**:
| 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. | | "Need to explore first" | Fine. Throw away exploration, start with TDD. | | "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. | | "This is different because..." | No. Apply the Iron Law. |
Before marking work complete:
Can't check all boxes? You skipped TDD. Start over.
AI coding toolkit with machine-enforced safety, 116 skills, 44 agents, lifecycle hooks, persona presets, opt-in plugin packs, and benchmark tooling.
Repo: softspark/ai-toolkit
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
Searches past coding sessions for observations, decisions, context. Triggers: mem-search,…
Accessibility validator: WCAG 2.1 AA, EN 301 549, EAA. Triggers: a11y, accessibility, WCAG,…
Creates new specialized agents with frontmatter, tools, delegation. Triggers: new agent,…
Analyzes code quality, complexity, patterns across codebase. Triggers: quality report,…
API design: naming, versioning, pagination, idempotency, OpenAPI, error contracts and safe…