actions
O que ela faz
Esta skill explica como criar actions em um aplicativo Agent-Native. Actions são operações compartilhadas que o agente chama como ferramentas e que as telas chamam por meio de hooks. É para desenvolvedores que criam ou ampliam esses aplicativos.
Quando usar
- ✓Quando você está acrescentando uma nova operação que tanto o agente quanto as telas precisam.
- ✓Quando você está conectando um aplicativo a uma API externa.
- ✓Quando você está configurando a busca de dados para uma tela de um aplicativo Agent-Native.
Link da skill
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/actions/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Pode criar uma action que busque minhas faturas em aberto na API de cobrança e as mostre no painel?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente verifica primeiro se já existe uma action adequada. Se nenhuma servir, escreve uma nova action que o agente e o frontend podem chamar, sem uma rota web separada.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Agent Actions
Rule
Actions in actions/ are the single source of truth for app operations. The agent calls them as tools, the frontend calls them through useActionQuery / useActionMutation, and the framework owns the HTTP transport behind those hooks — no duplicate /api/ routes.
Before creating any custom route for app data, check actions/ and the action table in AGENTS.md. An action already exists? Call it directly. Missing? Create or update a defineAction. Stop trigger: about to add a file under server/routes/api/ (or middleware to guard one)? Check it against the exception list in Custom /api/ Routes below first — even if you already started the route.
Keep Actions Deterministic
An action may call a provider API, validate data, and persist records without being an AI feature — keep it deterministic, focused, and independently useful to the agent. Don't put LLM calls or a second model runtime in app actions.
The sanctioned model-backed exception is @agent-native/core/decisions for capability-aware classification and scoring, and it returns a result without performing or authorizing the selected action.
When a workflow is research, analysis, generation, recommendation, or synthesis — or spans several provider calls and writes — route it to the AgentSidebar via sendToAgentChat({ openSidebar: true }) and let the agent orchestrate focused actions instead of hiding an AI-shaped workflow behind one opaque generate-*/create-* action just because its implementation happens to be deterministic.
How to Create an Action
One action per file, default-exported. The filename is the action name (kebab-case): actions/list-meals.ts is the list-meals action. Don't put several defineActions as named exports in one file — the registry keys actions by filename and only the default export is registered, so extra named exports never become callable and won't match .generated/action-types.d.ts.
// actions/list-meals.ts
import { z } from "zod";
import { defineAction } from "@agent-native/core/action";
import { getDb } from "../server/db/index.js";
import { meals } from "../server/db/schema.js";
export default defineAction({
description: "List all meals",
schema: z.object({}),
http: { method: "GET" },
run: async () => {
const db = getDb();
const rows = await db.select().from(meals);
return rows; // Return objects/arrays, NOT JSON.stringify()
},
});
schema (Zod or Standard Schema-compatible) gives runtime validation, TS inference for run() args, and an auto-generated JSON Schema for the tool. Write it so an agent can call the tool correctly on the first try: .describe() every param and state enum values and the default in that text (z.enum(["open","closed"]).default("open").describe('Filter status: "open" or "closed"; defaults to "open"')); mark a field .optional() only when the action truly tolerates its absence — a silent default the caller cannot see is a required field in disguise; name the primary id the same way across a family (create-/get-/update-/delete-<thing> all take id, not a mix of id and <thing>Id), and if one action must differ, accept both with .or(); give nested objects a real schema, never a prose description; keep the one-line description complete enough to call the tool without a second lookup, because compact catalogs and tool-search show only that line. Use z.coerce.number() for numeric HTTP params, but write an explicit boolean parser instead of z.coerce.boolean(), which treats "false" as truthy.
Use Drizzle's PostgreSQL query builder, not raw SQL/getDbExec() or direct driver imports, unless Drizzle can't express the query. Never hardcode API keys/tokens/secrets - read via readAppSecret / resolveCredential / OAuth helpers; process.env is deploy-level config only.
Decision order: existing action → extend/create a defineAction → custom route as last resort (Custom /api/ Routes below). Actions are already callable by agents, CLIs, hooks, HTTP, and MCP/A2A — don't wrap them in an umbrella REST API.
Keep the Action Surface Small and Orthogonal
Every agent-exposed action is a tool in the model's context window; more tools degrades tool-selection quality. Add the fewest, most orthogonal actions that cover the capability.
- One orthogonal
updateper resource, not one per field —update-<thing>taking an optional-fields patch, notupdate-<thing>-name+ `update-<t
Perguntas frequentes
Por que não escrever uma rota de API separada?
A action já fornece o endpoint web, então uma rota duplicada seria uma segunda fonte de verdade.
As actions devem usar modelos de IA?
A skill diz para manter as actions determinísticas e enviar o trabalho guiado por modelo para a barra lateral do agente.
Onde as actions ficam guardadas?
Elas ficam na pasta actions do aplicativo.
Detalhes
Descrição original do autor
How to create and run agent actions. Actions are the single source of truth for app operations — the agent calls them as tools and frontend code calls them through client hooks. Use when creating a new action, adding an API integration, or wiring up frontend data fetching.
repo: BuilderIO/agent-native
Popularidade
- Estrelas no GitHub
- 7,6 mil
- Posição no ranking
- #13129
- Licença
- MIT
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
design-exploration
7,6 milAjuda seu agente a explorar várias direções de design de interface lado a lado, deixar você escolher uma e depois refinar o design escolhido.
visual-edit
7,6 milAjuda seu agente a abrir um aplicativo local em execução em um editor visual, para que você possa revisar e editar as telas reais juntos.
turn-into-app
7,6 milTransforma um fluxo de trabalho, uma planilha ou um projeto em um aplicativo visual bem acabado, com telas preenchidas e um agente trabalhando por trás dos controles.
visual-plan
7,6 milTransforma um plano em texto simples em um plano visual interativo, com diagramas, mapas de arquivos, trechos de código e perguntas em aberto.
Skills parecidas
diffs
394 milPermite que seu agente gere um diff real e compartilhável das edições, como link de visualização ou arquivo de imagem, em vez de um resumo escrito à mão.
coding-agent
394 milAjuda seu agente a passar um trabalho grande de programação para o Codex, Claude Code ou OpenCode em segundo plano e acompanhar o andamento.
gh-issues
394 milAjuda seu agente a encontrar issues do GitHub, escolher quais resolver e abrir pull requests com correções, acompanhando os comentários de revisão.