Examples & Patterns

Battle-tested structures and small patterns you can steal for your own agents.

Small patterns, outsized returns. Each of these takes minutes to adopt and shows up again and again in high-performing agent setups. Full copy-paste versions live in the Examples gallery.

The patterns

Scratchpad discipline

Before touching source files, the agent writes its understanding and plan to scratch/current.md. Externalized reasoning survives context compaction, makes recovery trivial when a session derails, and gives humans something to audit. The cheapest insurance in agent work. → Full pattern

Self-critique loop

After producing an artifact, the agent switches to a reviewer persona, critiques its own output against a checklist, then applies the fixes. One extra step, consistently the biggest quality jump per token spent. → Full pattern

Phase gates

In workflows, make progression explicit: "Do not proceed to Phase 2 until scratch/analysis.md exists." Agents rush; gates stop them. See it used in Building Your First Workflow.

Tool guardrails

Wrap dangerous capabilities (shell, file writes, deploys) with allow-lists and confirmation rules defined in AGENTS.md. Prefer read-only modes by default — e.g. the Postgres MCP in restricted mode.

Progressive disclosure

Start the agent with a narrow slice of the codebase and expand access as it demonstrates understanding. Smaller context = sharper attention. The context-builder skill automates this.

Smallest verifiable task first

New setup, new model, or new skill? Run a small task with a known-correct answer before trusting it with real work. Three repeated runs reveal more than any amount of config reading.

project/
├── AGENTS.md          ← project facts, commands, rules (always loaded)
├── skills/            ← reusable instruction packages
├── workflows/         ← repeatable multi-step task definitions
└── scratch/           ← plans, analyses, handoffs (gitignore if you like)

This layout is convention, not requirement — but agents navigate it well, and every example on this site assumes it.

Where to go next

  • Copy a complete AGENTS.md and adapt it
  • Grab the handoff template if you're going multi-agent
  • Contribute your own improvements via the Members area — the best patterns here came from real sessions