AgentSkillsCN

chain

构建可按顺序依次执行多项技能的链式流程

SKILL.md
--- frontmatter
name: chain
description: Build chains that execute multiple skills sequentially
user-invocable: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash

Skill Chaining

Builds and executes chains that run multiple skills sequentially.

Syntax

code
/chain skill1 -> skill2 -> skill3

Predefined Chains

feature (new feature development)

code
task-planner -> architect -> coder -> test-writer -> code-reviewer

bugfix (bug fix)

code
debugger -> coder -> test-writer -> code-reviewer

refactor (refactoring)

code
code-reviewer -> architect -> refactorer -> test-writer -> code-reviewer

security-review (security review)

code
security-auditor -> code-reviewer -> coder (fix) -> security-auditor (re-verify)

Chain Execution Rules

1. Sequential Execution

Each skill waits for the previous skill to complete

2. Context Propagation

The output of the previous skill becomes the input for the next skill

3. Abort on Failure

If a skill fails, the chain is aborted

  • /chain --continue to force continuation

4. Checkpoints

Automatically creates a checkpoint when each skill completes

Custom Chain Definition

.claude/chains/custom-chain.yaml:

yaml
name: my-custom-chain
description: Custom chain description
steps:
    - skill: task-planner
      output_key: plan
    - skill: coder
      input_from: plan
      output_key: code
    - skill: test-writer
      input_from: code
      condition: "code.files_changed > 0"

Usage Examples

code
# Predefined chain
> /chain feature Add a new login feature

# Custom chain
> /chain debugger -> coder -> reflect

# Conditional execution
> /chain coder -> test-writer --if-changed