From codestable
Audits codebases within a user-defined scope, scanning for bugs, security issues, performance problems, maintainability concerns, and architecture drift. Produces a prioritized findings matrix categorized by severity and nature.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codestable:cs-auditThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
开始任何判断或动作前,先执行 CodeStable preflight:读 `.codestable/attention.md`;缺失先 `cs-onboard`;不读外部 AI 入口替代(详见 `.codestable/reference/execution-conventions.md`)。
开始任何判断或动作前,先执行 CodeStable preflight:读 .codestable/attention.md;缺失先 cs-onboard;不读外部 AI 入口替代(详见 .codestable/reference/execution-conventions.md)。
cs-issue 等你报 bug,cs-refactor 等你指优化点,cs-keep 等你说"这事记一下"——但"我也不知道哪有问题,你先扫一遍看看"这个诉求没人接。cs-audit 补上这块:在用户限定的范围内主动扫描,产出一份按严重度 × 性质交叉分类的发现清单。
本技能只发现、不定修。修是 cs-issue / cs-refactor 的事。
.codestable/audits/{YYYY-MM-DD}-{slug}/
├── index.md # 速览:范围、总评、发现清单交叉矩阵
├── finding-01.md
├── finding-02.md
└── ...
日期取审计当天。slug 短到一眼看出审计目标(auth-module、order-flow、payment-security)。
所有 audit 文档带 YAML frontmatter(doc_type 分别为 audit-index 和 audit-finding)便于 search-yaml.py 检索。
每个发现打两个标签:
性质:bug | security | performance | maintainability | arch-drift
严重度:P0(必须修)| P1(应该修)| P2(可以修)
交叉示例:
security × P0:SQL 注入、明文存密码bug × P1:特定边界条件下空指针,实际触发概率低performance × P2:循环内多余的对象分配,热点路径才需要改另外每个发现带 置信度(high / medium / low)和建议动作(cs-issue / cs-refactor)。
完整模板见 reference.md。
审计不能全仓库盲扫——成本高、噪音大。先帮用户把范围收窄到可执行。
问用户三样(有一样就能起步):
src/services/ 下面"用户描述已清楚直接进 Phase 2。用户说"整个项目都扫" → 推回去——建议先扫最常改的模块或最近出过问题的区域。
收敛后给用户确认:"扫 src/services/order/ 和 src/api/order.ts,约 12 个文件,看安全 / 性能 / bug 隐患三个维度。范围 OK 吗?"
按用户圈定的维度逐维扫描(用户没指定就全扫 5 维):
.codestable/requirements/adrs/ 已拍板决策、分层泄漏、跨模块隐式耦合扫描时用 Glob / Grep / Read 真实读代码。每条发现必须记录 文件:行号 + 具体代码片段。
上限:每种维度最多报 5 条。不是凑数——够了就停,不够也不硬凑。
置信度口径:
high:代码路径可确认触发,影响明确medium:静态分析能定位问题,但触发条件不确定low:线索可疑,需要进一步确认但值得标记index.md:范围、总评、发现清单表格(交叉分类)finding-NN.md先写 index 再写 finding——这个顺序让 AI 先做整体判断再展开细节,避免陷入单条发现迷失全局。
index.md 末尾给优先级建议:
用户选哪条 → 路由到 cs-issue 或 cs-refactor。cs-audit 自己不修。
| 技能 | 触发 | cs-audit 怎么对待 |
|---|---|---|
cs-issue | 用户报已知 bug | audit 发现 bug 后建议开 cs-issue |
cs-refactor | 用户指已知优化点 | audit 发现可优化点后建议开 cs-refactor |
cs-keep | 沉淀单点经验 / 决策 | audit 是批量扫多维度发现新问题,cs-keep 是把已知的事写下来 |
cs-domain | 维护 ADR / CONTEXT.md | cs-domain 写决策,cs-audit 检查代码是否偏离已拍板的 ADR |
cs-security-review | 安全审查 | audit 的安全维度是轻量扫描,深度安全审查走专项 |
high.codestable/requirements/adrs/ 对照status: superseded + superseded-by: {新目录}reference.md — index.md / finding-NN.md 模板.codestable/reference/shared-conventions.md — 跨工作流共享口径.codestable/requirements/adrs/ — 架构偏离类发现对照源npx claudepluginhub liuzhengdongfortest/codestable --plugin codestableIterative multi-agent code audit that fixes critical/high findings across a selected scope. Use for deep code audits, release-readiness reviews, or post-refactor risk sweeps.
Runs mechanical checks (build, typecheck, lint, tests, secrets scan) then dispatches specialist reviewers and produces a scored codebase health report. Use for code quality, security, or performance audits.
Runs a two-pass multidisciplinary code audit with security, performance, UX, DX, and edge-case analysis, producing a prioritized remediation report. Use for deep reviews, stress-testing, or risk-ranked fixes.