원클릭으로
원클릭으로
| name | contract-writing |
| description | Use before starting any coding task when Superpowers is not present. |
| user-invocable | true |
Write a testable contract BEFORE writing any code. The contract defines what "done" means in terms that an independent evaluator can verify without knowing your intent or reasoning.
NO CODE WITHOUT A CONTRACT FIRST.If you have already started coding before writing a contract, STOP. Write the contract now. Retroactive contracts are better than no contracts.
docs/superpowers/specs/ instead.Write the contract to .harnessed/contract.md using the format defined in skills/contract-writing/contract-format.md. The format includes: # Contract: {title}, ## Task, ## Acceptance Criteria (with Functional/Edge Cases/Regression subsections), ## Verification Commands, and ## Out of Scope.
If .harnessed/policies/ exists, treat it as a repo-specific policy store.
auth.md, response.md, db.md, validation.md, security.md, testing.mdSelect only the policies relevant to the current change scope. Use simple path and keyword matching:
auth.mdresponse.md + db.md + validation.mdtesting.mdsecurity.mdIf no policy file matches, continue with the existing behavior. Do NOT load the whole policy store just because it exists.
returns { name: "alice" } is ambiguous if the function always includes other fields. Write returns { _: [], name: "alice" } or use "contains" language: result includes name: "alice"| Task Size | Criteria Count | Guidance |
|---|---|---|
| Standard (bug fix, single feature) | 3–8 | Focus on the fix/feature + regression |
| Large (multi-file, new system) | 8–15 | Include integration points and edge cases |
More than 15 criteria suggests the task should be decomposed into smaller tasks.
Minimum: Every contract MUST have at least 1 criterion. If you cannot identify any verifiable criteria, the task is either micro (route accordingly) or requirements are unclear (ask the user before proceeding).
For each criterion, try to provide a verification command:
npm test, pytest, go test ./...curl http://localhost:3000/endpointgrep -n "pattern" file.ext to confirm implementation existsIf the project has no test infrastructure, the contract should note this under a ## Environment section so the evaluator knows to use Tier 1 (code review only).
.harnessed/failure-patterns.md exists, read it. Only note patterns with Count ≥ 2 that are relevant to the current task's domain (e.g., "missing input validation" is relevant for API work but not for CSS refactoring). Ignore patterns unrelated to the task — the goal is targeted prevention, not a checklist of every past mistake.
2c. Select relevant policies — if .harnessed/policies/ exists, determine the likely change scope from the task request and any already-known target files. Load only the relevant policy summaries. Distill their rules into contract criteria or regression constraints; do not paste policy text into the contract verbatim unless the user asked for that..harnessed/contract.md
6b. Coverage verification — re-read the user's original request and extract every distinct requirement (explicit and strongly implied). Map each to at least one contract criterion. If any requirement has no matching criterion, add it now. This step is mandatory, not optional reflection.If the user modifies requirements after the contract is written:
.harnessed/contract.md to reflect the new requirementsNever run QA against a stale contract.
| Your Thought | Why It's Wrong | What To Do |
|---|---|---|
| "The task is obvious, no contract needed" | Obvious tasks have implicit assumptions. Contracts make assumptions explicit. The evaluator cannot read your mind. | Write the contract. If it's truly obvious, it takes 30 seconds. |
| "I'll figure out the criteria as I code" | Post-hoc criteria are biased toward what you built, not what should be built. | Write criteria BEFORE coding. Adjust only if requirements change. |
| "The user just wants it done fast" | A broken feature delivered fast wastes more time than a working feature delivered with a 2-minute contract. | Write the contract. Speed without correctness is not speed. |
| "This is a refactor, there are no new requirements" | Refactors have the strictest contract: behavior must be IDENTICAL. List the behaviors that must not change. | Write regression criteria for every observable behavior. |
| "The evaluator will infer repo conventions from the diff" | Reviewers guess inconsistently when repo policy is left implicit. | Load only the relevant policy summaries and turn them into criteria. |
| "If the feature works, the repo rules can stay implicit" | Coherence failures create churn even when the feature appears correct. | Capture repo constraints in the contract whenever matching policies exist. |
For the request "Add a search bar to the user list page":
# Contract: Add search bar to user list page
## Task
Add a search input to the /users page that filters the displayed user list in real time.
## Acceptance Criteria
### Functional
- [ ] A text input is visible at the top of the /users page
- [ ] Typing in the input filters the user list to show only users whose name or email contains the query
- [ ] Filtering is case-insensitive
- [ ] Clearing the input restores the full user list
- [ ] Empty state message shown when no users match the query
### Edge Cases
- [ ] Search works correctly when user list is empty
- [ ] Special characters in query do not cause errors
### Regression
- [ ] Existing user list renders correctly without interaction
- [ ] User list pagination (if present) still works
## Verification Commands
- `npm test -- --grep "search"` — verifies search-related tests
- `curl http://localhost:3000/users` — verifies page loads
- Manual: Type "john" in search bar, verify only matching users shown
## Out of Scope
- Server-side search / API changes
- Search history or autocomplete
- URL query parameter sync
Use after completing a round of code generation.
Use before starting any coding task when Superpowers is not present.
Use after completing a round of code generation.
Use at the start of every session and before completing any coding task.
Use before declaring any coding task complete, done, or finished.
Use at the start of every session and before completing any coding task.