/audit-orchestrator — Universal Orchestrator
Meta-skill that runs a project through Pre-Scan → Analysis → Optimization → Report on any kind of codebase. Self-detects the project type, picks the right analysis track, and writes all state into a resumable session directory.
Two Modes
| Mode |
When |
What runs |
| Universal (default) |
Any project — infra, homelab, CLI, library, monorepo, docs, data/ML, web, generic |
Four-phase workflow, project-profile-driven analysis track (see universal-workflow.md) |
| Web Orchestration (specialization) |
Project detected as web-astro, web-sveltekit, or web-nextjs |
Same four phases, but Phase 2 delegates to /audit + /{framework}-audit + /project-audit + optional /db-audit / /auth-audit per the rules below |
Dry-Run Preview (RepoLens-inspired)
Invoke with dry-run argument to preview the full plan without firing any sub-agents or writing session state:
/audit-orchestrator dry-run
Dry-run output prints:
- Detected project type and confidence (no Read of large files beyond fingerprint check)
- Planned Phase-2 tracks — which audits/agents would run and why
- Estimated cost envelope — tool calls ×
HANGAR_COST_PER_CALL_USD (default 0.02 USD)
- Parallelization plan — which steps are independent, which serialize
- Session directory that would be created — path only, not materialized
No .audit-session/ is written, no agents are spawned. Safe to run on any repo for planning. Exit after printing the plan.
The universal mode is always entered first. If Phase 1 (Pre-Scan) detects a supported web framework, Phase 2 activates the web orchestration path. For any other project type, Phase 2 runs the general + specialty analysis tracks described in universal-workflow.md.
Session Directory
Every run creates .audit-session/<YYYY-MM-DD>-<slug>/ with:
INDEX.md # TOC + navigation
STATUS.md # Live session state — read first on resume
01-prescan/ # detection + project profile
02-analysis/ # findings + opportunities + fix queue
03-optimization/ # applied changes + deferred + deviations
04-report/REPORT.md # canonical deliverable
- Full directory schema + file templates:
session-schema.md.
- Phase-by-phase execution (inputs, actions, outputs, exit criteria):
universal-workflow.md.
- Legacy web-specific state (
.audit-orchestrator-state.json v3): state-schema.md (still written when the web orchestration path is active; coexists with the session directory).
Resume Protocol (Crash / Handoff / New Instance)
A fresh LLM or a different AI (or the same instance after a crash) picks up a session like this:
ls .audit-session/ → find the target session directory.
- Read
INDEX.md — understand the structure.
- Read
STATUS.md — learn the current phase, state, and "next action".
- Claim the session: update STATUS.md
active instance and last updated before the first tool call.
- Continue from the next-action line.
STATUS.md is always current. It is updated at every phase transition and after every ~5 fix commits in Phase 3, and flipped to paused on exit. Because findings/TODOs/changes live in phase folders as plain Markdown, the entire session is portable — another LLM, or the user reading by hand, can pick it up without running any tool.
Problem solved by this skill
An Astro project needs:
/audit for performance, SEO, a11y, privacy compliance, security
/astro-audit for version-specific migration/best practices
/project-audit for Git, CI/CD, testing, maintenance
Without orchestration: user must decide manually, duplicate work on security/infra.
An infra/homelab repo needs different things again (Docker hygiene, Compose V2, Traefik, service inventory vs. running services, backup state, cert expiry) — the orchestrator detects this and runs the infra track instead.
Problem
An Astro project needs:
/audit for performance, SEO, a11y, privacy compliance, security
/astro-audit for version-specific migration/best practices
/project-audit for Git, CI/CD, testing, maintenance
Without orchestration: user must decide manually, duplicate work on security/infra.
Solution: Auto-Detection + Audit Plan
Step 0 — Session Init (always)
Before any detection, create the session directory:
- Slug =
<YYYY-MM-DD>-<short-descriptor> (see session-schema.md).
- Create
.audit-session/<slug>/ with empty phase folders.
- Write initial
INDEX.md (phases all pending) and STATUS.md (state: in_progress, phase: 01-prescan, next action: detect project type).
- From this point on, every phase transition and every ~5 fixes updates STATUS.md. This is what makes the session crash-resilient.
Step 1 — Scan Project
Same detection as /audit + /project-audit, plus universal signals:
- package.json, pyproject.toml, go.mod, Cargo.toml, Dockerfile, docker-compose*.yml, .tf, ansible.cfg, .github/, .claude/, registry.json
- Detect frontend framework (Astro, Next, SvelteKit, Hugo, etc.)
- Detect backend (Fastify, Express, FastAPI, etc.)
- Detect project type using the universal decision table in
universal-workflow.md:
web-astro | web-sveltekit | web-nextjs | node-app | node-lib | python | go | rust |
infra-docker | infra-iac | infra-homelab | meta-automation | monorepo | docs | data-ml | generic
- Detect output mode:
output: "static" vs. output: "server" (from astro.config.*) — web only
- Related projects:
audit-context.md → check relatedProjects (e.g., forms backend)
- Detect beta/unstable version: Version with
-beta, -rc, -alpha suffix → prioritize migration audit
Write the result to 01-prescan/project-profile.md using the profile template (see session-schema.md). The profile drives Phase 2 track selection:
| Detected project type |
Phase 2 tracks |
| web-astro / web-sveltekit / web-nextjs |
general + web-framework (delegates to existing /audit orchestration below) |
| infra-docker |
general + infra (Docker hygiene, Compose V2, rootless, secrets) |
| infra-iac |
general + infra (tf/tofu/ansible state, drift, secrets) |
| infra-homelab |
general + infra + ops (inventory vs. live, certs, backups, disk, retention) |
| python / go / rust / node-app / node-lib |
general + language-specific (lint, types, tests, CVEs, build repro) |
| monorepo |
general + per-package loop (each package under 02-analysis/packages/<name>/) |
| docs |
general + docs (link rot, meta, freshness, structure) |
| data-ml |
general + data-ml (deps, notebooks, reproducibility, dataset provenance) |
| meta-automation |
general + ci (workflow sanity, pinned actions, secret scopes) |
| generic |
general only |
Rule: The general track (git hygiene, CI sanity, secret scan, dependency freshness, license posture, docs freshness) runs for every project. Specialty tracks are additive.
Step 1b — Infrastructure Scan (Pre-Audit)
Before starting project audits, check infrastructure level:
Detect GitHub:
.github/ directory present → github: true
git remote -v → github.com → extract repo owner + name
- Detect organization:
gh api repos/{owner}/{repo} → owner.type == "Organization"
Detect VPS:
audit-context.md → server section present?
registry.json → server assignment for the project?
- Dockerfile/docker-compose present → deployment on server likely
Pre-Audit Recommendation:
| Detected |
Recommendation |
Reason |
| GitHub + VPS |
"Infra first: check GitHub settings + VPS hardening" |
Insecure platform makes code audit pointless |
| GitHub only |
"Check GitHub settings in /project-audit (github.md supplement)" |
Branch protection, secret scanning etc. |
| VPS only |
"VPS deep security in /audit Phase 08" |
Open ports, users, logging etc. |
| Neither |
Standard process |
No infra check needed |
Freshness Check + Opportunities:
| Condition |
Recommendation |
Last /freshness-check > 7 days |
"Recommendation: /freshness-check before audit start" |
| Last check < 7 days |
No hint, proceed to audit plan |
| No check documented |
"Recommendation: /freshness-check full (first run)" |
Prior Context — Freshness Opportunities:
If .freshness-state.json exists, read opportunities[] array:
- Include HIGH opportunities as "Pre-Audit Notes" in the audit plan
- Example: Opportunity
{ severity: "high", target: "audit/phases/02-security.md" } → "Note: Security phase has new best practices since last freshness check"
- Opportunities are NOT automatically fixed — only provided as context for the audits
Rule: With GitHub + VPS, the first session is recommended for infra checks:
- GitHub org settings (once per org, not per repo)
- GitHub repo settings (branch protection, secret scanning)
- VPS quick check (ports, users, SSH, fail2ban)
- Only then: regular audit sessions
Infra findings are documented with prefix INFRA- (VPS) or SEC- / GIT- (GitHub) — in the respective audit state files, not in the orchestrator state.
Step 1c — Security Pre-Scan (Claude Code Projects)
When .claude/ directory is detected in the project:
| Check |
Action |
.claude/settings.json exists |
Recommend /security-scan mcp before audit |
.claude/hooks/ has custom hooks |
Recommend /security-scan hooks before audit |
| Both present |
Recommend /security-scan (full) as Pre-Audit step |
Rationale: Compromised hooks or MCP servers could manipulate audit results.
Verify the Claude Code environment is clean before trusting audit output.
Integration: Security scan findings feed into the audit plan:
- CRITICAL security-scan findings → address before starting audit
- MCP permission issues → note in audit report context
- Hook safety issues → fix before running automated audit modes
Step 2 — Determine Audit Combination
| Project Type |
Recommended Audits |
Reason |
| Astro Website (static) |
/audit + /astro-audit (reduced) |
Web quality + Astro specifics, skip ADPT section |
| Astro Website (SSR) |
/audit + /astro-audit |
Web quality + Astro specifics (all sections) |
| Astro + Backend (e.g., Fastify) |
/audit + /astro-audit + /project-audit |
Everything — backend needs its own checks |
| SvelteKit App (SSR) |
/audit + /sveltekit-audit + /project-audit |
Web quality + SvelteKit specifics + code/CI |
| SvelteKit App (prerendered) |
/audit + /sveltekit-audit (reduced) |
Skip SSR sections when prerender = true |
| SvelteKit + Drizzle/PostgreSQL |
/audit + /sveltekit-audit + /db-audit + /project-audit |
Full stack — DB needs its own checks |
| SvelteKit + Auth |
Above + /auth-audit |
Custom auth always check separately |
| Next.js Website |
/audit + /project-audit (reduced) |
Web quality + code/CI/CD |
| Hugo Website |
/audit |
Web quality only (static, little code) |
| Backend Service (no web) |
/project-audit + /db-audit (if DB) |
No SEO/a11y needed |
| CLI Tool / Library |
/project-audit |
Code/Git/CI/CD only |
| Management Repo |
/project-audit |
Structure/docs/scripts only |
| Monorepo |
/project-audit + per sub-project |
Each package individually |
Always add when detected:
| Condition |
Additional Audit |
Reason |
.claude/ directory present |
/security-scan (pre-audit) |
Verify Claude Code environment before audit |
| Phase 09 content findings expected |
/design-system reference |
Use curated palette/typography/UX databases for content checks |
Step 2b — Static Site Filter (Astro)
When output: "static" is detected, certain checks are irrelevant:
| Section/Check |
Reason for Skip |
| ADPT-01 to ADPT-04 (Adapter) |
Static needs no adapter |
| Session Driver Checks |
No server sessions with static |
| SSR-specific Security Checks |
No server-side code |
allowedDomains Checks |
SSR-only relevant |
Rule: Mark skipped checks in state file as "status": "skipped", "reason": "static-output".
Step 2c — Related Projects (Cross-Repo)
When audit-context.md references related projects (e.g., forms backend):
- Recommend separate audit: Related projects have their own codebase → separate
/audit or /project-audit
- Check interfaces: In the main audit, check integration:
- API communication (CORS, auth, timeouts)
- Shared infrastructure (same server, reverse proxy routing)
- Credential management (shared secrets)
- Cross-references in state:
relatedProjects array with status ("audited", "open", "not in scope")
Step 2d — Checkpoint Gates between Audit Phases
In team mode and complex multi-audit runs: use checkpoint gates to ensure quality between phases.
| Gate |
Timing |
Check |
Action on Failure |
| Pre-Audit Gate |
Before audit start |
Freshness check current? Infra scan done? |
Postpone audit until pre-audit done |
| Migration Gate |
After framework audit |
All CRITICAL MIG findings fixed? Build OK? |
Don't start /audit until build is green |
| Security Gate |
After /audit Phase 02 |
No CRITICAL SEC findings open? |
Warning to team lead, prioritize fixing |
| Compliance Gate |
After /audit Phase 07 |
Privacy/accessibility mandatory checks passed? |
CRITICAL finding → fix immediately |
| Pre-Report Gate |
Before combined report |
All audits completed? State files consistent? |
Report only after completeness |
Checkpoint Logic in Team Mode:
- Teammate reports audit phase as done
- Orchestrator checks gate conditions for next phase
- Gate passed → next audit/phase is released
- Gate not passed → orchestrator informs user + blocks next phase
Rules:
- Gates are recommendations, not hard blocks — user can skip gates
- CRITICAL findings in security/compliance gates are always reported
- Migration gate is HARD — with a broken build, no web audit is worthwhile
- Pre-report gate is HARD — incomplete reports are misleading
Step 3 — Manage Phase Overlap
Some phases exist in both audits but check different aspects.
Do not delegate wholesale — instead clearly separate the focus:
| Phase |
/audit Focus |
/project-audit Focus |
Recommendation |
| Security |
Web security: OWASP, headers, SRI, SSRF, security.txt, CORP/COOP |
Supply chain: SBOM, ASVS, Sigstore, npm provenance, container signing |
Both run — complementary |
| Infra / Deployment |
VPS, Docker, Compose V2, rootless, proxy, monitoring |
Container signing, SBOM in image, OCI annotations |
Both run — complementary |
| Code Quality |
Linting, types (basic) |
Patterns, complexity, dead code, coverage (thorough) |
/project-audit leads, /audit skips |
| Dependencies |
Version check in status analysis (basic) |
Lockfiles, package managers, corepack, provenance (thorough) |
/project-audit leads, /audit status stays (version overview only) |
Rule: Phases with different focus BOTH run. Only with true duplicates (same checks) does the more thorough one lead.
Step 4 — Intelligent Sequencing
The order of audits depends on the detected project:
| Condition |
Recommended Order |
Reason |
| Framework beta/RC version |
Framework audit → /audit → /project-audit |
Migration breaking changes first — a broken build blocks everything |
| Framework stable (major upgrade needed) |
Framework audit → /audit → /project-audit |
Upgrade before quality audit |
| Framework stable (current) |
/audit → framework audit → /project-audit |
Web quality first, then framework best practices |
| SvelteKit + Drizzle + Auth |
/db-audit → /auth-audit → /sveltekit-audit → /audit → /project-audit |
DB foundation → auth security → framework → web quality → code |
| SvelteKit (without DB/Auth) |
/sveltekit-audit → /audit → /project-audit |
Framework checks → web quality → code |
| No framework-specific audit |
/audit → /project-audit |
Standard order |
| Backend only + DB |
/db-audit → /project-audit |
DB foundation → code |
| Backend only |
/project-audit |
Single audit |
Rule: With beta/RC versions ALWAYS run the migration audit first — a build that doesn't compile makes any other audit pointless.
Step 5 — Show Audit Plan to User
Dynamic plan based on detection. Example for different scenarios:
Scenario A: Framework Beta + Static + Docker + GitHub + VPS
Audit Plan for: {{PROJECT_NAME}}
Detected: {{FRAMEWORK}} {{VERSION}} (Beta) + Tailwind v4 + Docker + Reverse Proxy
Output: static (no SSR)
GitHub: {{ORG}}/{{REPO}} (Organization)
Server: {{SERVER_LIST}}
Related Projects: {{RELATED_NAME}} ({{RELATED_STACK}})
Recommendation: Pre-audit infra → Framework migration → Web quality → Code/CI
Pre-Audit: Freshness + Security + Infrastructure (1 session)
/freshness-check ← Pipeline knowledge current? Versions, standards, regulations
/security-scan ← Claude Code environment: MCP permissions, hook safety, secrets
GitHub Org Settings ← 2FA, base permissions, third-party access
GitHub Repo Settings ← Branch protection, secret scanning, CodeQL
VPS Quick Check ← Ports, users, SSH, fail2ban, services
→ Secure foundation before checking code
Audit 1: /{{FRAMEWORK}}-audit (migration checks) ← PRIORITY
{N} sections, of which {M} relevant (ADPT section skip: static)
Ensure breaking changes and build compatibility
→ Must run before web audit — broken build blocks everything
Audit 2: /audit (9 phases — web quality)
01 Status Analysis ← Baseline (version overview)
02 Security ← Web security (OWASP, headers, SRI, SSRF)
03 Performance ← Exclusive (CWV, Lighthouse, caching)
04 SEO ← Exclusive (meta, structured data, sitemap)
05 Accessibility ← Exclusive (WCAG 2.2, accessibility regulations)
07 Privacy ← Exclusive (consent, cookie regulations)
08 Infrastructure ← VPS deep security + Docker + proxy
09 Content & Design ← Content, typography, colors, consistency
(06 Code Quality → delegated to /project-audit)
Audit 3: /project-audit (10 phases — code/CI/CD)
02 Dependencies ← Leads (lockfiles, corepack, provenance)
03 Code Quality ← Leads (patterns, coverage, complexity)
04 Git & Versioning ← Exclusive (+ GitHub supplement)
05 CI/CD & Automation ← Exclusive (OIDC, attestation, SLSA, + GitHub supplement)
07 Testing & QA ← Exclusive (coverage, E2E)
08 Security ← Supply chain (SBOM, ASVS, Sigstore, + GitHub supplement)
09 Deployment ← Container signing, SBOM in image, OCI (+ GitHub environments)
10 Maintenance ← Exclusive (+ GitHub supplement)
(01 Structure → status in /audit)
Related Projects:
{{RELATED_NAME}}: Separate /project-audit recommended, check interfaces in main audit
Estimated Sessions: {calculated}
Shall I start?
Scenario B: Framework Stable + SSR (without VPS access)
...
Recommendation: Security scan → GitHub check → Web quality → Framework best practices
Pre-Audit: /security-scan + GitHub settings (in session 1)
Audit 1: /audit (8 phases) ← FIRST
Audit 2: /{{FRAMEWORK}}-audit (all sections incl. ADPT)
Audit 3: /project-audit (10 phases, with GitHub supplement)
...
Step 5b — Choose Execution Mode
After the audit plan, the orchestrator asks how the audits should be executed.
Offer options:
| Mode |
Prerequisite |
Description |
| Team (parallel) (Recommendation) |
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 set |
Orchestrator spawns teammates, audits run in parallel as team |
| Manual (sequential) |
Always available |
User starts each audit individually in separate sessions |
| Runner (external) |
/audit-runner available |
Autonomous run via audit-runner.sh (separate process) |
Rules:
- Team option ONLY shown when
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 is set as env var
- With available team mode: mark as recommendation (faster, less manual work)
- Without team flag: manual as default, mention runner as alternative
- User can always abort and switch to manual mode
Check Team Availability:
# Check in orchestrator:
echo $CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
# If "1" → offer team option
Step 6 — Calculate Session Estimate
Not hardcoded — dynamically based on phase count:
Session Formula:
framework_sessions = ceil(relevant_sections / 2) + ceil(expected_findings / 5)
audit_sessions = ceil(active_phases / 2) + ceil(expected_findings / 5)
project_sessions = ceil(active_phases / 2) + ceil(expected_findings / 5)
planning_session = 1 (orchestrator plan)
fixing_sessions = ceil(estimated_total_findings / 5)
TOTAL = planning + framework + audit + project + fixing
Benchmarks for expected findings:
- First audit: ~5-8 findings per skill
- After previous audit: ~2-4 new findings
- Beta migration: ~8-15 findings (more breaking changes)
Step 7 — Combined State
→ Full state schema (v3) + JSON example + backward compatibility: See state-schema.md
Session Strategy
The order adapts to the project. Variants:
Variant A: Beta/Migration + GitHub + VPS
| Session |
Recommendation |
| 1 |
/audit-orchestrator → Plan + /freshness-check + /security-scan + Pre-Audit: GitHub + VPS |
| 2 |
/{{FRAMEWORK}}-audit start (2 sections — CRITICAL first) |
| 3 |
/{{FRAMEWORK}}-audit continue (2 sections) |
| 4 |
/{{FRAMEWORK}}-audit continue (remaining sections) |
| 5 |
/audit start (2 phases) |
| 6 |
/audit continue (2 phases) |
| 7 |
/audit continue (remaining phases incl. VPS deep security) |
| 8 |
/project-audit start (2 phases, with GitHub supplement) |
| 9 |
/project-audit continue (2 phases) |
| 10 |
/project-audit continue (remaining phases) |
| 11+ |
Fix findings (highest severity first, cross-audit) |
Variant B: Standard + GitHub (Stable, Current)
| Session |
Recommendation |
| 1 |
/audit-orchestrator → Plan + /security-scan + Pre-Audit: GitHub Settings |
| 2 |
/audit start (2 phases) |
| 3 |
/audit continue (2 phases) |
| 4 |
/audit continue (remaining phases) + /{{FRAMEWORK}}-audit start |
| 5 |
/{{FRAMEWORK}}-audit continue (2 sections) |
| 6 |
/project-audit start (2 phases, with GitHub supplement) |
| 7+ |
Continue as needed |
Variant C: No Framework-Specific Audit (Backend, CLI, Library)
| Session |
Recommendation |
| 1 |
/audit-orchestrator → Plan + /security-scan + Pre-Audit: GitHub + optionally VPS |
| 2 |
/project-audit start (2 phases, with GitHub supplement) |
| 3+ |
Continue as needed |
Variant D: SvelteKit Full-Stack (+ Drizzle + Auth + GitHub + VPS)
| Session |
Recommendation |
| 1 |
/audit-orchestrator → Plan + /freshness-check + /security-scan + Pre-Audit: GitHub + VPS |
| 2 |
/db-audit start (2 sections — schema + security first) |
| 3 |
/db-audit continue (remaining sections) |
| 4 |
/auth-audit start (2 sections — hashing + sessions first) |
| 5 |
/auth-audit continue (remaining sections) |
| 6 |
/sveltekit-audit start (2 sections — ENV + CODE first) |
| 7 |
/sveltekit-audit continue (2 sections) |
| 8 |
/sveltekit-audit continue (remaining sections) |
| 9 |
/audit start (2 phases) |
| 10 |
/audit continue (2 phases) |
| 11 |
/audit continue (remaining phases) |
| 12 |
/project-audit start (2 phases, with GitHub supplement) |
| 13 |
/project-audit continue (remaining phases) |
| 14+ |
Fix findings (highest severity first, cross-audit) |
Automation: /audit-runner
For automated runs, the /audit-runner skill can be used.
It runs all audits unattended in separate sessions — no context limit.
/audit-runner setup → Configuration and audit plan
/audit-runner start → Start autonomous run
/audit-runner status → Check progress
When to use /audit-runner instead of manual:
- First overview of a new project (collect findings, fix later)
- Audit multiple projects sequentially
- Overnight run: audit runs, review results in the morning
Team Mode (Parallel Audit Execution)
→ Full team mode documentation (T1-T8, pre-audit, error handling): See team-modus.md
Cross-Audit Findings
When findings are fixed, check if the fix is also relevant in another audit:
- Web security fix in
/audit (e.g., SRI, CSP) → check if /project-audit security is affected
- Supply chain fix in
/project-audit (e.g., SBOM, Sigstore) → check if /audit infra is affected
- Docker fix (e.g., Compose V2) → mark as fixed in BOTH audits (infra + deployment)
- Container signing in
/project-audit → also relevant in /audit infrastructure
- Framework migration fix (e.g., Node 22) → also relevant in
/audit status analysis + /project-audit dependencies
/security-scan findings (MCP, hooks) → relevant for /audit Phase 02 (security) and /project-audit Phase 08 (security)
/audit Phase 09 content/design findings → feed into /polish scan + /design-system for resolution
Post-Audit Recommendations
After all audits complete, the orchestrator recommends follow-up actions:
| Condition |
Recommendation |
Reason |
| Content/Design findings in Phase 09 |
/polish scan → /design-system |
Use curated design databases for improvements |
/security-scan not run as pre-audit |
/security-scan |
Claude Code environment should be verified |
| Security findings across audits |
/security-scan + /adversarial-review |
Cross-check security posture |
| All audits clean, deployment target exists |
/deploy-check |
Verify deployment readiness |
| Significant learnings from audit |
/lesson-learned session |
Persist audit insights |
Status Display
Audit Orchestrator: {{PROJECT_NAME}}
Mode: {Team|Manual|Runner}
Order: {Reason} → {Audit 1} → {Audit 2} → {Audit 3}
Pre-Audit:
/security-scan: ██████████ Grade: B (1 HIGH, 2 MEDIUM)
/freshness-check: ██████████ done (2 opportunities)
Audits:
/{{FRAMEWORK}}-audit: ████████░░ 5/13 sections (8 findings, 1 skipped)
/audit: ████████░░ 5/8 phases (12 findings)
/project-audit: ████░░░░░░ 4/10 phases (5 findings)
Total: 25 findings (2 CRITICAL, 5 HIGH, 12 MEDIUM, 6 LOW)
Fixed: 3 | Open: 22 | Skipped: 1
Related Projects:
{{RELATED_NAME}}: {Status}
Recommendation: Fix 2 CRITICAL findings first (MIG-03 from framework audit, SEC-01 from /audit)
Session Estimate: {N} remaining (of {M} planned)
Addition for Team Mode (executionMode: "team"):
Team: audit-{{PROJECT_NAME}}
[audit-worker-1] /audit → running (Phase 5/8)
[audit-worker-2] /{{FRAMEWORK}}-audit → done (8 findings)
[audit-worker-3] /project-audit → waiting (blocked by /audit)
Runtime: 12 min
Combined Report
→ Report format, categories, regulatory standards + generation: See combined-report.md
Rules
- Session directory is canonical —
.audit-session/<date>-<slug>/ holds INDEX.md, STATUS.md, and four phase folders. STATUS.md must stay current (update at phase transitions and every ~5 fix commits).
- Any instance can resume — because state is plain Markdown in the session directory, a crashed session can be continued by a new instance, a different model, or a human. The resume protocol is: read INDEX.md → read STATUS.md → claim the session → continue from the "next action" line.
- Four phases always run — Pre-Scan, Analysis, Optimization, Report. Empty phases are documented, not skipped.
- Project type drives the track — Phase 1 writes
project-profile.md; Phase 2 picks tracks from universal-workflow.md. Web projects additionally activate the web-orchestration specialization below.
- Orchestrator plans + coordinates — the actual audits run via their own skills (manually or as teammates)
- Team mode optional — only if
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 is set AND user chooses
- Teammates use /auto — autonomous run, no manual start/continue
- Legacy state coexists — each sub-skill keeps its own state file, and the web-specific
.audit-orchestrator-state.json (v3) is still written when the web orchestration path is active; universal Markdown state is the primary surface for resume.
- Orchestrator state tracks overview + phase mapping + sequencing + team status
- Pre-audit by orchestrator — freshness check + GitHub/VPS checks done by orchestrator itself, not by teammate
- Beta/RC always first — migration audit before quality audit for unstable versions
- Static filter active — automatically skip SSR-specific checks for
output: "static"
- Crash not fatal + self-healing — teammate crash does not end the overall audit, state survives, manual fallback possible. In team mode: detect stalled workers (no state update > 5 min), restart once automatically before falling back to manual. Guard concurrent state file writes to prevent corruption (inspired by GSD v2 parallel worker patterns).
- Combined report via
/audit-orchestrator report or naturally as the Phase 4 output (04-report/REPORT.md).
- Regulatory standards — explicitly check applicable privacy, accessibility, and compliance regulations — separate section in combined report
Anti-Stall Rules (Subagent-Safe Execution)
When this skill runs inside a subagent (spawned via Agent), the parent stream watchdog kills workers that produce no output for ~600s. Long silent scans (deep Grep, multi-file Read loops, recursive walks) can exceed that window even on small repos.
Every audit-orchestrator run — especially inside a subagent — MUST:
- Heartbeat every ≤120s — emit a single-line progress marker (
[progress] phase=01 step=3/12 elapsed=85s) between tool batches. A completed tool call counts as output; a 600s silent Grep does not.
- Chunk Phase 1 fingerprinting — detect project type via at most 5 Glob + 3 Read calls before writing
project-profile.md. Deep scans happen in Phase 2, never Phase 1.
- Cap Phase 2 per-track work units — split each track (security, deps, docs, drift, CI) into independent chunks of ≤10 tool calls. Write incremental findings to
02-analysis/findings/ after each chunk so crash-resume loses at most one chunk.
- Never block on a single tool call >180s — use explicit Bash
timeout 120s <cmd> for scans that could hang (find, grep-r on huge trees, gh api without pagination).
- Prefer parallel tool calls — independent Greps/Reads go in one tool-call batch, not sequential. Each batch emits output to the parent; sequential chains starve the watchdog.
- Fail-soft on stalled subtasks — if a single track runs >5min with no new findings written, mark it
skipped-stall in STATUS.md and continue. Do not re-retry; log for user review.
Subagent-invocation contract: when the orchestrator is spawned as an Agent, the caller must pass a scoped chunk, not "run the whole audit". Example:
GOOD: Agent(prompt="Run audit-orchestrator Phase 1 prescan only for <repo>. Return project-profile.md contents. Cap: 15 tool calls, 4min.")
BAD: Agent(prompt="Run full audit on <repo>.")
The bad pattern is what stalls — 4 phases × N tracks × M files > watchdog window. Callers chaining this skill across phases should spawn one agent per phase and synthesize between.
Reference Files
universal-workflow.md — the four-phase workflow, project-type tracks, severity scale, exit criteria.
session-schema.md — session directory layout, INDEX.md / STATUS.md / findings / TODO / changes templates, ID conventions.
state-schema.md — legacy .audit-orchestrator-state.json v3 schema (web-orchestration path).
1---2name: audit-orchestrator3description: Universal Pre-Scan → Analysis → Optimization → Report orchestrator for ANY project type — web apps (Astro/SvelteKit/Next), infrastructure/homelab repos, CLI tools, libraries, backend services, monorepos, data/ML projects, docs. Self-detects project type and runs the matching analysis track. Session state lives in `.audit-session/<date>-<slug>/` with INDEX.md + STATUS.md so any instance (or a different LLM) can resume after a crash. Delegates to /audit + /project-audit + /astro-audit + /sveltekit-audit + /db-audit + /auth-audit for web projects. Use when: "full audit", "audit everything", "complete audit", "infra audit", "homelab audit", "repo audit", "orchestrate audit", "pre-scan analysis optimization report".4---56<!-- AI-QUICK-REF7## /audit-orchestrator — Quick Reference8- **Universal mode (default)** — works for any project type via self-detection9- **Four phases:** 01-prescan → 02-analysis → 03-optimization → 04-report (each with its own folder)10- **Session directory:** `.audit-session/<YYYY-MM-DD>-<slug>/` with INDEX.md + STATUS.md11- **Resume protocol:** any instance reads STATUS.md → continues where prior stopped12- **Project-type detection:** web (astro/sveltekit/next), infra (docker/iac/homelab), lang (py/go/rust/node), monorepo, docs, data-ml, generic13- **Web specialization:** delegates to /audit, /{framework}-audit, /project-audit, /db-audit, /auth-audit14- **Execution Modes:** Team (parallel) | Manual (sequential) | Runner (autonomous)15- **Legacy state:** .audit-orchestrator-state.json (v3) still written for web-framework path16-->1718# /audit-orchestrator — Universal Orchestrator1920Meta-skill that runs a project through **Pre-Scan → Analysis → Optimization → Report** on any kind of codebase. Self-detects the project type, picks the right analysis track, and writes all state into a resumable session directory.2122## Two Modes2324| Mode | When | What runs |25|------|------|-----------|26| **Universal (default)** | Any project — infra, homelab, CLI, library, monorepo, docs, data/ML, web, generic | Four-phase workflow, project-profile-driven analysis track (see `universal-workflow.md`) |27| **Web Orchestration (specialization)** | Project detected as `web-astro`, `web-sveltekit`, or `web-nextjs` | Same four phases, but Phase 2 delegates to `/audit` + `/{framework}-audit` + `/project-audit` + optional `/db-audit` / `/auth-audit` per the rules below |2829## Dry-Run Preview (RepoLens-inspired)3031Invoke with `dry-run` argument to preview the full plan without firing any sub-agents or writing session state:3233```34/audit-orchestrator dry-run35```3637Dry-run output prints:381. **Detected project type** and confidence (no Read of large files beyond fingerprint check)392. **Planned Phase-2 tracks** — which audits/agents would run and why403. **Estimated cost envelope** — tool calls × `HANGAR_COST_PER_CALL_USD` (default 0.02 USD)414. **Parallelization plan** — which steps are independent, which serialize425. **Session directory that would be created** — path only, not materialized4344No `.audit-session/` is written, no agents are spawned. Safe to run on any repo for planning. Exit after printing the plan.4546The universal mode is always entered first. If Phase 1 (Pre-Scan) detects a supported web framework, Phase 2 activates the web orchestration path. For any other project type, Phase 2 runs the general + specialty analysis tracks described in `universal-workflow.md`.4748## Session Directory4950Every run creates `.audit-session/<YYYY-MM-DD>-<slug>/` with:5152```53INDEX.md # TOC + navigation54STATUS.md # Live session state — read first on resume5501-prescan/ # detection + project profile5602-analysis/ # findings + opportunities + fix queue5703-optimization/ # applied changes + deferred + deviations5804-report/REPORT.md # canonical deliverable59```6061- Full directory schema + file templates: **`session-schema.md`**.62- Phase-by-phase execution (inputs, actions, outputs, exit criteria): **`universal-workflow.md`**.63- Legacy web-specific state (`.audit-orchestrator-state.json` v3): **`state-schema.md`** (still written when the web orchestration path is active; coexists with the session directory).6465## Resume Protocol (Crash / Handoff / New Instance)6667A fresh LLM or a different AI (or the same instance after a crash) picks up a session like this:68691. `ls .audit-session/` → find the target session directory.702. Read `INDEX.md` — understand the structure.713. Read `STATUS.md` — learn the current phase, state, and "next action".724. Claim the session: update STATUS.md `active instance` and `last updated` before the first tool call.735. Continue from the next-action line.7475**STATUS.md is always current.** It is updated at every phase transition and after every ~5 fix commits in Phase 3, and flipped to `paused` on exit. Because findings/TODOs/changes live in phase folders as plain Markdown, the entire session is portable — another LLM, or the user reading by hand, can pick it up without running any tool.7677## Problem solved by this skill7879An Astro project needs:80- `/audit` for performance, SEO, a11y, privacy compliance, security81- `/astro-audit` for version-specific migration/best practices82- `/project-audit` for Git, CI/CD, testing, maintenance8384Without orchestration: user must decide manually, duplicate work on security/infra.8586An infra/homelab repo needs different things again (Docker hygiene, Compose V2, Traefik, service inventory vs. running services, backup state, cert expiry) — the orchestrator detects this and runs the infra track instead.8788## Problem8990An Astro project needs:91- `/audit` for performance, SEO, a11y, privacy compliance, security92- `/astro-audit` for version-specific migration/best practices93- `/project-audit` for Git, CI/CD, testing, maintenance9495Without orchestration: user must decide manually, duplicate work on security/infra.9697## Solution: Auto-Detection + Audit Plan9899### Step 0 — Session Init (always)100101Before any detection, create the session directory:1021031. Slug = `<YYYY-MM-DD>-<short-descriptor>` (see `session-schema.md`).1042. Create `.audit-session/<slug>/` with empty phase folders.1053. Write initial `INDEX.md` (phases all `pending`) and `STATUS.md` (`state: in_progress`, `phase: 01-prescan`, `next action: detect project type`).1064. From this point on, **every phase transition and every ~5 fixes updates STATUS.md**. This is what makes the session crash-resilient.107108### Step 1 — Scan Project109110Same detection as `/audit` + `/project-audit`, plus universal signals:111- package.json, pyproject.toml, go.mod, Cargo.toml, Dockerfile, docker-compose*.yml, .tf, ansible.cfg, .github/, .claude/, registry.json112- Detect frontend framework (Astro, Next, SvelteKit, Hugo, etc.)113- Detect backend (Fastify, Express, FastAPI, etc.)114- Detect **project type** using the universal decision table in `universal-workflow.md`:115 web-astro | web-sveltekit | web-nextjs | node-app | node-lib | python | go | rust |116 infra-docker | infra-iac | infra-homelab | meta-automation | monorepo | docs | data-ml | generic117- **Detect output mode:** `output: "static"` vs. `output: "server"` (from astro.config.*) — web only118- **Related projects:** `audit-context.md` → check `relatedProjects` (e.g., forms backend)119- **Detect beta/unstable version:** Version with `-beta`, `-rc`, `-alpha` suffix → prioritize migration audit120121Write the result to `01-prescan/project-profile.md` using the profile template (see `session-schema.md`). The profile drives Phase 2 track selection:122123| Detected project type | Phase 2 tracks |124|-----------------------|----------------|125| web-astro / web-sveltekit / web-nextjs | general + web-framework (delegates to existing /audit orchestration below) |126| infra-docker | general + infra (Docker hygiene, Compose V2, rootless, secrets) |127| infra-iac | general + infra (tf/tofu/ansible state, drift, secrets) |128| infra-homelab | general + infra + ops (inventory vs. live, certs, backups, disk, retention) |129| python / go / rust / node-app / node-lib | general + language-specific (lint, types, tests, CVEs, build repro) |130| monorepo | general + per-package loop (each package under `02-analysis/packages/<name>/`) |131| docs | general + docs (link rot, meta, freshness, structure) |132| data-ml | general + data-ml (deps, notebooks, reproducibility, dataset provenance) |133| meta-automation | general + ci (workflow sanity, pinned actions, secret scopes) |134| generic | general only |135136**Rule:** The general track (git hygiene, CI sanity, secret scan, dependency freshness, license posture, docs freshness) runs for every project. Specialty tracks are additive.137138### Step 1b — Infrastructure Scan (Pre-Audit)139140Before starting project audits, check infrastructure level:141142**Detect GitHub:**143- `.github/` directory present → `github: true`144- `git remote -v` → github.com → extract repo owner + name145- Detect organization: `gh api repos/{owner}/{repo}` → `owner.type == "Organization"`146147**Detect VPS:**148- `audit-context.md` → server section present?149- `registry.json` → server assignment for the project?150- Dockerfile/docker-compose present → deployment on server likely151152**Pre-Audit Recommendation:**153154| Detected | Recommendation | Reason |155|----------|---------------|--------|156| GitHub + VPS | "Infra first: check GitHub settings + VPS hardening" | Insecure platform makes code audit pointless |157| GitHub only | "Check GitHub settings in /project-audit (github.md supplement)" | Branch protection, secret scanning etc. |158| VPS only | "VPS deep security in /audit Phase 08" | Open ports, users, logging etc. |159| Neither | Standard process | No infra check needed |160161**Freshness Check + Opportunities:**162163| Condition | Recommendation |164|-----------|---------------|165| Last `/freshness-check` > 7 days | "Recommendation: `/freshness-check` before audit start" |166| Last check < 7 days | No hint, proceed to audit plan |167| No check documented | "Recommendation: `/freshness-check full` (first run)" |168169**Prior Context — Freshness Opportunities:**170If `.freshness-state.json` exists, read `opportunities[]` array:171- Include HIGH opportunities as "Pre-Audit Notes" in the audit plan172- **Example:** Opportunity `{ severity: "high", target: "audit/phases/02-security.md" }` → "Note: Security phase has new best practices since last freshness check"173- Opportunities are NOT automatically fixed — only provided as context for the audits174175**Rule:** With GitHub + VPS, the **first session** is recommended for infra checks:1761. GitHub org settings (once per org, not per repo)1772. GitHub repo settings (branch protection, secret scanning)1783. VPS quick check (ports, users, SSH, fail2ban)1794. Only then: regular audit sessions180181Infra findings are documented with prefix `INFRA-` (VPS) or `SEC-` / `GIT-` (GitHub) — in the respective audit state files, not in the orchestrator state.182183### Step 1c — Security Pre-Scan (Claude Code Projects)184185When `.claude/` directory is detected in the project:186187| Check | Action |188|-------|--------|189| `.claude/settings.json` exists | Recommend `/security-scan mcp` before audit |190| `.claude/hooks/` has custom hooks | Recommend `/security-scan hooks` before audit |191| Both present | Recommend `/security-scan` (full) as Pre-Audit step |192193**Rationale:** Compromised hooks or MCP servers could manipulate audit results.194Verify the Claude Code environment is clean before trusting audit output.195196**Integration:** Security scan findings feed into the audit plan:197- CRITICAL security-scan findings → address before starting audit198- MCP permission issues → note in audit report context199- Hook safety issues → fix before running automated audit modes200201### Step 2 — Determine Audit Combination202203| Project Type | Recommended Audits | Reason |204|-------------|-------------------|--------|205| Astro Website (static) | `/audit` + `/astro-audit` (reduced) | Web quality + Astro specifics, skip ADPT section |206| Astro Website (SSR) | `/audit` + `/astro-audit` | Web quality + Astro specifics (all sections) |207| Astro + Backend (e.g., Fastify) | `/audit` + `/astro-audit` + `/project-audit` | Everything — backend needs its own checks |208| SvelteKit App (SSR) | `/audit` + `/sveltekit-audit` + `/project-audit` | Web quality + SvelteKit specifics + code/CI |209| SvelteKit App (prerendered) | `/audit` + `/sveltekit-audit` (reduced) | Skip SSR sections when `prerender = true` |210| SvelteKit + Drizzle/PostgreSQL | `/audit` + `/sveltekit-audit` + `/db-audit` + `/project-audit` | Full stack — DB needs its own checks |211| SvelteKit + Auth | Above + `/auth-audit` | Custom auth always check separately |212| Next.js Website | `/audit` + `/project-audit` (reduced) | Web quality + code/CI/CD |213| Hugo Website | `/audit` | Web quality only (static, little code) |214| Backend Service (no web) | `/project-audit` + `/db-audit` (if DB) | No SEO/a11y needed |215| CLI Tool / Library | `/project-audit` | Code/Git/CI/CD only |216| Management Repo | `/project-audit` | Structure/docs/scripts only |217| Monorepo | `/project-audit` + per sub-project | Each package individually |218219**Always add when detected:**220221| Condition | Additional Audit | Reason |222|-----------|-----------------|--------|223| `.claude/` directory present | `/security-scan` (pre-audit) | Verify Claude Code environment before audit |224| Phase 09 content findings expected | `/design-system` reference | Use curated palette/typography/UX databases for content checks |225226### Step 2b — Static Site Filter (Astro)227228When `output: "static"` is detected, certain checks are irrelevant:229230| Section/Check | Reason for Skip |231|--------------|-----------------|232| ADPT-01 to ADPT-04 (Adapter) | Static needs no adapter |233| Session Driver Checks | No server sessions with static |234| SSR-specific Security Checks | No server-side code |235| `allowedDomains` Checks | SSR-only relevant |236237**Rule:** Mark skipped checks in state file as `"status": "skipped", "reason": "static-output"`.238239### Step 2c — Related Projects (Cross-Repo)240241When `audit-context.md` references related projects (e.g., forms backend):2422431. **Recommend separate audit:** Related projects have their own codebase → separate `/audit` or `/project-audit`2442. **Check interfaces:** In the main audit, check integration:245 - API communication (CORS, auth, timeouts)246 - Shared infrastructure (same server, reverse proxy routing)247 - Credential management (shared secrets)2483. **Cross-references in state:** `relatedProjects` array with status ("audited", "open", "not in scope")249250### Step 2d — Checkpoint Gates between Audit Phases251252In team mode and complex multi-audit runs: use checkpoint gates to ensure quality between phases.253254| Gate | Timing | Check | Action on Failure |255|------|--------|-------|--------------------|256| **Pre-Audit Gate** | Before audit start | Freshness check current? Infra scan done? | Postpone audit until pre-audit done |257| **Migration Gate** | After framework audit | All CRITICAL MIG findings fixed? Build OK? | Don't start /audit until build is green |258| **Security Gate** | After /audit Phase 02 | No CRITICAL SEC findings open? | Warning to team lead, prioritize fixing |259| **Compliance Gate** | After /audit Phase 07 | Privacy/accessibility mandatory checks passed? | CRITICAL finding → fix immediately |260| **Pre-Report Gate** | Before combined report | All audits completed? State files consistent? | Report only after completeness |261262**Checkpoint Logic in Team Mode:**2631. Teammate reports audit phase as done2642. Orchestrator checks gate conditions for next phase2653. Gate passed → next audit/phase is released2664. Gate not passed → orchestrator informs user + blocks next phase267268**Rules:**269- Gates are recommendations, not hard blocks — user can skip gates270- CRITICAL findings in security/compliance gates are always reported271- Migration gate is HARD — with a broken build, no web audit is worthwhile272- Pre-report gate is HARD — incomplete reports are misleading273274### Step 3 — Manage Phase Overlap275276Some phases exist in both audits but check **different aspects**.277Do not delegate wholesale — instead clearly separate the focus:278279| Phase | `/audit` Focus | `/project-audit` Focus | Recommendation |280|-------|---------------|------------------------|---------------|281| Security | Web security: OWASP, headers, SRI, SSRF, security.txt, CORP/COOP | Supply chain: SBOM, ASVS, Sigstore, npm provenance, container signing | **Both run** — complementary |282| Infra / Deployment | VPS, Docker, Compose V2, rootless, proxy, monitoring | Container signing, SBOM in image, OCI annotations | **Both run** — complementary |283| Code Quality | Linting, types (basic) | Patterns, complexity, dead code, coverage (thorough) | `/project-audit` leads, `/audit` skips |284| Dependencies | Version check in status analysis (basic) | Lockfiles, package managers, corepack, provenance (thorough) | `/project-audit` leads, `/audit` status stays (version overview only) |285286**Rule:** Phases with different focus BOTH run. Only with true duplicates (same checks) does the more thorough one lead.287288### Step 4 — Intelligent Sequencing289290The order of audits depends on the detected project:291292| Condition | Recommended Order | Reason |293|-----------|-------------------|--------|294| Framework beta/RC version | Framework audit → `/audit` → `/project-audit` | Migration breaking changes first — a broken build blocks everything |295| Framework stable (major upgrade needed) | Framework audit → `/audit` → `/project-audit` | Upgrade before quality audit |296| Framework stable (current) | `/audit` → framework audit → `/project-audit` | Web quality first, then framework best practices |297| SvelteKit + Drizzle + Auth | `/db-audit` → `/auth-audit` → `/sveltekit-audit` → `/audit` → `/project-audit` | DB foundation → auth security → framework → web quality → code |298| SvelteKit (without DB/Auth) | `/sveltekit-audit` → `/audit` → `/project-audit` | Framework checks → web quality → code |299| No framework-specific audit | `/audit` → `/project-audit` | Standard order |300| Backend only + DB | `/db-audit` → `/project-audit` | DB foundation → code |301| Backend only | `/project-audit` | Single audit |302303**Rule:** With beta/RC versions ALWAYS run the migration audit first — a build that doesn't compile makes any other audit pointless.304305### Step 5 — Show Audit Plan to User306307Dynamic plan based on detection. Example for different scenarios:308309**Scenario A: Framework Beta + Static + Docker + GitHub + VPS**310```311Audit Plan for: {{PROJECT_NAME}}312313Detected: {{FRAMEWORK}} {{VERSION}} (Beta) + Tailwind v4 + Docker + Reverse Proxy314Output: static (no SSR)315GitHub: {{ORG}}/{{REPO}} (Organization)316Server: {{SERVER_LIST}}317Related Projects: {{RELATED_NAME}} ({{RELATED_STACK}})318Recommendation: Pre-audit infra → Framework migration → Web quality → Code/CI319320Pre-Audit: Freshness + Security + Infrastructure (1 session)321 /freshness-check ← Pipeline knowledge current? Versions, standards, regulations322 /security-scan ← Claude Code environment: MCP permissions, hook safety, secrets323 GitHub Org Settings ← 2FA, base permissions, third-party access324 GitHub Repo Settings ← Branch protection, secret scanning, CodeQL325 VPS Quick Check ← Ports, users, SSH, fail2ban, services326 → Secure foundation before checking code327328Audit 1: /{{FRAMEWORK}}-audit (migration checks) ← PRIORITY329 {N} sections, of which {M} relevant (ADPT section skip: static)330 Ensure breaking changes and build compatibility331 → Must run before web audit — broken build blocks everything332333Audit 2: /audit (9 phases — web quality)334 01 Status Analysis ← Baseline (version overview)335 02 Security ← Web security (OWASP, headers, SRI, SSRF)336 03 Performance ← Exclusive (CWV, Lighthouse, caching)337 04 SEO ← Exclusive (meta, structured data, sitemap)338 05 Accessibility ← Exclusive (WCAG 2.2, accessibility regulations)339 07 Privacy ← Exclusive (consent, cookie regulations)340 08 Infrastructure ← VPS deep security + Docker + proxy341 09 Content & Design ← Content, typography, colors, consistency342 (06 Code Quality → delegated to /project-audit)343344Audit 3: /project-audit (10 phases — code/CI/CD)345 02 Dependencies ← Leads (lockfiles, corepack, provenance)346 03 Code Quality ← Leads (patterns, coverage, complexity)347 04 Git & Versioning ← Exclusive (+ GitHub supplement)348 05 CI/CD & Automation ← Exclusive (OIDC, attestation, SLSA, + GitHub supplement)349 07 Testing & QA ← Exclusive (coverage, E2E)350 08 Security ← Supply chain (SBOM, ASVS, Sigstore, + GitHub supplement)351 09 Deployment ← Container signing, SBOM in image, OCI (+ GitHub environments)352 10 Maintenance ← Exclusive (+ GitHub supplement)353 (01 Structure → status in /audit)354355Related Projects:356 {{RELATED_NAME}}: Separate /project-audit recommended, check interfaces in main audit357358Estimated Sessions: {calculated}359Shall I start?360```361362**Scenario B: Framework Stable + SSR (without VPS access)**363```364...365Recommendation: Security scan → GitHub check → Web quality → Framework best practices366367Pre-Audit: /security-scan + GitHub settings (in session 1)368Audit 1: /audit (8 phases) ← FIRST369Audit 2: /{{FRAMEWORK}}-audit (all sections incl. ADPT)370Audit 3: /project-audit (10 phases, with GitHub supplement)371...372```373374### Step 5b — Choose Execution Mode375376After the audit plan, the orchestrator asks how the audits should be executed.377378**Offer options:**379380| Mode | Prerequisite | Description |381|------|-------------|-------------|382| **Team (parallel)** (Recommendation) | `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` set | Orchestrator spawns teammates, audits run in parallel as team |383| **Manual (sequential)** | Always available | User starts each audit individually in separate sessions |384| **Runner (external)** | `/audit-runner` available | Autonomous run via audit-runner.sh (separate process) |385386**Rules:**387- Team option ONLY shown when `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set as env var388- With available team mode: mark as recommendation (faster, less manual work)389- Without team flag: manual as default, mention runner as alternative390- User can always abort and switch to manual mode391392**Check Team Availability:**393```bash394# Check in orchestrator:395echo $CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS396# If "1" → offer team option397```398399### Step 6 — Calculate Session Estimate400401Not hardcoded — dynamically based on phase count:402403```404Session Formula:405 framework_sessions = ceil(relevant_sections / 2) + ceil(expected_findings / 5)406 audit_sessions = ceil(active_phases / 2) + ceil(expected_findings / 5)407 project_sessions = ceil(active_phases / 2) + ceil(expected_findings / 5)408409 planning_session = 1 (orchestrator plan)410 fixing_sessions = ceil(estimated_total_findings / 5)411412 TOTAL = planning + framework + audit + project + fixing413```414415**Benchmarks for expected findings:**416- First audit: ~5-8 findings per skill417- After previous audit: ~2-4 new findings418- Beta migration: ~8-15 findings (more breaking changes)419420### Step 7 — Combined State421422→ Full state schema (v3) + JSON example + backward compatibility: See **state-schema.md**423424---425426## Session Strategy427428The order adapts to the project. Variants:429430### Variant A: Beta/Migration + GitHub + VPS431432| Session | Recommendation |433|---------|---------------|434| 1 | `/audit-orchestrator` → Plan + **`/freshness-check` + `/security-scan` + Pre-Audit: GitHub + VPS** |435| 2 | `/{{FRAMEWORK}}-audit start` (2 sections — CRITICAL first) |436| 3 | `/{{FRAMEWORK}}-audit continue` (2 sections) |437| 4 | `/{{FRAMEWORK}}-audit continue` (remaining sections) |438| 5 | `/audit start` (2 phases) |439| 6 | `/audit continue` (2 phases) |440| 7 | `/audit continue` (remaining phases incl. VPS deep security) |441| 8 | `/project-audit start` (2 phases, with GitHub supplement) |442| 9 | `/project-audit continue` (2 phases) |443| 10 | `/project-audit continue` (remaining phases) |444| 11+ | Fix findings (highest severity first, cross-audit) |445446### Variant B: Standard + GitHub (Stable, Current)447448| Session | Recommendation |449|---------|---------------|450| 1 | `/audit-orchestrator` → Plan + **`/security-scan` + Pre-Audit: GitHub Settings** |451| 2 | `/audit start` (2 phases) |452| 3 | `/audit continue` (2 phases) |453| 4 | `/audit continue` (remaining phases) + `/{{FRAMEWORK}}-audit start` |454| 5 | `/{{FRAMEWORK}}-audit continue` (2 sections) |455| 6 | `/project-audit start` (2 phases, with GitHub supplement) |456| 7+ | Continue as needed |457458### Variant C: No Framework-Specific Audit (Backend, CLI, Library)459460| Session | Recommendation |461|---------|---------------|462| 1 | `/audit-orchestrator` → Plan + **`/security-scan` + Pre-Audit: GitHub + optionally VPS** |463| 2 | `/project-audit start` (2 phases, with GitHub supplement) |464| 3+ | Continue as needed |465466### Variant D: SvelteKit Full-Stack (+ Drizzle + Auth + GitHub + VPS)467468| Session | Recommendation |469|---------|---------------|470| 1 | `/audit-orchestrator` → Plan + **`/freshness-check` + `/security-scan` + Pre-Audit: GitHub + VPS** |471| 2 | `/db-audit start` (2 sections — schema + security first) |472| 3 | `/db-audit continue` (remaining sections) |473| 4 | `/auth-audit start` (2 sections — hashing + sessions first) |474| 5 | `/auth-audit continue` (remaining sections) |475| 6 | `/sveltekit-audit start` (2 sections — ENV + CODE first) |476| 7 | `/sveltekit-audit continue` (2 sections) |477| 8 | `/sveltekit-audit continue` (remaining sections) |478| 9 | `/audit start` (2 phases) |479| 10 | `/audit continue` (2 phases) |480| 11 | `/audit continue` (remaining phases) |481| 12 | `/project-audit start` (2 phases, with GitHub supplement) |482| 13 | `/project-audit continue` (remaining phases) |483| 14+ | Fix findings (highest severity first, cross-audit) |484485### Automation: /audit-runner486487For automated runs, the `/audit-runner` skill can be used.488It runs all audits unattended in separate sessions — no context limit.489490```491/audit-runner setup → Configuration and audit plan492/audit-runner start → Start autonomous run493/audit-runner status → Check progress494```495496**When to use /audit-runner instead of manual:**497- First overview of a new project (collect findings, fix later)498- Audit multiple projects sequentially499- Overnight run: audit runs, review results in the morning500501---502503## Team Mode (Parallel Audit Execution)504505→ Full team mode documentation (T1-T8, pre-audit, error handling): See **team-modus.md**506507---508509## Cross-Audit Findings510511When findings are fixed, check if the fix is also relevant in another audit:512- Web security fix in `/audit` (e.g., SRI, CSP) → check if `/project-audit` security is affected513- Supply chain fix in `/project-audit` (e.g., SBOM, Sigstore) → check if `/audit` infra is affected514- Docker fix (e.g., Compose V2) → mark as fixed in BOTH audits (infra + deployment)515- Container signing in `/project-audit` → also relevant in `/audit` infrastructure516- Framework migration fix (e.g., Node 22) → also relevant in `/audit` status analysis + `/project-audit` dependencies517- `/security-scan` findings (MCP, hooks) → relevant for `/audit` Phase 02 (security) and `/project-audit` Phase 08 (security)518- `/audit` Phase 09 content/design findings → feed into `/polish scan` + `/design-system` for resolution519520---521522## Post-Audit Recommendations523524After all audits complete, the orchestrator recommends follow-up actions:525526| Condition | Recommendation | Reason |527|-----------|---------------|--------|528| Content/Design findings in Phase 09 | `/polish scan` → `/design-system` | Use curated design databases for improvements |529| `/security-scan` not run as pre-audit | `/security-scan` | Claude Code environment should be verified |530| Security findings across audits | `/security-scan` + `/adversarial-review` | Cross-check security posture |531| All audits clean, deployment target exists | `/deploy-check` | Verify deployment readiness |532| Significant learnings from audit | `/lesson-learned session` | Persist audit insights |533534---535536## Status Display537538```539Audit Orchestrator: {{PROJECT_NAME}}540Mode: {Team|Manual|Runner}541Order: {Reason} → {Audit 1} → {Audit 2} → {Audit 3}542543Pre-Audit:544/security-scan: ██████████ Grade: B (1 HIGH, 2 MEDIUM)545/freshness-check: ██████████ done (2 opportunities)546547Audits:548/{{FRAMEWORK}}-audit: ████████░░ 5/13 sections (8 findings, 1 skipped)549/audit: ████████░░ 5/8 phases (12 findings)550/project-audit: ████░░░░░░ 4/10 phases (5 findings)551552Total: 25 findings (2 CRITICAL, 5 HIGH, 12 MEDIUM, 6 LOW)553Fixed: 3 | Open: 22 | Skipped: 1554555Related Projects:556 {{RELATED_NAME}}: {Status}557558Recommendation: Fix 2 CRITICAL findings first (MIG-03 from framework audit, SEC-01 from /audit)559Session Estimate: {N} remaining (of {M} planned)560```561562**Addition for Team Mode** (`executionMode: "team"`):563```564Team: audit-{{PROJECT_NAME}}565 [audit-worker-1] /audit → running (Phase 5/8)566 [audit-worker-2] /{{FRAMEWORK}}-audit → done (8 findings)567 [audit-worker-3] /project-audit → waiting (blocked by /audit)568Runtime: 12 min569```570571---572573## Combined Report574575→ Report format, categories, regulatory standards + generation: See **combined-report.md**576577---578579## Rules580581- **Session directory is canonical** — `.audit-session/<date>-<slug>/` holds INDEX.md, STATUS.md, and four phase folders. STATUS.md must stay current (update at phase transitions and every ~5 fix commits).582- **Any instance can resume** — because state is plain Markdown in the session directory, a crashed session can be continued by a new instance, a different model, or a human. The resume protocol is: read INDEX.md → read STATUS.md → claim the session → continue from the "next action" line.583- **Four phases always run** — Pre-Scan, Analysis, Optimization, Report. Empty phases are documented, not skipped.584- **Project type drives the track** — Phase 1 writes `project-profile.md`; Phase 2 picks tracks from `universal-workflow.md`. Web projects additionally activate the web-orchestration specialization below.585- **Orchestrator plans + coordinates** — the actual audits run via their own skills (manually or as teammates)586- **Team mode optional** — only if `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set AND user chooses587- **Teammates use /auto** — autonomous run, no manual start/continue588- **Legacy state coexists** — each sub-skill keeps its own state file, and the web-specific `.audit-orchestrator-state.json` (v3) is still written when the web orchestration path is active; universal Markdown state is the primary surface for resume.589- **Orchestrator state** tracks overview + phase mapping + sequencing + team status590- **Pre-audit by orchestrator** — freshness check + GitHub/VPS checks done by orchestrator itself, not by teammate591- **Beta/RC always first** — migration audit before quality audit for unstable versions592- **Static filter active** — automatically skip SSR-specific checks for `output: "static"`593- **Crash not fatal + self-healing** — teammate crash does not end the overall audit, state survives, manual fallback possible. In team mode: detect stalled workers (no state update > 5 min), restart once automatically before falling back to manual. Guard concurrent state file writes to prevent corruption (inspired by GSD v2 parallel worker patterns).594- **Combined report** via `/audit-orchestrator report` or naturally as the Phase 4 output (`04-report/REPORT.md`).595- **Regulatory standards** — explicitly check applicable privacy, accessibility, and compliance regulations — separate section in combined report596597## Anti-Stall Rules (Subagent-Safe Execution)598599When this skill runs inside a subagent (spawned via `Agent`), the parent stream watchdog kills workers that produce no output for ~600s. Long silent scans (deep Grep, multi-file Read loops, recursive walks) can exceed that window even on small repos.600601**Every audit-orchestrator run — especially inside a subagent — MUST:**6026031. **Heartbeat every ≤120s** — emit a single-line progress marker (`[progress] phase=01 step=3/12 elapsed=85s`) between tool batches. A completed tool call counts as output; a 600s silent Grep does not.6042. **Chunk Phase 1 fingerprinting** — detect project type via **at most 5 Glob + 3 Read** calls before writing `project-profile.md`. Deep scans happen in Phase 2, never Phase 1.6053. **Cap Phase 2 per-track work units** — split each track (security, deps, docs, drift, CI) into independent chunks of ≤10 tool calls. Write incremental findings to `02-analysis/findings/` after each chunk so crash-resume loses at most one chunk.6064. **Never block on a single tool call >180s** — use explicit Bash `timeout 120s <cmd>` for scans that could hang (find, grep-r on huge trees, `gh api` without pagination).6075. **Prefer parallel tool calls** — independent Greps/Reads go in one tool-call batch, not sequential. Each batch emits output to the parent; sequential chains starve the watchdog.6086. **Fail-soft on stalled subtasks** — if a single track runs >5min with no new findings written, mark it `skipped-stall` in STATUS.md and continue. Do not re-retry; log for user review.609610**Subagent-invocation contract:** when the orchestrator is spawned as an `Agent`, the *caller* must pass a **scoped chunk**, not "run the whole audit". Example:611612```613GOOD: Agent(prompt="Run audit-orchestrator Phase 1 prescan only for <repo>. Return project-profile.md contents. Cap: 15 tool calls, 4min.")614BAD: Agent(prompt="Run full audit on <repo>.")615```616617The bad pattern is what stalls — 4 phases × N tracks × M files > watchdog window. Callers chaining this skill across phases should spawn **one agent per phase** and synthesize between.618619## Reference Files620621- `universal-workflow.md` — the four-phase workflow, project-type tracks, severity scale, exit criteria.622- `session-schema.md` — session directory layout, INDEX.md / STATUS.md / findings / TODO / changes templates, ID conventions.623- `state-schema.md` — legacy `.audit-orchestrator-state.json` v3 schema (web-orchestration path).