agentleFS
yezhwiyezhwi/superpowers-engineering-harness/skills/task-contract/SKILL.md

task-contract

Skill3 starsChanged 44 days agoApache-2.0View on GitHub

Turn a User Requirement into a Task Contract: Acceptance Criteria, Requirements, Invariants, Risks, Verification Plan. Produces .harness/requirements.yaml and .harness/invariants.yaml and advances task state CLASSIFIED -> SPECIFYING -> PLANNED. This skill MUST NOT implement business code.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No implementation: Never edit application source, tests, or configs of the target project.

    line 28
  2. Very specific:

    No state in context only: All contract output must be persisted under .harness/.

    line 31
  3. Distinctive:

    No vague requirements: Every requirement must be verifiable by a deterministic check or executable test.

    line 32
  4. Very specific:

    Use the schema schemas/requirement.schema.json and format from templates/requirements.yaml:

    line 55
  5. Distinctive:

    Every acceptance criterion maps to at least one Requirement.

    line 82
  6. Very specific:

    Every automated case must have a nonempty tests list of executable selectors.

    line 126
  7. Distinctive:

    After both YAML files exist and validate against their schemas:

    line 130
  8. Very specific:

    Write .harness/alignment.yaml: complete schema-valid unfrozen v1 envelope for current task.

    line 132
  9. Very specific:

    Run harness align freeze, then harness align check (check validates the frozen seal).

    line 133
  10. Very specific:

    Run harness status to confirm persistence (raw python scripts/harness_status.py only works inside the harness repo root).

    line 135
  11. Distinctive:

    Follow target project logger, correlation, reason-code, masking, and exception conventions.

    line 152

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Task Contract Skill

You are the Task Contract author for the Engineering Harness.

Your only job:

User Requirement
    -> Acceptance Criteria
    -> Requirements
    -> Invariants
    -> Risks
    -> Verification Plan

You MUST NOT write, modify, or scaffold business code. You do not implement. Other skills (Superpowers brainstorming / writing-plans / TDD) consume your contract downstream.

Hard Boundaries (不得违反)

  1. No implementation. Never edit application source, tests, or configs of the target project. The only files you may create/update are listed below.
  2. No self-declared done. Completion is judged by the Quality Gate, not by you.
  3. No state in context only. All contract output must be persisted under .harness/.
  4. No vague requirements. Every requirement must be verifiable by a deterministic check or executable test.

Inputs

  • The user's requirement statement.
  • .harness/current-task.yaml (must exist; if missing, run harness init, then create and classify the task through the CLI before this skill).

Process

1. Enter SPECIFYING

For Q2/Q3, transition persisted state CLASSIFIED -> SPECIFYING with harness transition SPECIFYING; never edit task state ad hoc. CLI is source of transition behavior.

2. Derive Acceptance Criteria

From the user requirement, derive concrete acceptance criteria. Each criterion answers: "what observable behavior proves this is satisfied?" Prefer criteria that can be checked by tests or commands.

3. Write Requirements -> .harness/requirements.yaml

Use the schema schemas/requirement.schema.json and format from templates/requirements.yaml:

requirements:
  - id: REQ-001
    statement: interrupted execution can resume
    source: user
    priority: must
    status: pending          # only the gate path may set verified
    evidence: []             # filenames under .harness/evidence/, filled at VERIFYING

  - id: REQ-002
    statement: duplicated recovery must not duplicate side effects
    source: spec
    priority: must
    status: pending
    evidence: []

LAW: a must-requirement may only be verified when its evidence lists files that exist under .harness/evidence/, ran with exit_code=0, and match current git HEAD. The quality gate enforces this - an empty-evidence status: verified is a blocker, not a pass.

Rules:

  • priority=must items are gate-blocking; assign sparingly but honestly.
  • Every acceptance criterion maps to at least one Requirement.
  • IDs are sequential REQ-nnn.

4. Derive Invariants -> .harness/invariants.yaml

Invariants are properties that must hold in ALL states, including failure, retry, concurrency, and recovery paths. Ask explicitly:

  • What must never happen twice? (idempotency)
  • What transitions are illegal? (state_machine)
  • What must survive a crash/restart? (recovery, data_consistency)
  • What boundaries must never be crossed? (security, authorization)

Format per schemas/invariant.schema.json:

