CommunityProgramación y desarrollogithub.com

qa-audit-diff

Audits pull requests, branch diffs, commit ranges, working-tree changes, or pasted patches read-only to expose outward Blast Radius, missed siblings, 10-class Failure Mode risks, and pre-merge test gaps.

¿Qué es qa-audit-diff?

qa-audit-diff is a Claude Code agent skill that audits pull requests, branch diffs, commit ranges, working-tree changes, or pasted patches read-only to expose outward Blast Radius, missed siblings, 10-class Failure Mode risks, and pre-merge test gaps.

Compatible con✓Claude Code~Codex CLI~Cursor
Part ofMobile
npx skills add https://github.com/HBaHa1303/qa-skills/tree/HEAD/skills/qa-audit-diff

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

QA Audit Diff

Execute read-only change-risk forensics on a diff to uncover outward Blast Radius, missed sibling patterns in unchanged code, 10-class Failure Mode risks, and test gaps before merge.

Guardrails, Language & Boundaries

  • Strictly read-only on target code and runtime: Inspect repository files, git history, and PR diffs read-only; leave application source code, tests, schemas, and databases untouched. Persist output only to .qa/reports/<slug>-diff-audit.md when chaining .qa/reports/<slug>-* checkpoints or explicitly requested by the user.
  • No Raw Secrets Rule: Never read .env, private key files, or credential dumps, and never echo literal tokens, passwords, or keys found in a diff—mask any discovered literal as <REDACTED> and cite only file:line and variable name.
  • Zero-config context load: Read GLOSSARY.md and docs/qa/context.md if present to align domain terms, system pointers, and Artifact language; fall back silently to .qa/ defaults when absent.
  • Bilingual policy: Keep SKILL.md schema keys, report headings, RISK-* IDs, evidence tags, Severity cues (S1-Blocker–S4-Minor), Diff Risk Posture (High-Risk | Medium-Risk | Low-Risk), and canonical GLOSSARY.md terms in English. Adapt conversational responses to the user's prompt language (English or Vietnamese); honor Artifact language in docs/qa/context.md when persisting .qa/reports/<slug>-diff-audit.md.
  • Skill boundaries: Target concrete diffs, PRs, commit ranges, working-tree changes, or pasted patches. Route static module exploration without a diff to qa-audit-codebase (if installed; otherwise map entry points and persistence sites directly), whole-suite scoring to qa-audit-coverage, live Defect debugging to qa-investigate-defect, and formal Go/Conditional-Go/No-Go decisions to qa-release-gate.

Step 1 — Diff Resolution & Context Load

Resolve the target diff strictly in this priority order:

  1. Explicit PR or commit/branch range: PR URL/number (via repo tracker CLI if configured) or explicit git range (<base>..<head>, <base>...<head>, or commit SHA).
  2. Current branch vs. base branch: Compare HEAD against repository default base (main, master, or configured default) plus any uncommitted local changes if part of the branch work.
  3. Working tree: Inspect staged (git diff --cached), unstaged (git diff), and newly created untracked files when no branch diff applies.
  4. Pasted patch (Diff-Only Mode): When repo access is absent and the user supplies a patch or diff snippet, activate Diff-Only Mode.

If no diff source exists in steps 1–4, pause and ask the user for a PR, branch/commit range, or patch (or suggest qa-audit-codebase when auditing a static module without changes). Derive a kebab-case <slug> (^[a-z0-9-]+$) from the PR, ticket, or branch name, and load GLOSSARY.md and docs/qa/context.md if present.

Completion criterion: Exact diff target, resolved ref, execution mode (diff-repo or diff-only), changed file list, and total changed lines are established before triage.


Step 2 — Large-Diff Risk Triage (Conditional)

Check diff size (total changed files and added + deleted lines):

  • Standard diff (<= 15 files AND <= 600 changed lines): Audit every changed file at Tier 1 depth.
  • Large diff (> 15 files OR > 600 changed lines): Activate Large-Diff Risk Triage and partition files using references/failure-mode-probes.md:
    • Tier 1 (Deep Audit): Auth/authz guards, DB migrations and schemas, state transitions and lifecycle enums, persistence/billing/external I/O, public APIs/contracts/events, feature flags, and background job/cron handlers.
    • Tier 2 (Surface Scan): UI copy, styling/CSS, formatting-only changes, static assets, lockfiles, generated artifacts, and pure fixture data.

Promote any Tier 2 file to Tier 1 immediately if a surface scan spots inline logic, permission checks, SQL/API calls, or hardcoded credentials. Record all Tier 2 surface-scanned files explicitly in Blind Spots.

Completion criterion: Every changed file is classified as Tier 1 or Tier 2, and every Tier 2 file is queued for explicit Blind Spots reporting.


Step 3 — Diff-Hunk Forensics & Outward Blast Radius

