AGENT SKILL

ask-improve

Improve: Audits a codebase (correctness, security, performance, tech debt), plans and runs fixes, or does a focused refactor. Use for audits and cleanups.

License 许可
MIT
最近更新
2026-11-09
Stars
★ 1
Forks
0

01 前言 Front Matter

name
ask-improve
triggers
[ "improve", "audit", "tech debt", "tech debt audit", "audit codebase", "improve codebase", "direction", "audit and plan", "refactor this", "refactoren", "code cleanup", "opschonen", "simplify this code", "vereenvoudigen", "remove over-engineering", "deduplicate logic", "restructure this code", "reduce complexity", "untangle this", "clean architecture mess" ]
description
Improve: Audits a codebase (correctness, security, performance, tech debt), plans and runs fixes, or does a focused refactor. Use for audits and cleanups.
execution_tier
standard
delegation_default
prefer-subagent
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

ASK Improve

Structured, evidence-first codebase audit that produces executable implementation plans. Also covers focused refactoring and simplification passes. Runs once to audit and plan; re-invoke execute, reconcile, or next modes for follow-through.

When to use

Use when:

  • you want a structured audit (correctness, security, performance, tech debt, deps, DX, docs, direction, user-facing text language/locale consistency)
  • you have audit output and need executable implementation plans
  • you need to execute, reconcile, or publish those plans as issues
  • the user asks for a refactor, cleanup, simplification, or deduplication

Skip when:

  • the problem is a single known bug (use debugging)
  • you only need a quick code review (use code-review)

Audit flow

  1. Recon: detect repo layout, conventions, commands, existing docs/ADRs, intent signals (TODOs, flags, stubs, PRDs, roadmap)
  2. Audit: run category audits, including code-smell scanning and applicable hard coding/style rules. Inspect every function-like construct in scope for required intent comments and run the repository's source-comment check when available; each finding is evidence-grounded (file:line)
  3. Plan: convert findings into self-contained, executor-ready plans with drift checks, verification gates, hard boundaries, and escape hatches
  4. Follow-through: execute <plan>, reconcile, next, branch

Wide audits. When the host runs dynamic workflows and the audit is deep or repository-wide (hundreds of files, several categories), offer to run the audit as one workflow. A recon agent lists the surface; each agent takes a chunk of files or modules for one category (sized to the host's guideline) and returns schema-shaped findings with file:line; a verifier agent tries to refute each finding before it is reported, which is the false-positive validation the Rules require. The offer states the agent count, a model tier per stage, a one-directory slice first, and a rough cost, and the coordinator starts the run only after the user opts in. The audit stays read-only, and execute still dispatches a separate executor. quick, branch, and one-category audits of one module stay direct. A worker that finds the audit is this wide reports ASK_WORKFLOW_BLOCKED phase=EXECUTE with the file count, because a worker cannot start workflows; the coordinator makes the offer. In a non-interactive run, where no answer can come, continue with a delegated audit at the same evidence bar.

For significant or release-sensitive work, act as the independent audit role: inspect callers and the complete diff, challenge ownership, ambiguity, fallbacks, determinism, compatibility, and test invariants. Return concrete evidence, not generic quality advice. Use ASK_WORKFLOW_PASS phase=AUDIT, ASK_WORKFLOW_FINDINGS phase=AUDIT, ASK_WORKFLOW_BLOCKED phase=AUDIT, or ASK_WORKFLOW_FAILED phase=AUDIT.

When an audit satisfies code-review debt, include review-generation, review-scope: final-diff, review-reference, review-completed-at, and review-result: PASS metadata, followed by terminal ASK_REVIEW_COMPLETE. An audit outside final diff scope must not clear review debt.

Modes

  • (bare): Full audit + plans (recon → audit → plan)
  • quick / deep: Audit depth modifier; quick keeps smell scanning focused on the relevant changed surface, while deep expands it across affected modules or the repository. Default to quick; escalate to deep only when the changed surface is unknown, cross-cutting, or a quick scan already surfaced evidence a bounded scan cannot reconcile.
  • security / perf / tests / deps / dx / docs / direction / tech-debt / text: Focus on one category. The perf and security modes carry standing behavior rules (below), not just a scan.
  • refactor: Focused simplification pass — not full audit
  • execute <plan>: Dispatch executor, review, verdict (APPROVE/REVISE/BLOCK)
  • reconcile: Refresh plan backlog, verify DONE, investigate BLOCKED
  • next / features / roadmap: Direction-only audit
  • branch: Diff-only audit of current branch vs default branch
  • --issues: Publish plans as GitHub issues

Focus rules

  • perf: Measure before optimizing. Neutral results are reverts, not keeps; log every attempt including the reverted ones so a discarded optimization stays discarded.
  • security: Start from a threat model. Trust follows who wrote a value, not which channel delivered it.

Refactoring pattern

  1. Find the actual pain point, not the most stylistically ugly code.
  2. Choose one high-leverage simplification in the smallest owning area.
  3. Implement the smallest coherent change set, then validate.
  4. Stop when the main complexity is gone.
  5. Prefer deletion over indirection, extraction over rewrites. If the best refactor is leaving code alone, leave it alone.

Rules

  • Every finding cites evidence (file:line). "Probably has N+1" is not a finding; orders/api.ts:142 issues one query per item is.
  • Smell-scan findings must state concrete impact, severity, and false-positive validation. Separate defects, maintainability risks, test gaps, and intentional trade-offs.
  • Hard coding and styling rules are pass/fail gates. Do not report a missing required comment as a low-priority nit, and do not mark an audit complete until the applicable automated checks passed.
  • Plans are self-contained: executor has zero context beyond the plan file. Every step ends with a verification command and expected result.
  • STOP conditions are explicit. Plans stamp the commit SHA they were written against for drift detection.
  • Never copy secrets into plans or issues.
  • Advisor never edits source code; execute dispatches a separate executor.

Use with

  • intake when the work scope is ambiguous
  • code-review for executor diffs or standalone PRs
  • debugging when audit finds a bug that needs tracing
  • verification to confirm preserved behavior or executed plans

Avoid

  • Full audit on every small change (use quick, branch, or focused category)
  • Broad rewrites because code "could be cleaner"
  • New abstractions for a single current use case
  • Style-only rewrites in untouched areas
  • Publishing sensitive findings as public issues without confirmation

04 同仓库更多 Skills