Back to Skills

db-generate

Generate database migrations for a Medusa module

194stars22forksUpdated 7/2/2026

Security Assessment

Safe(100/100)
Security Score100/100

About db-generate

A focused command skill for the Medusa commerce framework that generates database migrations for a single module. It fits into the routine development loop where a module's data model has changed and the corresponding migration files need to be produced before they can be applied.

Usage is straightforward: the user supplies a module name as an argument, for example a built-in module like product or a custom module, and the skill runs Medusa's database migration generation for that module through the Bash tool. Its allowed tools are restricted to Medusa's db:generate command, keeping the skill narrowly scoped to this single operation and preventing it from running unrelated commands.

After running, it reports the outcome back to the user, including the module name for which migrations were generated, the resulting migration file name or location, any errors or warnings surfaced by the command, and the recommended next step. That next step is applying the newly generated migration with Medusa's database migrate command, which the skill intentionally leaves as a separate action rather than performing automatically. Because it wraps a single CLI command with clear inputs and outputs, it is well suited to being invoked as a named slash command during backend development, giving a consistent and reportable way to keep a module's migrations in sync with its model changes without having to remember the exact command syntax.

FAQ

What does this skill do?

It generates database migrations for a specified Medusa module by running the Medusa CLI's db:generate command for that module.

How do I tell it which module to migrate?

Provide the module name as an argument, such as brand, product, or a custom module name, for example /medusa-dev:db-generate brand.

What does it report after running?

The module name, the generated migration file name or location, any errors or warnings, and the recommended next step.

What is the next step after generating a migration?

Applying the migration by running Medusa's database migrate command; the skill leaves this as a separate manual step.

What tools is it allowed to use?

Only the Bash tool, and specifically restricted to npx medusa db:generate commands, so its scope is limited to migration generation.

Install db-generate

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill