tms-audit-sweep
Runs an adversarial audit sweep to verify findings while minimizing false positives.
Install
mkdir -p .claude/skills/tms-audit-sweep && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11577" && unzip -o skill.zip -d .claude/skills/tms-audit-sweep && rm skill.zipInstalls to .claude/skills/tms-audit-sweep
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Codebase-audit stage 2 — sweep ONE zone for findings using an adversarial finder↔skeptic duel (independent subagents), record only the findings that survive refutation. Run once per zone, each in a fresh context window; no arg = next pending zone from the manifest. Second of the tms-audit-* pipeline. Use when the user invokes /tms-audit-sweep.Key capabilities
- →Locate the active audit folder and read scope/manifest
- →Pick a specific zone or the next pending zone from the manifest
- →Ground findings with static-analysis tool output
- →Spawn a finder subagent to identify findings within a zone
- →Spawn an independent skeptic subagent to refute findings
- →Write confirmed findings and a false-positive ledger to a zone-specific file
How it works
The skill orchestrates a duel between a finder and a skeptic subagent to identify and validate codebase findings within a single zone, recording only those that survive refutation.
Inputs & outputs
When to use tms-audit-sweep
- →Auditing a codebase zone
- →Verifying security or quality findings
- →Refuting false positive issues
About this skill
Codebase Audit — Stage 2: Sweep (adversarial)
Audit exactly one zone at the manifest's immutable target SHA and write its findings. Search both local code and the declared producer/consumer seams. The whole point of this stage is the finder↔skeptic duel: an automated audit's worst failure mode is false positives or local conclusions that miss an owning layer elsewhere.
Read THIS project's AGENTS.md / CLAUDE.md for the relevant source-of-truth,
owner, vertical-trace, coupled-path, validation, security, and output-language
rules, including the known-test-debt register (AGENTS.md → Testing And
Validation). Use the exact severity rubric persisted in
00_scope.md; do not reinterpret it per zone.
Subagent Authorization (Claude Code)
A user invocation of this stage explicitly authorizes the subagents described by
the skill. Use Claude Code's Agent tool for mandatory scout, finder, skeptic
and critic work. Fall back to a local pass only when the Agent tool is genuinely
unavailable or the user explicitly opts out, and record the limitation in the
stage artifact and final summary. Optional delegation still follows the skill's
own use/skip criteria.
A local fallback is adversarial_review: LIMITED, not equivalent independent
coverage. It keeps a high-risk zone incomplete unless the user explicitly
accepts that named limitation.
Subagent Independence And Model Tiers (Claude Code)
Every Agent call receives a fresh self-contained prompt. Use Explore for a
read-only scout and general-purpose for finder and skeptic. The skeptic must
NOT see the finder's reasoning as your endorsement, only bare claims to refute.
Model tiers:
- Code scout:
sonnetfor an eligible broad/unknown-owner zone; evidence map only, no findings or severity. If unavailable, use bounded local mapping and record the limitation; do not silently substitute a weaker model. - Finder:
sonnetfor ordinary zones;opusfor auth/RLS/payments/PII/ migrations/queues/lifecycle. - Skeptic: at least the finder's capability tier;
opusfor proposed Class A/B or security/privacy/payment findings. - Debate follow-ups: use the lowest sufficient tier, but never below
opusfor Class A/B security or data-integrity disputes.
Method
-
Locate and verify the audit snapshot. Find the active
docs/AUDIT-*/folder named by$1or current context. If more than one in-progress audit is plausible, stop and request the exactaudit_id; do not guess from directory sorting or date alone. Read00_scope.mdandmanifest.md. Verify the checkout is the recordedtarget_sha, or read that immutable tree through the declared clean worktree. Do not silently sweep current HEAD instead. If the target cannot be reproduced, stop withBLOCKED_AUDIT_SNAPSHOT. -
Pick the zone. If
$1names a zone, use it. If$1is empty ornext, take the first↻ re-sweep requiredzone, otherwise the first☐ pendingzone in the manifest. Load its owner, path/seam boundary, coupled zones, risk tags, validators, previous audit coverage, target SHA, exclusions, and overlap/re-sweep note. Only when neither status remains may you tell the user the sweep is complete and to runtms-audit-triage; stop. -
Ground with tools first. Run the safe scoped validators recorded for the zone: dead-code/unused, dependency/cycle, typecheck, linter, focused tests, coverage or contract/generated-drift checks where available. Their output is grounded seed evidence, not an automatic finding. Do NOT install tools. Note every required validator that is unavailable, skipped, timed out, flaky, or cannot run at the target SHA. A green validator is coverage evidence only when the artifact records its exact command, discovered/tested count, relevant assertion or invariant, and a failing counterexample/negative path showing it can detect the candidate defect; otherwise it is merely a validator result or limitation.
-
Define the ownership map required before judging. Establish this compact shape through verified local evidence or the eligible scout:
business fact/capability → canonical owner/store → producers → consumers → competing sources/caches → invariant tests → release/runtime evidence.Follow only the direct seams declared in the manifest; add a newly discovered coupled zone to the findings file and manifest notes rather than recursively reading the whole repository in one context.
-
Run one bounded code scout only when eligible. Use it when the zone is broad, its canonical owner/entrypoints/tests are not already explicit, or a new coupled seam makes the local map uncertain. Skip it for a narrow zone or when a verified map already exists for the same zone, target SHA, and worktree fingerprint.
Resolve
scripts/repository_fingerprint.pyrelative to thisSKILL.mdand run it against the exact audit worktree before spawning. Start exactly one freshsonnetscout with no parent conversation, explicit read-only instructions, no implementation, no findings/severity, and no nested delegation. Give it the zone boundary, declared direct seams, target SHA, primary mapping goal, relevant instruction filenames, and the fingerprint command — not parent hypotheses or expected owners.Require one JSON object with no prose:
{ "schema_version": "audit-code-map.v1", "status": "ready", "repository_state": {"head": "<sha>", "worktree_sha256": "<sha256>"}, "zone": "<manifest-zone>", "targets": [ {"path": "<relative>", "lines": [1, 2], "symbols": ["<symbol>"], "kind": "owner", "role": "<role>", "reason": "<evidence>"} ], "flow": [{"from": "<path:symbol>", "to": "<path:symbol>", "relation": "<verb>"}], "open_questions": [] }statusisready,not_found, orneeds_clarification; targetkindisowner,coupled,test, orconstraint. Allow at most 16 tight repository-relative targets, eight flow edges, and five questions. Reject unsafe/nonexistent/generated paths, absent symbols, vague reasons, extra fields, or areadymap without an owner and an existing closest test. A symbol must appear in or directly beside its range: use a declared symbol, an exact test title, or an exact route/RPC/SQL identifier literal — never an invented composite label. Keep each inclusive range to at most 80 lines and make its reason provable from that range. Flow endpoints usepath:symbol; relation is one concise lowercase verb such ascalls,loads,persists,renders, ortests, not a narrative.Parse and validate the map, rerun the fingerprint in the primary process, and accept it only when pre-scout, scout-reported, and post-scout
headandworktree_sha256all match the audit target. Reopen every cited range and verify its symbol and role before giving the map to the finder. Send the same scout at most one focused correction for a malformed/stale map; after a second failure, use the narrowest local mapping and record the limitation, except when the result demonstrates that the map cannot fit within 16 targets. That means the zone is oversized: set↻ re-sweep required, record the split reason, return it to Scope, and stop before Finder rather than spawning more scouts or squeezing out a coupled path. -
Finder pass. Give the finder only the verified scout/local map plus tool seeds. Spawn a finder scoped to the zone and direct seams. Make its prompt self-contained with a compact extract of only the relevant project invariants: canonical owner/source of truth, required vertical trace, coupled paths, validation rules, and the known-test-debt register (
AGENTS.md→ Testing And Validation). Do not paste the whole project instruction file. Require it to hunt every in-scope debt category, including:- unreachable, unfinished, dead, or stranded product paths;
- correctness/security/privacy/money/lifecycle/operational defects;
- competing sources of truth, duplicated business decisions, dependency cycles, wrong ownership, or producer/consumer drift;
- brittle or unbounded work and unsafe change coupling;
- false-green tests or mocks that bypass the owning boundary;
- source/generated/schema/migration/release/UI/document control-plane drift.
Raw findings need
file:line, kind/category, owner and affected seam, delta provenance, proposed severity with "why not lower", concrete impact, and evidence. Every A/B claim requires a runnable repro/test or concrete exploit/failure path. A technical/architecture-debt claim requires a demonstrated duplicate owner, cycle, dead path, false-green boundary, repeated reconciliation burden, or drift — not a preferred refactor. For an oversized zone, split across 2–3 finders by sub-area. Collect raw findings; do not yet trust them.duplicate_closedprovenance is valid only when the cited closing commit is an ancestor of the audit target and the owning behavior still matches. A closed document without integrated code is not a refutation.A false-green-test finding stands only when a discriminating negative path fails to catch the defect, or concrete mock/assertion evidence shows that the test never crosses the owning boundary. Coverage percentage alone is not proof. Do not mutate task source merely to manufacture evidence.
-
Skeptic pass — context asymmetry. Spawn an INDEPENDENT skeptic subagent (fresh context) given ONLY each bare claim,
file:line, owner/seam coordinates, target SHA, and the minimum zone/direct-seam code needed to refute it — NOT the finder's narrative. Give it the same compact project invariants required to judge the boundary; independence means withholding finder reasoning, not essential facts. Its job is to
Content truncated.
When not to use it
- →When the user needs to audit multiple zones in a single context window
- →When the user needs to perform actions outside of a codebase audit sweep
- →When the user needs to generate findings without adversarial refutation
Limitations
- →The skill sweeps exactly one zone per invocation.
- →The skeptic must NOT see the finder's reasoning to ensure independent judgment.
- →A survivor finding with final confidence below the threshold (default 70) is either dropped or downgraded.
How it compares
This skill uses an adversarial finder↔skeptic duel to reduce false positives in codebase audits, providing a more reliable validation process than a single agent's assessment.
Compared to similar skills
tms-audit-sweep side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| tms-audit-sweep (this skill) | 0 | 3mo | No flags | Advanced |
| find-bugs | 5 | 8mo | No flags | Intermediate |
| tech-debt-analyzer | 5 | 10mo | Review | Intermediate |
| static-analysis | 5 | 8mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
find-bugs
davila7
Find bugs, security vulnerabilities, and code quality issues in local branch changes. Use when asked to review changes, find bugs, security review, or audit code on the current branch.
tech-debt-analyzer
ailabs-393
This skill should be used when analyzing technical debt in a codebase, documenting code quality issues, creating technical debt registers, or assessing code maintainability. Use this for identifying code smells, architectural issues, dependency problems, missing documentation, security vulnerabilities, and creating comprehensive technical debt documentation.
static-analysis
gmh5225
Expertise in LLVM-based static analysis including dataflow analysis, pointer analysis, taint tracking, and program verification. Use this skill when implementing security scanners, bug finders, code quality tools, or performing program analysis research.
agent-code-analyzer
ruvnet
Agent skill for code-analyzer - invoke with $agent-code-analyzer
codex-code-review
tyrchen
Perform comprehensive code reviews using OpenAI Codex CLI. This skill should be used when users request code reviews, want to analyze diffs/PRs, need security audits, performance analysis, or want automated code quality feedback. Supports reviewing staged changes, specific files, entire directories, or git diffs.
review-code
catlog22
Multi-dimensional code review with structured reports. Analyzes correctness, readability, performance, security, testing, and architecture. Triggers on "review code", "code review", "审查代码", "代码审查".