A comprehensive Claude Code skill for validating Mastra AI agent projects. This skill performs 66 checks across 10 categories to identify configuration issues, missing best practices, and potential problems before they cause runtime errors.
npx mastra-system-checkcurl -fsSL https://raw.githubusercontent.com/goldk3y/mastra-system-check/main/install.sh | bashgit clone https://github.com/goldk3y/mastra-system-check.git ~/.claude/skills/mastra-system-checkDownload and copy this directory to:
~/.claude/skills/mastra-system-check/The skill will automatically activate when working with Mastra projects. You can verify installation by asking Claude Code to perform a system check on your Mastra project.
| Badge | Level | Description | Action |
|---|---|---|---|
| π΄ | CRITICAL | System won't function | Fix immediately |
| π | HIGH | Major functionality issues | Fix before deployment |
| π‘ | MEDIUM | Quality and maintainability | Fix when possible |
| π’ | LOW | Performance and cost | Nice to have |
| # | Category | Rules | Priority | Key Checks |
|---|---|---|---|---|
| 1 | Configuration & Setup | 6 | π΄ CRITICAL | Storage, env vars, TypeScript, entry points |
| 2 | Agent Configuration | 6 | π HIGH | Model format, instructions, tools, memory |
| 3 | Workflow Configuration | 6 | π HIGH | .commit(), schemas, steps, error handling |
| 4 | Context & Data Flow | 8 | π HIGH | Type safety, middleware, propagation |
| 5 | Prompt Engineering | 10 | π HIGH | Structure, token efficiency, examples |
| 6 | Memory Configuration | 6 | π‘ MEDIUM | Storage, threads, vector stores |
| 7 | Tool Configuration | 6 | π‘ MEDIUM | Schemas, descriptions, error handling |
| 8 | Observability & Evals | 6 | π‘ MEDIUM* | Tracing, exporters, scorers |
| 9 | Security & Guardrails | 6 | π‘ MEDIUM | Auth, CORS, PII, prompt injection |
| 10 | Performance & Optimization | 6 | π’ LOW | Model selection, caching, batching |
*Observability checks are conditional - only run if telemetry/evals are configured.
The skill activates when you say any of these phrases:
| Category | Example Phrases |
|---|---|
| General Check | "check my mastra project", "mastra system check", "validate mastra" |
| Setup Issues | "mastra not working", "agent won't start", "can't find mastra instance" |
| Memory Issues | "memory not persisting", "conversation lost", "agent forgets context" |
| Workflow Issues | "workflow stuck", "workflow not executing", "steps not running" |
| Context Issues | "context not propagating", "requestcontext empty" |
| Deployment | "prepare for production", "production checklist", "deploy mastra" |
Ask Claude to run specific checks:
Run a Mastra system check on this project
Check my Mastra agent configurations
Validate my workflow setup
Review my memory configuration for issues
Is my Mastra project ready for production?
For each issue found:
### π΄ CRITICAL Issues (count)
**[rule-id] Rule Name**
- **Location:** `file/path.ts:lineNumber`
- **Issue:** Clear description of what's wrong
- **Fix:**
```typescript
// Corrected code example
---
## Quick Checks (Run First)
Before deep analysis, the skill verifies these **4 common issues** that cause most failures:
| Check | Command | Fix |
|-------|---------|-----|
| Storage configured? | `grep "storage:" src/mastra/index.ts` | Add LibSQLStore |
| API keys set? | `cat .env \| grep API_KEY` | Add to .env |
| Model format correct? | All models use `provider/model-name` | Fix format |
| Workflows committed? | Every workflow ends with `.commit()` | Add .commit() |
---
## Most Common Issues
These are the issues most frequently caught by the system check:
1. **Missing storage provider** - Memory and workflows won't persist
2. **Missing API keys** - Agent calls fail at runtime
3. **Wrong model format** - Should be `provider/model-name` (e.g., `openai/gpt-4o`)
4. **No thread/resource in memory calls** - Messages aren't tracked
5. **Untyped RequestContext** - No type safety across components
6. **Security processors not first** - PII stored before redaction
7. **Missing .commit() on workflows** - Workflow won't execute
---
## Quick Fixes
### Essential Setup
```typescript
// src/mastra/index.ts
import { Mastra } from "@mastra/core";
import { LibSQLStore } from "@mastra/libsql";
export const mastra = new Mastra({
storage: new LibSQLStore({
id: "mastra-storage",
url: process.env.DATABASE_URL || "file:./mastra.db",
}),
agents: { /* your agents */ },
});
# .env
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
DATABASE_URL=file:./mastra.db{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}// β Wrong
model: "gpt-4o"
// β
Correct
model: "openai/gpt-4o"// β Wrong - missing .commit()
const workflow = new Workflow({ id: "my-flow" })
.step("step1", { execute: async () => ({ done: true }) });
// β
Correct
const workflow = new Workflow({ id: "my-flow" })
.step("step1", { execute: async () => ({ done: true }) })
.commit(); // Required!mastra-system-check/
βββ SKILL.md # Skill metadata, triggers, and execution steps
βββ AGENTS.md # Complete 66-rule guide with examples
βββ metadata.json # Version and feature info
βββ README.md # This file
βββ assets/
β βββ banner.png # Header image
βββ bin/
β βββ install.js # npx installer
βββ install.sh # Shell installer
βββ rules/
βββ _sections.md # Category hierarchy
βββ _template.md # Template for new rules
βββ config-*.md # Configuration checks (CRITICAL)
βββ agent-*.md # Agent checks (HIGH)
βββ workflow-*.md # Workflow checks (HIGH)
βββ context-*.md # Context checks (HIGH)
βββ prompt-*.md # Prompt checks (HIGH)
βββ memory-*.md # Memory checks (MEDIUM)
βββ tool-*.md # Tool checks (MEDIUM)
βββ observability-*.md # Observability checks (MEDIUM)
βββ security-*.md # Security checks (MEDIUM)
βββ optimization-*.md # Optimization checks (LOW)
| Version | Changes |
|---|---|
| 1.1.0 | Enhanced skill activation with keyword triggers, quick checks, explicit execution steps, improved output format with examples |
| 1.0.0 | Initial release with 66 rules across 10 categories |
To add new rules:
- Copy
rules/_template.mdto a new file with the appropriate prefix - Fill in the frontmatter (title, impact, tags, category)
- Write clear "What to Check", "Incorrect", "Correct", and "How to Fix" sections
- Update
rules/_sections.mdif adding a new category
MIT
