Code audit hardcore

From hawkyre/hawk-skills · View interactive version

Code audit hardcore is an AI agent skill from the GitHub repository hawkyre/hawk-skills. Aggressive cleanup audit scoped to the user's specified changes plus tangibly-relevant surrounding code. Same blind audit-* specialists as code-audit, with a maximum-improvement posture — any code in the expanded review scope that can be cleaner WILL be made cleaner. Small fixes applied inline; big

How to use this skill

Skill file

Code Audit (Hardcore)

Run code-audit's entire process (read code-audit/SKILL.md), with the deltas below. Don't restate the shared shape — the orchestrator follows code-audit, then applies these overrides.

What carries through from `code-audit`

Hardcore inherits all of code-audit's quality gates — the deltas change the posture and routing, not the gates:

Deltas vs `code-audit`

| Aspect | code-audit | hardcore |

| ---------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------- |

| tier= default | auto | deep (run all five specialists) |

| Modes | report or cleanup | always cleanup — no report |

| Scope | the user-specified diff | core scope expanded to tangibly-relevant code (rule below) |

| Specialist user prompt | standard template | standard template + Posture: hardcore block (below) |

| Routing axis | Scope: local \| cross-cutting \| plan-override | Size: small \| big — replaces Scope (below) |

| Apply step | apply local FIXes only | classify each FIX small/big; apply small inline; route big through plan-small or plan-large |

| Plan-overrides | surface as QUESTION | route through plan-large (hardcore acts) |

| Output | code-audit report template | hardcore template (below) |

Hardcore defaults to tier=deep because the expanded review scope and the always-improve posture both benefit from the research and architecture specialists, which standard omits.

When to use

For a strict diff-only review, use code-audit.

Args

There is no mode= arg — hardcore always cleans up. For a report-only hardcore-style review, use code-audit mode=report and read it as a punch list.

The scope expansion rule

The user's specified changes are the core scope. They are a starting point, not a fence. Before the audit, identify the tangibly-relevant surrounding code and add it to the review:

One hop out from the diff. Not callers (two hops). Not the whole repo. The user can rerun hardcore with explicit scope= to widen.

The union of the core scope and the tangibly-relevant set is the review scope. Present the expansion as a fact before fixing — the user should know what code the skill is touching, and they can interrupt to narrow. Default is forward; hardcore is aggressive, not chatty.

If the expansion is >15 files, group by module/area in the presentation instead of file-by-file — keeps the message scannable.

The always-improve rule then applies across the entire review scope:

When evaluating any line in the review scope, if there is a choice between leaving it as it is and improving it, choose to improve. Always. Conventions in the surrounding code are not a defense.

"Improvement" means the same dimensions the specialists already cover: cleaner naming, simpler control flow, fewer abstractions, no dead code, consistent layering, correct types, no duplication, proper error paths, modern API usage.

Specialist user prompt — Posture: hardcore

Run the audit-* specialists listed in code-audit/SKILL.md from the main session. Do not delegate to code-audit; it is a skill. Append this block to each specialist's brief:

## Posture: hardcore — always improve

You are reviewing the user's diff PLUS the tangibly-relevant
surrounding code (setup, wiring, sibling files in the same module,
files the diff depends on). The full review scope is in the
"Files / diff in scope" section above.

When deciding between flagging an improvement to relevant
surrounding code and letting it go because "it's not in the strict
diff" — flag it. Always. The user's intent for this audit is
maximum cleanup of everything tangibly related to their changes.

Conventions in the surrounding code are not a defense. If the
existing pattern is bad, change it. If a routing setup is wrong,
fix the routing setup, not just the new endpoint. If a duplicated
utility exists next to the changes, replace the duplicate with a
call to the canonical version — and clean the canonical version
too if it needs it.

**Apply more, not faster.** A FIX that masks a symptom is a
regression even when it makes the build green. Hardcore's licence
is to improve aggressively — that licence is forfeit the moment
you take a lazy patch. When in doubt: surface the issue and let
the orchestrator route it through a plan skill, rather than
applying a band-aid.

You may flag improvements that exceed the scope of an inline
patch (rename a public API, redesign a module, change a schema).
Mark them clearly in your `Why:` — the orchestrator will route
them through a plan skill.

Write a concrete improvement as a FIX. Use a NOTE only for an
improvement that needs a plan or that you cannot verify.

Small-vs-big classifier

After merge and promotion, each FIX is big if any of these are true:

Otherwise: small.

When in doubt, classify big. Plans are cheap; bad refactors are not.

Routing

Small FIXes — apply inline. After each batch, run the project check command with the layered retry ladder (inherited from code-audit's cleanup mode):

Stage 3 matters more in hardcore than in code-audit because hardcore applies more FIXes per batch — so the probability that one is wrong is higher, and "revert the suspect FIX" is the safety valve that prevents an aggressive batch from forcing the user into manual cleanup.

Big FIXes — cluster related ones by module/theme. For each cluster, derive a kebab-case slug from the cluster's theme (≤4 words: e.g. routing-cleanup, error-handling-refactor, schema-naming), then invoke:

plan-small "<cluster description>" slug=<derived-slug>

…or plan-large when the cluster spans modules or PRs. Plan-override clusters always go through plan-large regardless of size — they need the schema-first treatment and the architectural-decisions structure that the small-plan template doesn't have.

NOTEs that remain after promotion join these clusters. Each one goes to a plan; none is left as an observation.

The plan skill's own slug-collision logic (-2, -3) handles duplicates. Hardcore stops at "plan written" and surfaces the plan path. Implementation belongs to the plan skill and its corresponding implement-plan invocation.

Behavior-changing FIXes are surfaced in the output even when applied as small fixes. Apply more, not faster — never silent.

Output template

# Hardcore Audit: {{core scope}}

## Scope

- Core: {{user-specified scope}}
- Expanded (tangibly relevant):
  - {{path}} — {{one-line reason}}
  - ...
    (if >15 files, group by module/area)

## Applied (small fixes)

- [path:line] — issue
  Verify: <runnable check that confirms the fix stuck>
  Strength: <N>/<S>
  Source: logic / security / simplification / research / architecture
  Behavior change: yes (omit when no)
- ...

## Routed to plans (big fixes)

- {{cluster name}} → `.plans/{{slug}}/plan.md` (plan-small | plan-large)
  Why this needs a plan: {{summary}}
  Specialists involved: ...
  Plan-override: yes (omit when no)
- ...

## Open questions

- ...

## Check command

- {{result}} ({{n}} retries if any; which ladder stage closed it)

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.