happycapy-ai/happycapy-skills/contract-first-agents
Claude Code and agent skill by happycapy-ai/happycapy-skills
- community
Checking that the SKILL.md file is still in the repository.
Contract-First Map-Reduce coordination protocol for native TeamCreate multi-agent teams. Wraps TeamCreate, Task (teammates), SendMessage with an upfront shared contract phase that eliminates 75% of integration errors. Based on 400+ experiment research proving 52.5% quality improvement over naive coordination.
Install
npx vskill@latest install happycapy-ai/happycapy-skills/contract-first-agentsSKILL.md
The same SKILL.md was published earlier as reactflowbrasil-lgtm/contract-first-agents/contract-first-agents.
Contract-First Map-Reduce Agent Coordination
Wraps native TeamCreate/Task/SendMessage with a proven 4-phase protocolthat eliminates 75% of integration errors in multi-agent tasks.
Research Basis
Based on 400+ controlled experiments comparing 7 coordination strategies:
- Naive multi-agent: 0.571 composite quality score
- Contract-First Map-Reduce: 0.871 composite quality score (+52.5%)
- The contract alone accounts for the ENTIRE quality improvement
- Validated across 2-64 agent configurations
The Protocol
Phase 1: CONTRACT GENERATION (Team Lead, ~5% of time)
Before spawning ANY worker agent, the team lead MUST create a Contract Document.
The Contract Document must contain:
Contract Quality Checklist:
- [ ] Every exported name is spelled out exactly
- [ ] Every cross-module import has a matching export
- [ ] Style guide is specific (not "be consistent" but "use snake_case")
- [ ] Shared types have exact field names and types
- [ ] No ambiguity - an agent reading only the contract can produce correct code
Phase 2: PARALLEL EXECUTION (Worker Agents)
Spawn worker agents using the Task tool with team_name parameter. Each worker's prompt MUST include:
Spawn all workers in parallel using a single message with multiple Task tool calls.
Phase 3: AUTOMATED VALIDATION (Team Lead or Script)
After all workers complete, the team lead validates the merged output:
Save validation results. If all pass -> done. If issues found -> Phase 4.
Phase 4: TARGETED FIX (Fixer Agent, only if needed)
Spawn ONE fixer agent that receives:
- The merged output
- The specific validation errors (exact line numbers, exact issues)
- The original contract
The fixer ONLY fixes the specific issues found. It does NOT regenerate or restructure.
Implementation with Native Tools
When to Use This Protocol
ALWAYS use for:
- Any task requiring 3+ agents
- Tasks producing code that must interoperate
- Large document generation (multiple sections that reference each other)
- Any task where agents produce outputs that will be merged
SKIP the contract for:
- Completely independent tasks (no cross-references)
- Single-agent tasks
- Research/exploration tasks (no integration needed)
Key Principles
- The contract IS the coordination - review phases add <5% value if contract is good
- Every agent gets the FULL contract - not just their section's part
- Specific beats general - "use snake_case" beats "be consistent"
- Parallel beats sequential - contract enables parallel work; pipelines sacrifice speed for marginal gain
- Targeted fixes beat regeneration - fix specific issues, don't redo entire sections
- 10+ agents need validation - probability of ANY error increases with agent count
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/contract-first-agents/SKILL.md
Popularity
- Repository stars
- 137
- Repository forks
- 30
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/happycapy-ai/happycapy-skills/contract-first-agents)