code-audit – Coding skill for AI agents
Authorized source-code security review and SAST workflows: Semgrep and CodeQL pattern hunting, dangerous API identification, and fix verification.
Install the code-audit skill with one command
Pick the tool you use, copy the command and paste it in your terminal. The skill lands in that tool's skills folder and is ready in your next session.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/code-audit-5533b.tgz | tar xz -C ~/.claude/skills
Call it in Claude Code: /code-audit – then describe the task you want done.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/code-audit-5533b.tgz | tar xz -C ~/.codex/skills
Call it in Codex: $code-audit – then describe the task you want done.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/code-audit-5533b.tgz | tar xz -C ~/.hermes/skills
Call it in Hermes Agent: /code-audit – then describe the task you want done.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/code-audit-5533b.tgz | tar xz -C ~/.deepcode/skills
Call it in DeepSeek: /code-audit – then describe the task you want done.
SKILL.md content
Source Code Security Audit
When to Use
- Reviewing a codebase for security defects with static analysis.
- Verifying that a vulnerability fix actually removes the flawed pattern.
适用场景
- 白盒审计、PR/差分安全审查
- Semgrep / CodeQL / Bandit / gosec 等 SAST
- 危险 API、注入点、鉴权缺失、加密误用
- 与
supply-chain-security/分工:本 skill 偏自有代码逻辑,供应链偏依赖与管道
工作流
1. 范围与威胁模型
□ 信任边界:用户输入、文件、反序列化、SSRF、鉴权中间件
□ 高价值资产:鉴权、支付、管理端、密钥处理2. 自动扫描
semgrep --config auto .
# 或项目规则包
semgrep --config p/owasp-top-ten .3. 人工验证(MUST)
□ 每个 SAST 命中:可达性?可利用性?误报?
□ 鉴权:IDOR/越权、缺校验、错误的多租户隔离
□ 注入:SQL/命令/模板/LDAP
□ 加密:硬编码密钥、ECB、自定义 crypto4. 产出
Finding:位置 + 数据流 + PoC + 修复建议
可选 ATT&CK / CWE 编号工具链
| 工具 | 语言/场景 |
|------|-----------|
| Semgrep | 多语言快速规则 |
| CodeQL | 深数据流(GitHub) |
| Bandit | Python |
| gosec / staticcheck | Go |
| SpotBugs / FindSecBugs | Java |
参考
references/sast-review-checklist.md../supply-chain-security/../api-security/../llm-security/(Agent 代码)
路由上下文
上游: MASTER R26
角色: ops/role-map.md cae
下游: 依赖漏洞 → supply-chain;运行时验证 → pentest-tools
任务完成自检
- [ ] 是否人工验证而非只贴扫描器输出?
- [ ] 是否含修复建议?
- [ ] 是否限定在授权仓库范围?
- [ ] Checklist?
Limitations
- Static analysis produces false positives; manual triage is required.
- Coverage depends on language support of the chosen SAST engine.
> Adapted from [zhaoxuya520/reverse-skill](https://github.com/zhaoxuya520/reverse-skill) (MIT).
Related skills
- code-documentation-code-explain – You are a code education expert specializing in explaining complex code through clear…
- code-documentation-doc-generate – You are a documentation expert specializing in creating comprehensive, maintainable…
- code-of-conduct – Build a human-reviewed conduct register after context-first intake. Use when an SME…
- code-polish – Rewrites unprofessional code comments into clear ones and performs non-semantic cleanup…
- code-refactoring-context-restore – Resume interrupted project work from a handoff and current checkout evidence; reconcile…
- code-refactoring-refactor-clean – You are a code refactoring expert specializing in clean code principles, SOLID design…
- code-refactoring-tech-debt – Identify technical debt from actual code and change history, estimate its impact, and…
- code-review-ai-ai-review – Review pull requests with source inspection, available static analysis and…