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.

referencesembedded-docs.md

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

Embedded Docs Reference

Look up API signatures from embedded docs in node_modules/@mastra/*/dist/docs/ - these match the installed version.

Use this FIRST when Mastra packages are installed locally. Embedded docs are always accurate for the installed version.

Why use embedded docs

  • Version accuracy: Embedded docs match the exact installed version
  • No network required: All docs are local in node_modules/
  • Mastra evolves quickly: APIs change rapidly, embedded docs stay in sync
  • TypeScript definitions: Includes JSDoc, type signatures, and examples
  • Training data may be outdated: Claude's knowledge cutoff may not reflect latest APIs

Documentation structure

node_modules/@mastra/core/dist/docs/
├── SKILL.md # Package overview, exports
├── assets/
│   └── SOURCE_MAP.json # Export -> file mappings
└── references/ # Individual topic docs

Lookup process

1. Check if packages are installed

ls node_modules/@mastra/

If you see packages like core, memory, rag, etc., proceed with embedded docs lookup.

2. Look through topic docs

Use grep to find relevant docs in references/:

grep -r "Agent" node_modules/@mastra/core/dist/docs/references

Naming convention

Documents are typically formatted as <category>-<topic>.md where category is one of: "docs", "reference", "guides", "models".

Optional: Check source code for type definitions / additional details

Look at the SOURCE_MAP.json to find the file path for the export:

cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"Agent"'

Returns: { "Agent": { "types": "dist/agent/agent.d.ts", ... } }

Read the type definition for exact constructor parameters, types, and JSDoc:

cat node_modules/@mastra/core/dist/agent/agent.d.ts

Common packages

Package Path Contains
@mastra/core node_modules/@mastra/core/dist/docs/ Agents, Workflows, Tools, Mastra instance
@mastra/memory node_modules/@mastra/memory/dist/docs/ Memory systems, conversation history
@mastra/rag node_modules/@mastra/rag/dist/docs/ RAG features, vector stores
@mastra/pg node_modules/@mastra/pg/dist/docs/ PostgreSQL storage
@mastra/libsql node_modules/@mastra/libsql/dist/docs/ LibSQL/SQLite storage

Quick commands reference

# List installed @mastra packages
ls node_modules/@mastra/

# List available topic documentation
ls node_modules/@mastra/core/dist/docs/references/

# Find specific export in SOURCE_MAP
cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"ExportName"'

# Read type definition from path
cat node_modules/@mastra/core/dist/[path-from-source-map]

# View package overview
cat node_modules/@mastra/core/dist/docs/SKILL.md

When embedded docs are not available

If packages aren't installed or dist/docs/ doesn't exist:

  1. Recommend installation: Suggest installing packages to access embedded docs
  2. Fall back to remote docs: See references/remote-docs.md

Best Practices

  1. Check topic docs for conceptual understanding and patterns
  2. Search source code if docs don't answer the question
  3. Verify imports match what's exported in the type definitions

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.