Agent Builder Guide

How to assemble prompts, skills, and agents from the catalog into production-grade workflows — including IO contracts, handoff patterns, and error handling.

PromptSkillAgentWorkflow

How Agent Artifacts are structured

Every product in the catalog is a machine-readable file (Markdown, JSON, or YAML) with a defined structure. Products come in five types — prompts, skills, agents, utilities, and docs — and each type plays a distinct role in a workflow stack.

Prompt
Single-turn or multi-turn instructions. The top of the call stack.
Skill
SKILL.md modules with defined input/output schema. Callable tool units.
Agent
Orchestrated workflows with a manifest, task loop, and handoff rules.
Utility
JSON schemas, validators, and glue code between components.
Doc
Playbooks, SOP templates, and reference guides for runtime decisions.

Input/output contracts

Every skill and agent product ships with an IO contract — a JSON schema specifying the exact inputs it expects and the outputs it produces. Before connecting two products, verify their contracts are compatible.

Input contract structure
{
  "input_schema": {
    "required": ["context", "task"],
    "optional": ["tone", "max_tokens", "examples"],
    "types": {
      "context": "string",
      "task": "string",
      "tone": "enum:professional|casual|technical",
      "max_tokens": "integer"
    }
  }
}

Replace {{placeholder}} tokens in prompt files before passing to your LLM. All tokens are listed in the product's manifest section.

Composition patterns

Pattern 1: Prompt → Skill chain

Use a system prompt to establish context and persona, then invoke skills for discrete sub-tasks within the same session.

system_prompt.md        → establishes role + constraints
  ↓ call
/skill-name {input}     → discrete tool-use unit
  ↓ output
next_prompt.md          → uses skill output as context
Pattern 2: Agent orchestrator

A top-level agent manifest routes sub-tasks to specialized skills. The agent decides which skill to call based on task type.

agent-manifest.md
  ├── task: "research"    → research-skill.md
  ├── task: "draft"       → writer-skill.md
  ├── task: "review"      → qa-skill.md
  └── task: "publish"     → publish-skill.md
Pattern 3: Prompt suite → pipeline

Chain multiple system prompts in sequence, passing the output of each as the input context of the next. Use a utility schema to validate each handoff.

step-1-intake.md        → structured JSON output
  ↓ validate with io-schema.json
step-2-analysis.md      → uses JSON as context
  ↓ validate
step-3-output.md        → final formatted response

Handoff patterns

When passing output between components, use structured handoffs to avoid context drift.

Structured JSON handoff

Always request JSON output from intermediate steps. Parse and validate before passing downstream. Include a "status" field so downstream components know whether to proceed or escalate.

Context window management

Large pipelines can overflow the context window. Pass only the essential structured output from each step, not the full conversation history. Each component should be self-contained.

Role boundary enforcement

Each component in a chain should stay within its defined role. Use the system prompt to hard-constrain behavior. If a downstream component needs the upstream role, pass it as a context string, not as a new system prompt.

Explicit output format instruction

End every prompt with an explicit output format instruction. E.g. "Respond with a JSON object matching {field: type, ...}. No commentary, no markdown wrapping."

Error handling

SCHEMA_MISMATCH

Output from upstream component does not match downstream input schema. Fix: add a validation step between components or relax the downstream schema.

CONTEXT_OVERFLOW

Combined context length exceeds model limit. Fix: trim history to essential structured data, use summarization prompt before next step.

HALLUCINATED_TOOL

Model invokes a skill that does not exist or uses wrong syntax. Fix: explicitly list available skills in system prompt and use strict tool-calling mode.

RETRY_LOOP

Component fails and retries indefinitely. Fix: set explicit retry limits (typically 2–3) with exponential backoff, then escalate to human-in-the-loop or fallback response.

DISCLOSURE_MISSING

Trading product invoked without risk disclosure acknowledgement. Fix: gate all trading skill invocations behind a disclosure check — see the Trading Risk Playbook.

Next steps