| name | audit-code |
| description | Performs a complete security, quality, and infrastructure audit before deploying to production. Use this skill when the user triggers /audit-code, or when asking to audit, verify if something is ready for production, or do a quality checklist. Always use when the message starts with /audit-code. |
Skill: /audit-code
Trigger
The user triggers with:
/audit-code "description of what will be audited"
The description is optional. Without it, the audit is performed on the available general context (open files, recent diff, or conversation).
Reading project context
Before any analysis, search for and read the following files if they exist:
.claude/project.md — stack, environments, modules
.claude/conventions.md — team standards to check compliance
.claude/architecture.md — expected infrastructure and code patterns
.claude/known-issues.md — check if any documented problems are present
Stage 0: Clarification
Before auditing, check if the scope is clear enough to apply the right stages.
Ask up to 3 targeted questions if any of the following are true:
- No description was provided AND no diff/files are visible in context
- The deployment target is unknown (K8s, serverless, bare VM) and Stage 5 (Infrastructure) is relevant
- The audit intent is unclear — full pre-deployment audit vs. targeted review of a specific change
Do not ask about code style or team preferences. Only ask when missing context would cause entire stages to be skipped or incorrectly applied.
After asking, wait for the user's reply before proceeding to Stage 1.
If the user says "skip questions" or "audit everything", proceed with all 7 stages.
Stage execution
By default, all 7 stages execute in one response.
The user can restrict this: "audit only Stages 1 and 2", "stop after Stage 3", "skip to Stage 5". Respect this literally.
If the user asks for a targeted audit (e.g., "audit the jobs only"), map their request to the relevant stage(s) and run only those.
For each item in every stage, mark:
- ✅ OK
- ⚠️ Attention (doesn't block, but should be reviewed)
- ❌ Critical (blocks deployment)
- ➖ Not applicable
Stage 1: Security
If any Security item is marked ❌ Critical, after completing Stage 1 ask:
"Found critical security issue(s). Proceed with remaining audit stages, or stop here to address security first?"
Stage 2: Database
Stage 3: Performance
Stage 4: Queues and Jobs
Stage 5: Infrastructure and K8s
Stage 6: Code quality
Stage 7: Tests and validation
Check known-issues
After the stages, check if any item in .claude/known-issues.md is relevant to what is being audited. If yes, list which ones and confirm if they were addressed.
Register in known-issues
If the audit reveals a new problem with potential to be recurring, add to .claude/known-issues.md:
## [Category — short title]
Description: problem found.
Context: where it tends to appear.
Solution: how to prevent or fix.
Detected in: [audit-code]
Inform the user: "⚠️ Recorded in known-issues: [title]"
Final verdict
## Audit Summary
| Stage | Name | ❌ | ⚠️ | ✅ | ➖ |
|-------|------|----|----|----|-----|
| 1 | Security | N | N | N | N |
| 2 | Database | N | N | N | N |
| 3 | Performance | N | N | N | N |
| 4 | Queues/Jobs | N | N | N | N |
| 5 | Infrastructure | N | N | N | N |
| 6 | Code Quality | N | N | N | N |
| 7 | Tests | N | N | N | N |
| **Total** | | **N** | **N** | **N** | **N** |
## Critical Items (if any)
[numbered and actionable list]
## Attention Items (if any)
[list]
## Known Issues
[new records, or "No new issues recorded"]
## Verdict
✅ READY FOR DEPLOYMENT
⚠️ DEPLOY WITH CAVEATS — resolve attention items after
❌ BLOCKED — resolve critical items before deployment