PluginBench
Skill
Official
Fail
Audit score 45

db-generate

medusajs/medusa-agent-skills

Generate database migrations for Medusa modules with a single command.

What is db-generate?

This skill automates the creation of database migrations for Medusa modules. Use it when you need to generate migration files for a new or modified module before applying them to your database.

  • Generates database migration files for specified Medusa modules
  • Executes the npx medusa db:generate command with module name argument
  • Reports migration file names and locations
  • Identifies errors or warnings during generation
  • Suggests next steps for applying migrations

How to install db-generate

npx skills add https://github.com/medusajs/medusa-agent-skills --skill db-generate
Prerequisites
  • Medusa project initialized and configured
  • Node.js and npm installed
  • Access to Medusa CLI tools
Claude Code
Cursor
Windsurf
Cline

How to use db-generate

  1. 1.Identify the module name you need to generate migrations for (e.g., 'brand', 'product', 'custom-module')
  2. 2.Invoke the skill with the module name as argument: /medusa-dev:db-generate <module-name>
  3. 3.Review the generated migration file name and location in the output
  4. 4.Check for any errors or warnings reported
  5. 5.Run npx medusa db:migrate to apply the generated migrations to your database

Use cases

Good for
  • Create migrations when adding a new custom module to your Medusa store
  • Generate migrations after modifying module database schema
  • Prepare migration files before running database updates
  • Automate migration creation in development workflows
Who it's for
  • Medusa developers building custom modules
  • Backend engineers managing Medusa database schemas
  • DevOps engineers automating Medusa deployments

db-generate FAQ

What module names can I use?

You can use any Medusa module name, including built-in modules (product, brand, etc.) or custom module names you've created in your project.

Where are migration files generated?

Migration files are generated in your Medusa project's migrations directory. The exact location and filename are reported in the skill output.

What should I do after generating migrations?

After generation, review the migration file for correctness, then run npx medusa db:migrate to apply the migrations to your database.

Can I edit the generated migration files?

Yes, you can edit migration files after generation to customize them before applying them to your database.

Full instructions (SKILL.md)

Source of truth, from medusajs/medusa-agent-skills.


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)