AGENT SKILL

prove-by-running

Execution proof that a script or tool works. Use when about to trust a new or changed script, hook, migration or release tool, and always for anything that rewrites git history, publishes or pushes, deletes, or transforms data; also when the user asks "does this actually work", "test this script", "prove it" or "try it on a copy first". Not for reviewing code by reading it, for writing unit tests of a library, or for fixing the faults found.

License 许可
MIT
所属仓库
justnnc/skills
最近更新
2026-10-22
Stars
★ 0
Forks
0

01 前言 Front Matter

name
prove-by-running
license
MIT
description
Execution proof that a script or tool works. Use when about to trust a new or changed script, hook, migration or release tool, and always for anything that rewrites git history, publishes or pushes, deletes, or transforms data; also when the user asks "does this actually work", "test this script", "prove it" or "try it on a copy first". Not for reviewing code by reading it, for writing unit tests of a library, or for fixing the faults found.

03 SKILL.md 正文

Prove by running

Contract. You produce one verdict - RUNS CLEAN, BREAKS or UNPROVEN - backed by commands you ran and what they printed. You do not produce a code review, an opinion of the design, or a fix. Your responsibility ends at the report. If you feel the pull to patch what you found, stop and report it: a prover that also patches loses the independence that makes its verdict worth anything. Faults go to whoever owns the tool.

What the tool is meant to do comes from the user or the tool's own documentation, never from reading its code. If neither says, ask the user one question naming the behaviour you would test; if no answer comes, test what you can and list the unstated behaviour under "Unproven".

The failure this exists for is code that reads correctly and fails on execution: shell escaping that eats a format string, a deny list that misses a sibling file, a check that reads one of two fields, a path lookup that works in a normal repository and exits 128 in a bare one. Faults like these are easy to miss on inspection and plain in a run.

The rule: no command, no claim

Every statement in the verdict cites a command you ran and its observed output. A claim with no command behind it goes under "Unproven", never under "Ran".

The thoughts that come before breaking this rule, and the answer to each:

Thought Answer
"I read it, the logic is fine." Reading is the method this skill replaces. Run it.
"The dry run passed." A dry run takes a different code path. Run the real path on a copy.
"This guard obviously works." An unexercised guard is an untested claim. Make it fire.
"Setting up a copy costs too much." A local clone costs seconds. If it truly cannot be built, the verdict is UNPROVEN.
"It is a small change." A small change to tooling can carry any of the faults above.

Citing a command you did not run, or summarising output you did not read, breaks the rule as surely as skipping the run.

1. Isolate: never test against the real thing

Pick the cheapest rung that still exercises the real behaviour. Work in a scratch directory of your own, never a shared temp directory that parallel jobs also write to.

  1. Disposable clone, the default. git clone -q <repo> <scratch>/probe for a normal checkout, git clone -q --mirror <repo> <scratch>/probe.git for a bare one. Local clones hardlink objects, so even a large repository costs little. The clone's origin is the real repository, so repoint it at a fake remote (rung 4) before the tool can push.
  2. Both shapes when the tool touches git. Bare and non-bare repositories diverge (git rev-parse --show-toplevel fails in a bare one), so test each shape the tool may meet.
  3. git worktree add only for a tool that reads, or writes nothing but working-tree files. A worktree shares refs, config, hooks and stashes with the real repository, so never use one for a tool that rewrites history, pushes, deletes or transforms data. Remove it afterwards with git worktree remove --force and git worktree prune.
  4. A local bare repository as the remote. git init --bare <scratch>/fake-remote.git and point the tool at it. Never let a test reach a network remote, and never push to a real one. If the tool refuses a local remote because it validates the URL, that validation is working: override it through whatever setting the tool exposes, never by weakening the tool.
  5. A copied data directory for a tool that reads or writes files outside git: copy the input, point the tool at the copy, and compare the original's checksum before and after.

A copy is not containment. A clone still runs as you, with your git config, credential helpers, SSH keys, environment tokens and network. For a tool that rewrites history, publishes, pushes, deletes or transforms data, before the first run:

  • git -C <copy> remote -v shows only the fake remote; repoint or remove anything else.
  • No real credential is reachable: unset tokens and keys in the test shell's environment, and check configured hosts and URL rewrites with git config --show-origin --get-regexp 'url\.|credential|remote'.
  • Where the tool touches the network or a service, run it in a container or as a separate user that holds no credentials.
  • Where the tool deletes, rewrites or transforms data, every place it writes (its flags, its config, any absolute path, $HOME or default location in them) points into the copy. Otherwise, run it in a container or as a throwaway user.

If no rung can be built (no copy possible, a credential you must not use, a service that is not running), stop here: the verdict is UNPROVEN, and the report says what would unblock it.

Done when the tool's target is a copy you made, you can name the command that made it, and nothing real is reachable from it, shown for a destructive or publishing tool by the checks above. No copy, no test.

2. Test, in this order

Record every command verbatim with a one-line observed result as you go; that list becomes the report.

  1. The happy path, actually run. Not a --dry-run, --check or preview flag.
  2. The second run. Run it again; the expected result comes from the tool's contract. A tool meant to converge (a sync, a formatter, a sanitizer) must be a no-op: same commit hash, same file bytes, "nothing to do". An appender or generator must change state in exactly the documented way, and no more. Anything else is a fault.
  3. Every guard, by making it fire. Plant a violation and show the tool stops. Prefer planting through a configuration or override file so the copy under test stays otherwise unchanged.
  4. The failure path. Wrong branch, uncommitted changes, missing dependency, wrong remote, absent file, empty input, permission denied. The tool must fail closed: refusing to act is correct, proceeding half-way is not.
  5. The boundary. First run and second, empty set and one element, the busiest real case. A counter that formats as two digits can break at 60; a list that names one file can miss its sibling; a check that reads one of two fields can miss the other.
  6. Scale. If the tool's cost grows with input, run it on a full copy of the real input rather than a three-file fixture. If that run is expensive (long, large, or on shared machines), state its expected time and ask before starting it.

