Skip to content

Commit 6917273

Browse files
authored
Merge pull request #117 from ssdeanx/develop
Develop
2 parents 63f68d1 + e297802 commit 6917273

121 files changed

Lines changed: 10240 additions & 11634 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agent/skills/mastra/SKILL.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
---
2+
name: mastra
3+
description: "Comprehensive Mastra framework guide. Teaches how to find current documentation, verify API signatures, and build agents and workflows. Covers documentation lookup strategies (embedded docs, remote docs), core concepts (agents vs workflows, tools, memory, RAG), TypeScript requirements, and common patterns. Use this skill for all Mastra development to ensure you're using current APIs from the installed version or latest documentation."
4+
license: Apache-2.0
5+
metadata:
6+
author: Mastra
7+
version: "2.0.0"
8+
repository: https://github.com/mastra-ai/skills
9+
---
10+
11+
# Mastra Framework Guide
12+
13+
Build AI applications with Mastra. This skill teaches you how to find current documentation and build agents and workflows.
14+
15+
## ⚠️ Critical: Do not trust internal knowledge
16+
17+
**Everything you know about Mastra is likely outdated or wrong. Never rely on memory. Always verify against current documentation.**
18+
19+
Your training data contains obsolete APIs, deprecated patterns, and incorrect usage. Mastra evolves rapidly - APIs change between versions, constructor signatures shift, and patterns get refactored.
20+
21+
## Prerequisites
22+
23+
**Before writing any Mastra code**, check if packages are installed:
24+
25+
```bash
26+
ls node_modules/@mastra/
27+
```
28+
29+
- **If packages exist:** Use embedded docs first (most reliable)
30+
- **If no packages:** Install first or use remote docs
31+
32+
## Documentation lookup guide
33+
34+
### Quick Reference
35+
36+
| User Question | First Check | How To |
37+
| ----------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------- |
38+
| "Create/install Mastra project" | [`references/create-mastra.md`](references/create-mastra.md) | Setup guide with CLI and manual steps |
39+
| "How do I use Agent/Workflow/Tool?" | [`references/embedded-docs.md`](references/embedded-docs.md) | Look up in `node_modules/@mastra/*/dist/docs/` |
40+
| "How do I use X?" (no packages) | [`references/remote-docs.md`](references/remote-docs.md) | Fetch from `https://mastra.ai/llms.txt` |
41+
| "I'm getting an error..." | [`references/common-errors.md`](references/common-errors.md) | Common errors and solutions |
42+
| "Upgrade from v0.x to v1.x" | [`references/migration-guide.md`](references/migration-guide.md) | Version upgrade workflows |
43+
44+
### Priority order for writing code
45+
46+
⚠️ **Never write code without checking current docs first**
47+
48+
1. **Embedded docs first** (if packages installed)
49+
50+
```bash
51+
# Check what's available
52+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"Agent"'
53+
54+
# Read the actual type definition
55+
cat node_modules/@mastra/core/dist/[path-from-source-map]
56+
```
57+
58+
- **Why:** Matches your EXACT installed version
59+
- **Most reliable source of truth**
60+
- **See:** [`references/embedded-docs.md`](references/embedded-docs.md)
61+
62+
2. **Remote docs second** (if packages not installed)
63+
64+
```bash
65+
# Fetch latest docs
66+
# https://mastra.ai/llms.txt
67+
```
68+
69+
- **Why:** Latest published docs (may be ahead of installed version)
70+
- **Use when:** Packages not installed or exploring new features
71+
- **See:** [`references/remote-docs.md`](references/remote-docs.md)
72+
73+
## Core concepts
74+
75+
### Agents vs workflows
76+
77+
**Agent**: Autonomous, makes decisions, uses tools
78+
Use for: Open-ended tasks (support, research, analysis)
79+
80+
**Workflow**: Structured sequence of steps
81+
Use for: Defined processes (pipelines, approvals, ETL)
82+
83+
### Key components
84+
85+
- **Tools**: Extend agent capabilities (APIs, databases, external services)
86+
- **Memory**: Maintain context (message history, working memory, semantic recall)
87+
- **RAG**: Query external knowledge (vector stores, graph relationships)
88+
- **Storage**: Persist data (Postgres, LibSQL, MongoDB)
89+
90+
## Critical requirements
91+
92+
### TypeScript config
93+
94+
Mastra requires **ES2022 modules**. CommonJS will fail.
95+
96+
```json
97+
{
98+
"compilerOptions": {
99+
"target": "ES2022",
100+
"module": "ES2022",
101+
"moduleResolution": "bundler"
102+
}
103+
}
104+
```
105+
106+
### Model format
107+
108+
Always use `"provider/model-name"`:
109+
110+
- `"openai/gpt-4o"`
111+
- `"anthropic/claude-3-5-sonnet-20241022"`
112+
- `"google/gemini-2.5-pro"`
113+
114+
## When you see errors
115+
116+
**Type errors often mean your knowledge is outdated.**
117+
118+
**Common signs of outdated knowledge:**
119+
120+
- `Property X does not exist on type Y`
121+
- `Cannot find module`
122+
- `Type mismatch` errors
123+
- Constructor parameter errors
124+
125+
**What to do:**
126+
127+
1. Check [`references/common-errors.md`](references/common-errors.md)
128+
2. Verify current API in embedded docs
129+
3. Don't assume the error is a user mistake - it might be your outdated knowledge
130+
131+
## Development workflow
132+
133+
**Always verify before writing code:**
134+
135+
1. **Check packages installed**
136+
137+
```bash
138+
ls node_modules/@mastra/
139+
```
140+
141+
2. **Look up current API**
142+
- If installed → Use embedded docs [`references/embedded-docs.md`](references/embedded-docs.md)
143+
- If not → Use remote docs [`references/remote-docs.md`](references/remote-docs.md)
144+
145+
3. **Write code based on current docs**
146+
147+
4. **Test in Studio**
148+
```bash
149+
npm run dev # http://localhost:4111
150+
```
151+
152+
## Resources
153+
154+
- **Setup**: [`references/create-mastra.md`](references/create-mastra.md)
155+
- **Embedded docs lookup**: [`references/embedded-docs.md`](references/embedded-docs.md) - Start here if packages are installed
156+
- **Remote docs lookup**: [`references/remote-docs.md`](references/remote-docs.md)
157+
- **Common errors**: [`references/common-errors.md`](references/common-errors.md)
158+
- **Migrations**: [`references/migration-guide.md`](references/migration-guide.md)
159+
- **Official site**: https://mastra.ai (verify against embedded docs first)

0 commit comments

Comments
 (0)