Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

create-mastra

verified

Complete project setup guide for Mastra AI framework. Covers: CLI installation (create-mastra), manual installation, TypeScript configuration (ES2022 requirements), environment setup, adding to existing projects (Next.js, Express), troubleshooting (module not found, import errors, CommonJS issues), deployment preparation, and monorepo configuration. Includes both quick setup (user runs CLI) and automatic setup (step-by-step file creation). Use this skill for all Mastra installation and setup questions to ensure correct configuration and prevent common errors.

View on GitHub

Marketplace

mastra-agent-skills

mastra-ai/skills

Plugin

mastra-skills

Repository

mastra-ai/skills
16stars

skills/create-mastra/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/mastra-ai/skills/blob/main/skills/create-mastra/SKILL.md -a claude-code --skill create-mastra

Installation paths:

Claude
.claude/skills/create-mastra/
Powered by add-skill CLI

Instructions

# Create Mastra Skill

Complete guide for creating new Mastra AI agent projects. Includes both quickstart CLI method and detailed manual installation with full working code examples.

**Official documentation: [mastra.ai/docs](https://mastra.ai/docs)**

---

## Getting Started

Ask: **"How would you like to create your Mastra project?"**

1. **Quick Setup** - Copy and run: `npm create mastra@latest`
2. **Guided Setup** - I walk you through each step, you approve commands
3. **Automatic Setup** ⭐ - I create everything, just give me your API key

> **For AI agents:** The CLI is interactive. Use **Automatic Setup** — create files using the steps in "Automatic Setup / Manual Installation" below.

---

## Prerequisites

- An API key from a supported model provider (OpenAI, Anthropic, Google, etc.)

---

## Quick Setup (User runs CLI)

Create a new Mastra project with one command:

```bash
npm create mastra@latest
```

**Other package managers:**
```bash
pnpm create mastra@latest
yarn create mastra@latest
bun create mastra@latest
```

---

## CLI Flags

**Skip the example agent:**
```bash
npm create mastra@latest --no-example
```

**Use a specific template:**
```bash
npm create mastra@latest --template <template-name>
```

---

## Automatic Setup / Manual Installation

**Use this for Automatic Setup** (AI creates all files) or when you prefer manual control.

Follow these steps to create a complete Mastra project:

### Step 1: Create Project Directory
```bash
mkdir my-first-agent && cd my-first-agent
npm init -y
```

### Step 2: Install Dependencies

```bash
npm install -D typescript @types/node mastra@latest
npm install @mastra/core@latest zod@^4
```

### Step 3: Configure Package Scripts

Add to `package.json`:

```json
{
  "scripts": {
    "dev": "mastra dev",
    "build": "mastra build"
  }
}
```

### Step 4: Configure TypeScript

Create `tsconfig.json`:

```json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ES2022",
    "moduleResolution": "bundler"

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5502 chars