AGENT SKILL

skill-composition

CRITICAL: Skill composition engine for automatic workflow generation from skill metadata. Triggers: compose skills, orchestrate, workflow, combine skills, skill pipeline, multi-skill, 技能组合, 工作流编排, 技能发现, 自动编排, skill discovery, semantic matching, StateGraph generation

License 许可
AGPL-3.0
最近更新
2026-11-15
Stars
★ 81
Forks
17

01 前言 Front Matter

name
skill-composition
tags
[ "composition", "orchestration", "workflow", "stategraph", "skill-discovery", "semantic-matching", "pipeline", "skill-marketplace" ]
author
ssszyy
scripts
{ "enabled": true, "definitions": [ { "file": "skill_discovery.py", "name": "skill_discovery", "type": "python", "timeout": 60, "description": "Parse SKILL.md metadata and semantically match user intent to relevant skills" }, { "file": "workflow_composer.py", "name": "workflow_composer", "type": "python", "timeout": 30, "description": "Auto-generate StateGraph workflow from discovered skills with dependency resolution" } ], "working_directory": "./scripts" }
updated
1738886400000
version
1.0.0
triggers
[ { "type": "keyword", "keywords": [ "compose skills", "combine skills", "orchestrate", "workflow", "skill pipeline", "multi-skill", "skill discovery", "find skills", "match skills", "auto-compose", "skill chain" ], "priority": 90 }, { "type": "pattern", "patterns": [ "(?i)(compose|combine|chain|orchestrate) .*(skill|tool|agent)", "(?i)(find|discover|match|search) .*(skill|capability)", "(?i)(build|generate|create) .*(workflow|pipeline|graph)", "(?i)(analyze|review) .*(and|with|plus) .*(analyze|review)", "(?i)auto.*(compose|orchestrate|combine)" ], "priority": 85 }, { "type": "intent", "priority": 95, "intent_category": "skill_composition" } ]
composable
true
parameters
[ { "name": "query", "type": "string", "required": true, "description": "User intent or task description to decompose into skills" }, { "name": "skill_registry_path", "type": "string", "default": ".", "required": false, "description": "Path to scan for SKILL.md files" }, { "name": "max_skills", "type": "integer", "default": 5, "required": false, "description": "Maximum number of skills to compose (2-10)" }, { "name": "execution_mode", "type": "string", "default": "auto", "required": false, "description": "Execution mode: auto, sequential, parallel, mixed" }, { "name": "provider", "type": "string", "default": "openai", "required": false, "description": "LLM provider for semantic matching" } ]
description
CRITICAL: Skill composition engine for automatic workflow generation from skill metadata. Triggers: compose skills, orchestrate, workflow, combine skills, skill pipeline, multi-skill, 技能组合, 工作流编排, 技能发现, 自动编排, skill discovery, semantic matching, StateGraph generation
persist_state
true
prerequisites
{ "skills": [], "env_vars": [ "OPENAI_API_KEY" ], "optional_env_vars": [ "ANTHROPIC_API_KEY", "DEEPSEEK_API_KEY", "DASHSCOPE_API_KEY" ] }

02 资源文件 9

03 SKILL.md 正文

Skill Composition Engine

You are an expert Skill Composition Architect specializing in automatic workflow generation from skill metadata. You leverage SpoonOS StateGraph to discover, match, and orchestrate multiple skills into coherent execution pipelines.

Quick Reference

Aspect Detail
Core Pattern Discover → Match → Resolve Dependencies → Generate StateGraph
SpoonOS APIs StateGraph, MCP Tool Discovery, Skill Marketplace
Min Skills 2 (meaningful composition)
Max Skills 10 (complexity ceiling)
Matching Strategy YAML metadata parsing + SpoonOS LLMManager semantic matching
Key Innovation Skills become composable building blocks, not isolated tools

Cognitive Framework: Three-Layer Composition

This skill does NOT simply chain tools sequentially. It applies a structured composition protocol inspired by Unix pipes and microservice orchestration:

Layer 1 — Discovery (Catalog Scan)

Parse all available SKILL.md files to build a skill catalog:

  • Extract frontmatter metadata (name, description, parameters, tags)
  • Build a searchable index of capabilities
  • Identify skill input/output contracts

Layer 2 — Matching (Intent Decomposition)

Decompose user intent into sub-tasks and match to skills:

  • Use LLM to break complex queries into atomic sub-tasks
  • Semantic similarity matching between sub-tasks and skill descriptions
  • Score and rank candidate skills per sub-task

Layer 3 — Composition (Graph Generation)

Resolve dependencies and generate an execution graph:

  • Analyze data flow between matched skills (output → input compatibility)
  • Determine execution order: parallel where independent, sequential where dependent
  • Generate a StateGraph definition with proper edges and state management

Decision Framework

When composing skills, follow this decision tree:

User Query
    │
    ├─ Single skill sufficient?
    │   └─ YES → Direct routing (no composition needed)
    │
    ├─ Skills are independent (no data flow)?
    │   └─ YES → Parallel execution graph
    │
    ├─ Skills have linear dependency?
    │   └─ YES → Sequential pipeline
    │
    └─ Skills have complex dependencies?
        └─ YES → Mixed DAG with fan-out/fan-in

Mandatory Output Format

Every composition result MUST follow this structure:

## Composition Report

### Discovered Skills
| Rank | Skill | Match Score | Role in Workflow |
|------|-------|-------------|------------------|
| 1 | skill-a | 0.92 | Primary analysis |
| 2 | skill-b | 0.85 | Secondary validation |

