Skills: Skill Composition & Orchestration

Last updated: 2026-08-31

A single Skill solves a single problem — composed Skills solve complex problems.


1. Composition Patterns

(1) Skill Chain (Pipeline)

Execute multiple Skills sequentially, where one's output is the next's input:

TEXT 📖 Display only
Skill Chain Example: Code Commit Full Process

Code Review → Auto Fix → Run Tests → Update Docs → Commit Code
    ↓           ↓          ↓          ↓          ↓
 Review Report  Fix Patch  Test Report  Doc Update  commit ID

(2) Skill Matrix (Matrix)

Multiple Skills execute in parallel, results aggregated:

TEXT 📖 Display only
Skill Matrix Example: Comprehensive Quality Check

           ┌→ Security Scan ─┐
Code Change ──┤→ Performance Analysis ─┤→ Quality Report
           └→ Style Check ─┘

(3) Conditional Orchestration

Select execution path based on conditions:

TEXT 📖 Display only
Conditional Orchestration Example: Smart Deploy

Change type determination:
├── Doc change → Only update docs
├── Test change → Only run tests
├── Code change → Full process (review→test→deploy)
└── Config change → Review + confirm then deploy

2. Composition Implementation

(1) Prompt Orchestration

Describe composition logic in the Skill prompt:

MARKDOWN
## Execution Strategy

1. First execute code-review Skill
2. If 🔴 issues found:
   - Execute auto-fix Skill
   - Re-execute code-review to confirm fix
3. After review passes, execute test-runner Skill
4. After tests pass, output summary report

(2) Context Passing

Skills pass data through context:

TEXT 📖 Display only
Skill A output → Write to context variable → Skill B reads

Example:
code-review finds 3 issues →
  context: { review_issues: [...], fix_targets: [...] }
→ auto-fix reads fix_targets and executes fixes

(3) Result Aggregation

MARKDOWN
## Summary Report Template

### Skill Chain Execution Results
| Step | Skill | Status | Duration | Key Output |
|:-----|:------|:-------|:---------|:-----------|
| 1 | code-review | ✅ | 30s | 5 issues |
| 2 | auto-fix | ✅ | 45s | Fixed 4 |
| 3 | test-runner | ✅ | 2m | All pass |

3. Composition Design Principles

(1) Loose Coupling

Each Skill is independently usable, not depending on other Skills' internal implementation:

TEXT 📖 Display only
Loose Coupling Design:
├── Skill A doesn't directly call Skill B's internal functions
├── Skills pass data via standard formats (e.g., JSON, Markdown)
├── Single Skill failure doesn't affect other Skills' basic functionality
└── Each Skill can be tested independently

(2) Single Responsibility

Each Skill does one thing and does it well:

✅ Correct ❌ Wrong
code-review only reviews code-review reviews+fixes+tests
auto-fix only fixes auto-fix fixes+reviews+deploys
deploy only deploys deploy deploys+monitors+alerts

(3) Idempotency

Repeated execution produces consistent results, supporting safe retries:

MARKDOWN
## Idempotency Requirements
- Multiple runs of review Skill produce the same results
- Fix Skill checks if issue is already fixed, skips if so
- Deploy Skill checks current state, confirms rather than re-deploys if already deployed

4. Composition Orchestration Practice

▶ Example: PR Quality Gate

Alice designed a PR auto-review composition:

YAML
---
name: pr-gate
description: "PR quality gate: review+test+security three-in-one"
triggers:
  - keyword: "pr-gate|quality gate"
---
MARKDOWN
## Execution Flow

1. Call code-review (code review)
2. Call test-runner (run tests)
3. Call security-scan (security scan)
4. Aggregate results from all three
5. Output merge recommendation:
   - All three pass → ✅ Recommend merge
   - Any 🔴 → ❌ Do not recommend merge
   - Only 🟡 → ⚠️ Merge after fixes

Bob commented: "A single Skill is a tool, composed Skills are a pipeline — the power of a pipeline far exceeds the simple sum of individual tools."


❓ FAQ

Q Can Skills directly call each other?
A Depends on platform. Claude Code supports describing call logic in prompts; OpenCode requires manual orchestration. The core is data passing, not function calling.
Q How to maintain overly complex compositions?
A Limit nesting depth ≤2, composition Skills ≤5. Beyond that, consider splitting into independent workflows or using dedicated orchestration tools.
Q What if one Skill fails in a chain?
A Critical path (review, test) failure stops everything; non-critical path (docs, notifications) failure logs and continues. Use error classification to decide.

📖 Summary


📝 Exercises

  1. Basic (⭐): Create a simple skill chain connecting code-review and test-runner Skills.
  2. Intermediate (⭐⭐): Create a PR quality gate Skill that runs review, test, and security scan in parallel, then aggregates results.
  3. Advanced (⭐⭐⭐): Design a smart orchestration system that auto-selects which Skills to execute based on change type, handling mid-step failures and retries.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