Use when code changes need review for security, cost, architecture, or acceptance criteria verification. Triggers on /review, after implementation, pre-merge.
From shieldnpx claudepluginhub infraspecdev/tesseract --plugin shieldThis skill uses the workspace's default tool permissions.
Implements structured self-debugging workflow for AI agent failures: capture errors, diagnose patterns like loops or context overflow, apply contained recoveries, and generate introspection reports.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
All review output goes into the feature's code-review directory:
{output_dir}/{feature}/code-review/{N}-{slug}/
├── summary.md ← consolidated findings (main output)
├── changes.md ← fixes applied (written after step 9)
└── detailed/
└── <agent-name>.md ← one file per dispatched agent
Where {output_dir} comes from .shield.json output_dir field (default docs/shield), {feature} is the feature folder name ({feature-name}-YYYYMMDD), {N} is a sequential number, and {slug} is a short kebab-case descriptor. Do NOT use any other path or directory structure. The Write tool creates directories automatically.
/reviewplan-review skill instead/review-security, /review-cost, etc.At startup, call execute-steps to register these steps. Execute them in order, updating status after each.
| Step | Action | Condition | Mandatory |
|---|---|---|---|
| 1 | Load prior context (plan, research) | skip if none exists | No |
| 2 | Code correctness review | always | Yes |
| 3 | Domain-specific review | skip if no active domains | No |
| 4 | Dispatch agent reviewers | explicit/final review only | No |
| 5 | AC verification | skip if no plan.json | No |
| 6 | Merge + present findings | always | Yes |
| 7 | Apply selected fixes | always | Yes |
| 8 | Write summary + update manifest | always | Yes |
Before reviewing, check for artifacts from prior phases (all optional — proceed without if missing):
{output_dir}/{feature}/plan.json for stories and acceptance criteria{output_dir}/{feature}/research/ for domain contextgit log --oneline and git diff to see what changed during implementationIdentify the review context to determine depth:
| Context | Scope | Depth |
|---|---|---|
| Per-step (during implementation) | Changed files for current story only | Code correctness + domain skill. No full agent suite. |
Explicit /review | All files in scope | Full: code correctness + domain skills + all selected agents + AC verification |
| Final review | All files in scope | Full: everything + AC for all stories |
For all contexts, review the changed/staged files for:
Read .shield.json to get active domains. For each active domain, check if a domain-specific review skill exists:
terraform → invoke shield:terraform:reviewatmos → invoke shield:atmos:reviewgithub-actions → invoke shield:github-actions:reviewDomain skills run in parallel. Their findings are collected and merged.
Check .shield.json for external_skills configured for the active domain's review phase. Invoke each configured external skill and merge findings.
Select reviewer agents based on:
always_include: from .shield.json reviewers section — always dispatchednever_include: from .shield.json reviewers section — always skippedDispatch selected agents in parallel using the appropriate mode:
infra-code modeplan modeapp-code mode (when available)For each agent that returned results, write its full raw output to:
code-review/{N}-{slug}/detailed/<agent-name>.md
Where <agent-name> matches the agent (e.g., security.md, cost.md, architecture.md, operations.md, well-architected.md).
Each detailed file should include a header and back-link:
# <Agent Name> — Detailed Findings
> Back to [summary](../summary.md)
<full agent output>
If an agent fails or times out, omit its detailed file — do not write a placeholder.
If an active story context exists (from the plan sidecar {output_dir}/{feature}/plan.json):
NEEDS_DISCUSSION, present options before applying## Detailed Agent Findings
- [Security](detailed/security.md)
- [Cost](detailed/cost.md)
- [Architecture](detailed/architecture.md)
...
{output_dir}/{feature}/code-review/{N}-{slug}/summary.md (exact path from Output Path section above){output_dir}/manifest.json and regenerate {output_dir}/index.htmlchanges.md in the same directory documenting applied fixes:
# Code Review Changes
> Review: [summary.md](summary.md)
| # | Finding | File | Change Description |
|---|---------|------|--------------------|
| 1 | <finding from summary> | <file:line> | <what was changed> |
code-review/{N}-{slug}/
├── summary.md ← table below
├── changes.md ← applied fixes log
└── detailed/<agent>.md ← full per-agent output
| # | Severity | Source | Location | Finding | Recommendation |
|---|---|---|---|---|---|
| 1 | Critical | security-reviewer | main.tf:42 | Wildcard IAM policy | Scope to specific ARNs |
| 2 | Important | terraform/review | variables.tf:15 | Missing validation block | Add CIDR validation |
| Criteria | Status | Evidence |
|---|---|---|
| Regional pools allocate /20 CIDRs | Met | main.tf:42 — netmask_length = 20 |
| No CIDR overlap | Not verified | No test found |
Which fixes would you like to apply?
| Mistake | Fix |
|---|---|
| Running full agent suite for a per-step review during implementation | Per-step reviews only need code correctness + domain skills — save the full agent suite for explicit /review |
Dispatching all agents without checking .shield.json reviewers config | Respect always_include and never_include from the project config before auto-selecting |
| Applying fixes without user confirmation | Always present findings and ask which to apply — never auto-fix, especially for NEEDS_DISCUSSION items |
| Writing detailed agent findings to summary.md instead of separate files | Each agent gets its own file in detailed/<agent>.md — summary.md only has the merged table |
| Skipping AC verification because no plan sidecar exists | If there's no plan.json, skip AC verification silently — don't error or ask the user to create one |
| Not deduplicating findings from multiple sources | If security-reviewer and terraform/security-audit flag the same issue, keep the most detailed one |