agentleFS
K95M65K95M65/AI_ONBOARD/skills/develop-test-first/SKILL.md

develop-test-first

Skill0 starsChanged 4 months agoMITView on GitHub

Implements a known behavior change through a focused failing test, the smallest passing production change, and a verified refactor. Use when the user requests test-driven development, a known-cause regression-first bug fix, or new testable domain logic; do not use for unknown-cause diagnosis, behavior-preserving legacy characterization or refactoring, documentation-only work, generated artifacts, exploratory spikes, or UI polish whose value cannot be expressed as stable behavior.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use a red-green-refactor loop to clarify behavior and protect the change, not to maximize test count.

    line 8
  2. Distinctive:

    Follow the repository's existing test framework, naming, fixture, and placement conventions.

    line 13
  3. Very specific:

    Run the nearest existing tests before editing.

    line 18
  4. Distinctive:

    Run it and confirm it fails for the intended product reason, not syntax, setup, or fixture failure.

    line 25
  5. Distinctive:

    Run the focused test and relevant neighboring tests.

    line 27
  6. Distinctive:

    If the work requires a discovery spike, keep it disposable and translate the learned contract into a test before shipping production code.

    line 36
  7. Distinctive:

    Run the focused test, relevant suite, and any required typecheck, lint, build, or integration checks.

    line 42
  8. Very specific:

    Use debug-systematically first when the cause is unknown, then return here only after the intended correction is supported.

    line 45
  9. Distinctive:

    Use an independent reviewer and verifier after implementation when available.

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Develop test first

Use a red-green-refactor loop to clarify behavior and protect the change, not to maximize test count.

Define the behavior

State the observable outcome, boundary, representative input, expected result, and meaningful failure case. Follow the repository's existing test framework, naming, fixture, and placement conventions. Use a platform-specific testing skill when it provides more precise guidance.

Establish the baseline

Run the nearest existing tests before editing. Confirm whether the requested behavior is absent, broken, or already covered. If the request is only to characterize and preserve existing legacy behavior, route to simplify-code-safely; a passing characterization test is not the Red step for a new behavior.

Run the loop

  1. Red — add the smallest test that expresses one missing behavior.
  2. Run it and confirm it fails for the intended product reason, not syntax, setup, or fixture failure.
  3. Green — make the smallest coherent production change that satisfies the behavior.
  4. Run the focused test and relevant neighboring tests.
  5. Refactor — simplify names, duplication, control flow, and test setup while all tests stay green.
  6. Repeat for the next independently valuable behavior.

Assert public outcomes, state transitions, outputs, or boundary interactions. Avoid tests coupled to private method order, incidental DOM structure, arbitrary timing, or excessive mocks.

Handle exceptions honestly

If the work requires a discovery spike, keep it disposable and translate the learned contract into a test before shipping production code. If a reliable automated test is impractical, explain why and define the strongest repeatable manual or integration evidence instead of pretending the loop occurred.

Finish with evidence

Run the focused test, relevant suite, and any required typecheck, lint, build, or integration checks. Report the initial failing behavior, production change, refactor, and final commands.

Use debug-systematically first when the cause is unknown, then return here only after the intended correction is supported. Use simplify-code-safely for characterization and behavior-preserving cleanup. Use an independent reviewer and verifier after implementation when available.

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.