mastra

Guides building Mastra agents, workflows, tools, and memory with verified current APIs.

Updated May 11, 2026
One-click install
npx skills add https://github.com/mmnavarr/harness --skill mastra-mmnavarr
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mastra
Source: https://github.com/mmnavarr/harness/tree/main/skills/mastra
Command: npx skills add https://github.com/mmnavarr/harness --skill mastra-mmnavarr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Mastra evolves rapidly, so AI-generated code based on training data often uses outdated APIs, deprecated patterns, and wrong constructor signatures. This Skill forces verification against current documentation—embedded in node_modules or fetched remotely—before any Mastra code is written. ## Core Features & Use Cases - Version-accurate API lookup: Prioritizes embedded docs in node_modules/@mastra/*/dist/docs/ matching the installed version, with remote docs from mastra.ai as fallback. - Project scaffolding and migration: Step-by-step project creation with correct TypeScript ES2022 config, plus version upgrade workflows using official migration guides and codemods. - Error diagnosis and model validation: Catalogs common errors (tool registration, memory persistence, workflow commits, storage connections) and verifies provider/model names via a registry script. - Use Case: A developer asks to add memory to a Mastra agent. The Skill checks installed packages, reads the embedded type definitions for the current Memory API, and writes code that compiles against the actual installed version. ## Quick Start Ask the AI to create a Mastra agent with a weather tool and verify the model name against the provider registry before writing any code.

Frequently Asked Questions about mastra

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new Mastra project?▼

Run npm create mastra@latest for the interactive CLI, or set up manually by installing mastra and @mastra/core, configuring tsconfig.json with ES2022 modules, and creating an agent, tool, and Mastra entry point. Then run npm run dev to open Studio at localhost:4111.

How do I choose between a Mastra agent and a workflow?▼

Use an agent for open-ended tasks that require decisions and tool usage, such as support or research assistants. Use a workflow for defined multi-step processes like pipelines, approvals, and ETL where steps execute in a structured sequence.

What model format does Mastra use?▼

Mastra's model router requires the "provider/model-name" format, such as "openai/gpt-5.4" or "anthropic/claude-sonnet-4-5". Run the provider-registry script to verify provider keys and model names, since available models change frequently.

Why does my Mastra agent not remember previous messages?▼

Memory requires a configured storage backend, a Memory instance assigned to the agent, and a consistent threadId passed to each generate call. Without storage or a stable threadId, conversation history is lost between calls.

Why do I get "Property X does not exist on type Y" errors in Mastra?▼

These errors usually mean your code uses an outdated API, since Mastra changes rapidly between versions. Check the embedded docs in node_modules/@mastra/core/dist/docs/ for the installed version's actual signatures rather than relying on memory.

How do I upgrade Mastra from v0.x to v1.x?▼

Start with the official migration guide at mastra.ai/llms.txt, update all @mastra packages together, run any available codemod, then verify new API signatures against embedded docs. Test with npx tsc --noEmit and npm run dev afterward.