agentleFS
Kromatic-InnovationKromatic-Innovation/kromatic-dev-stack/skills/tdd-implementation/SKILL.md

tdd-implementation

Skill0 starsChanged 4 months agoMITView on GitHub

GREEN-phase role for implementing code to make failing tests pass — supports both frontend (React/Next.js) and backend (Python/FastAPI).

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. felipeArnold/filament-ai-skills★ 9same name
    2. gimso2x/claude-harness-slim-template★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository11 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 12 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After tests pass and all quality checks are clean, hand back to Dorothy's push routine.

    line 18
  2. Very specific:

    Run /caveman ultra at task start to compress implementation-phase output.

    line 22
  3. Very specific:

    Test files (*.test.ts, *.test.tsx, __tests__/, tests/)

    line 30
  4. Distinctive:

    Read failing tests to understand expected contracts and behavior.

    line 34
  5. Distinctive:

    Run the test suite.

    line 36
  6. Distinctive:

    Run language-specific quality checks (see below).

    line 37
  7. Very specific:

    If a failing test was written as a regression gate for a named prior bug (PR or commit references "regression test for X", "would have …

    line 45
  8. Distinctive:

    All tests pass, no regressions

    line 55
  9. Distinctive:

    All quality checks clean (see language-specific sections)

    line 56
  10. Distinctive:

    No test files written or modified

    line 57
  11. Distinctive:

    Run the repo's control-plane risk gate (if present) — confirm no gate violations

    line 97
  12. Very specific:

    All new interactive elements have aria-label / aria-labelledby

    line 98
  13. Very specific:

    All test-targeted elements have data-testid

    line 99
  14. Distinctive:

    Must also never touch: Alembic migration files (autogenerate only.

    line 107
  15. Distinctive:

    db_api / DAO: all SQLAlchemy queries; return ORM models

    line 119
  16. Very specific:

    All DB + I/O is async/await

    line 124
  17. Distinctive:

    Use injected session dependency.

    line 125
  18. Distinctive:

    Never access relationships after session close

    line 130

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: TDD Implementation

Goal

Make the failing tests pass with clean, well-structured code. This is Dorothy's GREEN phase.

Next Step

After tests pass and all quality checks are clean, hand back to Dorothy's push routine. Do not open a PR from this phase — Dorothy handles the full push → CI → PR cycle.

Token budget

Run /caveman ultra at task start to compress implementation-phase output. Before writing commit messages or PR bodies, run /normal mode. If the caveman plugin is not installed, proceed without it.

Role

Owns source files across frontend and backend. In the TDD workflow, implements code to make pre-written failing tests pass (GREEN phase). Does not write test files — that is the tdd-test-writer role.

Must Never Touch

  • Test files (*.test.ts, *.test.tsx, __tests__/, tests/)
  • Other repos

TDD Workflow — GREEN Phase

  1. Read failing tests to understand expected contracts and behavior.
  2. Implement the required code.
  3. Run the test suite.
  4. Run language-specific quality checks (see below).
  5. Report to orchestrator: "Implementation complete, all tests passing."

If test files have errors (e.g., type errors), flag them back to tdd-test-writer — do not silently modify test files.

Regression gates — do not land the fix alone

If a failing test was written as a regression gate for a named prior bug (PR or commit references "regression test for X", "would have caught Y", etc.), the tdd-test-writer role must additionally demonstrate the test fails against a simulated pre-fix version of the code before the commit lands — see tdd-test-writer SKILL.md → "Regression gate tests — prove the gate". If that demonstration is missing, flag it back; do not report GREEN on the basis of "test passes against my fix" alone. A regression test that has only been verified against the fix proves nothing about whether it would have caught the bug.

Done Criteria

  • All tests pass, no regressions
  • All quality checks clean (see language-specific sections)
  • No test files written or modified
  • Orchestrator notified with results

PR-ready boundary

  • PR-ready boundary = local test suite green + lint/typecheck clean + acceptance criteria addressed.
  • This phase does not open the PR (see "Next Step" above — that's Dorothy's job, per Dorothy SKILL.md → "Pre-PR discipline" → "Draft PR for Quine review"). Once this phase's Done Criteria are met, hand back to Dorothy's push routine, which opens the PR as a draft and manages gh pr ready timing. See also Occam SKILL.md → "Ship to staging routine" Path A.

Frontend (React / Next.js)

File Ownership

  • Source files: components, pages, hooks, lib (excluding lib/test/), theme
  • Mocks, stories, synthetic monitoring checks
  • Config: jest config, next config, tsconfig, eslint config

Quality Checks

yarn test --watchAll=false   # All tests pass
yarn tsc --noEmit            # No TypeScript errors
yarn lint                    # No ESLint errors

TypeScript errors in test files are NOT caught by lint, build, or test. If the test-writer has type errors, flag them back — do not silently change test files to work around them.

Accessibility Requirements

  • aria-label on all interactive elements without visible text (icon buttons, icon-only links, form controls without a label element)
  • aria-labelledby when pointing at existing visible text
  • data-testid on any element tests need to target: key buttons, links, form fields, sections, modals, list items

Code Style

  • TypeScript strict mode; full type annotations; no any without justification
  • Functional components; React.memo where beneficial
  • Styling: MUI sx prop for one-offs; Emotion styled() for reusable styles
  • PascalCase for component files/directories; camelCase for hooks and utils

Additional Done Criteria

  • Run the repo's control-plane risk gate (if present) — confirm no gate violations
  • All new interactive elements have aria-label / aria-labelledby
  • All test-targeted elements have data-testid

Backend (Python / FastAPI)

File Ownership

  • Source files: routers, managers, db, schemas, auth, utils, integrations, workers
  • Must also never touch: Alembic migration files (autogenerate only; never hand-edit existing migrations)

Quality Checks

pytest tests    # All tests pass
black .         # No-op (code already formatted)
flake8 .        # No lint errors

Architecture Layers

  • Routers (thin): validate input → call manager → return response
  • Managers (business logic): own business logic; hold DB API instances as class attributes
  • db_api / DAO: all SQLAlchemy queries; return ORM models
  • Schemas (Pydantic v2): separate request vs. response models
  • Exceptions: raise from utils.exceptions (e.g., NotFoundException)

Async / Session Rules

  • All DB + I/O is async/await
  • Use injected session dependency; no manual commit/close in route handlers
  • One session per request

ORM Safety

  • Eager-load relationships with selectinload / joinedload
  • Never access relationships after session close
  • Build nested trees manually in manager layer

Code Style

  • Black formatter (120-char line length)
  • Flake8 with import-order, quotes, naming plugins
  • Full type hints on all signatures
  • snake_case for files, functions, variables; PascalCase for classes

Part of kromatic-dev-stack by Kromatic. Questions on this development stack, how to use it, or how to integrate it with your team — reach us at kromatic.com/contact-us.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.