majiayu000/spellbook / skills/codebase-audit
codebase-audit
Verified全面代码库审计 — 自适应并行深度分析(前后端契约、数据完整性、异常处理/安全、架构/技术债、配置/缓存),结构化 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.1 KB |
| evals/README.md | markdown | 2.6 KB |
| evals/evals.json | config | 2.6 KB |
| evals/expected-findings.json | config | 3.6 KB |
| evals/fixture/README.md | markdown | 406 B |
| evals/fixture/app/__init__.py | script | 0 B |
| evals/fixture/app/config.py | script | 548 B |
| evals/fixture/app/handlers.py | script | 587 B |
| evals/fixture/app/main.py | script | 787 B |
| evals/fixture/app/pipeline.py | script | 807 B |
| evals/fixture/app/registry.py | script | 983 B |
| evals/fixture/app/storage.py | script | 669 B |
| evals/fixture/app/tasks.py | script | 510 B |
| evals/fixture/config.yaml | config | 72 B |
| evals/fixture/requirements.txt | manifest | 42 B |
| evals/fixture/tests/test_pipeline.py | script | 418 B |
| references/agent-prompts.md | markdown | 18.1 KB |
| references/ledger-format.md | markdown | 2.3 KB |
| references/stack-patterns.md | markdown | 2.8 KB |
| references/workflow-template.md | markdown | 5.2 KB |
references/stack-patterns.md
View on GitHub# Stack-Specific Search Patterns
Quick reference for each agent to adapt its searches based on the detected tech stack.
## Python + Pydantic + FastAPI
| Agent | Key Search Patterns |
|-------|-------------------|
| Type Consistency | `Field(alias=...)` values, `model_dump(by_alias=True)` output keys |
| Declaration-Execution | `@app.get/post`, dependency injection `Depends()`, `include_router()` |
| Data Flow | `model_validate()`, `model_dump(exclude_none=True)`, `extra="ignore"` |
| Serialization | `class X(BaseModel)`, check `model_config` for `extra` setting |
| Exception | `except Exception: pass`, `logger.debug` for errors, `logger.warning + return` |
| Cache | `hashlib`, cache key construction, `pickle.dumps/loads` |
| Config | `os.getenv()`, `.env` files, `Settings(BaseSettings)` |
## TypeScript + React
| Agent | Key Search Patterns |
|-------|-------------------|
| Type Consistency | `interface X`, `type X =`, compare with backend model fields |
| Declaration-Execution | Component registry, route definitions, `switch(type)` exhaustiveness |
| Rendering | `props?.fieldName`, component `switch/if-else` chains for type routing |
| Serialization | Zod schemas (`.strict()` vs `.passthrough()`), `as` type assertions |
| Exception | `catch(e) {}`, `.catch(() => {})`, unhandled promise rejections |
## Rust + serde + axum/actix
| Agent | Key Search Patterns |
|-------|-------------------|
| Type Consistency | `#[serde(rename=...)]`, `#[serde(rename_all=...)]` |
| Declaration-Execution | `impl Trait for X`, `Router::new().route()`, `mod` declarations |
| Data Flow | `#[serde(skip_serializing_if)]`, `#[serde(default)]` |
| Serialization | `#[serde(deny_unknown_fields)]` absence, `serde_json::from_str` |
| Exception | `let _ = expr`, `unwrap()`, `.ok()` discarding errors |
| God Objects | `impl X { }` with >15 methods, files >800 lines |
## Go + gin/echo
| Agent | Key Search Patterns |
|-------|-------------------|
| Type Consistency | `json:"field_name"` struct tags, compare with frontend types |
| Declaration-Execution | `r.GET/POST()` route registrations, interface implementations |
| Data Flow | `json.Marshal/Unmarshal`, `omitempty` tags, struct embedding |
| Serialization | Missing `json` tags (Go exports uppercase but JSON uses lowercase) |
| Exception | `if err != nil { return }` without logging, `_ = expr` |
## Full-Stack Projects
When both frontend and backend are detected (dimension names per SKILL.md Phase 1):
- **Frontend-Backend Contract** becomes the most critical dimension — compare BOTH sides, including the rendering pipeline (backend-producible types vs frontend renderers)
- **Data Integrity & Flow** should trace data across the API boundary, not stop at the serialization edge
- **Architecture & Code Quality** should specifically check cross-stack duplication (same constants, enums, validation rules defined in both stacks)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |