# db-generate

Generate database migrations for a Medusa module

Skill by Medusa. Category: Data and backend.

## Install

Project (for this project only):

```sh
npx skills add medusajs/medusa-agent-skills --skill db-generate
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

Global (for every project on this machine):

```sh
npx skills add medusajs/medusa-agent-skills --skill db-generate -g
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

## Tags

- Runs on your computer: It runs as a program on your machine, with your access.
- Runs shell commands: Its steps run shell commands in your terminal.

## Security audits

- Gen Agent Trust Hub: Pass
- Socket: Pass
- Snyk: Pass
- Runlayer: Warn
- ZeroLeaks: Pass

Installs: 3179. Installs counted by skills.sh. [Open on skills.sh](https://www.skills.sh/medusajs/medusa-agent-skills/db-generate)

## Source

[Open the source](https://github.com/medusajs/medusa-agent-skills/tree/HEAD/plugins/medusa-dev/skills/db-generate). Checked 2026-10-10. This summary may contain AI-generated text, so it can be wrong. Check the source before you rely on it.

## SKILL.md

````markdown
---
name: db-generate
description: Generate database migrations for a Medusa module
argument-hint: <module-name>
allowed-tools: Bash(npx medusa db:generate:*)
---

# Generate Database Migrations

Generate database migrations for the specified Medusa module.

The user will provide the module name as an argument (e.g., `brand`, `product`, `custom-module`).

For example: `/medusa-dev:db-generate brand`

Use the Bash tool to execute the command `npx medusa db:generate <module-name>`, replacing `<module-name>` with the provided argument.

Report the results to the user, including:

- The module name for which migrations were generated
- Migration file name or location
- Any errors or warnings
- Next steps (running `npx medusa db:migrate` to apply the migrations)
````

- Previous: [learning-medusa](https://syn4pse.dev/terminal/medusa-learning.md)
- Next: [new-user](https://syn4pse.dev/terminal/medusa-new-user.md)
- [Terminal](https://syn4pse.dev/terminal.md)
- [Suggest a change](mailto:terminal@syn4pse.dev?subject=Terminal%20suggestion)
