No slash command · from agent-patterns-plugin
Scaffolds a code execution pattern for MCP-based agents that generates and runs code against typed wrappers instead of calling tools directly. Reduces token usage when fanning across many servers, handling large intermediate data, or keeping PII out of context.
Ships in agent-patterns-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Expert knowledge for designing agent systems that generate and execute code to interact with MCP servers, instead of calling tools directly.
For the typed-wrapper code, the six key-pattern examples, and the project scaffolding steps, see REFERENCE.md.
| Use code execution when... | Use direct tool calls / mcp-management when... |
|---|---|
| Designing agents that fan out across 10+ MCP servers or 50+ tools | Installing or configuring one or two servers in .mcp.json |
| Intermediate results are large (>10K tokens) and would blow context | Results are small and all needed by the model |
| Workflows need loops, retries, or conditionals across tool calls | Linear sequences of 2–3 tool calls |
| PII must not reach the model context | Tool responses contain no sensitive data |
| Tasks benefit from state persistence across runs | Stateless, one-shot operations |
| You want agents to accumulate reusable skills | Fixed, predefined workflows |
Instead of loading all MCP tool definitions into context upfront, the agent:
This reduces token usage from O(all_tool_definitions) to O(only_relevant_imports).
project/
├── servers/
│ ├── google-drive/
│ │ ├── getDocument.ts
│ │ ├── getSheet.ts
│ │ └── index.ts # Re-exports all tools
│ ├── salesforce/
│ │ └── index.ts
│ └── slack/
│ └── index.ts
├── skills/ # Agent-accumulated reusable functions
├── workspace/ # Persistent state between executions
├── client.ts # MCP client that routes calls to servers
└── sandbox.config.ts # Execution environment configuration
Each MCP tool gets a typed wrapper function the agent imports
(callMCPTool<T>("server__tool", input)); the agent writes ordinary code
against those wrappers. See
REFERENCE.md → Typed wrapper pattern.
Six patterns make this efficient — each with a worked code example in REFERENCE.md → Key patterns:
| Pattern | What it buys |
|---|---|
| Progressive tool discovery | Navigate servers/ on demand — ~150K tokens → ~2K (98.7% reduction) |
| Context-efficient filtering | Filter large datasets in the sandbox; only a summary reaches the model |
| Native control flow | Loops/retries/conditionals run in the sandbox, not as chained tool calls |
| PII tokenization | The client tokenizes sensitive fields so PII never enters model context |
| State persistence | Save intermediate results to workspace/ for cross-execution continuity |
| Skill accumulation | Persist reusable functions to skills/ for future executions |
The five-step scaffold — identify servers → generate typed wrappers → create the
routing client → configure the sandbox → wire the agent loop — is detailed with
code in REFERENCE.md → Scaffolding a new project.
The agent loop becomes: explore servers/ → generate code → execute in sandbox
→ filtered output returns → decide done or iterate.
| Item | Status |
|---|---|
| Sandboxed execution environment | Required |
| Resource limits (CPU, memory, disk) | Required |
| Network isolation (MCP servers only) | Required |
| Execution timeout | Required |
| PII tokenization in MCP client | Recommended for sensitive data |
| Audit logging of all executions | Recommended |
Read-only access to servers/ | Recommended |
Scoped write access to workspace/ only | Recommended |
| Approach | Tool definitions | Intermediate data | Total |
|---|---|---|---|
| Direct tool calls | All loaded upfront | Passes through context | High |
| Code execution | On-demand discovery | Stays in sandbox | Low |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin agent-patterns-plugin26 skills in this plugin
/adversarial-reviewAdversarial second-pass review that tries to break code, designs, plans, or ADRs. Use when stakes are high and a normal review already ran./agent-cli-worktree-safetyData-loss invariants for a CLI that runs an agent SDK in a git worktree then force-removes it. Use when building or reviewing such a CLI, or when an agent run reports "no changes" after writing files./agent-teamsConfigure Claude Code agent teams (implicit team, SendMessage, TaskUpdate). Use when running parallel agents, coordinating with messaging, or setting up a lead/teammate architecture.Other plugins' skills for the same job