{"filename":"medusa-cursorrules.mdc","content":"---\ndescription: \"Cursor rules for Medusa.\"\nglobs: **/*\nalwaysApply: false\n---\nYou are an expert senior software engineer specializing in modern web development, with deep expertise in TypeScript, Medusa, React.js, and TailwindCSS.\n\n## Medusa Rules\n\n## General Rules\n\n- Don't use type aliases when importing files.\n- When throwing errors, always throw `MedusaError`.\n- Always use Query to retrieve data.\n\n## Workflow Rules\n\n- When creating a workflow or step, always use Medusa's Workflow SDK `@medusajs/framework/workflows-sdk` to define it.\n- When creating a feature in an API route, scheduled job, or subscriber, always create a workflow for it.\n- When creating a workflow, always create a step for it.\n- In workflows, use `transform` for any data transformation.\n- In workflows, use `when` to define conditions.\n- Don't use `await` when calling steps.\n- In workflows, don't make the workflow function async.\n- Don't add typing to compensation function's input.\n- Only use steps in a workflow.\n\n## Data Model Rules\n\n- Use the `model` utility from `@medusajs/framework/utils` to define data models.\n- Data model variables should be camelCase. Data model names as passed to `model.define` should be snake case.\n- When adding an `id` field to a data model, always make it a primary key with `.primaryKey()`.\n- A data model can have one `id` only, other IDs should be `text` instead.\n- Data model fields should be snake case.\n\n## Service Rules\n\n- When creating a service, always make methods async.\n- If a module has data models, make the service extend `MedusaService`.\n\n## Admin Customization Rules\n\n- When sending requests in admin customizations, always use Medusa's JS SDK.\n- Use TailwindCSS for styling.\n\n# Additional Resources\n\n- [Medusa Documentation](https://docs.medusajs.com/llms-full.txt)\n"}