Skip to content
Prompt

examples — Cursor Rules

by medusajs

AI Summary

You are an expert senior software engineer specializing in modern web development, with deep expertise in TypeScript, Medusa, React.js, and TailwindCSS.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "examples — Cursor Rules" prompt rules to my project.
Repository: https://github.com/medusajs/examples

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

All Medusa-related examples.

General Rules

• Don't use type aliases when importing files. • When throwing errors, always throw MedusaError.

Workflow Rules

• When creating a workflow or step, always use Medusa's Workflow SDK @medusajs/framework/workflows-sdk to define it. • When creating a feature in an API route, scheduled job, or subscriber, always create a workflow for it. • When creating a workflow, always create a step for it. • In workflows, use transform for any data transformation. • In workflows, use when to define conditions. • Don't use await when calling steps. • In workflows, don't make the workflow function async. • Don't add typing to compenstion function's input. • Only use steps in a workflow.

Data Model Rules

• Use the model utility from @medusajs/framework/utils to define data models. • Data model variables should be camelCase. Data model names as passed to model.define should be snake case. • When adding an id field to a data model, always make it a primary key with .primaryKey(). • A data model can have one id only, other IDs should be text instead. • Data model fields should be snake case.

Service Rules

• When create a service, always make methods async. • If a module has data models, make the service extend MedusaService.

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 2mo ago
Active
Adoption100+ stars on GitHub
237 ★ · Growing
DocsMissing or thin
Undocumented

GitHub Signals

Stars237
Forks59
Issues7
Updated2mo ago
View on GitHub
No License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more