agentleFS
dagarre00dagarre00/claude-code-template/.claude/skills/spec-writing/SKILL.md

spec-writing

Skill1 starsChanged 28 days agoMITView on GitHub

Conductor-only. How to write entity Behavior cases that produce good tests — When/Then shape, granularity, state transitions, and test mapping. Use when adding an entity page, refining behavior during /project:interview, or splitting a vague case.

17 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 1

    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:

    Falsifiable: Every case must imply a specific failing assertion.

    line 39

“Common” is measured: kept by at least 6 in 10 of the 15 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

Writing Behavior Cases

Behavior cases on an entity page (or [infra] concept page) are the executable spec; each becomes a failing test.

Read first

  • docs/wiki/requirements.md — cases must serve a requirement.
  • docs/wiki/architecture.md — testing strategy sets granularity (unit vs integration).
  • Existing entity pages in the same domain to match phrasing.

Shape

- [ ] B<N>: When <condition>, <subject> <observable outcome>.

Good:

  • - [ ] B1: When a user submits valid credentials, the server responds 200 and sets the session cookie.
  • - [ ] B2: When a user submits an unknown email, the server responds 401 and sets no session cookie.
  • - [ ] B3: When an IP has 5 failed logins in the last 60 seconds, the next attempt gets 429.

Bad: Logins work correctly. (untestable) · Validates inputs, hashes password, looks up user, and returns session. (four cases) · Login is fast. (unmeasurable).

Rules

  1. One observable behavior per case. Split any "and"/"or" outcome needing multiple assertion groups.
  2. When/Then trigger and outcome.
  3. No implementation details ("calls validate_email()" is how, not what an external caller observes).
  4. Measurable ("completes in <200ms for ≤1KB input", not "fast").
  5. Single layer (HTTP boundary vs domain function).
  6. Explicit state ("When the user is already logged in and submits the form, …").
  7. Errors are separate cases, never "(also handles errors)".
  8. Falsifiable: Every case must imply a specific failing assertion.

States and numbering

  • [ ] defined, no test · [~] test written and confirmed failing · [x] passing (updated in the same commit).
  • Cases never move backwards: when behavior changes, strike through the [x] case with a pointer to a newly appended B<N> (never reuse or renumber IDs).

Tie cases to tests

## Tests
- B1 → `test_login_succeeds_with_valid_credentials`
- B2 → `test_login_fails_with_unknown_email`

After writing cases

Bump the page's updated: date, and update docs/wiki/requirements.md if a case reveals a missing requirement.

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.