---
name: verification-before-completion
description: >
  The skill enforces that every claim of success, completion, or readiness is
  backed by fresh, concrete verification output before any commit, pull
  request, or hand‑off. It requires running a defined command, checking
  explicit numeric results, and only then emitting a success statement;
  otherwise it reports the actual state.
---

# Verification Before Completion

## Core Principle

**Evidence before claims** - a success claim may be emitted only after fresh verification evidence satisfies explicit numeric thresholds.

## Gate Function (Five‑Step Sequence)

1. **Identify command** - List a single command that produces an exit code and a measurable count (e.g., test failures, lint errors, build errors). The command must be appropriate for the claim.
2. **Run command** - Execute the command in the current message. The output must be captured in full.
3. **Read output** - Record two values:
 - `exit_code` (integer)
 - `failure_count` (integer, derived from the command’s standard output; for linters use `error_count`).
4. **Verify** - The claim is valid only if **both** conditions hold:
 - `exit_code == 0`
 - `failure_count == 0`
 If either condition fails, report the actual values and do **not** emit a success claim.
5. **Claim** - Emit the success statement **only** after step 4 passes, and include the verified numbers in the message.

### Example (Software testing)
```bash
# Step 1: Identify
command="pytest -q"
# Step 2: Run
output=$(pytest -q)
exit_code=$?
# Step 3: Read - count lines that start with "FAIL" or "ERROR"
failure_count=$(echo "$output" | grep -E "^(FAIL|ERROR)" | wc -l)
# Step 4: Verify
if [ $exit_code -eq 0 ] && [ $failure_count -eq 0 ]; then
 echo "✅ All tests pass (exit_code=0, failures=0)"
else
 echo "❌ Tests failed (exit_code=$exit_code, failures=$failure_count)"
fi
```

### Example (Infrastructure plan)
```bash
# Step 1: Identify
command="terraform plan -detailed-exitcode"
# Step 2: Run
output=$(terraform plan -detailed-exitcode)
exit_code=$?
# Step 3: Read - Terraform uses exit code 2 for changes, 0 for no changes, 1 for errors
failure_count=$(( exit_code == 1 ? 1 : 0 ))
# Step 4: Verify
if [ $exit_code -eq 0 ] && [ $failure_count -eq 0 ]; then
 echo "✅ Infrastructure is up‑to‑date (exit_code=0)"
else
 echo "❌ Plan indicates issues (exit_code=$exit_code)"
fi
```

## Fresh Verification Requirement

The command must be executed **in the same message** that contains the claim. Re‑using cached results or prior runs does not satisfy the rule.

## Prohibited Language Before Verification

Do not emit any of the following before step 4 succeeds:
- "Great!", "Done!", "All set!", "Looks good!", "Should work now", "Probably fixed", "Perfect", or any synonym that expresses satisfaction.
- Statements that assert success without the explicit numeric evidence defined in step 4.

If such language appears, the skill must replace it with a factual report of the verification results.

## Scope of Application

The gate function applies to **every** statement that:
- Claims that tests, builds, linters, or deployments have succeeded.
- Declares that a bug is fixed, a feature is complete, or a requirement is met.
- Precedes a commit, push, pull‑request creation, or hand‑off to another agent.
The rule covers exact phrases, paraphrases, and implicit implications of success.

## Decision Table for Common Claims

| Claim | Required command | Acceptable thresholds |
|-------|------------------|-----------------------|
| Tests pass | `pytest`, `npm test`, `go test` | `exit_code == 0` AND `failure_count == 0` |
| Linter clean | `flake8`, `eslint` | `exit_code == 0` AND `error_count == 0` |
| Build succeeds | `make`, `npm run build` | `exit_code == 0` AND `failure_count == 0` |
| Infrastructure plan OK | `terraform plan -detailed-exitcode` | `exit_code == 0` |
| Bug fixed | Re‑run the failing test that exposed the bug | `exit_code == 0` AND `failure_count == 0` |

## Red Flags - Immediate Stop

If any prohibited language is detected **before** verification, abort the claim and output the verification status instead.

## Rationalization Countermeasures

| Excuse | Required Action |
|--------|-----------------|
| "Should work now" | Run the identified command and check thresholds. |
| "I'm confident" | Confidence does not replace numeric verification. |
| "Just this once" | No exceptions; the gate function always applies. |
| "Linter passed" (but build not run) | Run the build command and verify its thresholds. |
| "Agent said success" | Independently run the verification command and report its result. |
| "I'm tired" | Exhaustion does not waive the verification requirement. |

## Provenance

verification-before-completion - https://github.com/obra/superpowers/blob/main/skills/verification-before-completion/SKILL.md
MIT
Rewritten by Tek_tonic against a harshest-seat audit; the changes are listed at https://tek-tonic.pro/skills/verification-before-completion.
