agentleFS
ChiefGyk3DChiefGyk3D/department-of-internal-arguments/.agents/skills/pack-implementer-self-check/SKILL.md

pack-implementer-self-check

Skill166 starsChanged 6 days agoApache-2.0View on GitHub

Load before the first review of code that opens files, runs subprocesses, parses input, holds locks or writes output: twelve-class defect checklist, remove-surface rule, revert proof. Not for docs-only changes.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Fail closed: Every exception, missing file, unset variable, timeout, empty list and parse error ends in refusal.

    line 17
  2. Distinctive:

    Prove success by the protected action,: not by the step before it.

    line 19
  3. Distinctive:

    Run the targeted checks and record the revert proof per new guard.

    line 46
  4. Distinctive:

    Remove-surface pass (rule 1): list new validation branches and what removing the feature would delete.

    line 47
  5. Very specific:

    Put one line in the report: self-check: ids passed, ids not applicable, ids with known residuals.

    line 48
  6. Distinctive:

    Never weaken a check, add a skip or loosen a test to pass.

    line 70
  7. Distinctive:

    Delete only files you created, by exact path.

    line 72
  8. Very specific:

    All twelve ids are present once each: grep -cE '^\| (F1|S1|O1|L1|P1|B1|E1|K1|T1|D1|G1|X1) \|' packs/implementer-self-check/PACK.md returns …

    line 76

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
<!-- Generated by scripts/generate.py (release 0.4.0) from packs/implementer-self-check/PACK.md, updated 2026-11-25. sha256:977c599fa572d9fbcda72ae43d478217e1a125326af9829e088fd5c601e50e86. Do not edit; run the generator. -->

Pack: implementer self-check