Inspect all Tier 1 hunks and trace outward exposure across unchanged code (consult references/failure-mode-probes.md for stack-agnostic cues):

  1. Changed-hunk invariants: Examine modified logic, defaults, guards, queries, transactions, and exception-handling branches.
  2. 1-hop callers & consumers (diff-repo): Trace direct callers, route mounts, UI callers, event/queue subscribers, scheduled jobs, and shared table/cache consumers.
  3. Sibling-pattern sweep (diff-repo): Search unchanged code for parallel endpoints, handlers, serializers, or queries that still rely on the old pattern or lack a guard introduced by the diff.
  4. Mode & messy-codebase fallbacks:
    • Dynamic dispatch / raw strings: Supplement symbol search with route string, event-name, and SQL table/column greps; tag unresolved dynamic edges Opaque in Blast Radius and Blind Spots.
    • Diff-Only Mode: Audit the pasted hunks directly and log No repo access for 1-hop caller tracing or sibling-pattern sweep in Blind Spots.

Completion criterion: Every Tier 1 change has changed-hunk invariants checked, 1-hop callers/consumers traced (or logged as Opaque / Diff-Only Mode in Blind Spots), and a sibling-pattern sweep completed across unchanged code.


Step 4 — 10-Class Failure Mode Diff-Lens Audit

Evaluate Tier 1 changes and their outward Blast Radius across all 10 canonical Failure Mode classes (load references/failure-mode-probes.md for per-class probes):

  1. Spec Ambiguity: Behavior changed without clear spec/PR rationale or conflicting with GLOSSARY.md or a linked Testable Acceptance Criterion.
  2. Implicit Business Rule: Change overrides, duplicates, or diverges from an existing invariant or sibling rule.
  3. Boundary & Input Validation Defect: Altered regex, schema, numeric precision, range limit, off-by-one threshold, or missing null/empty guard.
  4. Broken State Transition: Modified status enum, skipped transition guard, or partial multi-step write leaving records stuck mid-lifecycle.
  5. Cross-Module Side Effect: Unchanged callers, triggers, caches, webhooks, or counters broken by altered return values or side effects.
  6. Contract / Integration Drift: Altered request/response shape, HTTP status code, nullability, or event payload without synchronized consumer updates.
  7. Concurrency Defect: Non-atomic read-modify-write, missing transaction/lock/idempotency key, or shared mutable state across async handlers.
  8. Auth & Permission Leak: Missing auth/tenant/ownership middleware, broadened query filter, leaky serializer/log payload, or literal secret (redact per No Raw Secrets Rule).
  9. Migration & Compatibility Defect: Destructive or NOT NULL migration without backfill, rolling-deploy skew between old code and new schema, or unmigrated legacy rows.
  10. Silent Failure: New try/catch suppressing failures, fire-and-forget async call without propagation, or misleading HTTP 200 / success signal on partial failure.

Assign every finding: RISK-* ID, canonical Failure Mode class, file:line citation (or patch:<hunk> in Diff-Only Mode), evidence tag (Confirmed-in-Code | Inferred-from-Pattern | Opaque), Severity cue (S1-Blocker–S4-Minor), and concrete failure scenario.

Completion criterion: All 10 Failure Mode classes evaluated; every finding carries RISK-*, class, file:line, evidence confidence tag, Severity cue, and concrete failure scenario.


Step 5 — Diff Test-Gap Signals, Diff Risk Posture & Output

  1. Evaluate diff test-gap signals: Inspect test changes in the diff (and adjacent tests when in diff-repo) for untested Tier 1 changes, uncovered 1-hop consumers or sibling paths, and False-Confidence Test patterns (tautological assertions, over-mocked persistence, or happy-path-only checks).
  2. Assign Diff Risk Posture (distinct from Release Gate):
    • High-Risk: Any S1-Blocker finding, any Confirmed-in-Code S2-Critical finding in auth, migrations, state transitions, concurrency, or contracts, or severe unmitigated outward Blast Radius / critical Tier 1 test gap.
    • Medium-Risk: S2-Critical (Inferred-from-Pattern / Opaque) or S3-Major findings, missed sibling checks needing verification, or moderate Tier 1 test gaps.
    • Low-Risk: Only S4-Minor findings or clean diff with verified 1-hop consumers, consistent siblings, and adequate tests.
  3. Compile Must-Verify Before Merge: Order concrete actions by Severity and confidence (code fixes, sibling alignment, missing tests, and runtime/DB checks for Opaque edges). If an Opaque module outside the diff needs deep reverse-engineering, recommend qa-audit-codebase if installed (otherwise suggest direct entry-point and persistence inspection).
  4. Emit report: Follow references/report-template.md to present the 5-section report in chat. Write .qa/reports/<slug>-diff-audit.md (with checkpoint YAML frontmatter + <= 25-line ## Handoff Summary + the 5 sections) only when chaining .qa/reports/<slug>-* checkpoints or explicitly requested.

Completion criterion: Report includes resolved diff summary, Diff Risk Posture, outward Blast Radius, 10-class Failure Mode findings with file:line and evidence tags, diff test-gap signals, prioritized Must-Verify Before Merge checklist, and Blind Spots (plus .qa/reports/<slug>-diff-audit.md if chaining checkpoints or requested).

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

Skills relacionados