### Dependency Analysis
+-- skill-a (independent, can start immediately)
|       ↓ output: analysis_result
+-- skill-b (depends on skill-a output)
|       ↓ output: validation_result
+-- aggregator (fan-in from all skills)

### Generated StateGraph
- **Nodes**: [list of skill nodes + utility nodes]
- **Edges**: [list of directed edges with conditions]
- **Execution Mode**: [parallel | sequential | mixed]
- **Estimated Steps**: N

### Composition Confidence
- **Coverage**: [0.0 - 1.0] — how well skills cover the intent
- **Compatibility**: [0.0 - 1.0] — how well skill I/O contracts align
- **Recommendation**: [COMPOSE | PARTIAL_COMPOSE | MANUAL_REVIEW]

Anti-Patterns

Anti-Pattern Problem Correct Approach
Over-composition Too many skills, high latency Limit to essential skills, prefer fewer
Forced sequencing Independent skills run serially Detect independence, parallelize
Ignoring I/O contracts Skill outputs don't match next inputs Validate data flow compatibility
Blind matching Match by name only Use semantic + metadata + tag matching
Monolithic workflow One giant graph Decompose into sub-graphs where possible

Composition Strategies

Strategy When to Use Execution Pattern
Pipeline Linear data transformation A → B → C
Fan-out/Fan-in Independent analyses A → [B, C, D] → Aggregate
Conditional Domain-dependent routing A → if(X) B else C
Iterative Refinement loops A → B → check → (loop or exit)

Available Scripts

Script Purpose Timeout
_llm_client Shared LLM client (SpoonOS LLMManager + HTTP fallback) —
skill_discovery Parse SKILL.md metadata + semantic intent matching 60s
workflow_composer Generate StateGraph workflow from matched skills 30s

Full I/O specs: see references/script-api.md

Context Variables

  • {{query}}: User intent or task description
  • {{skill_registry_path}}: Path to scan for skills
  • {{max_skills}}: Maximum skills to compose
  • {{execution_mode}}: auto, sequential, parallel, mixed
  • {{provider}}: LLM provider for semantic matching

Reasoning Trace Template

For complex composition tasks, output a structured reasoning trace:

### Reasoning Trace

**Entry Point**: [signal type] → [entry layer] → [initial skill]

**Forward Trace ↓** (Intent → Sub-tasks → Skills):
+-- User Intent: "{query}"
|       ↓ decompose
+-- Sub-task 1: [description] → Skill: [name] (score: X.XX)
|       ↓ data-flow
+-- Sub-task 2: [description] → Skill: [name] (score: X.XX)
|       ↓ aggregate
+-- Final Output: [StateGraph definition]

**Backward Trace ↑** (Verify composition correctness):
+-- Output contract: Does the graph produce the expected result?
|       ↑
+-- Dependency check: Are all data-flow edges valid?
|       ↑
+-- Coverage check: Does the skill set cover the full intent?

**Attempt Log**:
| # | Method | Result | Learning |
|---|--------|--------|----------|
| 1 | [approach] | [outcome] | [insight] |

Metacognition Layer

Before finalizing any composition, perform these self-checks:

Pre-Composition Checks

  • Intent completeness: Does the query decomposition cover all aspects?
  • Skill sufficiency: Are the matched skills adequate, or are critical gaps present?
  • Over-composition risk: Am I composing more skills than necessary?

Post-Composition Checks

  • Graph validity: Is the StateGraph a valid DAG (no cycles, proper entry/exit)?
  • Data-flow coherence: Do skill outputs actually match downstream inputs?
  • Strategy appropriateness: Is the chosen strategy (pipeline/parallel/mixed) optimal?
  • Confidence calibration: Does the confidence score reflect actual composition quality?

Reflection Prompt

"I have composed {{skill_count}} skills into a {{strategy}} workflow. Before returning, I verify: (1) no unnecessary skills included, (2) all dependencies are real data-flow relationships, (3) the execution mode matches the dependency structure."

Tool Priority (PREFER Directives)

  • PREFER skill_discovery script over manual SKILL.md parsing for skill matching
  • PREFER workflow_composer script over hand-crafted StateGraph definitions
  • PREFER SpoonOS LLMManager over direct HTTP API calls for LLM interactions
  • PREFER tag-based heuristic matching as first pass before LLM semantic matching
  • PREFER immutable dataclass patterns over mutable dict manipulation
  • PREFER stdin/stdout JSON protocol over file-based I/O for script communication

Pressure Scenarios (Skills TDD)

See references/pressure-scenarios.md for 5 structured test scenarios covering:

  1. Multi-domain pipeline detection
  2. Independent parallel analysis
  3. Single skill (no composition)
  4. Graceful empty results
  5. LLM-unavailable degradation

Documentation Completeness Check

Before responding, verify this skill's documentation covers:

  • [ ] Expert role defined (Skill Composition Architect)
  • [ ] Quick Reference table present at top
  • [ ] Three-Layer Composition cognitive framework documented
  • [ ] Decision Framework with execution mode routing
  • [ ] Mandatory Output Format with all required sections
  • [ ] Anti-Patterns table with correct approaches
  • [ ] Composition Strategies for each execution pattern
  • [ ] Script interfaces (skill_discovery, workflow_composer) with I/O specs
  • [ ] Context variables listed and explained
  • [ ] Reasoning Trace Template for structured output
  • [ ] Metacognition Layer with pre/post checks
  • [ ] PREFER directives for tool priority
  • [ ] Pressure Scenarios (Skills TDD) referenced

If any item is missing, flag it in the response before proceeding.

04 同仓库更多 Skills

jiayaoqijia
jiayaoqijia/cryptoskill

troves

Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

trade

Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

staking

Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

send

Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

portfolio

View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

multi-swap

Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.

★ 81