Logo: Contract First Agents

Contract First Agents

Communautéit
happycapy-ai
contract-first-agents

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.

Iwwersiicht

Editeurhappycapy-ai
RepositoryHappycapy-skills
Skill-Nummcontract-first-agents
Stären
138
Forks
30
Matgeliwwert Dateien
3
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 3 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    happycapy-ai huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Contract First Agents an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/happycapy-ai/Happycapy-skills/tree/main/skills/contract-first-agents
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/happycapy-ai/Happycapy-skills.git /tmp/Happycapy-skills
mkdir -p .claude/skills
cp -r /tmp/Happycapy-skills/skills/contract-first-agents .claude/skills/contract-first-agents
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Contract First Agents an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Contract First Agents automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Contract First Agents net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Contract-First Map-Reduce Agent Coordination

Wraps native TeamCreate/Task/SendMessage with a proven 4-phase protocol that 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:

markdown
# === SHARED CONTRACT: [Project Name] ===

## 1. MODULE MANIFEST
For EVERY module/section an agent will produce:
- Exact filename
- Purpose (1 sentence)
- ALL exported names (exact spelling, exact case)

## 2. INTERFACE DEFINITIONS
For EVERY cross-module reference:
- Exact function/class name
- Exact parameter names and types
- Exact return type
- Source module -> consuming module(s)

## 3. SHARED TYPES
For EVERY data structure shared across modules:
- Exact field names and types
- Validation rules
- Serialization format

## 4. STYLE GUIDE
- Naming: snake_case for functions/variables, PascalCase for classes
- Indentation: [N] spaces
- Docstrings: [Google/NumPy/Sphinx] style on all public functions/classes
- Error handling: exact exception types
- Import convention: "from module import Name"
- Language-specific conventions

## 5. DEPENDENCY MAP
- Which modules import from which
- Execution order constraints (if any)
- Shared state / global configuration

## 6. SECTION BOUNDARIES
For EACH section assigned to an agent:
- What it must produce (exact deliverables)
- What it imports from other sections (exact names)
- What it exports for other sections (exact names)
- How it connects to adjacent sections (transitions, API calls, imports)

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:

[FULL CONTRACT TEXT - every worker gets the COMPLETE contract]

---

YOUR ASSIGNMENT: [Specific section/module]

You are Agent [N] of [Total]. You are producing [section name].

CRITICAL INSTRUCTIONS:
1. Follow the contract EXACTLY. Do not deviate from specified names, types, or conventions.
2. Your section will be merged with outputs from other agents working in parallel.
3. Use ONLY the exported names specified in the contract when referencing other modules.
4. Do NOT rename, reorganize, or "improve" the interface - follow the contract.
5. Write your output to: [exact file path]

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:

python
# Validation checks (in priority order):
1. Syntax validity    - Can the output be parsed? (ast.parse, eslint --no-fix, etc.)
2. Import resolution  - Do all imports match actual exports?
3. Name consistency   - Is the naming convention uniform throughout?
4. Completeness       - Are all contracted exports present?
5. Style consistency  - Indent, docstrings, error handling patterns
6. Cross-references   - Do function calls use correct signatures?

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

python
# Step 1: Create team
TeamCreate(team_name="my-project", description="Building X with contract-first protocol")

# Step 2: Team lead generates the contract
# Save contract to a shared file: ~/.claude/teams/{team-name}/contract.md

# Step 3: Spawn workers with full contract in their prompts
Task(
    name="worker-auth",
    team_name="my-project",
    subagent_type="general-purpose",
    prompt=f"""
    {FULL_CONTRACT_TEXT}

    YOUR ASSIGNMENT: auth module
    Write to: /workspace/project/auth.py
    Follow the contract exactly.
    """
)
# ... spawn all workers in parallel

# Step 4: After workers complete, validate
# Team lead reads all output files and runs validation checks

# Step 5: If issues found, spawn fixer
Task(
    name="fixer",
    team_name="my-project",
    subagent_type="general-purpose",
    prompt=f"""
    Fix these specific issues in the merged output:
    {VALIDATION_ERRORS}

    Original contract: {CONTRACT}
    Do NOT restructure. Only fix the specific issues listed.
    """
)

# Step 6: Cleanup
SendMessage(type="shutdown_request", recipient="worker-auth")
# ... shutdown all workers
TeamDelete()

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

  1. The contract IS the coordination - review phases add <5% value if contract is good
  2. Every agent gets the FULL contract - not just their section's part
  3. Specific beats general - "use snake_case" beats "be consistent"
  4. Parallel beats sequential - contract enables parallel work; pipelines sacrifice speed for marginal gain
  5. Targeted fixes beat regeneration - fix specific issues, don't redo entire sections
  6. 10+ agents need validation - probability of ANY error increases with agent count

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Contract First Agents?

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.

Firwat Contract First Agents op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Contract First Agents besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Contract First Agents an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/happycapy-ai/Happycapy-skills/tree/main/skills/contract-first-agents an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Contract First Agents benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Contract First Agents benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Contract First Agents domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Contract First Agents gratis?

Jo. happycapy-ai huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