Skill: project-audit
Systematic project audit for any repository — with a three-layer depth model.
Automatically detects the stack, loads relevant supplements, and performs
structured checks — for management repos, CLI tools, libraries,
backend services, monorepos, Python projects, and shell collections.
Distinction from /audit: No SEO, no accessibility, no privacy/GDPR, no Lighthouse.
Instead, more thorough checking of Git, CI/CD, code quality, deployment, and maintenance.
Check Layers
Each phase has two check levels:
| Layer |
Method |
When |
| Source Layer |
Read code, analyze configs, scan files |
Always (offline possible) |
| Runtime Layer |
npm audit, tsc --noEmit, docker scout, run tests, check CI logs |
When tools are available |
Rule: Source layer is mandatory. Runtime layer supplements with tool-based checks.
Both layers are tracked in state per phase.
Runtime layer per phase:
| Phase |
Runtime Tools |
| 02 Dependencies |
npm audit, pip-audit, npm outdated |
| 03 Code Quality |
tsc --noEmit, npx biome check, pylint |
| 05 CI/CD |
gh run list, check CI logs |
| 07 Testing |
npm test, coverage reports |
| 08 Security |
npm audit, docker scout, git log --all -p -- .env |
| 09 Deployment |
docker scout cves, container health check |
Check Priorities + Completeness Tracking
See _shared/audit-patterns.md (MUST/SHOULD/COULD markers, completeness counting).
Phase with <100% MUST-checks can NOT be marked as done.
Architecture: Three-Layer Model
Layer 1: Base Phase (phases/*.md) ~70-100 lines, universal
Layer 2: Stack Supplement (stacks/*.md §-sections) ~10-15 lines per phase, stack-specific
Layer 3: Project Override (project-audit-context.md) ~20-40 lines, project-specific
Per phase, only the relevant supplements are loaded.
Result: ~100-150 lines of check instructions per phase — comparable to a dedicated skill.
5 Modes
| Mode |
Trigger |
Description |
start |
/project-audit start |
Detect stack + project type, create phase plan, first 2 phases |
continue |
/project-audit continue |
Continue next phases or fix max 5 findings |
status |
/project-audit status |
Show progress + statistics |
report |
/project-audit report |
Generate structured Markdown report |
auto |
/project-audit auto |
Fully autonomous run — all phases without prompts |
Mode: start
Step 1 — Detect Project Type
| Detected |
Project Type |
global/, projects/, setup.sh, no src/ |
management-repo |
bin in package.json |
cli-tool |
main/exports in package.json, no bin, no framework |
library |
fastify/express/koa without frontend framework |
backend-service |
workspaces in package.json or pnpm-workspace.yaml |
monorepo |
Python project (setup.py, pyproject.toml, requirements.txt) |
python-project |
| Shell scripts dominant (*.sh), no package.json |
scripts-collection |
| Fallback |
generic |
Step 2 — Stack Detection
Scan files and detect stack:
| File/Pattern |
Detects |
Stack-Key |
package.json present |
Node.js |
node: true |
pyproject.toml, setup.py, requirements.txt |
Python |
python: true |
Majority *.sh files, no package.json |
Shell/Bash |
shell: true |
Dockerfile, docker-compose.* |
Docker |
docker: true |
workspaces in package.json, pnpm-workspace.yaml |
Monorepo |
monorepo: true |
.claude/ directory or CLAUDE.md in root |
Claude Code |
claude-code: true |
go.mod present |
Go |
go: true |
*.tf files, terraform.tfvars |
Terraform |
terraform: true |
.github/ directory or git remote shows github.com |
GitHub |
github: true |
Version detection: For each detected stack, extract version:
- Node:
engines.node or .nvmrc / .node-version
- Python:
python_requires or .python-version
- Docker: Base image tag in Dockerfile
Step 3 — Load Context
- Project CLAUDE.md read (architecture, conventions)
- project-audit-context.md load (if in project root) — project-specific context
- README.md read (purpose, setup instructions)
- Existing docs scan: TODO.md, STATUS.md, CHANGELOG.md
- package.json /
pyproject.toml analyze (if present)
- Existing state file (.project-audit-state.json) check > auto-migrate if v1
Step 4 — User Query
Show detection result:
Project Detection:
+-------------+------------------+---------+
| Category | Detected | Version |
+-------------+------------------+---------+
| Project Type| management-repo | — |
| Stack | Shell/Bash | — |
| Docker | Yes | — |
| Monorepo | No | — |
+-------------+------------------+---------+
Project context: project-audit-context.md found
Existing docs: TODO.md, STATUS.md
Ask user (AskUserQuestion):
- Audit scope: Complete (all 10 phases) vs. focused (specific phases)
- Phase order: Sequential (01>10, default) vs. Smart Order (Security>Dependencies>Code>Rest, recommended)
[CHECKPOINT: decision] — User selects audit scope and phase order.
Step 5 — Create state, start first 2 phases
Mode: continue
- Read
.project-audit-state.json
- Identify next pending phase(s)
- Generate smart recommendation (> logic in
_shared/audit-patterns.md)
- Show recommendation as first option in AskUserQuestion, user chooses
- Write state immediately after each phase/fix
Fixing Findings
- Always fix highest severity first: CRITICAL > HIGH > MEDIUM > LOW
- Per fix: Show problem > Load fix template (from
fix-templates.md) > User confirmation > Implement > Test
- Update fix status in state (
"status": "fixed", "fixedIn": "Session N")
- No auto-fix — every fix requires user confirmation (except
auto mode)
Mode: status
Read state file and display:
Project Audit: {{PROJECT_NAME}} (management-repo)
Stack: Shell/Bash, Docker
Phases:
[done] 01 Structure & Architecture (Session 1, 2 Findings, MUST 100%)
[done] 02 Dependencies & Ecosystem (Session 1, 1 Finding, MUST 100%)
[wip] 03 Code Quality (in progress)
[wait] 04 Git & Versioning
[wait] 05 CI/CD & Automation
[wait] 06 Documentation & Onboarding
[wait] 07 Testing & QA
[wait] 08 Security & Secrets
[wait] 09 Deployment & Operations
[wait] 10 Maintenance & Hygiene
Findings: 3 total
CRITICAL: 0
HIGH: 1 (open: 1)
MEDIUM: 2 (open: 2)
LOW: 0
Completeness: 2/10 phases completed
Layer: Source done | Runtime done (2/2 phases)
Mode: report
Generate structured Markdown report based on templates/report.md.
- Read state file
- Group all findings by phase
- Report with Executive Summary, Findings per Phase, Recommendations
- Include trend analysis (if history available):
Trend (recent audits):
CRITICAL: 3 > 1 > 0 (resolved)
HIGH: 5 > 3 > 2 (declining)
Total: 12 > 8 > 5
Assessment: Project is steadily improving.
- Save report as
PROJECT-AUDIT-REPORT-{YYYY-MM-DD}.md in project root
- If previous reports exist: Diff section (new/resolved since last report)
Mode: auto
Fully autonomous project audit without prompts.
Flow
- Check orchestrator context: If
.audit-orchestrator-state.json exists:
- Read
phaseMapping.project-audit.delegated > skip delegated phases
- Read
sequencingReason > understand context
- Example: If
structure delegated to /audit > skip Phase 01
- Auto-detection as in
start
- All 10 phases run through (no 2-phase limit, skip delegated phases)
- Document findings with fix templates from
fix-templates.md
- Context management: When context is running low:
- Write state immediately
- Create task in
.tasks.json with handoff note
- Recommend: "New session with
/project-audit continue"
- At the end: automatically generate report
Context Protection in Auto Mode
- Findings are collected but not fixed immediately (documented only)
- Write state after EVERY phase immediately
- At context limit: clean abort with complete state
- Fixes in follow-up sessions with
/project-audit continue
10 Phases
| # |
Phase |
Prefix |
Checks |
| 01 |
Structure & Architecture |
STRUC |
Folder structure, patterns, coupling, layering |
| 02 |
Dependencies & Ecosystem |
DEP |
Packages, versions, ecosystem health, licenses |
| 03 |
Code Quality |
QUAL |
Patterns, complexity, dead code, types, linting |
| 04 |
Git & Versioning |
GIT |
.gitignore, commits, branches, tags, history |
| 05 |
CI/CD & Automation |
CICD |
Workflows, actions security, deploy pipelines, hooks |
| 06 |
Documentation & Onboarding |
DOC |
README, CLAUDE.md, ADRs, API docs, runbooks |
| 07 |
Testing & QA |
TEST |
Test pyramid, coverage, E2E, mutation testing |
| 08 |
Security & Secrets |
SEC |
Secrets, supply chain, container security, SAST |
| 09 |
Deployment & Operations |
DEPLOY |
Docker, server, monitoring, rollback, health checks |
| 10 |
Maintenance & Hygiene |
MAINT |
Tech debt, cleanup, lifecycle, deprecations |
Details in the phase files under phases/.
Phase Execution
For each phase:
Load base: Read phases/{NN}-{name}.md — universal check items
Load supplements: For each detected stack, load the matching file, ONLY the section relevant to the current phase
| Phase |
Supplement Section |
| 01-structure |
§Structure |
| 02-dependencies |
§Dependencies |
| 03-code-quality |
§Code |
| 04-git |
§Git |
| 05-cicd |
§CICD |
| 06-documentation |
§Documentation |
| 07-testing |
§Testing |
| 08-security |
§Security |
| 09-deployment |
§Deployment |
| 10-maintenance |
§Maintenance |
Project override: If project-audit-context.md exists > include relevant section
Existing findings: Check previous audit docs, do not create duplicates
Source layer: Systematically execute all code/config-based checks
Runtime layer: Execute tool-based checks (when tools are available)
- Unavailable tools: document, no error
Document findings: Each finding with ID, severity, description, location
Count completeness: MUST/SHOULD/COULD checks (executed vs. skipped)
- Skipped MUST-checks with reason in
checksSkipped[]
- Phase with <100% MUST = NOT markable as
done
Update state: Phase status + completeness + layer status
[CHECKPOINT: verify] — After each phase: show findings + completeness to user, get confirmation.
Supplement Loading Logic
Per phase, the skill loads only relevant stack supplements.
Each stack file is structured by sections.
Example Phase 08-security:
> Always: phases/08-security.md (base)
> If node=true: + stacks/node.md §Security
> If docker=true: + stacks/docker.md §Security
> If python=true: + stacks/python.md §Security
> If project-audit-context.md exists: + relevant section
Supplement files:
| Stack-Key |
Supplement Path |
node: true |
stacks/node.md |
python: true |
stacks/python.md |
shell: true |
stacks/shell.md |
docker: true |
stacks/docker.md |
monorepo: true |
stacks/monorepo.md |
claude-code: true |
stacks/claude-code.md |
go: true |
stacks/go.md |
terraform: true |
stacks/terraform.md |
github: true |
stacks/github.md |
If a stack is detected but no supplement exists > use base phase only, no error.
Finding-IDs
| Phase |
Prefix |
Example |
| 01-structure |
STRUC |
STRUC-01 |
| 02-dependencies |
DEP |
DEP-01 |
| 03-code-quality |
QUAL |
QUAL-01 |
| 04-git |
GIT |
GIT-01 |
| 05-cicd |
CICD |
CICD-01 |
| 06-documentation |
DOC |
DOC-01 |
| 07-testing |
TEST |
TEST-01 |
| 08-security |
SEC |
SEC-01 |
| 09-deployment |
DEPLOY |
DEPLOY-01 |
| 10-maintenance |
MAINT |
MAINT-01 |
Severity Definitions
| Level |
Criteria |
Examples |
| CRITICAL |
Security vulnerability, data loss, exposed secrets |
Secrets in repo, SQL injection, open ports |
| HIGH |
Missing tests for critical paths, broken CI/CD, CVEs |
No tests, outdated deps with CVE, broken pipelines |
| MEDIUM |
Missing docs, style inconsistencies, missing .gitignore |
No README, inconsistent naming, missing types |
| LOW |
Cosmetic, nice-to-have, best practice |
Outdated but secure deps, missing comments |
Prioritization: CRITICAL > HIGH > MEDIUM > LOW. Security before functional before cosmetic.
State Schema v2.1 (.project-audit-state.json)
Complete state schema (JSON example) + migrations v1>v2 and v2>v2.1: See state-schema.md
Phase Order
Sequential (Default)
01 > 02 > 03 > 04 > 05 > 06 > 07 > 08 > 09 > 10
Smart Order (Recommended)
Prioritized by impact:
08-security > 02-dependencies > 03-code-quality > 05-cicd > 09-deployment > 04-git > 07-testing > 01-structure > 06-documentation > 10-maintenance
Logic: Security and dependencies are most urgent (CVEs, secrets).
Code quality and CI/CD have high impact. Structure/docs/maintenance are important but less time-critical.
User chooses at start. Store in state as "phaseOrder": "sequential" or "smart".
Fix Templates
For common findings there are ready-made fix templates in fix-templates.md.
Per finding type: code snippet, config change, verify step.
Verification-Depth + Fix Protocol
See _shared/audit-patterns.md (4-Level Verification, Stub-Detection, 5-Step Fix-Protocol).
Level 4 (Functional) is mandatory when runtime layer is available. READ + VERIFY never skip.
Context Protection (CRITICAL)
Base rules: See _shared/audit-patterns.md (Max 2 phases, state immediately, no auto-fix).
Project audit specific:
- Layer tracking: Document source layer and runtime layer status per phase
Smart Next Steps
After completing the project audit, recommend suitable follow-up skills to user:
| Condition |
Recommendation |
Justification |
| >3 HIGH/CRITICAL findings |
/adversarial-review audit |
Check report for completeness |
| Claude Code project (.claude/ present) |
/security-scan |
MCP permissions, hook safety, secret detection |
| Audit completed |
/lesson-learned session |
Extract learnings from audit process |
| Web project detected AND no .audit-state.json |
/audit start |
Check website quality (SEO, A11y, privacy) |
| Astro project detected AND no .astro-audit-state.json |
/astro-audit start |
Astro-specific checks |
Output in report: Replace {NEXT_STEPS} placeholder with concrete recommendation list.
Files in This Skill
project-audit/
├── SKILL.md <- This file
├── state-schema.md # State Schema v2.1 + Migrations
├── fix-templates.md # Quick-Fix templates for common findings
├── phases/
│ ├── 01-structure.md # Folder structure, architecture, coupling
│ ├── 02-dependencies.md # Packages, ecosystem, licenses
│ ├── 03-code-quality.md # Patterns, complexity, dead code
│ ├── 04-git.md # .gitignore, commits, branches, tags
│ ├── 05-cicd.md # Workflows, actions security, pipelines
│ ├── 06-documentation.md # README, ADRs, API docs, onboarding
│ ├── 07-testing.md # Test pyramid, coverage, E2E
│ ├── 08-security.md # Secrets, supply chain, SAST
│ ├── 09-deployment.md # Docker, server, monitoring, rollback
│ └── 10-maintenance.md # Tech debt, cleanup, deprecations
├── stacks/
│ ├── node.md # Node.js-specific checks
│ ├── python.md # Python-specific checks
│ ├── shell.md # Shell/Bash-specific checks
│ ├── docker.md # Docker-specific checks
│ ├── monorepo.md # Monorepo-specific checks
│ ├── claude-code.md # Claude Code config/skills/agents/hooks checks
│ ├── go.md # Go-specific checks
│ ├── terraform.md # Terraform/IaC-specific checks
│ └── github.md # GitHub repo/org security checks
└── templates/
└── report.md # Markdown report template
1---2name: project-audit3description: Repository audit for non-website projects (CLI, libs, backend, monorepo). Use when: "project-audit", "project audit", "repo audit", "code audit".4---56<!-- AI-QUICK-REF7## /project-audit — Quick Reference8- **Modes:** start | continue | status | report | auto9- **Arguments:** `/project-audit $0` e.g. `/project-audit auto`, `/project-audit status`10- **Three-layer:** phases/*.md + stacks/*.md + project-audit-context.md11- **Dual-Layer:** Source (read code) + Runtime (npm audit, tsc, docker scout)12- **Check-Priorities:** MUST (mandatory) | SHOULD (standard) | COULD (nice-to-have)13- **10 Phases:** Structure, Dependencies, Code, Git, CI/CD, Docs, Testing, Security, Deploy, Maintenance14- **Finding-IDs:** STRUC-01, DEP-01, QUAL-01, GIT-01, CICD-01, DOC-01, TEST-01, SEC-01, DEPLOY-01, MAINT-0115- **Severity:** CRITICAL > HIGH > MEDIUM > LOW16- **Context Protection:** Max 2 phases OR 5 fixes per session (except auto)17- **State:** .project-audit-state.json (v2.1)18- **Checkpoints:** [CHECKPOINT: verify] after each phase, [CHECKPOINT: decision] at audit scope19-->2021# Skill: project-audit2223Systematic project audit for any repository — with a three-layer depth model.24Automatically detects the stack, loads relevant supplements, and performs25structured checks — for management repos, CLI tools, libraries,26backend services, monorepos, Python projects, and shell collections.2728**Distinction from `/audit`:** No SEO, no accessibility, no privacy/GDPR, no Lighthouse.29Instead, more thorough checking of Git, CI/CD, code quality, deployment, and maintenance.3031---3233## Check Layers3435Each phase has two check levels:3637| Layer | Method | When |38|-------|--------|------|39| **Source Layer** | Read code, analyze configs, scan files | Always (offline possible) |40| **Runtime Layer** | `npm audit`, `tsc --noEmit`, `docker scout`, run tests, check CI logs | When tools are available |4142**Rule:** Source layer is mandatory. Runtime layer supplements with tool-based checks.43Both layers are tracked in state per phase.4445**Runtime layer per phase:**4647| Phase | Runtime Tools |48|-------|--------------|49| 02 Dependencies | `npm audit`, `pip-audit`, `npm outdated` |50| 03 Code Quality | `tsc --noEmit`, `npx biome check`, `pylint` |51| 05 CI/CD | `gh run list`, check CI logs |52| 07 Testing | `npm test`, coverage reports |53| 08 Security | `npm audit`, `docker scout`, `git log --all -p -- .env` |54| 09 Deployment | `docker scout cves`, container health check |5556---5758## Check Priorities + Completeness Tracking5960> See `_shared/audit-patterns.md` (MUST/SHOULD/COULD markers, completeness counting).61Phase with <100% MUST-checks can NOT be marked as `done`.6263---6465## Architecture: Three-Layer Model6667```68Layer 1: Base Phase (phases/*.md) ~70-100 lines, universal69Layer 2: Stack Supplement (stacks/*.md §-sections) ~10-15 lines per phase, stack-specific70Layer 3: Project Override (project-audit-context.md) ~20-40 lines, project-specific71```7273Per phase, only the relevant supplements are loaded.74Result: ~100-150 lines of check instructions per phase — comparable to a dedicated skill.7576---7778## 5 Modes7980| Mode | Trigger | Description |81|------|---------|-------------|82| `start` | `/project-audit start` | Detect stack + project type, create phase plan, first 2 phases |83| `continue` | `/project-audit continue` | Continue next phases or fix max 5 findings |84| `status` | `/project-audit status` | Show progress + statistics |85| `report` | `/project-audit report` | Generate structured Markdown report |86| `auto` | `/project-audit auto` | Fully autonomous run — all phases without prompts |8788---8990## Mode: start9192### Step 1 — Detect Project Type9394| Detected | Project Type |95|----------|-------------|96| `global/`, `projects/`, `setup.sh`, no src/ | `management-repo` |97| `bin` in package.json | `cli-tool` |98| `main`/`exports` in package.json, no `bin`, no framework | `library` |99| `fastify`/`express`/`koa` without frontend framework | `backend-service` |100| `workspaces` in package.json or `pnpm-workspace.yaml` | `monorepo` |101| Python project (`setup.py`, `pyproject.toml`, `requirements.txt`) | `python-project` |102| Shell scripts dominant (*.sh), no package.json | `scripts-collection` |103| Fallback | `generic` |104105### Step 2 — Stack Detection106107Scan files and detect stack:108109| File/Pattern | Detects | Stack-Key |110|-------------|---------|-----------|111| `package.json` present | Node.js | `node: true` |112| `pyproject.toml`, `setup.py`, `requirements.txt` | Python | `python: true` |113| Majority `*.sh` files, no package.json | Shell/Bash | `shell: true` |114| `Dockerfile`, `docker-compose.*` | Docker | `docker: true` |115| `workspaces` in package.json, `pnpm-workspace.yaml` | Monorepo | `monorepo: true` |116| `.claude/` directory or `CLAUDE.md` in root | Claude Code | `claude-code: true` |117| `go.mod` present | Go | `go: true` |118| `*.tf` files, `terraform.tfvars` | Terraform | `terraform: true` |119| `.github/` directory or `git remote` shows github.com | GitHub | `github: true` |120121**Version detection:** For each detected stack, extract version:122- Node: `engines.node` or `.nvmrc` / `.node-version`123- Python: `python_requires` or `.python-version`124- Docker: Base image tag in Dockerfile125126### Step 3 — Load Context1271281. **Project CLAUDE.md** read (architecture, conventions)1292. **project-audit-context.md** load (if in project root) — project-specific context1303. **README.md** read (purpose, setup instructions)1314. **Existing docs** scan: TODO.md, STATUS.md, CHANGELOG.md1325. **package.json** / `pyproject.toml` analyze (if present)1336. **Existing state file** (.project-audit-state.json) check > auto-migrate if v1134135### Step 4 — User Query136137Show detection result:138139```140Project Detection:141+-------------+------------------+---------+142| Category | Detected | Version |143+-------------+------------------+---------+144| Project Type| management-repo | — |145| Stack | Shell/Bash | — |146| Docker | Yes | — |147| Monorepo | No | — |148+-------------+------------------+---------+149150Project context: project-audit-context.md found151Existing docs: TODO.md, STATUS.md152```153154Ask user (AskUserQuestion):155- **Audit scope:** Complete (all 10 phases) vs. focused (specific phases)156- **Phase order:** Sequential (01>10, default) vs. Smart Order (Security>Dependencies>Code>Rest, recommended)157158**[CHECKPOINT: decision]** — User selects audit scope and phase order.159160### Step 5 — Create state, start first 2 phases161162---163164## Mode: continue1651661. Read `.project-audit-state.json`1672. Identify next pending phase(s)1683. Generate **smart recommendation** (> logic in `_shared/audit-patterns.md`)1694. Show recommendation as first option in AskUserQuestion, user chooses1705. Write state immediately after each phase/fix171172### Fixing Findings173174- Always fix highest severity first: CRITICAL > HIGH > MEDIUM > LOW175- Per fix: Show problem > **Load fix template** (from `fix-templates.md`) > User confirmation > Implement > Test176- Update fix status in state (`"status": "fixed"`, `"fixedIn": "Session N"`)177- **No auto-fix** — every fix requires user confirmation (except `auto` mode)178179---180181## Mode: status182183Read state file and display:184185```186Project Audit: {{PROJECT_NAME}} (management-repo)187Stack: Shell/Bash, Docker188189Phases:190 [done] 01 Structure & Architecture (Session 1, 2 Findings, MUST 100%)191 [done] 02 Dependencies & Ecosystem (Session 1, 1 Finding, MUST 100%)192 [wip] 03 Code Quality (in progress)193 [wait] 04 Git & Versioning194 [wait] 05 CI/CD & Automation195 [wait] 06 Documentation & Onboarding196 [wait] 07 Testing & QA197 [wait] 08 Security & Secrets198 [wait] 09 Deployment & Operations199 [wait] 10 Maintenance & Hygiene200201Findings: 3 total202 CRITICAL: 0203 HIGH: 1 (open: 1)204 MEDIUM: 2 (open: 2)205 LOW: 0206207Completeness: 2/10 phases completed208 Layer: Source done | Runtime done (2/2 phases)209```210211---212213## Mode: report214215Generate structured Markdown report based on `templates/report.md`.2162171. Read state file2182. Group all findings by phase2193. Report with Executive Summary, Findings per Phase, Recommendations2204. **Include trend analysis** (if history available):221 ```222 Trend (recent audits):223 CRITICAL: 3 > 1 > 0 (resolved)224 HIGH: 5 > 3 > 2 (declining)225 Total: 12 > 8 > 5226 Assessment: Project is steadily improving.227 ```2285. Save report as `PROJECT-AUDIT-REPORT-{YYYY-MM-DD}.md` in project root2296. If previous reports exist: Diff section (new/resolved since last report)230231---232233## Mode: auto234235Fully autonomous project audit without prompts.236237### Flow2382391. **Check orchestrator context:** If `.audit-orchestrator-state.json` exists:240 - Read `phaseMapping.project-audit.delegated` > skip delegated phases241 - Read `sequencingReason` > understand context242 - **Example:** If `structure` delegated to `/audit` > skip Phase 012432. Auto-detection as in `start`2443. **All 10 phases** run through (no 2-phase limit, skip delegated phases)2454. Document findings with fix templates from `fix-templates.md`2465. **Context management:** When context is running low:247 - Write state immediately248 - Create task in `.tasks.json` with handoff note249 - Recommend: "New session with `/project-audit continue`"2505. At the end: automatically generate report251252### Context Protection in Auto Mode253254- Findings are collected but **not fixed immediately** (documented only)255- Write state after EVERY phase immediately256- At context limit: clean abort with complete state257- Fixes in follow-up sessions with `/project-audit continue`258259---260261## 10 Phases262263| # | Phase | Prefix | Checks |264|---|-------|--------|--------|265| 01 | Structure & Architecture | STRUC | Folder structure, patterns, coupling, layering |266| 02 | Dependencies & Ecosystem | DEP | Packages, versions, ecosystem health, licenses |267| 03 | Code Quality | QUAL | Patterns, complexity, dead code, types, linting |268| 04 | Git & Versioning | GIT | .gitignore, commits, branches, tags, history |269| 05 | CI/CD & Automation | CICD | Workflows, actions security, deploy pipelines, hooks |270| 06 | Documentation & Onboarding | DOC | README, CLAUDE.md, ADRs, API docs, runbooks |271| 07 | Testing & QA | TEST | Test pyramid, coverage, E2E, mutation testing |272| 08 | Security & Secrets | SEC | Secrets, supply chain, container security, SAST |273| 09 | Deployment & Operations | DEPLOY | Docker, server, monitoring, rollback, health checks |274| 10 | Maintenance & Hygiene | MAINT | Tech debt, cleanup, lifecycle, deprecations |275276Details in the phase files under `phases/`.277278---279280## Phase Execution281282For each phase:2832841. **Load base:** Read `phases/{NN}-{name}.md` — universal check items2852. **Load supplements:** For each detected stack, load the matching file, ONLY the section relevant to the current phase286287 | Phase | Supplement Section |288 |-------|-------------------|289 | 01-structure | §Structure |290 | 02-dependencies | §Dependencies |291 | 03-code-quality | §Code |292 | 04-git | §Git |293 | 05-cicd | §CICD |294 | 06-documentation | §Documentation |295 | 07-testing | §Testing |296 | 08-security | §Security |297 | 09-deployment | §Deployment |298 | 10-maintenance | §Maintenance |2993003. **Project override:** If `project-audit-context.md` exists > include relevant section3014. **Existing findings:** Check previous audit docs, do not create duplicates3025. **Source layer:** Systematically execute all code/config-based checks3036. **Runtime layer:** Execute tool-based checks (when tools are available)304 - Unavailable tools: document, no error3057. **Document findings:** Each finding with ID, severity, description, location3068. **Count completeness:** MUST/SHOULD/COULD checks (executed vs. skipped)307 - Skipped MUST-checks with reason in `checksSkipped[]`308 - Phase with <100% MUST = NOT markable as `done`3099. **Update state:** Phase status + completeness + layer status310311**[CHECKPOINT: verify]** — After each phase: show findings + completeness to user, get confirmation.312313### Supplement Loading Logic314315Per phase, the skill loads only relevant stack supplements.316Each stack file is structured by sections.317318**Example Phase 08-security:**319```320> Always: phases/08-security.md (base)321> If node=true: + stacks/node.md §Security322> If docker=true: + stacks/docker.md §Security323> If python=true: + stacks/python.md §Security324> If project-audit-context.md exists: + relevant section325```326327**Supplement files:**328329| Stack-Key | Supplement Path |330|-----------|----------------|331| `node: true` | `stacks/node.md` |332| `python: true` | `stacks/python.md` |333| `shell: true` | `stacks/shell.md` |334| `docker: true` | `stacks/docker.md` |335| `monorepo: true` | `stacks/monorepo.md` |336| `claude-code: true` | `stacks/claude-code.md` |337| `go: true` | `stacks/go.md` |338| `terraform: true` | `stacks/terraform.md` |339| `github: true` | `stacks/github.md` |340341If a stack is detected but no supplement exists > use base phase only, no error.342343---344345## Finding-IDs346347| Phase | Prefix | Example |348|-------|--------|---------|349| 01-structure | `STRUC` | STRUC-01 |350| 02-dependencies | `DEP` | DEP-01 |351| 03-code-quality | `QUAL` | QUAL-01 |352| 04-git | `GIT` | GIT-01 |353| 05-cicd | `CICD` | CICD-01 |354| 06-documentation | `DOC` | DOC-01 |355| 07-testing | `TEST` | TEST-01 |356| 08-security | `SEC` | SEC-01 |357| 09-deployment | `DEPLOY` | DEPLOY-01 |358| 10-maintenance | `MAINT` | MAINT-01 |359360---361362## Severity Definitions363364| Level | Criteria | Examples |365|-------|----------|----------|366| **CRITICAL** | Security vulnerability, data loss, exposed secrets | Secrets in repo, SQL injection, open ports |367| **HIGH** | Missing tests for critical paths, broken CI/CD, CVEs | No tests, outdated deps with CVE, broken pipelines |368| **MEDIUM** | Missing docs, style inconsistencies, missing .gitignore | No README, inconsistent naming, missing types |369| **LOW** | Cosmetic, nice-to-have, best practice | Outdated but secure deps, missing comments |370371**Prioritization:** CRITICAL > HIGH > MEDIUM > LOW. Security before functional before cosmetic.372373---374375## State Schema v2.1 (.project-audit-state.json)376377> Complete state schema (JSON example) + migrations v1>v2 and v2>v2.1: See **state-schema.md**378379---380381## Phase Order382383### Sequential (Default)384`01 > 02 > 03 > 04 > 05 > 06 > 07 > 08 > 09 > 10`385386### Smart Order (Recommended)387Prioritized by impact:388`08-security > 02-dependencies > 03-code-quality > 05-cicd > 09-deployment > 04-git > 07-testing > 01-structure > 06-documentation > 10-maintenance`389390**Logic:** Security and dependencies are most urgent (CVEs, secrets).391Code quality and CI/CD have high impact. Structure/docs/maintenance are important but less time-critical.392393User chooses at `start`. Store in state as `"phaseOrder": "sequential"` or `"smart"`.394395---396397## Fix Templates398399For common findings there are ready-made fix templates in `fix-templates.md`.400Per finding type: code snippet, config change, verify step.401402---403404## Verification-Depth + Fix Protocol405406> See `_shared/audit-patterns.md` (4-Level Verification, Stub-Detection, 5-Step Fix-Protocol).407Level 4 (Functional) is mandatory when runtime layer is available. READ + VERIFY never skip.408409---410411## Context Protection (CRITICAL)412413> Base rules: See `_shared/audit-patterns.md` (Max 2 phases, state immediately, no auto-fix).414415**Project audit specific:**416- **Layer tracking:** Document source layer and runtime layer status per phase417418---419420## Smart Next Steps421422After completing the project audit, recommend suitable follow-up skills to user:423424| Condition | Recommendation | Justification |425|-----------|---------------|---------------|426| >3 HIGH/CRITICAL findings | `/adversarial-review audit` | Check report for completeness |427| Claude Code project (.claude/ present) | `/security-scan` | MCP permissions, hook safety, secret detection |428| Audit completed | `/lesson-learned session` | Extract learnings from audit process |429| Web project detected AND no .audit-state.json | `/audit start` | Check website quality (SEO, A11y, privacy) |430| Astro project detected AND no .astro-audit-state.json | `/astro-audit start` | Astro-specific checks |431432**Output in report:** Replace `{NEXT_STEPS}` placeholder with concrete recommendation list.433434---435436## Files in This Skill437438```439project-audit/440├── SKILL.md <- This file441├── state-schema.md # State Schema v2.1 + Migrations442├── fix-templates.md # Quick-Fix templates for common findings443├── phases/444│ ├── 01-structure.md # Folder structure, architecture, coupling445│ ├── 02-dependencies.md # Packages, ecosystem, licenses446│ ├── 03-code-quality.md # Patterns, complexity, dead code447│ ├── 04-git.md # .gitignore, commits, branches, tags448│ ├── 05-cicd.md # Workflows, actions security, pipelines449│ ├── 06-documentation.md # README, ADRs, API docs, onboarding450│ ├── 07-testing.md # Test pyramid, coverage, E2E451│ ├── 08-security.md # Secrets, supply chain, SAST452│ ├── 09-deployment.md # Docker, server, monitoring, rollback453│ └── 10-maintenance.md # Tech debt, cleanup, deprecations454├── stacks/455│ ├── node.md # Node.js-specific checks456│ ├── python.md # Python-specific checks457│ ├── shell.md # Shell/Bash-specific checks458│ ├── docker.md # Docker-specific checks459│ ├── monorepo.md # Monorepo-specific checks460│ ├── claude-code.md # Claude Code config/skills/agents/hooks checks461│ ├── go.md # Go-specific checks462│ ├── terraform.md # Terraform/IaC-specific checks463│ └── github.md # GitHub repo/org security checks464└── templates/465 └── report.md # Markdown report template466```