# db-generate

Generates database migrations for a Medusa module and tells you what to run next.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3400 installs · ★ 235
- Author: medusajs
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/medusajs/medusa-agent-skills/tree/HEAD/plugins/medusa-dev/skills/db-generate/SKILL.md
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/skills/db-generate

## What it does

The skill takes a module name and runs `npx medusa db:generate <module-name>`. That is the whole job — one Bash call with your argument dropped in.

When it finishes, you get the module name, the migration file name or location, and any errors or warnings. It also points at the follow-up: apply the migrations with `npx medusa db:migrate`.

The module name is required, so a bare invocation goes nowhere. Tool access is scoped to `Bash(npx medusa db:generate:*)`, which keeps the skill inside generation and out of your other commands.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add medusajs/medusa-agent-skills --skill db-generate -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/db-generate/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/db-generate/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add medusajs/medusa-agent-skills --skill db-generate -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/db-generate/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add medusajs/medusa-agent-skills --skill db-generate -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/db-generate/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install medusajs/medusa-agent-skills db-generate
```

2. **Manually: put the files in place**
- File: `.github/skills/db-generate/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add medusajs/medusa-agent-skills --skill db-generate -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/medusajs/medusa-agent-skills --path plugins/medusa-dev/skills/db-generate
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/db-generate/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add medusajs/medusa-agent-skills --skill db-generate -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/medusajs/medusa-agent-skills/tree/HEAD/plugins/medusa-dev/skills/db-generate/SKILL.md

## When to use it
- generate a migration file for a new Medusa module
- skip typing the module name into the command by hand
- find where the migration file landed
- catch errors and warnings during generation
- get reminded to apply the migrations

## Example prompts
- /medusa-dev:db-generate brand
- /medusa-dev:db-generate custom-module
- Generate migrations for the product module

## Similar
- [convex-migrate](https://affpapa.org/en/nevibecode/skills/convex-migrate.md) — skill · 36100 installs
- [supabase-schema-architect](https://affpapa.org/en/nevibecode/agents/supabase-schema-architect.md) — subagent · 3839 installs
- [prisma-cli](https://affpapa.org/en/nevibecode/skills/prisma-cli.md) — skill · 388700 installs
- [neon-postgres](https://affpapa.org/en/nevibecode/skills/neondatabase-neon-postgres.md) — skill · 281100 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs

From the same set: [medusajs/medusa-agent-skills](https://affpapa.org/en/nevibecode/by/medusajs/medusa-agent-skills.md) — 12 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
