lock-tests-first
Skill1 starsChanged 4 months agoMITView on GitHub
Explicit-invocation workflow for test-first implementation that defines behavior, proves new tests fail correctly, protects those tests from implementation-time edits, implements production code, and verifies the final red-to-green result. Use only when the user directly invokes the lock-tests-first skill.
In this repository3 other files it gives its agents.
- debug-with-evidenceSkill
- review-changesSkill
- rework-commitsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 13 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
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
- Distinctive: line 9
Treat tests as the behavioral contract.
- Distinctive: line 14
Start from approved acceptance criteria or derive observable inputs, outputs, errors, state changes, and invariants.
- Distinctive: line 17
Read repository instructions, test commands, nearby tests, fixtures, and production interfaces.
- Distinctive: line 21
Prefer behavior-level assertions over implementation details, excessive mocks, or broad snapshots.
- Distinctive: line 22
Write the contract tests only.
- Distinctive: line 24
Do not write or change production behavior yet.
- Distinctive: line 26
Run the smallest relevant test command.
- Distinctive: line 28
If a test passes unexpectedly, determine whether the behavior already exists or the assertion is ineffective.
- Distinctive: line 30
Check that assertions are meaningful, deterministic, and capable of detecting a wrong implementation.
- Distinctive: line 32
Commit a test-only baseline only when the user requested or approved committing.
- Distinctive: line 34
Do not modify protected tests, their expected values, or test selection.
- Distinctive: line 35
If a protected test is genuinely incorrect, stop and explain the flaw.
- Distinctive: line 37
Run the focused tests, then relevant surrounding tests and available type, lint, or build checks in proportion to risk.
≈ “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.
Files
Lock Tests First
Treat tests as the behavioral contract. Do not weaken or rewrite protected tests merely to make implementation pass.
Workflow
- Confirm the contract.
- Start from approved acceptance criteria or derive observable inputs, outputs, errors, state changes, and invariants.
- Resolve any ambiguity that would change expected behavior before editing files.
- Inspect the test system.
- Read repository instructions, test commands, nearby tests, fixtures, and production interfaces.
- Match existing test levels and conventions.
- Design coverage.
- Cover the happy path, meaningful boundaries, failures, regression cases, and relevant authorization or security behavior.
- Prefer behavior-level assertions over implementation details, excessive mocks, or broad snapshots.
- Write the contract tests only.
- Modify only tests and the minimum test-only fixtures or infrastructure required to express the contract.
- Do not write or change production behavior yet.
- Prove the red state.
- Run the smallest relevant test command.
- Confirm each new test fails because the behavior is missing or wrong, not because of syntax, setup, import, fixture, or unrelated failures.
- If a test passes unexpectedly, determine whether the behavior already exists or the assertion is ineffective. Do not proceed with a false red state.
- Audit and protect the tests.
- Check that assertions are meaningful, deterministic, and capable of detecting a wrong implementation.
- Record the protected test paths and their exact pre-implementation diff or content hash.
- Commit a test-only baseline only when the user requested or approved committing. Otherwise state that the freeze is procedural and keep the baseline for comparison.
- Implement the smallest production change.
- Do not modify protected tests, their expected values, or test selection.
- If a protected test is genuinely incorrect, stop and explain the flaw; obtain approval before changing the contract.
- Prove the green state.
- Run the focused tests, then relevant surrounding tests and available type, lint, or build checks in proportion to risk.
- Compare protected tests to the baseline and confirm they were not altered during implementation.
- Review the result.
- Inspect the production diff for overfitting, hard-coded test values, bypassed code paths, weakened validation, or unrelated changes.
Output
Report the red evidence, protected test files, implementation summary, green evidence, broader checks, and anything not verified. Never report success from a passing test whose pre-implementation failure was not established. Use the review-changes skill before packaging commits.
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
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.

