Agent skill

Codebase Audit

by majiayu000 in majiayu000/spellbook

全面代码库审计 — 自适应并行深度分析(前后端契约、数据完整性、异常处理/安全、架构/技术债、配置/缓存),结构化 findings + 对抗验证 + 基线对比,输出按严重程度排序的统一报告和修复路线图。支持 quick 快速体检模式。Use when user asks to audit, analyze, or review an entire codebase for design…

MITAuto-check passedDevelopment

Install Codebase Audit

skills CLI
$ npx skills add majiayu000/spellbook --skill codebase-audit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install majiayu000/spellbook codebase-audit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/codebase-audit .claude/skills/codebase-audit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
codebase-audit
GitHub stars
286
Token cost
~2.8k tokens
SKILL.md length
1,201 words
Files
21 (incl. references)
Skills in repo
97
Repo updated
First seen
Licence
MIT

At a glance

全面代码库审计 — 自适应并行深度分析(前后端契约、数据完整性、异常处理/安全、架构/技术债、配置/缓存),结构化 findings + 对抗验证 + 基线对比,输出按严重程度排序的统一报告和修复路线图。支持 quick 快速体检模式。Use when user asks to audit, analyze, or review an entire codebase for design…

  • Works in 5 steps: Detect & Prepare → Assemble Dimensions → Orchestrate → …
  • User asks to audit
  • SKILL.md covers Core Principles, Operating Contract, Gotchas and Modes, plus 3 more sections
  • Runs Python scripts from its folder; calls cargo and npm

What it does

Codebase Audit is an agent skill from majiayu000/spellbook. 全面代码库审计 — 自适应并行深度分析(前后端契约、数据完整性、异常处理/安全、架构/技术债、配置/缓存),结构化 findings + 对抗验证 + 基线对比,输出按严重程度排序的统一报告和修复路线图。支持 quick 快速体检模式。Use when user asks to audit, analyze, or review an entire codebase for design issues, find hidden bugs, check architecture health, or asks '全面审查', '代码库审计', '分析设计问题', 'audit codebase', 'health check', '有哪些问题', '快速体检'. Also trigger when user asks to find silent degradation, data flow breakpoints, type mismatches between frontend and backend, or wants to understand technical debt across a project.

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 24 other files, including reference files (for example `evals/README.md`, `evals/evals.json` and `evals/expected-findings.json`).

It sits in Development, covering Technical debt and Responsive design. The repository describes itself as: Cross-runtime skills for Claude Code, Codex, and multi-agent workflows. The licence is MIT.

When your agent uses it

  • User asks to audit
  • Review an entire codebase for design issues
  • Find hidden bugs
  • Check architecture health

Example prompts

  • “分析设计问题”
  • “audit codebase”
  • “health check”
  • “/codebase-audit”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Detect & Prepare
  2. Assemble Dimensions
  3. Orchestrate
  4. Dedup & Ledger Diff
  5. Report

What it can do on your machine

Read from SKILL.md and the folder at commit 6310f81. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • cargo
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Codebase Audit loads about 2.8k tokens when it runs, and up to ~10k if it reads all its reference files. Until then it costs about 133 tokens; SKILL.md has 1,201 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~133
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~10k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from majiayu000/spellbook at commit 6310f81, republished under its MIT licence (© majiayu000). 1,201 words, ~2,758 tokens.

