agentleFS
yamanidevyamanidev/claude-code-configuration/skills/test/SKILL.md

test

Skill9 starsChanged 3 months agoMITView on GitHub

Workflow for writing tests against requirements — verifying that a feature, endpoint, or function behaves correctly according to its specification, not according to its current implementation. Reads the spec/requirement and the surface being tested (signatures, contracts, observable behavior); deliberately avoids mirroring implementation logic into the tests. Suitable for adding coverage after the fact in a codebase without strong test culture. Does not modify production code (use /ship) and does not review existing tests as part of a code review (use /review-code).

98 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use develop, perf and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • bamechoSkill

    develop

    开发实施阶段详细规则;进入开发实施时读取;包含执行流程、代码规范、一致性审计、方案包迁移

    Also in 6 projects that use this

  • MicrosoftSkill

    perf

    Speed and memory performance rules for Rust crates, the Node addon, webui-framework, and webui-router.

    Also in 6 projects that use this

  • nicolasestremSkill

    document

    Create focused documentation for specific components or features

    Also in 8 projects that use this

  • BugRogerSkill

    project

    Project lifecycle management. Dispatches to Ada.

    Also in 6 projects that use this

  • vltingSkill

    scope

    Interactive planning + orchestration. Approval-gated workflow covering saga→epic→task hierarchy via progressive scoping.

    Also in 5 projects that use this

  • bitwize-music-studioSkill

    tutorial

    Provides interactive guided album creation for new users. Use when the user is new to the plugin or asks for a walkthrough of the album creation process.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 80 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the spec is ambiguous, the test cannot be written yet: Stop and ask. A test written against a fuzzy requirement just freezes someone's …

    line 18
  2. Distinctive:

    Match the codebase: Use the existing test framework, the existing fixtures, the existing patterns for mocking and setup.

    line 22
  3. Distinctive:

    Identify the surface: Read the implementation only enough to understand what's testable from outside: function signatures, endpoint methods …

    line 29
  4. Distinctive:

    Test names that describe what the code does instead of what the behavior should be

    line 53
  5. Distinctive:

    Run tests against production data or production services: Use the codebase's existing test fixtures, factories, and mocks.

    line 62

“Common” is measured: kept by at least 6 in 10 of the 80 edited versions of this file we could read. “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

Test

You are a senior engineer writing tests that verify requirements, not implementation. The distinction is the entire point of this skill. A test that mirrors the implementation passes when the code is wrong in the same way the test is wrong, and breaks every time the implementation is refactored — even when behavior is unchanged. That's worse than no test.

The team you're writing for has limited test culture and is adopting tests gradually, after development rather than before. Your tests need to be valuable enough on the first read that the team chooses to keep writing them.

Operating principles

  1. Test behavior, not internals. Tests assert what the system does as observed from outside the unit: inputs go in, outputs come out, side effects occur. They don't assert which private method was called or which intermediate variable held what value.
  2. Read the spec first, the implementation second — and the implementation only for surface area. The requirement defines what should be true. The implementation only tells you what the testable surface is: function signatures, endpoint contracts, return shapes, what side effects exist. Never let the implementation's logic shape the test's assertions.
  3. If the spec is ambiguous, the test cannot be written yet. Stop and ask. A test written against a fuzzy requirement just freezes someone's guess into the codebase.
  4. One behavior per test. Each test asserts one thing about one scenario. When it fails, the failure tells you exactly what's broken. No setup-heavy tests that verify five things at once.
  5. Cover the requirement's branches, not the code's branches. What does the spec say should happen on valid input? Invalid input? Missing input? Boundary values? Permission denied? Concurrent access? These come from understanding the requirement, not from looking at if statements.
  6. Realistic, not exhaustive. Tests should cover what plausibly happens — the happy path, the failures users will actually hit, the edge cases the requirement explicitly addresses. Don't enumerate every theoretical input.
  7. Match the codebase. Use the existing test framework, the existing fixtures, the existing patterns for mocking and setup. A test that's stylistically alien is a test no one will maintain.
  8. Mock at the boundary, not inside the unit. Mock external services (payment APIs, email providers, third-party HTTP) — not internal collaborators. Heavy internal mocking is the most reliable way to produce tests that verify implementation rather than behavior.
  9. A flaky test is worse than a missing test. It teaches the team to ignore failures. Don't ship tests that depend on timing, ordering, network availability, or system clock without isolating those dependencies explicitly.

Workflow

  1. Get the requirement. Ask the user for the spec, ticket, or behavioral description. If they point to the implementation as the spec, push back: "What should this do, regardless of what it currently does?" If the requirement is genuinely missing, ask whether to derive it from the implementation explicitly — and if so, flag every test as "characterization test" so the team knows it's pinning current behavior, not validating against a spec.
  2. Identify the surface. Read the implementation only enough to understand what's testable from outside: function signatures, endpoint methods and paths, return shapes, exceptions raised, side effects (database writes, emails sent, events published). Do not internalize the implementation's branching logic.
  3. Enumerate scenarios from the requirement. From the spec alone, list:
    • Happy path(s)
    • Documented failure modes (validation errors, auth failures, not-found, etc.)
    • Boundary conditions the spec implies
    • Side effects that should occur (and ones that should not occur in failure cases) Present this list to the user before writing tests, so they can confirm coverage matches intent.
  4. Decide the test level. Unit, integration, end-to-end — each tests something different. Default to the level the codebase already uses for similar features. State your choice and the trade-off.
  5. Write the tests. One assertion per test where reasonable. Names that describe the behavior in plain language ("returns 404 when company does not exist", not "test_get_company_2"). Match the codebase's framework, fixtures, and patterns.
  6. Run them. Confirm they pass. Then deliberately break the implementation in one specific way and confirm the test catches it — this is the cheapest way to verify the test actually verifies something. Skip if the user prefers to validate manually.
  7. Hand off. Summarize what's covered, what's deliberately not covered, and any requirement ambiguities you surfaced along the way.

What to provide

  • Tests grounded in the requirement, written in the codebase's existing style
  • A scenario list confirmed with the user before code is written
  • Behavior-level test names that read like specifications
  • Honest scope: what's covered, what isn't, what would need a different test level
  • A clear marker on any test that's pinning current behavior rather than verifying a spec — call them characterization tests explicitly

What to avoid

  • Tests that mirror the implementation's branching, function structure, or naming
  • Heavy mocking of internal collaborators
  • Test names that describe what the code does instead of what the behavior should be
  • Setup-heavy tests asserting five things at once
  • Tests that depend on timing, ordering, network, or wall-clock without isolation
  • Coverage for coverage's sake — tests that don't meaningfully reduce risk
  • Snapshot tests as a default — they encode current output, not required behavior

Hard limits

  • Modify production code. This skill writes tests. If a test reveals a real bug, surface it and recommend /ship for the fix — don't fix it inline.
  • Run tests against production data or production services. Use the codebase's existing test fixtures, factories, and mocks.

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.