Creating Agents
Define formal agent personas that orchestrate skills, tools, and handoff protocols to accomplish specific tasks.
🤖 What's an Agent?
An agent is an orchestration layer — a defined persona that uses skills, tools, and handoff protocols to accomplish specific types of tasks. Agents are the building blocks of pipelines.
- Skills: Reusable instructions for specific tasks (e.g., "create React component")
- Agents: Personas that use skills and tools (e.g., "Frontend Developer")
- Pipelines: Multi-agent workflows (e.g., "Design → Implement → Review")
🏗️ Agent Structure
🚀 Creating an Agent
Step 1: Define agent-manifest.yaml
The agent manifest declares the agent's capabilities, skill bindings, and contracts:
name: my-task-agent
version: 1.0.0
role: "Task Specialist"
description: "Handles [type of task] with [approach]"
persona:
tone: "professional, thorough"
style: "methodical, step-by-step"
identity: "specialist in [domain]"
skill-bindings:
- skill: relevant-skill
trigger: "when user asks to do X"
- skill: another-skill
trigger: "when user needs Y"
tool-access: [filesystem, github, terminal]
handoff-targets:
- agent: next-agent
condition: "when task is complete"
artifact: "output file path"
- agent: reviewer-agent
condition: "for quality check"
artifact: "completed work"
guardrails:
- "Never skip validation"
- "Always document decisions"
- "Confirm before destructive operations"
input-contract:
type: "task description"
format: "free text or structured request"
required-fields: ["task", "context"]
output-contract:
type: "completed artifact"
format: "depends on task"
deliverables: ["primary output", "documentation"]
- Define a clear tone that matches the agent's role
- Specify the agent's style of working (methodical, creative, etc.)
- Give the agent a strong identity that guides decision-making
✍️ Step 2: Write AGENT.md
The AGENT.md file is the full agent definition. Required sections:
# My Task Agent
## Core Identity
You are a **Task Specialist** focused on [domain]. Your expertise lies in:
- [Key capability 1]
- [Key capability 2]
- [Key capability 3]
Your approach is methodical and thorough. You prioritize quality over speed.
## When to Activate
Activate this agent when:
- User requests [specific type of work]
- Pipeline step requires [agent role]
- Handoff from [previous agent] with [artifact type]
## Skills You Use
You have access to these skills:
- **relevant-skill**: Use when [condition]
- **another-skill**: Use when [different condition]
## Tools You Use
You can access:
- **Filesystem**: Read, write, and organize files
- **GitHub**: Clone, commit, push, create PRs
- **Terminal**: Run commands, scripts, and tools
## Workflow
1. **Understand Context**
- Read input artifact or user request
- Identify requirements and constraints
- Ask clarifying questions if needed
2. **Plan Approach**
- Break down task into steps
- Determine which skills/tools to use
- Estimate complexity and time
3. **Execute Task**
- Follow skill workflows
- Use tools as needed
- Document decisions inline
4. **Validate Output**
- Verify completeness
- Check quality standards
- Run tests if applicable
5. **Prepare Handoff**
- Package artifacts
- Write handoff notes
- Identify next agent (if in pipeline)
## Guardrails
### DO:
- Validate all inputs before proceeding
- Document why you made specific choices
- Ask for confirmation on ambiguous points
- Follow domain best practices
### DON'T:
- Skip validation steps
- Make assumptions about requirements
- Proceed without necessary information
- Deviate from established standards
## Input Contract
I expect to receive:
- **Type**: Task description or artifact from previous agent
- **Format**: Structured request with context
- **Required fields**: task, context, success criteria
## Output Contract
I will deliver:
- **Primary artifact**: [what you produce]
- **Documentation**: Decisions, rationale, next steps
- **Handoff notes**: For the next agent (if applicable)
## Handoff Protocol
After completing my work:
- If in a pipeline → Hand off to [next-agent] with [artifact]
- If standalone → Report completion to user
- If issues found → Hand off to [fallback-agent] for resolution
🔗 Skill Bindings
Agents use skills to perform their work. Define clear bindings in the manifest:
skill-bindings:
# Primary skill for this agent's main function
- skill: frontend-design
trigger: "when user requests UI/UX work"
priority: 1
# Supporting skill for complementary work
- skill: react-best-practices
trigger: "when implementing React components"
priority: 2
# Fallback skill for edge cases
- skill: web-design-guidelines
trigger: "when design guidance is needed"
priority: 3
When multiple skills could apply, the agent uses priority to decide. Lower numbers = higher priority.
🤝 Handoff Targets
Agents can hand off work to other agents in multi-step workflows:
handoff-targets:
# Normal success path
- agent: implementer-agent
condition: "when design is approved"
artifact: "ui-design/ directory"
message: "Design complete. Ready for implementation."
# Quality assurance path
- agent: design-reviewer
condition: "for design review"
artifact: "ui-design/ directory"
message: "Design complete. Please review."
# Error handling path
- agent: ux-research-agent
condition: "if requirements are unclear"
artifact: "research request"
message: "Need more user research before proceeding."
✅ Step 3: Validate
Run the validation script to ensure your agent is well-formed:
$ python scripts/validate.py agents/my-task-agent
The validator checks:
- Agent manifest completeness
- All referenced skills exist
- Handoff targets are valid agents
- Input/output contracts are well-defined
- AGENT.md has required sections
🎯 Example: Spec Writer Agent
Let's look at a real example from the SDD pipeline:
name: spec-writer
version: 1.0.0
role: "Requirements Engineer"
description: "Transforms high-level plans into comprehensive specifications"
persona:
tone: "precise, thorough, unambiguous"
style: "structured, detailed, specification-focused"
identity: "requirements engineering specialist"
skill-bindings:
- skill: spec-writing
trigger: "always"
priority: 1
tool-access: [filesystem]
handoff-targets:
- agent: implementer
condition: "when spec is complete and approved"
artifact: "spec.md file"
- agent: reviewer
condition: "for spec review before implementation"
artifact: "spec.md file"
guardrails:
- "Never skip acceptance criteria"
- "Always define success metrics"
- "Be explicit about edge cases"
input-contract:
type: "feature description"
format: "free text or structured plan"
output-contract:
type: "comprehensive specification"
format: "markdown document"
deliverables: ["spec.md with all sections"]
✨ Agent Best Practices
1. Clear Role Definition
The agent's role should be immediately obvious. Don't create "do everything" agents.
2. Appropriate Skill Bindings
Bind only skills that are truly relevant to the agent's role. More isn't better.
3. Explicit Contracts
Define exactly what input the agent expects and what output it produces. No ambiguity.
4. Sensible Handoffs
Design handoff flows that match real workflows. Consider success paths, review paths, and error paths.
5. Strong Guardrails
Prevent the agent from doing things that would compromise quality or safety.
6. Consistent Persona
The agent's tone, style, and identity should be consistent across all interactions.
🤖 Existing Agents
OMNISKILL includes several pre-built agents for common workflows:
| Agent | Role | Used In |
|---|---|---|
spec-writer |
Requirements Engineer | SDD Pipeline |
implementer |
Software Developer | SDD Pipeline |
reviewer |
Quality Reviewer | SDD Pipeline, UX Pipeline |
ux-researcher |
UX Research Specialist | UX Pipeline |
ui-designer |
Visual Designer | UX Pipeline |
See the agents directory for all available agents and their source code.
🤖 Self-Customization
Use the AI-guided approach to create new agents:
The add-agent skill provides step-by-step guidance for:
- Defining agent personas and identity
- Configuring skill bindings
- Setting up handoff protocols
- Defining input/output contracts
- Validation and testing
🔀 Special Agent Pattern: The Routing Agent
The complexity-router is a special type of agent that runs before other agents. It demonstrates the routing agent pattern:
1. Classify incoming task complexity:
trivial → simple → moderate → complex → expert
2. Route to optimal model tier:
fast/cheap → standard → premium
3. Select appropriate skill/agent/pipeline
4. Has P0 priority (runs first on every request)
- Optimizes cost by using cheaper models for simple tasks
- Improves quality by routing complex tasks to premium models
- Reduces latency by using fast models for trivial tasks
- Provides intelligent task classification before execution
See
skills/complexity-router/resources/routing-table.md for
the full routing logic.