Download SKILL.mdSave it as .claude/skills/codebase-audit/SKILL.md (or your agent's skills folder). This skill also uses 20 other files; get the full folder from GitHub.
name
codebase-audit
description
全面代码库审计 — 自适应并行深度分析(前后端契约、数据完整性、异常处理/安全、架构/技术债、配置/缓存),结构化 findings + 对抗验证 + 基线对比,输出按严重程度排序的统一报告和修复路线图。支持 quick 快速体检模式。Use when user asks to audit, analyze, or review an entire codebase for design issues, find hidden bugs, check architecture health, or asks '全面审查', '代码库审计', '分析设计问题', 'audit codebase', 'health check', '有哪些问题', '快速体检'. Also trigger when user asks to find silent degradation, data flow breakpoints, type mismatches between frontend and backend, or wants to understand technical debt across a project.

Codebase Audit — Adaptive Deep Analysis

Comprehensive codebase audit that adapts its agent configuration to the project's tech stack, forces structured findings, adversarially verifies Critical/High findings before they enter the report, diffs against the previous audit's ledger (resolved / still-open / new), and outputs a severity-sorted report plus a phased repair roadmap.

Core Principles

  1. READ-ONLY — Audit agents must never create, modify, or delete files in the target. Every agent prompt starts with the read-only preamble in references/agent-prompts.md.
  2. Inherit the session model — Omit the model param on all agents so they inherit the session model (usually the strongest available). Only override upward if the session model is clearly weak for cross-file reasoning. Never hardcode a specific model name in this skill.
  3. Depth over breadth — Fewer agents with broader merged scopes beat many shallow agents. Each agent traces issues across file boundaries.
  4. Adaptive — Agent count and dimensions vary by stack and mode.
  5. Verified findings — Critical/High findings must survive an adversarial verify pass. Medium findings pass through but are labeled unverified in the report.

Operating Contract

  • Direct actions: read-only inspection, local dependency audits, report writing under the target, and ledger updates under <target>/.audit/ after the user invokes this skill.
  • Escalate before: editing audited project source files, dependency manifests, .gitignore, CI config, remote issues, PR state, or anything outside the requested audit/report scope.
  • Secret evidence: retain file:line and the surrounding code, but replace credential values with [REDACTED] in findings, reports, and ledger entries; never reproduce the literal. This redacted snippet satisfies the code-evidence requirement.
  • Evidence-backed pushback: challenge "all clear" or "resolved" only with file evidence, dependency-audit output, verifier results, or ledger spot-checks.
  • Feedback loop: promote repeated misses into prompt updates, ledger matching rules, or fixture eval cases rather than leaving them as session-only notes.

Gotchas

  • Dependency-audit commands must run from {TARGET_DIR}, not the assistant's incidental cwd.
  • Finder agents must not read evals/expected-findings.json or eval README files when auditing the planted-bug fixture.
  • A previous ledger miss is not proof that a finding was resolved; spot-check the file before marking an old finding resolved.

Modes

ModeTriggerAgentsVerify passLedger
full (default)plain invocation, "全面审查"3–5 by stack (+ optional dims)yesyes
quick"quick" in args, "快速体检"2 (Silent Degradation & Security; Data Integrity & Registry)no — all findings labeled unverifiedyes

Optional dimensions (full mode only, enable when user asks or the repo obviously needs them):

  • tests — test quality: assertion strength, skip markers, coverage of critical paths (Agent 6)
  • concurrency — races, blocking calls in async, leaked tasks/goroutines (Agent 7)

Workflow

Phase 0: Detect & Prepare
  1. Stack detection: package.json/tsconfig.json → TS/JS; pyproject.toml/requirements.txt → Python; Cargo.toml → Rust; go.mod → Go; multiple → full-stack.
  2. Size estimate: tokei <target> (fallback: find <target> -name '*.<ext>' | xargs wc -l), excluding vendored/generated code. If effective size ≥ 400K LOC, split each agent's scope by top-level directory and note the split in the report.
  3. Exclusions (always, in every agent prompt): node_modules/, vendor/, target/, dist/, build/, .git/, lockfiles, generated code.
  4. Ledger: read <target>/.audit/findings.json if it exists — this is the previous audit baseline (format: references/ledger-format.md).
  5. Deterministic dependency audit: from {TARGET_DIR} (never the assistant's incidental cwd), run each matching tool and feed raw output to the Error Handling & Security prompt:
    • Rust: cargo audit
    • Node: npm audit
    • Python metadata (pyproject.toml / setup.py): pip-audit .
    • Python requirements (requirements.txt): pip-audit -r requirements.txt
    • Python fallback with no project files: pip-audit .
    • Go: govulncheck ./... If a required tool is unavailable, the report must state 依赖审计降级跳过: <tool>; never omit the degradation silently.
Phase 1: Assemble Dimensions

Pick the configuration by detected stack. Full prompt templates in references/agent-prompts.md; prepend the read-only preamble and inject {TARGET_DIR} / {STACK_INFO} into each.

Full-Stack (5 agents) — frontend + backend both present:

#DimensionScope (merged)
1Frontend-Backend ContractType consistency + rendering pipeline + serialization boundaries. Reads BOTH sides.
2Data Integrity & FlowEnd-to-end pipeline tracing, field dropping, declaration-execution gaps, registry coverage alignment.
3Error Handling & SecuritySilent degradation, exception patterns, secrets, injection, unsafe deserialization.
4Architecture & Code QualityLayer violations, god objects, duplication/drift, extension cost, registry cross-reference.
5Config & PersistenceConfig completeness, cache key/integrity, DB schema, temp files, state persistence.

Backend-Only (4 agents): replace #1 with "API Contract & Data Integrity" (which absorbs #2's data-flow/registry scope — do NOT also dispatch #2); keep #3–#5. Frontend-Only (3 agents): Component Architecture & Rendering; Error Handling & Code Quality; Config & Build. Quick mode (2 agents): Silent Degradation & Security (= #3); Data Integrity & Registry (= #2 core).

Fallback-path agent types (when using the Agent tool instead of Workflow): agent availability is environment-specific — check the subagent registry visible in the current session and use only type names that appear there. Never invent aliases (there is no generic reviewer type). If no specialized type matches, use general-purpose (or the environment's default catch-all) for every dimension; the prompts are self-contained. See the example mapping in references/agent-prompts.md.

Show full SKILL.md (422 more words)Show less
Phase 2: Orchestrate

Preferred — Workflow tool (skill invocation is the user's opt-in): use the script in references/workflow-template.md. It schema-forces every finder's output into structured findings, then pipelines each dimension's Critical/High findings straight into adversarial verify agents (no barrier — verification starts while other dimensions are still scanning).

Fallback — Agent tool (if Workflow is unavailable): launch all finder agents in a SINGLE message; prompts already demand the same JSON output. After they return, launch one verify agent per Critical/High finding (also batched in one message), using the verify prompt from references/workflow-template.md.

Phase 3: Dedup & Ledger Diff

Dedup:

  • Same file + same line → merge.
  • Same root cause found by multiple agents → keep the most detailed, note cross-agent confirmation (raises confidence).
  • Severity conflicts → use the highest.

Verification results:

  • confirmed=false findings do NOT enter the main report; list them in an appendix "Refuted by verification" with the refutation reason (keeps the work auditable).
  • Verifier failed/absent → keep the finding, label unverified.

Ledger diff (skip if no previous ledger — everything is new):

  • Match previous ↔ current findings by (category, file, root-cause summary) — never by line number (lines drift).
  • Previous finding with no current match → open the file and spot-check before marking resolved; if still present but missed, re-add as still-open.
  • Classify every current finding: new / still-open.
  • Write the updated ledger to <target>/.audit/findings.json. If the repo is tracked and .audit/ isn't ignored, suggest adding it to .gitignore (don't edit .gitignore yourself).
Phase 4: Report

Write the full report to <target>/audit-report-YYYY-MM-DD.md, then post a chat summary: counts per severity, top Criticals, ledger delta (N resolved / N still-open / N new), dependency-audit status, and the roadmap.

Report body requirements:

  • Use Chinese for problem descriptions, impact analysis, and repair advice; keep code identifiers, paths, and error messages in their original form.
  • Separate each finding into fact / inference / recommendation: the finding itself is a fact with file:line; impact is an inference with confidence; repair advice is a recommendation with stated assumptions.
  • Inferred-only findings cannot be higher than Medium unless a verifier confirms user-visible or security impact.

Report structure:

markdown
# [Project] Codebase Audit Report
> Date / Target / Stack / Mode / Agents / Dependency audit / Previous audit: date or "none"

## Summary
| Level | Count | Verified | Key Areas |

## Delta vs Previous Audit   (omit if first audit)
Resolved: N (list) | Still-open: N | New: N

## Critical (Fix Immediately)
Per finding: file:line, code snippet, risk, fix suggestion, verify status.

## High / P1 (Fix This Week)     — grouped by category
## Medium / P2 (Plan to Fix)     — labeled unverified where applicable

## Refuted by Verification       — appendix: finding + refutation reason

## Repair Roadmap
| Phase | Scope | Est. Files |

Severity Classification

LevelCriteria
CriticalData loss, rendering failure, security vulnerability, complete feature breakage affecting users NOW
High/P1Silent degradation (user sees wrong/incomplete output), type mismatches causing data truncation, missing config causing empty output, architectural violations blocking development
Medium/P2Code duplication, inconsistent patterns, suboptimal error handling, tech debt that slows development but doesn't break features

References

  • references/agent-prompts.md — read-only preamble + prompt templates (Agents 1–7)
  • references/stack-patterns.md — per-stack search patterns
  • references/workflow-template.md — Workflow script, finding/verdict schemas, verify prompt
  • references/ledger-format.md — ledger JSON schema and matching rules
  • evals/ — planted-bug fixture; evals measure recall against evals/expected-findings.json

© majiayu000, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 20 other files (references) in skills/codebase-audit of majiayu000/spellbook.

  • SKILL.md
  • evals/README.md
  • evals/evals.json
  • evals/expected-findings.json
  • evals/fixture/README.md
  • evals/fixture/app/__init__.py
  • evals/fixture/app/config.py
  • evals/fixture/app/handlers.py
  • evals/fixture/app/main.py
  • evals/fixture/app/pipeline.py
  • evals/fixture/app/registry.py
  • evals/fixture/app/storage.py
  • evals/fixture/app/tasks.py
  • evals/fixture/config.yaml
  • evals/fixture/requirements.txt
  • evals/fixture/tests/test_pipeline.py
  • references
  • … and 4 more

Open the folder on GitHubat commit 6310f81

Compare with similar skills

Codebase Audit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Codebase Audit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Codebase Audit this skillmajiayu000/spellbook286—~2.8kAutomated safety check: PassMIT
Ostackmr-daedalium/ostack-saas114—~6.1kAutomated safety check: NotesMIT
Local Log DebugUniClipboard/UniClipboard1.9k—~2.6kAutomated safety check: PassAGPL-3.0
Openocd Jtagmohitmishra786/low-level-dev-skills253—~1.6kAutomated safety check: PassMIT
Gearcoleco Debuggingdrhelius/Gearcoleco141—~3.5kAutomated safety check: PassGPL-3.0
Dbgtheodo-group/debug-that158—~2.2kAutomated safety check: PassMIT

Similar skills

  • Ostack

    mr-daedalium/ostack-saas

    Fast headless browser for QA testing and site dogfooding. An agent skill from mr-daedalium/ostack-saas.

    114 GitHub stars~6.1k tokensUpdated 6 mo ago
    DevelopmentAuto-check: notes
  • Local Log Debug

    UniClipboard/UniClipboard

    Inspect and analyze uniclipboard's local JSONL logs on a SINGLE machine — query, filter, and time-merge the per-role (gui/daemon/cli) log files to answer "what just happened" or trace a symptom…

    1.9k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Openocd Jtag

    mohitmishra786/low-level-dev-skills

    OpenOCD skill for embedded hardware debugging. An agent skill from mohitmishra786/low-level-dev-skills.

    253 GitHub stars~1.6k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Gearcoleco Debugging

    drhelius/Gearcoleco

    Debug and trace ColecoVision and Super Game Module games using the Gearcoleco emulator MCP server.

    141 GitHub stars~3.5k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Dbg

    theodo-group/debug-that

    Debug applications using the dbg CLI debugger. An agent skill from theodo-group/debug-that.

    158 GitHub stars~2.2k tokensUpdated today
    DevelopmentAuto-check passed
  • Ue Live Debugging

    JasonMa0012/MooaToon

    A skill your agent uses when debugging UE C++ crashes, runtime bugs, or unexpected behavior with Rider MCP available.

    749 GitHub stars~2.9k tokensUpdated 19 days ago
    DevelopmentAuto-check: notes

More from majiayu000/spellbook

All 97 skills in this repo
  • Skill Ecosystem Doctor

    majiayu000/spellbook

    Audits and repairs how coding-agent Skills are owned, copied and exposed across runtimes, from canonical sources to quarantine and retirement.

    286 GitHub stars~3k tokensUpdated today
    Auto-check passed
  • AGENTS.md Scaffold

    majiayu000/spellbook

    Scans a repository for real evidence and proposes, or on request writes, a small stack of root and scoped AGENTS.md files with validation commands and generated-file boundaries.

    286 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Product Demo Builder

    majiayu000/spellbook

    Plans, produces or diagnoses evidence-backed product demo videos: script, capture plan, pacing checks and verified final media built on real product behavior.

    286 GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Flowguard Task Guard

    majiayu000/spellbook

    Single entry point that routes long or ambiguous agent tasks, checks live state, bounds autonomous loops and leaves a resumable handoff.

    286 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • npm Supply Chain Check

    majiayu000/spellbook

    Scans a repository, its lockfiles and node_modules for known malicious npm package versions and install-time indicators, using a read-only Python scanner.

    286 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Product Manager Toolkit

    majiayu000/spellbook

    Product management helpers: a RICE scoring script, an interview transcript analyzer and PRD templates for prioritizing features, synthesizing research and writing requirements.

    286 GitHub stars~2.2k tokensUpdated today
    Auto-check passed

Questions about Codebase Audit

What does Codebase Audit do?

全面代码库审计 — 自适应并行深度分析(前后端契约、数据完整性、异常处理/安全、架构/技术债、配置/缓存),结构化 findings + 对抗验证 + 基线对比,输出按严重程度排序的统一报告和修复路线图。支持 quick 快速体检模式。Use when user asks to audit, analyze, or review an entire codebase for design…. Codebase Audit is an agent skill from majiayu000/spellbook. 全面代码库审计 — 自适应并行深度分析(前后端契约、数据完整性、异常处理/安全、架构/技术债、配置/缓存),结构化 findings + 对抗验证 + 基线对比,输出按严重程度排序的统一报告和修复路线图。支持 quick 快速体检模式。Use when user asks to audit, analyze, or review an entire codebase for design issues, find hidden bugs, check architecture health, or asks '全面审查', '代码库审计', '分析设计问题', 'audit codebase', 'health check', '有哪些问题', '快速体检'.

When should I use Codebase Audit?

Codebase Audit fits situations like: user asks to audit; review an entire codebase for design issues; find hidden bugs; check architecture health.

How do I install Codebase Audit in Claude Code?

Run `npx skills add majiayu000/spellbook --skill codebase-audit -a claude-code`. Or copy the skill folder (skills/codebase-audit in majiayu000/spellbook) into .claude/skills/codebase-audit in your project. Claude Code loads it when a task matches its description.

How do I install Codebase Audit in Codex?

Run `npx skills add majiayu000/spellbook --skill codebase-audit -a codex`. Or copy the skill folder (skills/codebase-audit in majiayu000/spellbook) into .agents/skills/codebase-audit in your project. Codex loads it when a task matches its description.

Can I use Codebase Audit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add majiayu000/spellbook --skill codebase-audit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/codebase-audit, .gemini/skills/codebase-audit, .github/skills/codebase-audit and .opencode/skills/codebase-audit in your project.

What does Codebase Audit need to run?

Going by SKILL.md and its folder, Codebase Audit needs Python for the scripts in its folder and the command-line tools its instructions call (cargo and npm). Our summary lists: Python 3.

Does Codebase Audit access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Codebase Audit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Codebase Audit use?

Codebase Audit is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Codebase Audit use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.3k tokens, read only when the agent opens those files.

What are the alternatives to Codebase Audit?

Skills that share tags, products or a category with Codebase Audit: Ostack (mr-daedalium/ostack-saas, 114 stars), Local Log Debug (UniClipboard/UniClipboard, 1.9k stars), Openocd Jtag (mohitmishra786/low-level-dev-skills, 253 stars) and Gearcoleco Debugging (drhelius/Gearcoleco, 141 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Codebase Audit?

majiayu000 (a GitHub user) maintains it in majiayu000/spellbook, which has 286 GitHub stars. The repository holds 97 skills in this directory. The repository was last updated on October 8, 2026.

Source: majiayu000/spellbook on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.