Skilllibrary artifact-contracts
install
source · Clone the upstream repo
git clone https://github.com/merceralex397-collab/skilllibrary
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/05-agentic-orchestration-and-autonomy/artifact-contracts" ~/.claude/skills/merceralex397-collab-skilllibrary-artifact-contracts && rm -rf "$T"
manifest:
05-agentic-orchestration-and-autonomy/artifact-contracts/SKILL.mdsource content
Purpose
Define explicit input/output schemas for artifacts passed between agents or pipeline stages. Every producer knows exactly what shape to emit; every consumer knows exactly what shape to expect. Eliminates silent data-loss and schema drift across multi-agent workflows.
When to use
- A multi-agent workflow hands data from one stage to another and the schema is undocumented.
- An agent's output is consumed by a downstream agent and validation is missing.
- Contract versioning is needed because the artifact shape is evolving across iterations.
- A new pipeline stage is being added and its expected inputs/outputs must be specified.
Do NOT use when
- The task is a single-agent, single-step operation with no handoff.
- An existing contract file already fully covers the artifact shape (update it instead).
- The work is pure prose generation where structured schemas add no value.
Operating procedure
- Run
in the repo to find existing contract definitions.grep -r "contract" --include="*.md" --include="*.json" --include="*.yaml" - List every pipeline stage involved in the workflow in a numbered table:
.| # | Stage | Producer Agent | Consumer Agent | - For each stage boundary, write a JSON Schema or TypeScript interface defining the artifact with required fields, types, and descriptions.
- Add a
field (semver string) to every contract schema — start atversion
for new contracts.1.0.0 - Define validation rules: list which fields are required vs. optional, acceptable value ranges, and enum constraints.
- Write a
pseudocode block showing how the consumer should reject malformed input.validate_artifact(data, schema) - Create a producer/consumer pairing table:
.| Contract Name | Producer | Consumer | Version | Breaking Change Policy | - Add a
envelope to each artifact specifying_contract_meta
,schema_version
,produced_by
(ISO-8601), andproduced_at
(SHA-256 of payload).checksum - Run a dry-run validation: pick one real or sample artifact, apply the schema, and list any violations found.
- Write the final contract files to
(or the repo's equivalent directory), one file per stage boundary.contracts/
Decision rules
- If a field is consumed by any downstream agent, it is
— never silently optional.required - If two producers emit the same artifact type, unify into one schema and version it; do not fork.
- Breaking changes (removing fields, narrowing types) require a major version bump and a migration note.
- Non-breaking changes (adding optional fields) require a minor version bump.
- If a consumer receives an artifact that fails validation, it must halt and return a structured error — never silently drop fields.
Output requirements
- Contract Schema — one JSON Schema or TypeScript interface per stage boundary.
- Pairing Table — maps every producer to every consumer with version and change policy.
- Validation Report — dry-run results showing pass/fail per field for a sample artifact.
- Migration Notes — for any version bump, a list of what changed and how consumers should adapt.
References
— patterns for structuring delegation handoff.references/delegate-contracts.md
— when to checkpoint before/after artifact production.references/checkpoint-rules.md- JSON Schema specification (https://json-schema.org/) for schema authoring.
Related skills
— contracts govern what a run must produce before it can terminate.autonomous-run-control
— checkpoints often trigger contract validation.collaboration-checkpoints
— decomposed tasks need contracts at each task boundary.goal-decomposition
— verification uses contracts as the acceptance criteria.verification-before-advance
Failure handling
- Missing contract: If no contract exists for a stage boundary, create one before allowing data to flow — never infer schema from a single sample.
- Schema mismatch: If a produced artifact fails validation, block the pipeline and emit a diff showing expected vs. actual shape.
- Version conflict: If producer and consumer expect different versions, halt and surface both versions for reconciliation.
- Ambiguous ownership: If no single agent owns a contract, assign ownership explicitly before proceeding.