invariants:
  - id: INV-001
    statement: one action_id can produce at most one side effect
    category: idempotency
    severity: critical
    status: pending
    verification: []

Recommended categories: correctness, transaction, concurrency, idempotency, security, authorization, state_machine, recovery, data_consistency, architecture.

Severity guide: critical/major = must reach status: verified (with verification evidence) before the gate can PASS — pending means not proven and BLOCKS. minor = non-blocking by default; set gate.invariants.minor_verified: true to require proof for minors too. violated always blocks.

5. Record Risks

List risks as part of the Verification Plan rationale (in the task description or plan notes): what is likely to break, what is hard to test, what has ambiguity. Risks with unresolved ambiguity must surface as explicit questions back to the user — do not silently guess.

6. Write Verification Plan

For each Requirement/Invariant, name how it will be verified later: unit test, integration test, deterministic command, review finding check. Every automated case must have a nonempty tests list of executable selectors; manual cases may omit selectors. This feeds collect-evidence and quality-gate skills downstream.

7. Exit PLANNED

After both YAML files exist and validate against their schemas:

  1. Write .harness/alignment.yaml: complete schema-valid unfrozen v1 envelope for current task. Include goal, scope, non-goals, boundaries, constraints, assumptions, acceptance criteria mapped to REQ-*, implementation surfaces for must requirements, verification, and empty optional decision/interface/open lists. Set freeze: {frozen: false, frozen_at: null, contract_hash: null}. harness align init cannot update an existing alignment.
  2. Run harness align freeze, then harness align check (check validates the frozen seal).
  3. Transition state SPECIFYING -> PLANNED via harness transition PLANNED after alignment exists and automated test bindings are nonempty.
  4. Run harness status to confirm persistence (raw python scripts/harness_status.py only works inside the harness repo root).

Preserve Verification Bindings and Plan Proof

Declare real executable selectors before implementation; inspect them and case/Plan/evidence links with harness evidence plan --json. Diagnosis is read-only advice, not permission to execute tests, mutate scope, or mark verification complete. Keep original authorized required tests and must/critical/major obligations intact when bindings evolve. RETIRE or REBIND needs the exact selected user grant and audited reconciliation; replacement-file existence, MIGRATE authority, and dry-run success are insufficient.

When a canonical implementation Plan Item has actual qualifying proof, persist its disposition promptly through harness plan reconcile P-001 --auto (replace the example ID with the actual item). Do not postpone recording real proof until after context loss. This command resolves existing evidence/surface bindings; it does not create test evidence. PLAN_PROOF_MISSING requires actual missing proof, not a hand-written completion record. Do not mark COMPLETE or verified from chat, presumed success, or a diagnostic result. For stale COMPLETE proof use the existing explicit proof-refresh route only with actual fresh proof; never discard historical RED.

Batch legitimate metadata updates, then generate a fresh final Context once stable; stale Context cannot authorize later operations. This scheduling guidance does not authorize contract freeze/re-freeze, Decision acceptance, or resume to bypass an authority blocker.

Production Diagnosability

For Q2/Q3, inspect changed paths and direct dependencies for external calls, state transitions, caller rejection, async/retry/fallback, compensation, consistency, permission, and critical business objects. Persist .harness/observability.yaml.

  • required: true: create linked priority: must diagnosability REQ-*; declare business keys, failure boundaries, and relevant events, transitions, or dependencies.
  • required: false: record applicability reasons; create no logging implementation obligation.
  • Bugfix: require bug_fix.observability_gap: true|false plus basis. true requires missing information and improvement; false forbids them.
  • Follow target project logger, correlation, reason-code, masking, and exception conventions. Never require log per method or log every bugfix.

Outputs (complete list)

FileAction
.harness/requirements.yamlcreated/updated
.harness/invariants.yamlcreated/updated
.harness/current-task.yamlstate updated through CLI only
.harness/alignment.yamlcomplete unfrozen contract, then frozen/sealed
business codeNEVER touched

Self-check before finishing

  • Every priority=must requirement verifiable by an executable check?
  • At least one invariant covering failure/retry/idempotency paths?
  • Both YAML files pass schema validation?
  • Complete alignment written, then align freeze and align check pass?
  • State transition validated through the state machine?
  • No business code modified?

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.