Loading...
Loading...
Reference implementation demonstrating the Command → Agent → Skill orchestration pattern in Claude MPM, showing both preloaded-skill and dynamic-skill-invocation styles
npx skill4agent add bobmatnyc/claude-mpm-skills mpm-orchestration-demoskills:# .claude/agents/code-reviewer.md
---
name: code-reviewer
description: Reviews code for quality, security, and correctness
skills:
- code-review-checklist # Injected at startup
model: sonnet
---SkillSkill(skill: "skill-name")# In a command or agent's instructions
Skill(skill: "security-scanner")╔══════════════════════════════════════════════════════════════════╗
║ CODE REVIEW ORCHESTRATION ║
║ Command → Agent → Skill ║
╚══════════════════════════════════════════════════════════════════╝
┌─────────────────────┐
│ User invokes │
│ /code-review-demo │
└──────────┬──────────┘
│
▼
┌──────────────────────────────────────────────────┐
│ /code-review-demo — Command (Entry Point) │
│ 1. Accept file path argument │
│ 2. Invoke code-reviewer agent (Agent tool) │
│ 3. If issues found: Skill("issue-formatter") │
└──────────────────────┬───────────────────────────┘
│
Agent tool call
│
▼
┌──────────────────────────────────────────────────┐
│ code-reviewer — Agent │
│ skills: [code-review-checklist] ← Style 1 │
│ │
│ Uses preloaded checklist to review the file │
│ Returns: list of issues (or "no issues") │
└──────────────────────┬───────────────────────────┘
│
Returns issues
│
┌──────────────────────▼───────────────────────────┐
│ Command receives issues │
│ Conditionally invokes: │
│ Skill("issue-formatter") ← Style 2 │
└──────────────────────┬───────────────────────────┘
│
▼
┌─────────────────────┐
│ issue-formatter │
│ Formats and writes │
│ review-report.md │
└─────────────────────┘/code-review-demo---
# .claude/commands/code-review-demo.md
description: Demo orchestration command for code review workflow
model: haiku
---
# Code Review Demo
Accept a file path as $ARGUMENTS.
1. Use the Agent tool to invoke code-reviewer:
Agent(subagent_type="code-reviewer", prompt="Review $ARGUMENTS for quality and security issues")
2. If the agent returns any issues:
Skill(skill: "issue-formatter")
3. Report: file reviewed, issue count, report location (if written)code-reviewer---
# .claude/agents/code-reviewer.md
name: code-reviewer
description: Reviews code files for quality, security, and correctness
tools: Read
model: sonnet
skills:
- code-review-checklist
---
You are a code reviewer. Use your preloaded code-review-checklist skill to
evaluate the file specified in the prompt. Return a structured list of issues,
or "NO_ISSUES" if the code is clean.code-review-checklist---
# .claude/skills/code-review-checklist/SKILL.md
name: code-review-checklist
user-invocable: false
---
# Code Review Checklist
Review code against these criteria:
1. Input validation — are all inputs validated before use?
2. Error handling — are errors caught and handled gracefully?
3. Null safety — are null/undefined values handled?
4. Security — SQL injection, XSS, hardcoded secrets?
5. Complexity — functions over 20 lines or cyclomatic complexity > 5?
Return findings as:
ISSUE: [line] [severity] [description]issue-formatter---
# .claude/skills/issue-formatter/SKILL.md
name: issue-formatter
description: Formats code review findings into a structured markdown report
---
# Issue Formatter
Format the issues from the current conversation into review-report.md.
Structure:
- Summary: total issues by severity
- Critical issues (fix before merge)
- Warnings (should fix)
- Suggestions (optional improvements)COMMAND (.claude/commands/my-workflow.md)
├── Accepts user arguments
├── Invokes specialized AGENT via Agent tool
│ └── Agent has PRELOADED SKILL(s) for core knowledge (Style 1)
├── Receives structured result from agent
└── Conditionally invokes DYNAMIC SKILL via Skill tool (Style 2)
└── Skill formats or persists the resultISSUE: [line] [severity] [desc]context: fork