Creates an agent skill with proper execution loop, stop criteria, and safety patterns. Use when the user wants to create an agent, build autonomous behavior for Claude, or says /agent.
Creates an agent skill — a skill that defines autonomous, goal-driven behavior with an execution loop and clear stop criteria.
Before creating an agent, confirm it's the right pattern:
| Pattern | Use when... | Example |
|---|---|---|
| Workflow | Steps are predictable and linear | Commit flow, deploy pipeline, audit checklist |
| Knowledge Base | Claude needs context, not instructions | Architecture docs, domain concepts |
| Operational | Integrating with a specific tool/service | Jira, PostgreSQL, Firebase |
| Agent | Behavior adapts based on what it discovers | Debugging, code review, refactoring |
Agent indicators:
Not an agent if:
Ask the user:
| Level | Description | Confirms before... | Example |
|---|---|---|---|
| Read-only | Observes and reports, never modifies | N/A — no modifications | Audit, analysis, review |
| Guided | Proposes actions, waits for approval | Every action | Refactoring assistant, migration helper |
| Semi-autonomous | Acts freely within safe boundaries, confirms risky actions | Destructive or irreversible actions | Test runner, formatter |
| Autonomous | Acts freely toward the goal | Nothing — full trust | CI pipeline, batch processor |
Default to Guided unless the user explicitly requests more autonomy.
Before generating, scan the project:
AGENTS.md — Understand conventions and stack~/.codex/skills/ — Avoid duplicating existing agentsEvery agent has a loop. Design it explicitly:
┌─→ Observe (gather information)
│ ↓
│ Analyze (interpret what was found)
│ ↓
│ Decide (choose next action or stop)
│ ↓
│ Act (execute the chosen action)
│ ↓
│ Verify (check the result)
│ ↓
└── Loop back or Stop
For each phase, define:
Every agent MUST have explicit stop criteria. Without them, it loops forever.
Success stops:
Failure stops:
Safety stops:
Based on the autonomy level:
Read-only agents:
allowed-tools restricts to Read, Glob, GrepWrite, Edit, or Bash in allowed-toolsGuided agents:
Write, Edit, Bash but must present changes before applyingSemi-autonomous agents:
unused.ts — OK?"Autonomous agents:
Structure:
---