parallel-agent-contracts

Parallel Agent Type Contracts

⭐2.2kstars🔀157forks📁View on GitHub🕐Updated Jan 10, 2026

When & Why to Use This Skill

The Parallel Agent Type Contracts skill is a specialized framework designed to synchronize multiple AI agents during code implementation. It solves the common problem of type duplication and architectural drift in parallel workflows by implementing a strict 'Grep-Before-Create' policy and mandatory TypeScript verification. This ensures that every agent-generated code block is type-safe, follows existing project structures, and maintains a clean, DRY (Don't Repeat Yourself) codebase.

Use Cases

  • Coordinating Parallel Development: Ensure multiple agents working on different modules of the same project reuse shared types instead of creating redundant definitions.
  • Automated Type Verification: Enforce mandatory TypeScript compilation checks within agent workflows to catch and resolve type mismatches instantly before completion.
  • Maintaining Architectural Consistency: Use a canonical type map to guide agents in utilizing existing core data structures, significantly reducing technical debt in large-scale projects.
  • Standardizing Agent Workflows: Provide a clear, repeatable prompt template that equips agents with the necessary commands to verify their work against the existing codebase autonomously.
nameparallel-agent-contracts
descriptionParallel Agent Type Contracts
user-invocablefalse

Parallel Agent Type Contracts

When launching parallel agents for code implementation, prevent type duplication.

Required in Every Agent Prompt

1. Verification Command (MANDATORY)

## Before Marking Complete
Run verification:
\`\`\`bash
npx tsc --noEmit 2>&1 | head -20
\`\`\`
If ANY type errors exist, fix them before completing.

2. Grep-Before-Create

## Before Creating Any Type/Interface
First check if it exists:
\`\`\`bash
grep -r "interface YourTypeName\|type YourTypeName" src/
\`\`\`
If found, import it. NEVER duplicate existing types.

3. Canonical Type Map

Include relevant entries from this map in agent prompts:

Type Owner File Import From
NormalizedTool src/sdk/agent.ts './agent'
ToolCall src/sdk/agent.ts './agent'
ToolResult src/sdk/agent.ts './agent'
ToolDefinition src/sdk/agent.ts './agent'
Message src/sdk/types.ts './types'
ContentBlock src/sdk/types.ts './types'
TokenUsage src/sdk/types.ts './types'
ProviderAdapter src/sdk/providers/index.ts './providers'
RiggClient src/sdk/client.ts './client'

Prompt Template

When spawning implementation agents:

# Task: [Description]

## Type Ownership (DO NOT recreate)
- [List relevant types from canonical map]

## Before Creating New Types
Run: `grep -r "interface TypeName" src/` - if exists, import it.

## Before Marking Complete
Run: `npx tsc --noEmit 2>&1 | head -20`
Fix all type errors before completing.

## Your Implementation
[Actual task description]

Why This Works

  1. Type checker is the contract - tsc catches conflicts automatically
  2. Grep is fast - 1 second to check if type exists
  3. Explicit ownership - No ambiguity about where types live
  4. Fail fast - Agent can't claim "done" with broken types