Index of every page on this site: llms.txt
All skills
mastra-ai avatar

/mastra

@0457401 official
by Mastramastra-ai/skills105 stars
13
Run it yourself

Comprehensive Mastra framework guide for building agents, workflows, tools, memory, workspaces, and storage with current APIs. Use for native capability discovery, logging, tracing, metrics/cost estimates, dataset experiments, documentation lookup, API verification, TypeScript setup, common errors, migrations, building and deploying apps to Mastra Platform via Platform APIs and `mastra deploy`, and `mastra api` CLI tasks: inspect or call resources on local, Mastra platform, or remote servers. For Mastra Factory operations, discover and activate the companion mastra-factory skill. Also report verified bugs and concrete documentation defects to the Mastra team automatically via the feedback endpoint.

Use this Skill: https://skilld.dev/gh/mastra-ai/skills/mastra

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesmigration-guide.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Migration Guide

Guide for upgrading Mastra versions using official documentation and current API verification.

Migration strategy

For version upgrades, follow this process:

1. Check official migration docs

Always start with the official migration documentation: https://mastra.ai/llms.txt

Look for the Migrations or Guides section, which will have:

  • Breaking changes for each version
  • Automated migration tools
  • Step-by-step upgrade instructions

Example sections to look for:

  • /guides/migrations/upgrade-to-v1/
  • /guides/migrations/upgrade-to-v2/
  • Breaking changes lists

2. Use embedded docs for current APIs

After identifying breaking changes, verify the new APIs:

Check your installed version:

cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"ApiName"'
cat node_modules/@mastra/core/dist/[path-from-source-map]

See embedded-docs.md for detailed lookup instructions.

3. Use remote docs for latest info

If packages aren't updated yet, check what APIs will look like: https://mastra.ai/reference/[topic]

See remote-docs.md for detailed lookup instructions.

Quick migration workflow

# 1. Check current version
npm list @mastra/core

# 2. Fetch migration guide from official docs
# Use WebFetch: https://mastra.ai/llms.txt
# Find relevant migration section

# 3. Update dependencies
npm install @mastra/core@latest @mastra/memory@latest @mastra/rag@latest mastra@latest

# 4. Run automated migration (if available)
npx @mastra/codemod@latest v1  # or whatever version

# 5. Check embedded docs for new APIs
cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json

# 6. Fix breaking changes using embedded docs lookup
# See embedded-docs.md for how to look up each API

# 7. Test
npm run dev
npm test

Common migration patterns

Finding what changed

Check official migration docs: https://mastra.ai/guides/migrations/upgrade-to-v1/overview.md

This will list:

  • Breaking changes
  • Deprecated APIs
  • New features
  • Migration tools

Updating API usage

For each breaking change:

  1. Find the old API in your code
  2. Look up the new API using embedded docs:
    cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"NewApi"'
    cat node_modules/@mastra/core/dist/[path]
  3. Update your code based on the type signatures
  4. Test the change

Example: Tool execute signature change

Official docs say: "Tool execute signature changed"

Look up current signature:

cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"createTool"'
cat node_modules/@mastra/core/dist/tools/tool.d.ts

Update based on type definition:

// Old (from docs)
execute: async (input) => { ... }

// New (from embedded docs)
execute: async (inputData, context) => { ... }

Pre-migration checklist

  • Backup code (git commit)
  • Check official migration docs: https://mastra.ai/llms.txt
  • Note current version: npm list @mastra/core
  • Read breaking changes list
  • Tests are passing

Post-migration checklist

  • All dependencies updated together
  • TypeScript compiles: npx tsc --noEmit
  • Tests pass: npm test
  • Studio works: npm run dev
  • No console warnings
  • APIs verified against embedded docs

Migration resources

Resource Use For
https://mastra.ai/llms.txt Finding migration guides and breaking changes
embedded-docs.md Looking up new API signatures after updating
remote-docs.md Checking latest docs before updating
common-errors.md Fixing migration errors

Version-specific notes

General principles

  1. Always update all @mastra packages together

    npm install @mastra/core@latest @mastra/memory@latest @mastra/rag@latest mastra@latest
  2. Check for automated migration tools

    npx @mastra/codemod@latest [version]
  3. Verify Node.js version requirements

    • Check official migration docs for minimum Node version
  4. Run database migrations if using storage

    • Follow storage migration guide in official docs

Getting help

  1. Check official migration docs: https://mastra.ai/llms.txt → Migrations section
  2. Look up new APIs: See embedded-docs.md
  3. Check for errors: See common-errors.md
  4. Ask in Discord: https://discord.gg/BTYqqHKUrf
  5. File issues: https://github.com/mastra-ai/mastra/issues

Key principles

  1. Official docs are source of truth - Start with https://mastra.ai/llms.txt
  2. Verify with embedded docs - Check installed version APIs
  3. Update incrementally - Don't skip major versions
  4. Test thoroughly - Run tests after each change
  5. Use automation - Use codemods when available

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

2 warnings17d5 checks · Risk SAFE
  • Gen Agent Trust Hub18d

    The skill provides a comprehensive guide for the Mastra framework, including documentation lookup, project scaffolding, and CLI interaction. All external resources, including documentation URLs, GitHub repositories, and API endpoints, belong to the official vendor infrastructure. No malicious patterns, obfuscation, or unsafe data handling were detected.

  • Socket17d

    No alerts

  • Snyk18d

    Risk: MEDIUM · 1 issue

  • Runlayer9mo

    3/6 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 0457401. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 3 weeks ago
Other metadata
metadata
{
  "author": "Mastra",
  "version": "2.5.0",
  "repository": "https://github.com/mastra-ai/skills"
}

README badge

README badge for mastra-ai/skills/mastra

Provides documentation lookup, API verification, and CLI reference for the Mastra framework—a TypeScript library for building AI agents, workflows, tools, and storage integrations. Use this skill to verify current Mastra APIs, resolve type errors from outdated knowledge, inspect resources via the `mastra api` CLI, and troubleshoot common setup issues like ES2022 module configuration.

Generated from the current SKILL.md.

Does this skill work without Mastra packages installed?
Yes. The skill includes references to remote documentation at mastra.ai/llms.txt for cases where packages aren't installed. If packages are installed, the skill prioritizes embedded docs in node_modules for accuracy.
What should I do if I get a TypeScript error when using Mastra?
Check references/common-errors.md first, then verify the current API in embedded docs or remote docs. Type errors often signal outdated knowledge rather than user mistakes, since Mastra APIs change between versions.
How do I verify a model name or provider is valid?
Run scripts/provider-registry.mjs to look up current providers and models in the model router before using any model. Model names change frequently and should never be guessed from memory.
What does the `mastra api` CLI do?
It inspects or calls resources on local dev servers, Mastra platform deployments, or remote endpoints. Use it to access agent state, execution traces, logs, threads, and workflow operations.
Does Mastra support CommonJS?
No. Mastra requires ES2022 modules and will fail with CommonJS. Verify your tsconfig.json is set up correctly.

Generated from the current SKILL.md. These answers refresh after source changes.