Loading...
Loading...
Chain patterns for CC 2.1.71 pipelines — MCP detection, handoff files, checkpoint-resume, worktree agents, CronCreate monitoring. Use when building multi-phase pipeline skills. Loaded via skills: field by pipeline skills (fix-issue, implement, brainstorm, verify). Not user-invocable.
npx skill4agent add yonatangross/orchestkit chain-patternsskills:# FIRST thing in any pipeline skill — all in ONE message:
ToolSearch(query="select:mcp__memory__search_nodes")
ToolSearch(query="select:mcp__context7__resolve-library-id")
ToolSearch(query="select:mcp__sequential-thinking__sequentialthinking")
# Store results for all phases:
Write(".claude/chain/capabilities.json", JSON.stringify({
"memory": true_or_false,
"context7": true_or_false,
"sequential": true_or_false,
"timestamp": "ISO-8601"
}))# BEFORE any mcp__memory__ call:
if capabilities.memory:
mcp__memory__search_nodes(query="...")
# else: skip gracefully, no errorRead("${CLAUDE_SKILL_DIR}/references/mcp-detection.md")Write(".claude/chain/NN-phase-name.json", JSON.stringify({
"phase": "rca",
"skill": "fix-issue",
"timestamp": "ISO-8601",
"status": "completed",
"outputs": { ... }, # phase-specific results
"mcps_used": ["memory"],
"next_phase": 5
})).claude/chain/Read("${CLAUDE_SKILL_DIR}/references/handoff-schema.md")# FIRST instruction after MCP probe:
Read(".claude/chain/state.json")
# If exists and matches current skill:
# → Read last handoff file
# → Skip to current_phase
# → Tell user: "Resuming from Phase N"
# If not exists:
Write(".claude/chain/state.json", JSON.stringify({
"skill": "fix-issue",
"started": "ISO-8601",
"current_phase": 1,
"completed_phases": [],
"capabilities": { ... }
}))
# After each major phase:
# Update state.json with new current_phase and append to completed_phasesRead("${CLAUDE_SKILL_DIR}/references/checkpoint-resume.md")isolation: "worktree"# Agents editing different files in parallel:
Agent(
subagent_type="backend-system-architect",
prompt="Implement backend for: {feature}...",
isolation="worktree", # own copy of repo
run_in_background=true
)Read("${CLAUDE_SKILL_DIR}/references/worktree-agent-pattern.md")# Guard: Skip cron in headless/CI (CLAUDE_CODE_DISABLE_CRON)
# if env CLAUDE_CODE_DISABLE_CRON is set, run a single check instead
CronCreate(
schedule="*/5 * * * *",
prompt="Check CI status for PR #{number}:
Run: gh pr checks {number} --repo {repo}
All pass → CronDelete this job, report success.
Any fail → alert with failure details."
)Read("${CLAUDE_SKILL_DIR}/references/cron-monitoring.md")run_in_background=true# Launch all agents in ONE message with run_in_background=true
Agent(subagent_type="backend-system-architect",
prompt="...", run_in_background=true, name="backend")
Agent(subagent_type="frontend-ui-developer",
prompt="...", run_in_background=true, name="frontend")
Agent(subagent_type="test-generator",
prompt="...", run_in_background=true, name="tests")
# As each agent completes, output its findings immediately.
# CC delivers background agent results as notifications —
# present each result to the user as it arrives.
# If any agent scores below threshold, flag it before others finish.SendMessage# Spawn agent
Agent(subagent_type="backend-system-architect",
prompt="Design the API schema", name="api-designer")
# Later, continue the same agent with new context
SendMessage(to="api-designer", content="Now implement the schema you designed")
# CC 2.1.77: SendMessage auto-resumes stopped agents.
# No need to check agent state or handle "agent stopped" errors.
# NEVER use Agent(resume=...) — removed in 2.1.77./loopCronCreate/loop# User types these — skills suggest them in "Next Steps"
/loop 5m gh pr checks 42 # Watch CI after push
/loop 20m /ork:verify authentication # Periodic quality gate
/loop 10m npm test -- --coverage # Coverage drift watch
/loop 1h check deployment health at /api/health # Post-deploy monitor/loop/loop 20m /ork:verifyCronCreate/loop/loop 5m gh pr checks {pr_number}/loop 10m npm test/loop 1h check health at {endpoint}/loop 30m /ork:verify {scope}| Rule | Impact | Key Pattern |
|---|---|---|
| HIGH | Always ToolSearch before MCP calls |
| HIGH | Write handoff JSON after every major phase |
| MEDIUM | Update state.json at every user gate |
Read("${CLAUDE_SKILL_DIR}/references/<file>")| File | Content |
|---|---|
| ToolSearch probe pattern + capability map |
| JSON schema for |
| state.json schema + resume protocol |
| |
| CronCreate patterns for post-task health |
| Progressive output with run_in_background |
| SendMessage auto-resume (CC 2.1.77) |
| T1/T2/T3 graceful degradation |
ork:implementork:fix-issueork:verifyork:brainstorm