agentleFS
boadijboadij/pi-herdsman/.agents/skills/simplification-audit/SKILL.md

simplification-audit

Skill219 starsChanged 14 days agoApache-2.0View on GitHub

Run an occasional, read-only, evidence-gated audit for removable code, meaningful duplication, and unjustified tooling or configuration. Use only when explicitly requested.

  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    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. Very specific:

    Use a dedicated clean worktree at current origin/main.

    line 12
  2. Distinctive:

    Read a prior audit if supplied or already available in a shared archive.

    line 13
  3. Distinctive:

    Treat the repository, including source, tests, dependencies, scripts, hooks, and CI configuration, as read-only.

    line 14
  4. Distinctive:

    Run current tool versions on demand, not in CI.

    line 19
  5. Distinctive:

    Knip: use production mode with Pi's nonstandard entry points.

    line 21
  6. Distinctive:

    jscpd: look for substantial production duplication, not similar syntax:

    line 58
  7. Very specific:

    Only when warranted: use npx --yes oxlint -D suspicious -f json extension/ scripts/ for targeted correctness investigations, or a temporary …

    line 68
  8. Distinctive:

    Prefer deletion, existing code, native facilities, or a root-cause correction.

    line 76
  9. Distinctive:

    Write the report to a file when the user requests a file or an existing shared archive is explicitly being used.

    line 92
  10. Distinctive:

    Verify git status --short and git diff --check, and report any tracked changes or blockers.

    line 94

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

Simplification audit

Find improvements worth making, not diagnostics worth silencing. Follow AGENTS.md, product philosophy, relevant ADRs, and Ponytail Ultra. Do not compete with the broader agentic-system-audit skill.

Scope

  • Use a dedicated clean worktree at current origin/main; record the commit.
  • Read a prior audit if supplied or already available in a shared archive. Compare only findings from comparable tool versions, configuration, and scope. If unavailable, establish a new baseline; do not access another Agent's worktree.
  • Treat the repository, including source, tests, dependencies, scripts, hooks, and CI configuration, as read-only. Temporary diagnostic files may be created outside the repository. No implementation, commits, issues, PRs, or permanent dependencies.
  • Focus on production code; investigate tests or tooling only when a finding makes them relevant.

Scan

Run current tool versions on demand, not in CI. Record actual versions, commands, scope, and failures; use historical versions only to reproduce earlier findings. Ensure dependencies for the worktree are present before scanning.

Knip: use production mode with Pi's nonstandard entry points. From the repository root:

(
  set -eu

  tmp_dir="$(mktemp -d)"
  trap 'rm -rf "$tmp_dir"' EXIT

  cat > "$tmp_dir/knip.json" <<'JSON'
{
  "entry": [
    "extension/index.ts!",
    "extension/integrations/pi-codex-context-sharing.ts!",
    "scripts/{build,check,ci-scope,package-audit,smoke,test-env,tool-policy-diagnostic}.mjs!"
  ],
  "project": [
    "extension/**/*.ts!",
    "!extension/**/*.test.ts!",
    "!extension/support.ts!",
    "scripts/**/*.mjs!",
    "!scripts/**/*.test.mjs!"
  ]
}
JSON

  npm exec --yes --package=knip -- knip \
    --production \
    --no-progress \
    --reporter compact \
    --no-exit-code \
    --config "$tmp_dir/knip.json"
)

Check entry points against current package.json, Pi extension discovery, optional integrations, scripts, and dynamic consumers before interpreting unused-file/export results. These patterns are a starting point, not proof of reachability; test-only utilities and externally invoked maintenance scripts may be intentionally absent from the production graph. If entry points change, adjust the temporary config and record the difference.

jscpd: look for substantial production duplication, not similar syntax:

npm exec --yes --package=jscpd -- jscpd extension scripts \
  --format typescript,javascript \
  --ignore '**/*.test.ts,**/*.test.mjs,extension/support.ts' \
  --min-tokens 100 --min-lines 15 --mode mild --threshold 100 \
  --reporters console --no-colors

Only when warranted: use npx --yes oxlint -D suspicious -f json extension/ scripts/ for targeted correctness investigations, or a temporary TypeScript check for a specific contract. The earlier broad Oxlint and TypeScript scans were noisy; do not repeat them by default or adopt them as gates.

Triage

Compare against prior verified or rejected findings when available. Do not repeatedly investigate unchanged noise. For each promising candidate:

  1. Trace actual callers, entry points, runtime reachability, consumers, and the authoritative contract.
  2. Group cascading diagnostics. Distinguish a reachable defect, dead complexity, genuinely duplicated semantics, a justified boundary, and a false positive.
  3. Prefer deletion, existing code, native facilities, or a root-cause correction. Propose consolidation only when ownership, authorization, lifecycle, validation, and failure semantics really match.
  4. State the independent benefit, approximate net code/configuration change, risks, and smallest discriminating check. A lower diagnostic count or line count alone is not a benefit.
  5. Reject speculative changes, cosmetic cleanup, upstream/type-mock noise, and abstractions that cost more than they save.

Investigate tooling/configuration with the same standard: identify an obsolete or duplicated responsibility before proposing removal. Do not discard validation, durability, security, recovery, or portability guarantees.

Output

Return one consolidated audit report containing:

  • Baseline commit, previous audit if available, and tool versions/commands/configuration changes.
  • Counts for context, clearly separated from at most five independently verified, actionable findings.
  • For each finding: source location, root cause, consumer/reachability evidence, minimal change, benefit, risks, and validation.
  • Material rejected/unchanged findings and limitations.
  • Recommended order, or No action if nothing justifies a change.

Write the report to a file when the user requests a file or an existing shared archive is explicitly being used. Keep prior reports when comparing baselines. Do not build an archive service or require Dropbox availability.

Verify git status --short and git diff --check, and report any tracked changes or blockers. Stop after the audit; implementation requires a separate request.

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.