Agent skill

Mastra Hono

by jwynia in jwynia/agent-skills

Develop AI agents, tools, and workflows with Mastra v1 Beta and Hono servers.

MITAuto-check passedFrontend & Design

Install Mastra Hono

skills CLI
$ npx skills add jwynia/agent-skills --skill mastra-hono -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jwynia/agent-skills mastra-hono --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jwynia/agent-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/tech/ai/mastra-hono .claude/skills/mastra-hono && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mastra-hono
GitHub stars
170
Token cost
~2.9k tokens
SKILL.md length
485 words
Files
22 (incl. scripts, references, assets)
Skills in repo
111
Repo updated
First seen
Licence
MIT

At a glance

Develop AI agents, tools, and workflows with Mastra v1 Beta and Hono servers.

  • Tasks that involve Forms and validation
  • SKILL.md covers When to Use This Skill, Prerequisites, Quick Start and Core Patterns, plus 5 more sections
  • Runs TypeScript scripts from its folder; calls deno and npm

What it does

Mastra Hono is an agent skill from jwynia/agent-skills. Develop AI agents, tools, and workflows with Mastra v1 Beta and Hono servers. This skill should be used when creating Mastra agents, defining tools with Zod schemas, building workflows with step data flow, setting up Hono API servers with Mastra adapters, or implementing agent networks. Keywords: mastra, hono, agent, tool, workflow, AI, LLM, typescript, API, MCP.

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 24 other files, including scripts, reference files and assets (for example `assets/agent-template.ts`, `assets/hono-server-template.ts` and `assets/tool-template.ts`). Compatibility notes: Node.js 22.13.0+ required for v1 Beta

It sits in Frontend & Design, covering Forms and validation. It works with Hono, Mastra, Model Context Protocol and Zod. The licence is MIT.

When your agent uses it

  • Tasks that involve Forms and validation

Example prompts

  • “/mastra-hono”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): Node.js 22.13.0+ required for v1 Beta

What it can do on your machine

