Skip to content
VoltAgent Best Practices

VoltAgent Best Practices Skill

VoltAgent's official conventions skill — when to reach for an agent versus a workflow, the expected project layout, and the core snippets for agents, workflows, memory and servers.

GitHub Docs

Install

Install with the skills CLI

One command for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf and dozens of other agents. Needs Node.js; the skill is fetched straight from VoltAgent/skills.

$ npx skills add VoltAgent/skills --skill voltagent-best-practices

Run it in a terminal. The CLI finds the agents installed on your machine, asks which ones to add the skill to, and whether to install it into the folder you ran it from or for all your projects.

Other ways to install

  1. Open the skill on GitHub and download the folder that holds its SKILL.md.
  2. Put it at ~/.claude/skills/voltagent-best-practices/, where Claude Code picks it up in every project.

No scripts or references next to it? Saving the SKILL.md alone as ~/.claude/skills/voltagent-best-practices/SKILL.md works too.

Using another agent? Its personal skills folder
Codex
~/.agents/skills/
Cursor
~/.cursor/skills/
GitHub Copilot
~/.copilot/skills/
Gemini CLI
~/.gemini/skills/
Windsurf
~/.codeium/windsurf/skills/
OpenCode
~/.config/opencode/skills/

About

  • Agent vs workflow decision table — adaptive reasoning against explicit control flow
  • Canonical src/ layout with agents/, tools/ and workflows/
  • Agent construction with the provider/model string format spelled out
  • createWorkflowChain pipelines typed with Zod input and result schemas
  • VoltAgent bootstrap registering agents and workflows behind honoServer()
  • Memory, server and observability conventions in one reference

VoltAgent is a TypeScript framework for building AI agents and multi-step workflows, with its own memory, server and observability pieces. This is the vendor's own conventions skill: a compact reference an agent loads before writing VoltAgent code, so what it produces looks like the framework's documentation rather than an approximation of it.

The decision it makes first

Agent or workflow. An Agent is for open-ended tasks where the model picks tools and reasons adaptively; a workflow is for multi-step pipelines with explicit control flow and suspend/resume. Getting this backwards produces either an agent asked to follow a rigid script or a workflow trying to improvise, and it is the single most common structural mistake in a new VoltAgent project.

Layout and snippets

The expected shape is src/index.ts with agents/, tools/ and workflows/ beside it. From there the skill carries the canonical snippets: constructing an Agent from @voltagent/core with name, instructions and a provider/model string (openai/gpt-4o-mini, anthropic/claude-3-5-sonnet — the slash format is a detail models routinely get wrong); building a typed pipeline with createWorkflowChain and Zod schemas for input and result; and the VoltAgent bootstrap that registers agents and workflows behind honoServer().

The rest covers memory, server configuration and observability conventions.

Where it fits

It is one of four skills in VoltAgent's official pack, alongside create-voltagent for project setup, voltagent-core-reference for the VoltAgent class options and lifecycle methods, and voltagent-docs-bundle, which reads the version-matched docs embedded in @voltagent/core so answers track the version you actually installed rather than whatever the model remembers.

MIT licensed. Install with npx skills add VoltAgent/skills, or clone the repository and point your agent at the directory.

SKILL.md

The instructions your agent loads, as published by VoltAgent.

SKILL.md
name
voltagent-best-practices # prettier-ignore
description
VoltAgent architectural patterns and conventions. Covers agents vs workflows, project layout, memory, servers, and observability.
license
MIT
metadata
author: VoltAgent version: "1.0.0" repository: https://github.com/VoltAgent/skills

VoltAgent Best Practices

Quick reference for VoltAgent conventions and patterns.

---

Choosing Agent or Workflow
UseWhen
AgentOpen-ended tasks that require tool selection and adaptive reasoning
WorkflowMulti-step pipelines with explicit control flow and suspend/resume

---

Layout
src/
|-- index.ts
|-- agents/
|-- tools/
`-- workflows/

---

Quick Snippets
Basic Agent
import { Agent } from "@voltagent/core";

const agent = new Agent({
  name: "assistant",
  instructions: "You are helpful.",
  model: "openai/gpt-4o-mini",
});

Model format is provider/model (for example openai/gpt-4o-mini or anthropic/claude-3-5-sonnet).

Basic Workflow
import { createWorkflowChain } from "@voltagent/core";
import { z } from "zod";

const workflow = createWorkflowChain({
  id: "example",
  input: z.object({ text: z.string() }),
  result: z.object({ summary: z.string() }),
}).andThen({
  id: "summarize",
  execute: async ({ data }) => ({ summary: data.text }),
});
VoltAgent Bootstrap
import { VoltAgent } from "@voltagent/core";
import { honoServer } from "@voltagent/server-hono";

new VoltAgent({
  agents: { agent },
  workflows: { workflow },
  server: honoServer(),
});

---

Memory Defaults
  • Use memory for a shared default across agents and workflows.
  • Use agentMemory or workflowMemory when defaults need to differ.

---

Server Options
  • Use @voltagent/server-hono for Node HTTP servers.
  • Use @voltagent/server-elysia as an alternative Node server provider.
  • Use serverless provider for fetch runtimes (Cloudflare, Netlify).

---

Observability Notes
  • Use VoltOpsClient or createVoltAgentObservability for tracing.
  • VoltAgent will auto-configure VoltOps if VOLTAGENT_PUBLIC_KEY and VOLTAGENT_SECRET_KEY are set.

---

Recipes

Short best-practice recipes live in the embedded docs:

  • packages/core/docs/recipes/
  • Search: rg -n "keyword" packages/core/docs/recipes -g"*.md"
  • Read: cat packages/core/docs/recipes/<file>.md

---

Footguns
  • Do not use JSON.stringify inside VoltAgent packages. Use safeStringify from @voltagent/internal.

---

Resources
  • https://voltagent.dev/docs
  • https://github.com/voltagent/voltagent
  • https://github.com/voltagent/voltagent/tree/main/examples
Install
Featured

Build crash-safe AI agents on AgentKit and step.ai — durable tool calls, human-in-the-loop approval, realtime progress, and when not to reach for an agent loop at all.

Skill: Mastra

by Mastra

Mastra's official framework skill: makes an agent check embedded docs in node_modules before writing agents, workflows, tools or memory, verify models against the provider registry, query traces with mastra api, and deploy to Mastra Platform.

Featured

Inngest's durable-execution playbook as an agent skill — steps and memoisation, event and cron triggers, idempotency, cancellation, retries and non-retriable errors.

Seven ways to throttle agent and background workloads — concurrency keys, throttling, rate limiting, debounce, singleton, priority and batching — with a decision guide that picks the right one.

Browse all skills →