Done when steps 1 to 5, every guard found in step 3, and step 6 when it applies each have a recorded command and result, or an entry under "Unproven" saying why it could not run. A tool with no guards records "no guards found" for step 3, with the command that searched for them (its flags, its help text, its config).

3. Assert what inspection misses

  • On the result that ships, not the staging area. Check the committed tree or the published output, for example git cat-file -e <ref>:<path>, not the temp directory the tool built it in.
  • Absence, explicitly. For anything meant to be excluded, prove it is gone. A tool that never matched a path passes a "did it survive?" check trivially.
  • Both halves of a pair. Author and committer date. Read and write. Local and remote. Staged and committed. One-sided checks are how half-fixes ship.
  • Hashes, not descriptions. When content should be unchanged, compare git rev-parse <ref>^{tree} or file checksums on both sides.
  • The negative before the positive. Show the guard blocks, then show it passes when it should. A guard that never blocks proves nothing by passing.

The expected value in each assertion comes from somewhere other than the tool: the original input, a hash taken before the run, or the stated requirement. An expected value read off the tool's own output proves only that it agrees with itself.

4. Clean up

Delete every copy, worktree, fake remote and planted file you created, and run git worktree prune if you added a worktree.

Done when the scratch directory is gone, or each thing left in it is listed in the report with the reason.

5. Report

A fault is observed behaviour that contradicts what the tool is meant to do (its contract: the user's words or its own documentation), a crash, or a loss or corruption of data. A concern outside that contract, such as an undocumented side effect, a risk in some other environment, or a design you would do differently, is a caveat: report it, but it does not decide the verdict.

Choose the verdict by these rules:

  • BREAKS: at least one command produced a fault, whatever else passed.
  • RUNS CLEAN: steps 1 to 5, every guard, and step 6 when it applies all ran, with no fault, on a copy of each shape the tool meets. Caveats may still be listed.
  • UNPROVEN: anything else - the environment blocked a step, or a case that matters for this tool could not run. It is a real verdict and better than a guess.

Over-calling is the common failure here: the run confirms the contract, then the verdict says BREAKS because of a worry the contract never mentions. Before writing BREAKS, name the contract line the fault contradicts, or the data it lost; if you cannot, it is a caveat.

Keep this structure:

VERDICT: RUNS CLEAN | BREAKS | UNPROVEN - <one line: what was proven or what broke>

Copy
  how the copy was made (command), which shapes (bare, non-bare, data copy)

Ran
  <command, verbatim>  ->  <observed result, one line>
  ...

Faults
  for each: the contract line or data it breaks, the exact command, what was expected, what
  happened, the smallest reproduction, and the cause if found, marked "read from code" or
  "confirmed by run" ("none" if there were none)

Caveats
  concerns outside the contract, one line each, with how they were observed ("none" if none)

Unproven
  each step or case not exercised, why, and what would unblock it
  ("none" only when every step ran)

Left behind
  anything not cleaned up and why, or "nothing"

After the report, stop. If faults were found, the next step is a fix by whoever owns the tool, then a fresh run of this skill on the fixed version; a verdict does not carry over to changed code.

04 同仓库更多 Skills

justnnc
justnnc/skills

codex-worker

The OpenAI Codex CLI as a worker under Claude. Use when the user names Codex ("have Codex review this", "ask Codex", "run this on Codex", "hand this to Codex"), wants work done on Codex's quota instead of Claude tokens, or wants a review from another model family. Not for tasks that need this conversation's context, the user's running application, or tools only Claude has.

★ 0
justnnc
justnnc/skills

claude-worker

A headless Claude Code run started in another repository, so the work loads that repository's own instructions instead of the current session's. Use when work belongs to a different repository than the one this session is in ("do this in the other repo", "work on the docs repo from here"), when a subagent would carry the wrong project's rules, or when a run needs its own tool set or settings. Not for work in the current repository (use an ordinary subagent), anything that needs a conversation mid-run, or tasks that need this session's context.

★ 0
justnnc
justnnc/skills

spec-audit

A read-only audit of a project's specs against the work that just landed. Use when a batch, feature or set of changes has been merged or is about to be pushed, when the user asks whether a spec is up to date, accurate or drifted from the code, or before a design discussion leans on a spec's text. Not for writing a new spec or design document, reviewing a design document, reviewing code for bugs, or planning work that is not built yet.

★ 0
justnnc
justnnc/skills

skill-craft

A craft checklist for agent skills. Use when the user asks to write, improve, review, test or tighten a skill, a SKILL.md, an agent definition or a reusable brief, or asks why an agent skips, misreads or never triggers a skill. Not for the subject matter of a skill, only how it is written.

★ 0
justnnc
justnnc/skills

parallel-refactor

A fan-out of one large mechanical code change across parallel subagents. Use when a refactor, rename, migration or API move touches hundreds of call sites across many files, when the user asks to split a change per file or component or hand it to several agents at once, or asks how big a change is and whether it is mechanical. Not for edits inside one file, a redesign whose target shape is not yet decided, or a change small enough to make serially.

★ 0
justnnc
justnnc/skills

how-it-works

A cited, read-only explanation of how a mechanism in a codebase works. Use when the user asks "how does X work in this code", "where is Y computed", "walk me through Z", or wants a reference implementation read to compare with their own, in a large or unfamiliar codebase. Not for a file or function already known (just read it), bug hunting or debugging, reviewing a diff, or changing code.

★ 0