AgentSkillsCN

agent-coordination

主Claude Code代理的协调协议。需用户明确调用(“动员代理”、“协调”、“检查注册表”)。提供代理编排、注册表管理及交接协议。子代理绝不会访问此处——主代理在任务提示中提供上下文。

SKILL.md
--- frontmatter
name: agent-coordination
description: Coordination protocol for main Claude Code agent. Explicit user invocation required ("mobilize agents", "coordinate", "check registry"). Provides agent orchestration, registry management, and handoff protocols. Subagents never access this - main agent provides context in task prompts.
allowed-tools: Read, Write, Edit, Grep, Glob, Bash, TodoWrite

Agent Coordination Protocol

Core Principle

Build on existing work. Never recreate.


Two Registries

The system maintains two distinct registries:

RegistryPurposeUpdated When
_registry.mdIndex of completed work (reports)After each agent produces a report
_tech-debt.mdTracked improvements to address laterWhen issues are deferred, incidents occur

Decision rule:

  • Registry → "What work has been done?" (past/present state)
  • Tech Debt → "What do we need to fix later?" (future work)

4-Step Workflow

Step 1: Check Prior Work

Before invoking any agent, check what already exists:

bash
# Check registry for recent reports
cat .claude/reports/_registry.md | head -50

# Check if archiving needed (>50 entries)
ENTRIES=$(grep -c "^- .*|.*|" .claude/reports/_registry.md 2>/dev/null || echo 0)
[ "$ENTRIES" -gt 50 ] && echo "⚠️ Registry has $ENTRIES entries - suggest /archive"

# Check relevant tech debt (if working on that area)
grep -i "[area-keyword]" .claude/reports/_tech-debt.md

Read relevant reports before proceeding to understand current state.

Step 2: Context Injection

Subagents NEVER read registry or reports directly. Main agent provides ALL context:

code
Task(agent-name, "
[Objective]

Context from prior work:
- [Report X]: [key decisions/findings]
- [Tech debt TD-NNN]: [relevant constraint]
- Current state: [what exists now]

Requirements:
- [Specific deliverables]

Output location:
- Report: .claude/reports/[category]/[name]-YYYYMMDD.md
")

Step 3: Sequencing

Rule: Will Agent B need Agent A's output?

  • YES → Sequential (verify between each)
  • NO → Parallel

Step 4: Verify and Update

After each agent completes:

bash
# Verify deliverables exist
.claude/skills/agent-coordination/scripts/verify.sh "[category]" "[name]" "[date]"

Then update registries:

  1. Always: Add report to _registry.md

    code
    - [report-name] | [Status] | [1-line summary]
    
  2. If issues deferred: Add to _tech-debt.md

    code
    - [ ] **TD-NNN**: [Description]
      - **Impact:** [Critical|High|Medium|Low]
      - **Source:** [report-name or postmortem-name]
    

Report Categories

All reports go to .claude/reports/[category]/:

CategoryFolderUse ForTypical Agents
analysisanalysis/Research, EDA, data explorationdata-engineer, data-viz
archarch/Architecture decisions, ADRs, system designarchitect, rfc
bugsbugs/Bug reports, root cause analysiscode-quality (debug)
commitscommits/Commit summaries, changelog entriesdevops (git)
designdesign/UI/UX reviews, design specsux-designer
execexec/Execution logs, command outputsdevops
handoffhandoff/Agent coordination, context transfers(main agent)
implementationimplementation/Implementation plans, code specsbackend, frontend
reviewreview/Code reviews, PR reviewscode-quality (review)
teststests/Test plans, test results, coveragetest-engineer, qa
securitysecurity/Security scans, threat models, compliancesecurity-engineer
sresre/SLOs, postmortems, capacity planssre
rfcrfc/Design proposals, RFCsrfc
cici/CI pipeline results(bash/devops)
archivearchive/Old reports (moved, not deleted)(archive script)

Naming convention: [category]-[topic]-YYYYMMDD.md


Agent Reference

AgentModesPrimary Output Category
code-qualityreview, debug, qa-strategyreview/, bugs/, tests/
test-engineer-tests/
architectsystem, pipelinearch/
security-engineerscan, threat-model, compliancesecurity/
srereliability-review, incident, capacitysre/
rfcauthor, review, decisionrfc/
data-engineercollect, analyze, preprocessanalysis/
data-viz-specialist-analysis/, design/
devopsinfra, gitexec/, commits/, ci/
docsgeneral, webdev(documentation files)
frontend-implementation/
backend-implementation/
ml-engineertrain, evaluate, deployanalysis/, implementation/
lrl-nlp-expert-analysis/
ux-designerdesign, copydesign/

When to Update Tech Debt

Tech debt entries are created when:

SituationAction
Code review finds issue, won't fix nowAdd as Medium/Low priority
Postmortem identifies prevention actionAdd as Critical/High priority
RFC defers a requirementAdd as Medium priority
Security scan finds non-blocking issueAdd as High priority
Manual identificationUse /debt add

Format in _tech-debt.md:

markdown
- [ ] **TD-NNN**: Brief description
  - **Impact:** Critical | High | Medium | Low
  - **Source:** [link to originating report]
  - **Created:** YYYY-MM-DD

Commands

CommandPurpose
/review-fullMulti-level review (L1: peer → L2: arch → L3: security → L4: reliability)
/ciLocal CI pipeline (lint → build → test → security)
/securitySecurity vulnerability scan
/rfcCreate/review design documents
/sloDefine service level objectives
/postmortemIncident analysis and learning
/debtView and manage tech debt
/archiveMove old registry entries to archive

Skill Resources

code
skills/agent-coordination/
├── SKILL.md              # This file
├── templates.md          # Report templates
├── reference.md          # Verification details, retry logic
└── scripts/
    ├── verify.sh         # Deliverable verification
    └── archive_reports.py # Registry archiving (dated snapshots)

Version: 5.1.0