Read from SKILL.md and the folder at commit e02ec7e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (TypeScript, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • deno
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • mastra.ai
    • hono.dev
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Node.js 22.13.0+ required for v1 Beta

    From compatibility in the SKILL.md frontmatter.

Context cost

Mastra Hono loads about 2.9k tokens when it runs, and up to ~34k if it reads all its reference files. Until then it costs about 94 tokens; SKILL.md has 485 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~94
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~34k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jwynia/agent-skills at commit e02ec7e, republished under its MIT licence (© jwynia). 485 words, ~2,875 tokens.

Download SKILL.mdSave it as .claude/skills/mastra-hono/SKILL.md (or your agent's skills folder). This skill also uses 21 other files; get the full folder from GitHub.
name
mastra-hono
description
Develop AI agents, tools, and workflows with Mastra v1 Beta and Hono servers. This skill should be used when creating Mastra agents, defining tools with Zod schemas, building workflows with step data flow, setting up Hono API servers with Mastra adapters, or implementing agent networks. Keywords: mastra, hono, agent, tool, workflow, AI, LLM, typescript, API, MCP.
compatibility
Node.js 22.13.0+ required for v1 Beta
license
MIT
metadata.author
agent-skills
metadata.version
1.0
metadata.type
utility
metadata.mode
assistive
metadata.domain
development

Mastra + Hono Development

Build production-ready AI agents, tools, and workflows using Mastra v1 Beta with Hono API servers. This skill covers the complete stack from agent definition to deployment.

Target version: Mastra v1 Beta (stable release expected January 2026)

When to Use This Skill

Use when:

  • Creating Mastra agents with tools and memory
  • Defining tools with Zod input/output schemas
  • Building workflows with multi-step data flow
  • Setting up Hono API servers with Mastra adapters
  • Implementing agent networks for multi-agent collaboration
  • Authoring MCP servers to expose agents/tools
  • Integrating RAG and conversation memory

Do NOT use when:

  • Working with Mastra stable (0.24.x) - patterns differ significantly
  • Building non-AI web APIs (use Hono directly)
  • Simple LLM calls without agents/tools

Prerequisites

  • Node.js 22.13.0+ (required for v1 Beta)
  • Package manager: npm, pnpm, or bun
  • API keys: OpenAI, Anthropic, or other supported providers
bash
# Install v1 Beta packages
npm install @mastra/core@beta @mastra/hono@beta
npm install @ai-sdk/openai  # or other provider
npm install zod hono @hono/node-server

Quick Start

Minimal Agent + Tool + Hono Server
typescript
// src/mastra/tools/weather-tool.ts
import { createTool } from "@mastra/core/tools";
import { z } from "zod";

export const weatherTool = createTool({
  id: "get-weather",
  description: "Fetches current weather for a location",
  inputSchema: z.object({
    location: z.string().describe("City name, e.g., 'Seattle'"),
  }),
  outputSchema: z.object({
    temperature: z.number(),
    conditions: z.string(),
  }),
  // v1 Beta signature: (inputData, context)
  execute: async (inputData, context) => {
    const { location } = inputData;
    const { abortSignal } = context;

    if (abortSignal?.aborted) throw new Error("Aborted");

    // Fetch weather data...
    return { temperature: 72, conditions: "sunny" };
  },
});
typescript
// src/mastra/agents/weather-agent.ts
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";
import { weatherTool } from "../tools/weather-tool.js";

export const weatherAgent = new Agent({
  name: "weather-agent",
  instructions: "You are a helpful weather assistant.",
  model: openai("gpt-4o-mini"),
  tools: { weatherTool },  // Object, not array
});
typescript
// src/mastra/index.ts
import { Mastra } from "@mastra/core/mastra";
import { weatherAgent } from "./agents/weather-agent.js";

export const mastra = new Mastra({
  agents: { weatherAgent },
});
typescript
// src/index.ts
import { serve } from "@hono/node-server";
import { Hono } from "hono";
import { MastraServer } from "@mastra/hono";
import { mastra } from "./mastra/index.js";

const app = new Hono();
const server = new MastraServer({ app, mastra });
await server.init();

app.get("/", (c) => c.text("Mastra + Hono Server"));

serve({ fetch: app.fetch, port: 3000 });
console.log("Server running at http://localhost:3000");
// Agent endpoint: POST /api/agents/weather-agent/generate

Core Patterns

Agent Definition
typescript
import { Agent } from "@mastra/core/agent";

const agent = new Agent({
  name: "my-agent",                           // Required: unique identifier
  instructions: "You are a helpful assistant.", // Required: system prompt
  model: openai("gpt-4o-mini"),               // Required: LLM model
  tools: { weatherTool, searchTool },         // Optional: object with named tools
});

// Model routing (1113+ models from 53 providers)
model: "openai/gpt-4o-mini"
model: "anthropic/claude-3-5-sonnet"
model: "google/gemini-2.5-flash"

// Model fallbacks for resilience
model: [
  { model: "anthropic/claude-3-opus", maxRetries: 3 },
  { model: "openai/gpt-4o", maxRetries: 2 },
  { model: "google/gemini-pro", maxRetries: 1 },
]

// Agent execution with memory
const response = await agent.generate("Remember my name is Alex", {
  memory: {
    thread: "conversation-123",   // Isolates conversation
    resource: "user-456",         // Associates with user
  },
});
Tool Signatures (v1 Beta - CRITICAL)
typescript
// v1 Beta: execute(inputData, context)
execute: async (inputData, context) => {
  const { location } = inputData;  // First parameter: parsed input
  const { mastra, runtimeContext, abortSignal } = context;  // Second: context

  // Access nested agents via mastra
  const helper = mastra?.getAgent("helperAgent");

  // Always check abort signal for long operations
  if (abortSignal?.aborted) throw new Error("Aborted");

  return { temperature: 72, conditions: "sunny" };
}

// WRONG for v1 Beta:
execute: async ({ context }) => { ... }  // This is stable 0.24.x signature
Workflow Data Flow (CRITICAL)

This is where most errors occur. See references/workflow-data-flow.md for complete patterns.

typescript
import { createWorkflow, createStep } from "@mastra/core/workflows";

const step1 = createStep({
  id: "step-1",
  inputSchema: z.object({ message: z.string() }),
  outputSchema: z.object({ formatted: z.string() }),
  execute: async ({ inputData }) => {
    // inputData = workflow input (for first step)
    return { formatted: inputData.message.toUpperCase() };
  },
});

const step2 = createStep({
  id: "step-2",
  inputSchema: z.object({ formatted: z.string() }),  // MUST match step1 output
  outputSchema: z.object({ emphasized: z.string() }),
  execute: async ({ inputData }) => {
    // inputData = step1's return value directly
    return { emphasized: `${inputData.formatted}!!!` };
  },
});

const workflow = createWorkflow({
  id: "my-workflow",
  inputSchema: z.object({ message: z.string() }),     // MUST match step1 input
  outputSchema: z.object({ emphasized: z.string() }), // MUST match final output
})
  .then(step1)
  .then(step2)
  .commit();

Schema matching rules:

RuleDescription
Workflow input → Step 1 inputMust match exactly
Step N output → Step N+1 inputMust match exactly
Final step output → Workflow outputMust match exactly

Data access in steps:

typescript
execute: async ({
  inputData,      // Previous step's output (or workflow input for step 1)
  getStepResult,  // Access ANY step's output by ID
  getInitData,    // Get original workflow input
  mastra,         // Access agents, tools, storage
}) => {
  const step1Result = getStepResult("step-1");
  const originalInput = getInitData();
  return { result: inputData.formatted };
}
Hono Server Setup
typescript
import { MastraServer } from "@mastra/hono";

const app = new Hono();
const server = new MastraServer({ app, mastra });
await server.init();

// Endpoints auto-registered:
// POST /api/agents/{agent-name}/generate
// POST /api/agents/{agent-name}/stream
// POST /api/workflows/{workflow-id}/start

Custom route prefix:

typescript
const server = new MastraServer({
  app,
  mastra,
  prefix: "/v1/ai"  // Routes at /v1/ai/agents/...
});

Custom API routes:

typescript
import { registerApiRoute } from "@mastra/core/server";

registerApiRoute("/my-custom-route", {
  method: "POST",
  handler: async (c) => {
    const mastra = c.get("mastra");
    const agent = mastra.getAgent("my-agent");
    const result = await agent.generate("Hello");
    return c.json({ response: result.text });
  },
});

Common Mistakes Quick Reference

TopicWrongCorrect
Importsimport { Agent } from "@mastra/core"import { Agent } from "@mastra/core/agent"
Tools arraytools: [tool1, tool2]tools: { tool1, tool2 }
Memory context{ threadId: "123" }{ memory: { thread: "123", resource: "user" } }
Workflow datacontext.steps.step1.outputinputData or getStepResult("step-1")
After parallelinputData.resultinputData["step-id"].result
After branchinputData.resultinputData["step-id"]?.result (optional)
Nested agentsimport agent; agent.generate()mastra.getAgent("name").generate()
State mutationstate.counter++setState({ ...state, counter: state.counter + 1 })
v1 tool execexecute: async ({ context })execute: async (inputData, context)

Show full SKILL.md (204 more words)Show less

Scripts Reference

ScriptPurposeUsage
scaffold-project.tsCreate new Mastra+Hono projectdeno run --allow-all scripts/scaffold-project.ts --name my-project
scaffold-agent.tsCreate agent with toolsdeno run --allow-all scripts/scaffold-agent.ts --name weather
scaffold-workflow.tsCreate workflow with stepsdeno run --allow-all scripts/scaffold-workflow.ts --name process-data
scaffold-tool.tsCreate tool with schemasdeno run --allow-all scripts/scaffold-tool.ts --name fetch-weather
validate-workflow-schemas.tsValidate step schema matchingdeno run --allow-read scripts/validate-workflow-schemas.ts ./src/mastra/workflows/
check-version-patterns.tsDetect v1/stable pattern mixingdeno run --allow-read scripts/check-version-patterns.ts ./src/mastra/

Additional Resources

Reference Files
  • references/workflow-data-flow.md - Complete data flow patterns (CRITICAL)
  • references/common-mistakes.md - Extended anti-patterns and fixes
  • references/agent-patterns.md - Agent definition deep-dive
  • references/tool-patterns.md - Tool signatures, wrappers
  • references/hono-server-patterns.md - Server setup, routes, middleware
  • references/testing-patterns.md - Vitest setup, mocking LLMs
  • references/mcp-server-patterns.md - Model Context Protocol authoring
  • references/agent-networks.md - Multi-agent collaboration, A2A
  • references/rag-memory-patterns.md - Vector stores, embeddings, memory
  • references/context-network-memory.md - Context networks for agent memory
Asset Templates
  • assets/agent-template.ts - Agent boilerplate
  • assets/tool-template.ts - Tool boilerplate (v1 signature)
  • assets/workflow-template.ts - Workflow boilerplate
  • assets/hono-server-template.ts - Hono+Mastra server setup
  • assets/vitest-setup-template.ts - Test configuration
External Documentation

Limitations

  • Targets v1 Beta only; stable (0.24.x) patterns differ significantly
  • Scripts require Deno runtime with appropriate permissions
  • MCP server patterns require MCP-compatible clients
  • Agent networks require all participating agents to be registered in same Mastra instance
  • research-workflow - Deep dive research for AI agent design
  • web-search - Real-time information retrieval for agents

© jwynia, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 21 other files (scripts, references, assets) in skills/tech/ai/mastra-hono of jwynia/agent-skills.

  • SKILL.md
  • assets/agent-template.ts
  • assets/hono-server-template.ts
  • assets/tool-template.ts
  • assets/vitest-setup-template.ts
  • assets/workflow-template.ts
  • references/agent-networks.md
  • references/agent-patterns.md
  • references/common-mistakes.md
  • references/context-network-memory.md
  • references/hono-server-patterns.md
  • references/mcp-server-patterns.md
  • references/rag-memory-patterns.md
  • references/testing-patterns.md
  • references/tool-patterns.md
  • references/workflow-data-flow.md
  • scripts/check-version-patterns.ts
  • scripts/scaffold-agent.ts
  • … and 4 more

Open the folder on GitHubat commit e02ec7e

Compare with similar skills

Mastra Hono next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mastra Hono compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mastra Hono this skilljwynia/agent-skills170—~2.9kAutomated safety check: PassMIT
Hono Idiomsirahardianto/awesome-agv156—~3kAutomated safety check: PassMIT
MCP Server Patternsaffaan-m/ECC277k1 repos~551Automated safety check: PassMIT
Typescript Idiomsirahardianto/awesome-agv156—~6.1kAutomated safety check: PassMIT
MCP Server Patternsaffaan-m/ECC277k5 repos~1kAutomated safety check: PassMIT
Desloppifydatabuddy-analytics/Databuddy1.2k—~2.7kAutomated safety check: PassAGPL-3.0

Similar skills

  • Hono Idioms

    irahardianto/awesome-agv

    Hono lightweight web framework patterns: type-safe route handlers, middleware composition, Zod validation, and RPC clients for Cloudflare Workers, Node, or Bun.

    156 GitHub stars~3k tokensUpdated 6 days ago
    DevelopmentAuto-check passed
  • 使用Node/TypeScript SDK构建MCP服务器——工具、资源、提示、Zod验证、stdio与可流式HTTP对比。使用Context7或官方MCP文档获取最新API信息。

    277k GitHub starsUsed in 1 repo~551 tokens
    Agent WorkflowsAuto-check passed
  • Typescript Idioms

    irahardianto/awesome-agv

    TypeScript strict typing: type narrowing, discriminated unions, Zod runtime validation, generic utility types, and Vitest testing.

    156 GitHub stars~6.1k tokensUpdated 6 days ago
    Testing & QAAuto-check passed
  • Build MCP servers with Node/TypeScript SDK — tools, resources, prompts, Zod validation, stdio vs Streamable HTTP.

    277k GitHub starsUsed in 5 repos~1k tokens
    Agent WorkflowsAuto-check passed
  • Desloppify

    databuddy-analytics/Databuddy

    Reduce codebase slop by deleting code, flattening abstractions, and replacing custom helpers/types/assertions with native SDK/npm helpers or straightforward schemas (for example Zod).

    1.2k GitHub stars~2.7k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Zod Validation Expert

    davila7/claude-code-templates

    Expert in Zod — TypeScript-first schema validation. An agent skill from davila7/claude-code-templates.

    33k GitHub starsUsed in 3 repos~2.4k tokens
    Frontend & DesignAuto-check passed

More from jwynia/agent-skills

All 111 skills in this repo
  • Devcontainer

    jwynia/agent-skills

    Diagnose devcontainer configuration problems and guide development environment setup.

    170 GitHub stars~1.2k tokensUpdated 7 mo ago
    Auto-check: notes
  • Frontend Design

    jwynia/agent-skills

    Create distinctive, production-grade frontend interfaces with high design quality.

    170 GitHub stars~3.2k tokensUpdated 7 mo ago
    Auto-check passed
  • Gitea Workflow

    jwynia/agent-skills

    Orchestrate agile development workflows for Gitea repositories using the tea CLI.

    170 GitHub stars~3.8k tokensUpdated 7 mo ago
    Auto-check passed
  • Godot Asset Generator

    jwynia/agent-skills

    Generate game assets using AI image generation APIs (DALL-E, Replicate, fal.ai) and prepare them for Godot.

    170 GitHub stars~3.8k tokensUpdated 7 mo ago
    Auto-check passed
  • PPTX Generator

    jwynia/agent-skills

    Create and manipulate PowerPoint PPTX files programmatically.

    170 GitHub stars~3.1k tokensUpdated 7 mo ago
    Auto-check passed
  • React Pwa

    jwynia/agent-skills

    Build Progressive Web Apps with React and Vite. An agent skill from jwynia/agent-skills.

    170 GitHub stars~4.4k tokensUpdated 7 mo ago
    Auto-check passed

Questions about Mastra Hono

What does Mastra Hono do?

Develop AI agents, tools, and workflows with Mastra v1 Beta and Hono servers. Mastra Hono is an agent skill from jwynia/agent-skills. Develop AI agents, tools, and workflows with Mastra v1 Beta and Hono servers.

When should I use Mastra Hono?

Mastra Hono fits situations like: tasks that involve Forms and validation.

How do I install Mastra Hono in Claude Code?

Run `npx skills add jwynia/agent-skills --skill mastra-hono -a claude-code`. Or copy the skill folder (skills/tech/ai/mastra-hono in jwynia/agent-skills) into .claude/skills/mastra-hono in your project. Claude Code loads it when a task matches its description.

How do I install Mastra Hono in Codex?

Run `npx skills add jwynia/agent-skills --skill mastra-hono -a codex`. Or copy the skill folder (skills/tech/ai/mastra-hono in jwynia/agent-skills) into .agents/skills/mastra-hono in your project. Codex loads it when a task matches its description.

Can I use Mastra Hono in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jwynia/agent-skills --skill mastra-hono -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mastra-hono, .gemini/skills/mastra-hono, .github/skills/mastra-hono and .opencode/skills/mastra-hono in your project.

What does Mastra Hono need to run?

Going by SKILL.md and its folder, Mastra Hono needs TypeScript for the scripts in its folder and the command-line tools its instructions call (deno and npm). Our summary lists: Node.js. Compatibility (from SKILL.md): Node.js 22.13.0+ required for v1 Beta.

Does Mastra Hono access the network?

SKILL.md names 3 domains. As links in the text: mastra.ai, hono.dev and github.com. This is read from the text; nothing was executed.

Is Mastra Hono safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Mastra Hono use?

Mastra Hono is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mastra Hono use?

About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 31k tokens, read only when the agent opens those files.

What are the alternatives to Mastra Hono?

Skills that share tags, products or a category with Mastra Hono: Hono Idioms (irahardianto/awesome-agv, 156 stars), MCP Server Patterns (affaan-m/ECC, 277k stars), Typescript Idioms (irahardianto/awesome-agv, 156 stars) and MCP Server Patterns (affaan-m/ECC, 277k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mastra Hono?

jwynia (a GitHub user) maintains it in jwynia/agent-skills, which has 170 GitHub stars. The repository holds 111 skills in this directory. The repository was last updated on February 24, 2026.

Source: jwynia/agent-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.