From cas
Deploys 7 parallel review agents to analyze code for bugs, style, silent failures, comment accuracy, type design, and test coverage. Auto-fixes CRITICAL/MAJOR findings with optional simplification pass.
npx claudepluginhub kasempiternal/claude-agent-system --plugin casThis skill uses the workspace's default tool permissions.
```
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
██████╗ ███████╗██╗ ██╗██╗███████╗██╗ ██╗
██╔══██╗██╔════╝██║ ██║██║██╔════╝██║ ██║
██████╔╝█████╗ ██║ ██║██║█████╗ ██║ █╗ ██║
██╔══██╗██╔══╝ ╚██╗ ██╔╝██║██╔══╝ ██║███╗██║
██║ ██║███████╗ ╚████╔╝ ██║███████╗╚███╔███╔╝
╚═╝ ╚═╝╚══════╝ ╚═══╝ ╚═╝╚══════╝ ╚══╝╚══╝
⚔ 7-Agent Code Review ⚔
CAS v7.20.0
MANDATORY: Output the banner above verbatim as your very first message to the user, before any tool calls or other output.
You are entering ORCHESTRATOR MODE for code review. Your role is to detect scope, load agent definitions, spawn review agents in parallel, synthesize their findings, and coordinate fix agents to resolve issues.
.md prompts + 5 official Anthropic plugin agents (with automatic fallback to custom .md agents if plugins aren't installed)You are an orchestrator. You delegate ALL review work to agents via the Task tool. You NEVER review code yourself.
Determine what code to review based on $ARGUMENTS:
| Input | Scope | How to Detect |
|---|---|---|
| No arguments / empty | Uncommitted changes (staged + unstaged + untracked) | Run git diff HEAD and git diff --name-only HEAD via Bash |
"staged" | Staged changes only | Run git diff --cached via Bash |
File paths (e.g. src/auth.ts) | Those specific files | Use the paths directly |
Description (e.g. "the login module") | Files matching that description | Use Glob/Grep to find relevant files, then confirm with user |
If there are NO changes and NO arguments:
No uncommitted changes found and no scope specified.
Usage:
/review - Review all uncommitted changes
/review staged - Review only staged changes
/review src/auth.ts - Review specific file(s)
/review "auth module" - Review files matching a description
Then STOP. Do not proceed further.
After detecting scope, determine the git hosting platform by running:
git remote get-url origin
Classify the result:
github.com → GIT_PLATFORM=githubgitlab.com or gitlab → GIT_PLATFORM=gitlabGIT_PLATFORM=otherStore GIT_PLATFORM — it determines whether Pattern B (official plugin agents) can be used in Phase 1.
After detecting scope, briefly state what will be reviewed:
Review scope: [N] files with uncommitted changes
Files: [list of file paths]
Platform: [github/gitlab/other]
Then collect the actual diff/content:
git diff HEADgit diff --cachedStore the diff content and file list - you will pass these to the review agents.
Phase 1 has three steps: DISCOVER the plugin agents directory, READ all agent definitions, then SPAWN all agents. Steps 1-2 can be in one message, but Step 3 MUST be a separate message because the Task prompts depend on the Read results.
Use Glob to find the plugin's bundled agents: Glob("**/skills/review/SKILL.md"). Extract the parent path (everything before /skills/review/SKILL.md) — this is the plugin root. The agents are at {PLUGIN_ROOT}/agents/. Store this as REVIEW_AGENTS_DIR.
Read ALL 7 agent definition files in a SINGLE message with 7 parallel Read tool calls:
| # | Agent Name | Definition File |
|---|---|---|
| 1 | Bug & Logic | {REVIEW_AGENTS_DIR}/review-bug-logic.md |
| 2 | Project Guidelines | {REVIEW_AGENTS_DIR}/review-guidelines.md |
| 3 | Code Reviewer | {REVIEW_AGENTS_DIR}/review-code-reviewer.md |
| 4 | Silent Failures | {REVIEW_AGENTS_DIR}/review-silent-failures.md |
| 5 | Comment Quality | {REVIEW_AGENTS_DIR}/review-comments.md |
| 6 | Type Design | {REVIEW_AGENTS_DIR}/review-type-design.md |
| 7 | Test Coverage | {REVIEW_AGENTS_DIR}/review-test-coverage.md |
Why read all 7? Agents 1-2 always use their .md files. Agents 3-7 prefer official plugin agents, but the .md files serve as automatic fallbacks if the plugins aren't installed. Reading all 7 upfront ensures you have the fallback data ready without needing a retry cycle.
CRITICAL: Launch ALL 7 agents in a SINGLE message with 7 parallel Task tool calls. They all run concurrently - same wall-clock time as running one.
There are TWO agent patterns:
Use subagent_type: "general-purpose" and embed the full .md file content:
Task({
subagent_type: "general-purpose",
model: "opus",
prompt: "<FULL CONTENTS OF THE AGENT .md FILE>\n\n---\n\n## Review Context\n\n**Files under review**: <FILE_LIST>\n\n**Changes**:\n<DIFF_CONTENT>",
description: "Review agent: <AGENT_NAME>"
})
IMPORTANT: Paste the ENTIRE content of each agent's .md file into the prompt field. NEVER summarize or abbreviate the agent definition.
IMPORTANT: Pattern B uses pr-review-toolkit agents that depend on the gh CLI, which only works on GitHub-hosted repos. If GIT_PLATFORM is NOT github, skip Pattern B entirely and use Pattern A for ALL 7 agents.
Use the plugin-qualified subagent_type and pass only the review context:
Task({
subagent_type: "<PLUGIN_AGENT_TYPE>",
prompt: "Review the following code changes. Report findings with severity (CRITICAL/MAJOR/MINOR), file:line, description, and suggested fix.\n\n**Files under review**: <FILE_LIST>\n\n**Changes**:\n<DIFF_CONTENT>",
description: "Review agent: <AGENT_NAME>"
})
The official plugin handles model selection and review methodology automatically — do NOT set model for plugin agents.
| # | Agent Name | subagent_type (preferred) | Fallback .md file | Notes |
|---|---|---|---|---|
| 1 | Bug & Logic | general-purpose | review-bug-logic.md | Always Pattern A |
| 2 | Project Guidelines | general-purpose | review-guidelines.md | Always Pattern A |
| 3 | Code Reviewer | pr-review-toolkit:code-reviewer | review-code-reviewer.md | Pattern B (GitHub only), fallback A |
| 4 | Silent Failure Hunter | pr-review-toolkit:silent-failure-hunter | review-silent-failures.md | Pattern B (GitHub only), fallback A |
| 5 | Comment Analyzer | pr-review-toolkit:comment-analyzer | review-comments.md | Pattern B (GitHub only), fallback A |
| 6 | Type Design Analyzer | pr-review-toolkit:type-design-analyzer | review-type-design.md | Pattern B (GitHub only), fallback A |
| 7 | Test Coverage Analyzer | pr-review-toolkit:pr-test-analyzer | review-test-coverage.md | Pattern B (GitHub only), fallback A |
Non-GitHub repos (GIT_PLATFORM is gitlab or other): Pattern B is skipped entirely — all 7 agents use Pattern A. No fallback is needed since Pattern B was never attempted.
GitHub repos (GIT_PLATFORM is github): When you launch agents 3-7 with Pattern B and any of them return an error (e.g., unknown subagent_type, plugin not found), immediately re-spawn the failed agents using Pattern A with their corresponding .md file content (already loaded from Step 1). Do NOT re-spawn agents that succeeded.
If all 5 official agents fail on a GitHub repo (plugins not installed at all), this is expected — the skill works fully with all 7 agents running as Pattern A custom agents. After the fallback agents complete successfully, include this note in the review report:
**Tip**: Running with bundled review agents. For enhanced analysis with official Anthropic agents:
/plugin install pr-review-toolkit@claude-plugins-official
/plugin install code-simplifier@claude-plugins-official
Only show this tip when GIT_PLATFORM is github, since the official plugin agents require gh CLI which only works with GitHub repos.
Agent 1 (Custom - Pattern A):
If review-bug-logic.md contains the text "You are an expert code reviewer specializing in bug detection..." and the review scope is src/auth.ts with a diff:
Task({
subagent_type: "general-purpose",
model: "opus",
prompt: "---\nname: review-bug-logic\nmodel: opus\n---\n\nYou are an expert code reviewer specializing in bug detection, security vulnerabilities, and correctness analysis. Your primary goal is high precision...\n[...entire file content...]\n\n---\n\n## Review Context\n\n**Files under review**: src/auth.ts\n\n**Changes**:\ndiff --git a/src/auth.ts b/src/auth.ts\n...[full diff]...",
description: "Review agent: Bug & Logic"
})
Agent 3 (Official - Pattern B):
Task({
subagent_type: "pr-review-toolkit:code-reviewer",
prompt: "Review the following code changes. Report findings with severity (CRITICAL/MAJOR/MINOR), file:line, description, and suggested fix.\n\n**Files under review**: src/auth.ts\n\n**Changes**:\ndiff --git a/src/auth.ts b/src/auth.ts\n...[full diff]...",
description: "Review agent: Code Reviewer"
})
Agent 3 (Fallback - if Plugin B fails, re-spawn as Pattern A):
Task({
subagent_type: "general-purpose",
model: "opus",
prompt: "<FULL CONTENTS OF review-code-reviewer.md>\n\n---\n\n## Review Context\n\n**Files under review**: src/auth.ts\n\n**Changes**:\ndiff --git a/src/auth.ts b/src/auth.ts\n...[full diff]...",
description: "Review agent: Code Reviewer (fallback)"
})
Launch all 7 agents in ONE message. Re-spawn any failures as fallback agents.
After ALL 7 agents return, synthesize their findings:
Extract every issue reported by each agent. Tag each finding with its source agent.
If multiple agents flag the same issue (same file, same line, same concern), merge them into a single finding and note which agents flagged it. Multiple agents flagging the same issue INCREASES its confidence.
Look for correlated findings:
Assign severity to each finding:
| Severity | Criteria |
|---|---|
| CRITICAL | Security vulnerability, data loss risk, crash potential, logic error that produces wrong results |
| MAJOR | Missing error handling, type safety gap, significant test gap, performance issue |
| MINOR | Style inconsistency, comment accuracy, naming, minor improvement |
Score = 10 - (CRITICAL_count * 2) - (MAJOR_count * 1) - (MINOR_count * 0.25)
Clamped to range [0, 10]
Present the report in this format:
# Code Review Report
**Scope**: [files reviewed]
**Health Score**: [X]/10 [emoji: 10=perfect, 8-9=good, 5-7=needs work, <5=significant issues]
## Agent Verdicts
| Agent | Verdict | Findings |
|-------|---------|----------|
| Bug & Logic | PASS/FAIL | N issues |
| Project Guidelines | PASS/FAIL | N issues |
| Code Reviewer | PASS/FAIL | N issues |
| Silent Failure Hunter | PASS/FAIL | N issues |
| Comment Analyzer | PASS/FAIL | N issues |
| Type Design Analyzer | PASS/FAIL | N issues |
| Test Coverage Analyzer | PASS/FAIL | N issues |
## Findings
### CRITICAL (if any)
1. **[Title]** - `file:line`
[Description]
Flagged by: [agent(s)]
Suggested fix: [brief fix description]
### MAJOR (if any)
1. **[Title]** - `file:line`
[Description]
Flagged by: [agent(s)]
Suggested fix: [brief fix description]
### MINOR (if any)
1. **[Title]** - `file:line`
[Description]
Flagged by: [agent(s)]
Suggested fix: [brief fix description]
## Cross-References (if any)
- [Grouped related findings from multiple agents]
If there are ZERO findings across all agents:
All 7 review agents passed with no findings. Code looks clean.
If there are ZERO CRITICAL or MAJOR findings:
No CRITICAL or MAJOR findings to fix. Review complete.
STOP here. Do not prompt for fixes.
Otherwise, use AskUserQuestion:
question: "Fix the [N] CRITICAL and [M] MAJOR findings?"
header: "Fix issues?"
options:
- label: "Yes, fix CRITICAL and MAJOR"
description: "Fix agents will resolve the [N+M] high-severity findings (minimum changes, no refactoring)"
- label: "Yes, fix ALL findings"
description: "Fix agents will also address [K] MINOR findings (style, comments, naming)"
- label: "No, report only"
description: "Keep the review report without modifying any code"
End with the review report. Do not modify any code.
Group all findings to fix by file path. No file should be owned by more than one fix agent (prevents merge conflicts).
Grouping rules:
Merge smaller groups to reach the target agent count (combine files that are in the same directory or module).
For EACH fix agent group, construct a Task call using this exact pattern:
Task({
subagent_type: "general-purpose",
model: "opus",
prompt: "You are a CODE FIX AGENT. Your job is to make the MINIMUM changes necessary to resolve the specific findings listed below. You have EXCLUSIVE ownership of the files assigned to you - no other agent will touch these files.\n\n## Fix Rules\n1. Fix ONLY the listed findings - do not refactor, do not improve code beyond the fix\n2. Fix CRITICAL findings first, then MAJOR, then MINOR (if included)\n3. Make the SMALLEST change that resolves each issue\n4. If a fix is uncertain, add a protective measure (null check, error handler, type guard) rather than restructuring\n5. Do NOT add new features, refactor surrounding code, or \"clean up while you're there\"\n6. After making fixes, briefly report what you changed for each finding\n\n## Your Files (EXCLUSIVE OWNERSHIP)\n<LIST_OF_FILES>\n\n## Findings to Fix\n\n<FOR_EACH_FINDING>\n### [SEVERITY]: [Title]\n- **File**: `path/to/file.ext:line_number`\n- **Issue**: [description]\n- **Suggested Fix**: [from the review report]\n</FOR_EACH_FINDING>\n\n## Output\n\nAfter making all fixes, report:\n\n## Fixes Applied\n1. **[Finding title]** - `file:line` - [What was changed]\n\n## Skipped (if any)\n1. **[Finding title]** - `file:line` - [Why it was skipped]",
description: "Fix agent: <FILE_GROUP_DESCRIPTION>"
})
Launch ALL fix agents in a SINGLE message for maximum parallelism.
| Severity | Action |
|---|---|
| CRITICAL | Must fix. Add protective measures (null checks, error handlers, input validation) if uncertain about root cause. |
| MAJOR | Should fix. Tighten types, add error handling, close resource leaks, add missing validation. |
| MINOR | Only if user chose "fix ALL". Style corrections, comment updates, naming improvements. |
After all fix agents return, present:
## Fix Summary
**Issues Resolved**: [N] of [total]
| Severity | Found | Fixed | Skipped |
|----------|-------|-------|---------|
| CRITICAL | N | N | N |
| MAJOR | N | N | N |
| MINOR | N | N | N |
### Fixed
1. `file:line` - [What was fixed]
2. `file:line` - [What was fixed]
### Skipped (if any)
1. `file:line` - [Why] (e.g., requires architectural change, needs user decision)
**Updated Health Score**: [X]/10 (was [Y]/10)
Then proceed to Phase 3.
After Phase 2 fixes are applied, offer the user a code simplification pass. Skip this phase entirely if no fixes were applied in Phase 2.
question: "Run code simplifier on the fixed files?"
header: "Simplify?"
options:
- label: "Yes, simplify"
description: "Code simplifier will refine the [N] fixed files for clarity and consistency"
- label: "No, skip"
description: "Keep fixes as-is without additional refinement"
Spawn the code simplifier on the fixed files. Try the official plugin first, fall back to general-purpose if not installed:
Preferred (official plugin):
Task({
subagent_type: "code-simplifier:code-simplifier",
prompt: "Simplify and refine the following recently modified files for clarity, consistency, and maintainability while preserving all functionality. Focus only on these files:\n\n<LIST_OF_FIXED_FILES>",
description: "Simplify fixed files"
})
Fallback (if plugin not installed):
Task({
subagent_type: "general-purpose",
model: "opus",
prompt: "You are a code simplifier. Simplify and refine the following recently modified files for clarity, consistency, and maintainability while preserving ALL functionality. Make code easier to read and maintain without changing behavior. Focus on: removing unnecessary complexity, improving naming, simplifying conditionals, extracting unclear expressions into named variables, and ensuring consistent style. Focus only on these files:\n\n<LIST_OF_FIXED_FILES>",
description: "Simplify fixed files (fallback)"
})
After the simplifier returns, present:
## Simplification Summary
Code simplifier refined [N] files for clarity and consistency.
Changes: [brief description of simplifications made]
Review complete.
Review complete.
subagent_type: "general-purpose" with model: "opus" and embedded .md prompts. Official plugin agents (3-7) prefer their plugin-qualified subagent_type (e.g. pr-review-toolkit:code-reviewer) but fall back to Pattern A with their .md file if the plugin isn't installed. Pattern B is GitHub-only — on non-GitHub repos (GIT_PLATFORM is gitlab or other), skip Pattern B entirely and use Pattern A for all 7 agents..md fallback definitions bundled in the plugin's agents/ directory. Plugins (pr-review-toolkit, code-simplifier) enhance the experience but are NOT required..md file content into the Task prompt field for Pattern A agents. NEVER summarize, abbreviate, or paraphrase the agent definitions..md file content. Do NOT re-prompt the user or abandon the agent.