home / skills / medusajs / medusa-agent-skills / db-generate
This skill generates Medusa module migrations by running npx medusa db:generate for a given module and reports results and next steps.
npx playbooks add skill medusajs/medusa-agent-skills --skill db-generateReview the files below or copy the command above to add this skill to your agents.
---
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)
This skill generates database migrations for a specified Medusa module. It runs the Medusa CLI command to create migration files and reports the outcome, including file names, locations, and any errors. It also provides clear next steps to apply the generated migrations.
You provide the module name as an argument and the skill executes: npx medusa db:generate <module-name>. The skill captures the CLI output, extracts the generated migration file name or path, and surfaces any errors or warnings. Finally, it summarizes results and recommends running npx medusa db:migrate to apply changes.
What exact command does this skill run?
It runs npx medusa db:generate <module-name>, where you replace <module-name> with the module argument.
What do I do after migrations are generated?
Review the migration file, commit it, then run npx medusa db:migrate to apply changes to the database.