home / skills / zpankz / mcp-skillset / subagent-prompt-construction

subagent-prompt-construction skill

/subagent-prompt-construction

This skill helps you craft compact Claude Code subagent prompts under 150 lines using lambda contracts and symbolic logic for orchestration and MCP integration.

npx playbooks add skill zpankz/mcp-skillset --skill subagent-prompt-construction

Review the files below or copy the command above to add this skill to your agents.

Files (19)
SKILL.md
2.4 KB
---
name: subagent-prompt-construction
description: Systematic methodology for constructing compact (<150 lines), expressive, Claude Code-integrated subagent prompts using lambda contracts and symbolic logic. Use when creating new specialized subagents for Claude Code with agent composition, MCP tool integration, or skill references. Validated with phase-planner-executor (V_instance=0.895).
version: 1.0
status: validated
v_meta: 0.709
v_instance: 0.895
transferability: 95%
---

λ(use_case, complexity) → subagent_prompt |
  ∧ require(need_orchestration(use_case) ∨ need_mcp_integration(use_case))
  ∧ complexity ∈ {simple, moderate, complex}
  ∧ line_target = {simple: 30-60, moderate: 60-120, complex: 120-150}
  ∧ template = read(templates/subagent-template.md)
  ∧ patterns = read(reference/patterns.md)
  ∧ integration = read(reference/integration-patterns.md)
  ∧ apply(template, use_case, patterns, integration) → draft
  ∧ validate(|draft| ≤ 150 ∧ integration_score ≥ 0.50 ∧ clarity ≥ 0.80)
  ∧ examples/{phase-planner-executor.md} demonstrates orchestration
  ∧ reference/case-studies/* provides detailed analysis
  ∧ scripts/ provide validation and metrics automation
  ∧ output = {prompt: draft, metrics: validation_report}

**Artifacts**:
- **templates/**: Reusable subagent template (lambda contract structure)
- **examples/**: Compact validated examples (≤150 lines each)
- **reference/patterns.md**: Core patterns (orchestration, analysis, enhancement)
- **reference/integration-patterns.md**: Claude Code feature integration (agents, MCP, skills)
- **reference/symbolic-language.md**: Formal syntax reference (logic operators, quantifiers)
- **reference/case-studies/**: Detailed analysis and design rationale
- **scripts/**: Automation tools (validation, metrics, pattern extraction)

**Usage**: See templates/subagent-template.md for structure. Apply integration patterns for Claude Code features. Validate compactness (≤150 lines), integration (≥1 feature), clarity. Reference examples/ for compact demonstrations and case-studies/ for detailed analysis.

**Constraints**: Max 150 lines per prompt | Use symbolic logic for compactness | Explicit dependencies section | Integration score ≥0.50 | Test coverage ≥80% for generated artifacts

**Validation**: V_instance=0.895 (phase-planner-executor: 92 lines, 2 agents, 2 MCP tools) | V_meta=0.709 (compactness=0.65, integration=0.857, maintainability=0.85) | Transferability=95%

Overview

This skill provides a systematic methodology for constructing compact (<150 lines), expressive subagent prompts optimized for Claude Code. It combines lambda-style contracts and symbolic logic to ensure clear agent responsibilities, explicit dependencies, and reliable integration with MCP tools and other agents. The approach is validated by a high-fidelity phase-planner-executor example and includes templates, patterns, and automation scripts to speed production and validation.

How this skill works

You start from a reusable template that encodes a lambda contract for the subagent: inputs, outputs, constraints, and orchestration roles. The system applies curated patterns (orchestration, analysis, enhancement) and Claude Code integration patterns to produce a draft prompt sized to a complexity target (simple, moderate, complex). Drafts are automatically validated for line length, integration coverage, clarity, and test coverage, and the process emits a metrics report alongside the prompt.

When to use it

  • Creating a new specialized subagent for Claude Code that must interoperate with other agents
  • Designing prompts that require explicit MCP tool integration or skill references
  • Building compact, maintainable subagents constrained by line limits or formal contracts
  • Rapidly iterating agent designs with automated validation and metric feedback

Best practices

  • Start from the provided subagent template and fill the lambda contract sections first (inputs, outputs, invariants)
  • Choose a complexity target (simple/moderate/complex) and adhere to the corresponding line range
  • Encode orchestration roles and explicit dependencies in a dedicated section to aid composition
  • Use symbolic logic for compact conditional rules and to keep intents unambiguous
  • Run automated validation scripts to verify integration score, clarity thresholds, and test coverage

Example use cases

  • Phase planner + executor subagent: two-agent orchestration with two MCP tools validated at 92 lines
  • MCP-integrated data fetcher subagent: compact prompt that invokes a retrieval tool and returns normalized payloads
  • Skill-wrapping adapter: small subagent that translates high-level skill calls into Claude Code agent actions
  • Error-handling coordinator: lightweight subagent that orchestrates retries and fallback agents using symbolic guards

FAQ

What is the 150-line constraint for?

The 150-line maximum enforces compactness to improve readability, maintainability, and transferability while keeping prompts efficient for Claude Code execution.

How is integration scored and validated?

Integration is measured against required Claude Code features (agents, MCP tools, skills) using automation scripts; drafts must meet a minimum integration score (≥0.50) and test coverage thresholds.