tcr-kentbeck
TCR (Test && Commit || Revert)
Non-negotiables
When this skill applies, treat TCR as mandatory, not optional:
-
One small step — Prefer the smallest change that could move tests toward green (or add a failing test first in strict TDD, then minimal implementation).
-
Run tests — Use the project’s real test command (see Detecting the test command). Always run the full suite for that command (same as CI / default project test entrypoint): e.g.
pytestwith no path arguments,npm test/pnpm test/yarn test,cargo test,go test ./...,make testif that runs everything. Do not narrow to a single file, class, or-kfilter unless the user explicitly asks for a scoped run. -
Green → commit — If tests pass, commit that step immediately with a message that describes what changed (present tense, imperative).
-
Red → revert — If tests fail, do not keep the change. Restore the working tree to the last committed state (
git restore ./git checkout -- .or revert unstaged edits as appropriate). Then retry with a smaller or different step. -
Red → log — After reverting, append an entry to
tcr-failure-log.mdat the repository root (create it with a short title if missing). Record what went wrong so the failure is not invisible: when (ISO timestamp or equivalent), which test(s) failed and the assertion or error (or a short traceback excerpt), what change was attempted (intent in one or two sentences), and optionally what to try next. This file is append-only; do not delete past entries. Commit this log update with the next green commit if it is part of the same work, or as its own tiny commit if the user prefers a clean separation.
Do not accumulate uncommitted red edits “to fix in the next message.” Red means revert first, then log.