# Skill Composition

> Compose skills into chains and workflows with explicit contracts: declare the producer-consumer edges between skills, verify artifact compatibility at each edge, and keep the chain inside a declared budget.

- Skill: `quantumquirkxyz/skill-composition` (Agent Skill)
- Install (CLI): `npx get-skill add quantumquirkxyz/skill-composition`
- Raw SKILL.md: https://api.skillmd.com/api/skills/quantumquirkxyz/skill-composition/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Finance & Business
- License: MIT
- Author: quantumquirkxyz (https://skillmd.com/u/quantumquirkxyz)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/quantumquirkxyz/skill-composition

---


## Contract

Repository audit chains may use `code-review` as the producer and hand its `RepositoryAuditArtifact` to `diagnosing-bugs`, `testing`, `project-viability`, architecture review, or a specialist audit. Verify the artifact schema and preserve finding classification at every edge.

- Input: an ordered skill chain with declared edges and a budget.
- Output: a `SkillChainReport` with per-edge evidence, artifacts produced, and budget spent.
- Scope: the chain runs only the declared skills in the declared order. An edge that fails its compatibility check stops the chain before execution.
- Rule: every handoff is an artifact handoff (see `artifact-handoff`). A skill that "just knows" what the previous skill produced is a broken edge.

## Procedure

1. **Declare the chain.** List the skills in order and, for each edge, the artifact the producer emits and the input the consumer declares. Use `analyze-artifacts` to check spec/plan/ticket agreement across the chain.
2. **Verify edges.** Before running, check each edge: the producer's declared `outputs` satisfy the consumer's declared `inputs`. An incompatible edge is a design error, not a runtime error.
3. **Budget.** Declare the chain budget (iterations, wall time, cost) and track it per edge (see `loop-budget`).
4. **Execute.** Run each skill in order, persisting each artifact with provenance. After each skill, record the edge evidence in the report.
5. **Close.** Emit the `SkillChainReport` with the final artifact, the budget spent, and the next consumer.

## Provenance

| Question | Answer |
|---|---|
| What is the source of truth? | The declared chain, the per-edge artifact contracts, and the chain budget |
| What is in scope? | Declare, verify edges, budget, execute in order, close with evidence |
| What is explicitly out of scope? | Running undeclared skills, reordering edges, or spending past the budget |
| Who or what consumes this artifact afterward? | The next skill in the workflow or the user receiving the final artifact |
| What evidence proves it is done? | SkillChainReport with per-edge compatibility evidence and budget spent |
| What risk remains? | An implicit edge that "just knows" the previous output without a contract |

## Artifact

`SkillChainReport` with `status`, `chain`, `edges`, `artifacts`, `budgetSpent`, `nextConsumer`, and `riskRemaining`.

## Reference

- The canonical prompt for this skill is versioned at `.agents/skills/prompts/skill-composition/v1.md` (prompt version 1.0).
- Governing skills: see the dependencies in the frontmatter for the skills this one composes with.

Every execution is traced via `record-execution.mjs`. The trace includes traceId, spanId, model tier, duration, tool calls, and quality score.

## Rationale

Skills chained by assumption drift: each step reinterprets the previous output until the workflow silently diverges. Declared producer-consumer edges with per-edge artifact compatibility checks turn a fragile sequence into a verifiable chain.

## Completion

- Every edge passed its compatibility check before execution.
- Every artifact carries provenance and satisfies its consumer's declared inputs.
- The chain stayed inside its declared budget, or stopped with `budget-exceeded`.
- No approval is required for composition itself: it only coordinates declared skills inside their own budgets, and each skill's own approval gates still apply.

## Failure modes

- Implicit edges: skills chained by assumption rather than by declared artifact contracts.
- Budget drift: the chain budget is spent on early edges and the final skill runs degraded; check the budget at every edge.
- Cycle: a chain that routes back to an earlier skill; the dependency graph (`skill-dependency-graph`) must stay a DAG.

---
@include .agents/skills/platform/contract-base.xml