Status: pilot pack, written 2026-11-25 (issue #124). Counts below come from 103 review findings over 9 changes (22 rounds), tagged by keyword, so they are coarse and a finding can carry several classes. The claim that a self-check lowers review rounds is a prediction until measured.

The author runs the same sweep the reviewer will run, before the first review, and fixes what it finds, so round one finds the residue. The ids are stable: the round-one prompt in review-protocol names these twelve classes by id. Run targeted checks only; CI is the judge of the full gate.

Rules

  1. Prefer removing surface over adding guards. Before adding a validation, ask whether the input, option, file format or feature can go. A guard you do not write cannot be bypassed or attacked in the next round. List every new validation branch and say whether removing a feature would delete it. Removal never drops a mandatory check, evidence, documented behavior or security property; if it would, keep it.
  2. Fail closed. Every exception, missing file, unset variable, timeout, empty list and parse error ends in refusal.
  3. One reader per input. Parse once into a typed value and pass the value.
  4. Prove success by the protected action, not by the step before it.
  5. Revert proof is required. Every fix and every new guard ships with a test that goes red when the fix is reverted. Revert it, run the test, record the red output, restore the exact bytes, run it green, and confirm the tree is as you left it. Without that, the guard is a claim.
  6. Docs state only what the code does today.

Checklist

Each row: id, class, concrete checks, then the recurring findings that motivated it (class, findings, changes out of 9).

IdClassChecks
F1Files and pathsOpen each path component with no-follow (directory descriptors, openat style) and verify the opened descriptor with fstat, never the path; a resolve-then-open check is racy, so confine on the descriptor; refuse FIFOs, devices and non-regular files; create with an explicit mode (0600 for secrets); mkstemp in a private directory. Recurring: unsafe file open, 20 findings in 7 changes; check-then-use race, 3 in 3.
S1Subprocess and environmentargv list, never a shell string; resolved binary; allow-list environment, not copy-and-delete; -- before untrusted arguments; bounded timeout and output; stdin closed; read the exit code, not text; explicit working directory. Recurring: subprocess and environment hygiene, 26 in 6.
O1Fail-closed versus fail-openWalk every branch: lookup failure, parse error, missing input, exception. The default is deny; a skipped check reports skipped, never pass. Recurring: fail-open or silent success, 21 in 8.
L1Locks and orderingLock before read-modify-write; release on every path; stale-lock recovery only after checking the owner (a recorded pid or lease) is dead, never by age alone; atomic write by temp file and rename on one filesystem; no state recorded before the action it describes succeeded; signal and timer handlers cannot leave half-written state. Recurring: atomic write and ordering, 13 in 6; locking, 9 in 4; signal and timer, 10 in 4.
P1Parsing and normalizationOne parser; normalize before comparing, per identifier kind and per filesystem (case, Unicode, trailing dots and separators are not universal; a folded compare can merge distinct names); duplicate keys, empty and oversized values, NUL bytes, line endings; reject unknown fields; a validator is tested with an input it must reject. Recurring: parsing and normalization, 24 in 9 (the most common class); validator false negatives, 18 in 8.
B1Bounds and timeoutsSize cap before read; depth and count caps; a timeout on every network and subprocess call; bounded retries and pagination; never replay a non-idempotent call after an ambiguous outcome; check arithmetic at zero, negative and huge values. Recurring: resource bounds and timeouts, 25 in 7; logic and state correctness, 18 in 5.
E1Output escapingEscape each sink for its own grammar (shell, Markdown, HTML, workflow commands, a log line, JSON); untrusted text never reaches a command, summary or log un-neutralized; strip control characters and newlines from logged values. Recurring: output escaping, 6 in 3.
K1Secrets handlingEnvironment or secret manager, never argv, repository or fixtures; never in errors, logs, reports or artifacts; redact before writing, not after; least-scope tokens. Recurring: confidentiality and secrets, 12 in 5.
T1Tests that biteA negative case; loose collection, strict assertion; assert that something was collected; test the failing input, not the already-correct form; never mock the thing under test; revert proof per rule 5. Recurring: weak or vacuous test items, 122 across 8 of 9 changes.
D1Docs accuracyCheck every claim in the README, help text and comments against current behavior: flags, defaults, exit codes, file modes. Recurring: doc accuracy, 5 in 3.
G1GitHub automationActions pinned by commit; least-privilege permissions:; no untrusted ${{ }} in run:; no pull_request_target checkout of the PR; token scope; branch-protection assumptions (depth in gha-security-dast). Recurring: from the design review, no tagged count.
X1Trust boundariesRe-check credentials, approvals and verified bytes after crossing a host, scheme, job, process or branch; every entry point to one action is guarded, including its siblings. Recurring: from the design review, no tagged count; the reviewer's boundary classes found it.

Procedure

  1. List the changed files and, per file, the ids that apply. Say N/A with a reason; do not skip silently.
  2. For each applicable id, answer CLEAR with file:line, or fix it.
  3. Run the targeted checks and record the revert proof per new guard.
  4. Remove-surface pass (rule 1): list new validation branches and what removing the feature would delete.
  5. Put one line in the report: self-check: ids passed, ids not applicable, ids with known residuals. For example self-check: F1 S1 O1 T1 passed; L1 E1 K1 D1 G1 X1 not applicable (no locks, output or secrets touched); P1 B1 known residual (B1: no timeout on the local socket read, issue linked).

An id with a known residual gets its own line with severity and reason, so the reviewer can see it was known, not missed.

Shared helper patterns (reference text)

These are names and contracts only. The shared code is a later task in the maintainer's tooling repository; this pack holds no code. Until it exists, write the behavior inline and keep it small.

  1. safe_open(root, relpath, mode): descriptor-relative traversal from the root descriptor, component by component with no-follow, then fstat the opened descriptor (regular file only, size cap); never a path check followed by an open.
  2. atomic_write(path, data, mode=0o600): temp file in the same directory, fsync, rename, clean up on error.
  3. locked(path, timeout): advisory lock with a bounded wait, released on all paths, with owner liveness checked before any lock is broken.
  4. run_cmd(argv, timeout, max_output, env_allow, cwd): no shell, scrubbed environment, bounded output.
  5. bounded_read(stream, limit), load_json_strict, load_yaml_strict: size and depth caps, duplicate keys rejected.
  6. normalize_path_component and normalize_text: normalization chosen per identifier kind and per filesystem (for example NFKC plus case fold only where the names are case-insensitive), for comparison only.
  7. redact(text, patterns): applied at the write boundary.
  8. gh_api(...): REST only, timeout, bounded pagination, no redirect credential carry, no replay of a non-idempotent call.
  9. fail_closed(fn, default=DENY): for hooks, so an exception denies.
  10. Shell equivalents in a sourced lib.sh: die, require_cmd, mktemp_private, run_timeout.

Limits

  • This is a checklist for the author. It does not replace the independent review, and a clean self-check is not a clean review.
  • Never weaken a check, add a skip or loosen a test to pass. If the only route to green is such a change, stop and report it.
  • Load the checklist only for code that touches these surfaces; docs-only changes need rule 6 and id D1 alone.
  • Delete only files you created, by exact path.

How to verify (commands)

  • All twelve ids are present once each: grep -cE '^\| (F1|S1|O1|L1|P1|B1|E1|K1|T1|D1|G1|X1) \|' packs/implementer-self-check/PACK.md returns 12.
  • The report carries the line: grep -c '^self-check:' report.md returns 1.
  • Revert proof: revert the fix, run the new test and see it fail, restore, run it green, then git status --porcelain shows only your intended files.
  • Shell and subprocess sweep on the diff: git diff -U0 | grep -nP 'shell=True|os\.system|subprocess\.[a-z_]+\((?!.*timeout)' needs a reason for each hit.
  • Surface counts: lines and branches added versus removed, git diff --shortstat.

Deliverable

  1. The self-check: line and the ids with known residuals.
  2. Per new guard: the test name, the red output with the fix reverted, the green output restored.
  3. The remove-surface list: what was removed and what stayed, with the reason.

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.