协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
ai-audit【开发与工程】Run a full AI Playbook audit against an existing agentic application or AI feature. Orchestrates Decision Record reverse-engineering, security review, eval audit, launch check, and consolidated remediation planning in one flow. Use when the user explicitly runs /ai-audit or says "audit my AI app", "verify my agent against the playbook", "is my existi…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Iron Law: Do not auto-fix. This skill produces reports and a remediation plan — not code changes. Every finding becomes a separate task for a follow-up session.
Run a comprehensive audit of an existing agentic application or AI feature against the AI Playbook. This is for verifying existing code, not designing new features.
The audit runs in five phases with explicit confirmation gates between each. Each phase produces a written artifact in the repo. The final output is a prioritized remediation plan.
/ai-audit when you want a full pass against existing code and you're willing to let it run end-to-end./ai-decision-record, /ai-launch-check, /ai-incident-response) and subagents (@ai-security-reviewer, @ai-eval-designer) when you want finer control between phases or you're only doing part of the work.Walk through the five phases below in order. Do not skip phases. Each phase has an explicit confirmation gate where the user can pause, redirect, or abort.
Before starting, load the ai-playbook skill if it isn't already in context.
Before any audit work, get clarity on what's being audited. Ask the user:
docs/ai-decisions/<feature-slug>.md. If yes, this skips Phase 1 and uses it as input.)After confirming scope, summarize the plan:
Audit plan for: <feature-slug>
- AI code location: <paths>
- Phases to run:
1. Decision Record reverse-engineering (or skip if exists)
2. Security review via @ai-security-reviewer subagent
3. Eval audit via @ai-eval-designer subagent
4. Launch check (gate)
5. Consolidated remediation plan
- Estimated wall time: 60–120 minutes depending on codebase size
- Estimated token cost: significant (two subagents + main session). Confirm before proceeding.
Proceed? (yes / scope-down / abort)
Do not proceed without explicit confirmation. This audit consumes meaningful tokens and produces artifacts in the repo.
Skip this phase if a Decision Record already exists at docs/ai-decisions/<feature-slug>.md. In that case, read it, summarize what it claims, and ask the user to confirm it still reflects reality before moving to Phase 2.
If no Decision Record exists, reverse-engineer one:
Scan the AI code. Identify every AI surface: LLM calls, agent loops, tool definitions, prompts (system / user / templates), RAG/retrieval, model output handlers, side-effect points (writes, sends, payments).
Determine the pattern (assistant / workflow / agent / autonomous) based on what the code does, not what it's named. Multi-step planning with tools is an agent. A single LLM call wrapped in retries is a workflow.
Propose a risk tier based on actual blast radius. Sum across a session, not per action. Be honest. If the code can send emails to customers, that's at least Tier 3a regardless of how it's framed.
Ask clarifying questions for what the code can't tell you. Ask one at a time:
Write the Decision Record to docs/ai-decisions/<feature-slug>.md using the template from the ai-decision-record skill / Layer 3 §3.3 of the playbook.
Confirmation gate: Summarize the Decision Record. Highlight any fields where you had to guess. Ask the user to verify before proceeding.
Decision Record drafted at docs/ai-decisions/<feature-slug>.md.
Honest summary:
- Pattern: <X>
- Risk tier: <N>
- Top three risks I identified: ...
- Fields I had to guess (please verify): ...
Proceed to Phase 2 (security review)? (yes / edit-record / abort)
Confirmation before invoking the subagent. Subagents consume real tokens. Confirm scope:
About to invoke @ai-security-reviewer on:
- <paths>
The subagent will run in its own context. Expected output: structured findings report (Critical / High / Medium).
Proceed? (yes / narrow-scope / abort)
After confirmation, invoke:
@ai-security-reviewer audit the AI code at <paths> against the ai-playbook security defenses (Layer 2 §2.5) and the adversarial test catalog (Layer 3 §3.2).
Focus on:
- LLM call sites
- Tool definitions and agent loops
- RAG/retrieval code
- Anywhere user input, retrieved documents, or tool outputs flow into prompts
- Anywhere model output triggers side effects
Output the standard findings report. For each finding, cite file:line and explain why a prompt-level mitigation is insufficient.
Decision Record context: docs/ai-decisions/<feature-slug>.md
Write the subagent's report to docs/ai-audits/<feature-slug>/02-security-review.md.
Confirmation gate:
Security review complete. Summary:
- Critical findings: <N>
- High findings: <N>
- Medium findings: <N>
Top three blockers: ...
Full report: docs/ai-audits/<feature-slug>/02-security-review.md
Proceed to Phase 3 (eval audit)? (yes / pause-to-remediate / abort)
If there are Critical findings, recommend pausing to remediate before continuing. The launch check (Phase 4) will fail on Criticals anyway; fixing them first makes the rest of the audit more useful.
Confirmation before invoking the subagent:
About to invoke @ai-eval-designer on:
- Existing tests/evals at: <paths>
- Risk tier from Decision Record: <N>
The subagent will identify eval gaps and generate a starter eval set for the biggest ones.
Proceed? (yes / narrow-scope / abort)
After confirmation, invoke:
@ai-eval-designer audit eval coverage for this agentic app.
1. Find existing tests and evals at: <paths>
2. Read the Decision Record at docs/ai-decisions/<feature-slug>.md (risk tier: <N>).
3. Compare current eval coverage against the playbook's risk-tiered minimums (Layer 2 §2.14).
4. Identify gaps across happy path, edge cases, adversarial, negative.
5. Generate a starter eval set at evals/<feature-slug>/cases/starter.json filling the most critical gaps — especially adversarial cases from Layer 3 §3.2.
6. Output a gap analysis report.
Write the report to docs/ai-audits/<feature-slug>/03-eval-audit.md.
Confirmation gate:
Eval audit complete. Summary:
- Current eval set size: <N>
- Required minimum for Tier <N>: <M>
- Gap: <M-N> cases
- Categories most under-covered: ...
Starter eval set generated at: evals/<feature-slug>/cases/starter.json
Full report: docs/ai-audits/<feature-slug>/03-eval-audit.md
Proceed to Phase 4 (launch check)? (yes / abort)
This is the audit's accountability moment. The launch check demands evidence for every item — and on existing code, expect to fail it on the first pass. That's the audit doing its job.
Run the launch check inline (do not invoke a subagent — this needs to stay in the main session to read Phase 1–3 artifacts):
Apply the unified checklist from Layer 4 §4.1 of the playbook. For each item:
Be strict about evidence. "We have logging" without pointing to the logging schema doesn't count. "We have a kill switch" without pointing to a tested feature flag doesn't count.
Write the launch check report to docs/ai-audits/<feature-slug>/04-launch-check.md. Include:
Confirmation gate:
Launch check complete.
Decision: <GO / NO-GO / GO-WITH-EXCEPTIONS>
- ✅ Verified: <N>
- ⚠️ Partial: <N>
- ❌ Missing: <N>
Top blockers: ...
Full report: docs/ai-audits/<feature-slug>/04-launch-check.md
Proceed to Phase 5 (consolidated remediation plan)? (yes / abort)
Synthesize findings from all four prior phases into one prioritized backlog. Read the artifacts:
docs/ai-decisions/<feature-slug>.md (Decision Record)docs/ai-audits/<feature-slug>/02-security-review.mddocs/ai-audits/<feature-slug>/03-eval-audit.mddocs/ai-audits/<feature-slug>/04-launch-check.mdGroup every finding into one of four priority tiers:
For each item, include:
Write to docs/ai-audits/<feature-slug>/05-remediation-plan.md.
Final output to user:
AI Audit Complete
Feature: <feature-slug>
Pattern: <X>
Risk tier: <N>
Launch check decision: <GO / NO-GO / GO-WITH-EXCEPTIONS>
Findings:
- Critical: <N> items
- High: <N> items
- Medium: <N> items
- Structural: <N> items
Top three things to fix this week:
1. ...
2. ...
3. ...
Full artifacts:
- Decision Record: docs/ai-decisions/<feature-slug>.md
- Security review: docs/ai-audits/<feature-slug>/02-security-review.md
- Eval audit: docs/ai-audits/<feature-slug>/03-eval-audit.md
- Launch check: docs/ai-audits/<feature-slug>/04-launch-check.md
- Remediation plan: docs/ai-audits/<feature-slug>/05-remediation-plan.md
Suggested next step:
- If Critical items: pause, fix them, re-run `/ai-audit` to verify
- If High items: schedule with owners, re-run `/ai-audit` in 2 weeks
- If only Medium/Structural: ship with exceptions filed in Decision Record; track in regular planning
✅ docs/ai-decisions/<feature-slug>.md exists (created or confirmed in Phase 1)
✅ docs/ai-audits/<feature-slug>/02-security-review.md written
✅ docs/ai-audits/<feature-slug>/03-eval-audit.md written
✅ docs/ai-audits/<feature-slug>/04-launch-check.md written with GO/NO-GO decision
✅ docs/ai-audits/<feature-slug>/05-remediation-plan.md written with priority tiers
✅ No audit phase was silently skipped — every abort was explicit and user-confirmed
Abort condition: user declines scope confirmation at Phase 0
→ Stop. Do not run any phases.
→ Output: "Audit cancelled at scoping. No artifacts written."
Abort condition: Critical security findings in Phase 2
→ Recommend: "Pause audit. Fix Critical findings first. Re-run /ai-audit to continue."
→ Do not mark audit complete — it is paused, not done.
Abort condition: Decision Record missing and user refuses to reverse-engineer one
→ Stop at Phase 1. Output: "Cannot proceed without a Decision Record. Run /ai-decision-record first."
.claude/skills/ai-playbook/playbook.md (Layers 1–4).claude/skills/ai-decision-record/SKILL.md.claude/skills/ai-launch-check/SKILL.md (Layer 4 §4.1)