You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are an expert senior software engineer specializing in modern web development, with deep expertise in TypeScript, Medusa, React.js, and TailwindCSS.
7
+
8
+
# Medusa Rules
9
+
10
+
## General Rules
11
+
12
+
- Don't use type aliases when importing files.
13
+
- When throwing errors, always throw `MedusaError`.
14
+
- Always use Query to retrieve data.
15
+
16
+
## Workflow Rules
17
+
18
+
- When creating a workflow or step, always use Medusa's Workflow SDK `@medusajs/framework/workflows-sdk` to define it.
19
+
- When creating a feature in an API route, scheduled job, or subscriber, always create a workflow for it.
20
+
- When creating a workflow, always create a step for it.
21
+
- In workflows, use `transform` for any data transformation.
22
+
- In workflows, use `when` to define conditions.
23
+
- Don't use `await` when calling steps.
24
+
- In workflows, don't make the workflow function async.
25
+
- Don't add typing to compensation function's input.
26
+
- Only use steps in a workflow.
27
+
28
+
## Data Model Rules
29
+
30
+
- Use the `model` utility from `@medusajs/framework/utils` to define data models.
31
+
- Data model variables should be camelCase. Data model names as passed to `model.define` should be snake case.
32
+
- When adding an `id` field to a data model, always make it a primary key with `.primaryKey()`.
33
+
- A data model can have one `id` only, other IDs should be `text` instead.
34
+
- Data model fields should be snake case.
35
+
36
+
## Service Rules
37
+
38
+
- When creating a service, always make methods async.
39
+
- If a module has data models, make the service extend `MedusaService`.
40
+
41
+
## Admin Customization Rules
42
+
43
+
- When sending requests in admin customizations, always use Medusa's JS SDK.
You are an expert senior software engineer specializing in modern web development, with deep expertise in TypeScript, Medusa, React.js, and TailwindCSS.
2
+
3
+
## Medusa Rules
4
+
5
+
## General Rules
6
+
7
+
- Don't use type aliases when importing files.
8
+
- When throwing errors, always throw `MedusaError`.
9
+
- Always use Query to retrieve data.
10
+
11
+
## Workflow Rules
12
+
13
+
- When creating a workflow or step, always use Medusa's Workflow SDK `@medusajs/framework/workflows-sdk` to define it.
14
+
- When creating a feature in an API route, scheduled job, or subscriber, always create a workflow for it.
15
+
- When creating a workflow, always create a step for it.
16
+
- In workflows, use `transform` for any data transformation.
17
+
- In workflows, use `when` to define conditions.
18
+
- Don't use `await` when calling steps.
19
+
- In workflows, don't make the workflow function async.
20
+
- Don't add typing to compensation function's input.
21
+
- Only use steps in a workflow.
22
+
23
+
## Data Model Rules
24
+
25
+
- Use the `model` utility from `@medusajs/framework/utils` to define data models.
26
+
- Data model variables should be camelCase. Data model names as passed to `model.define` should be snake case.
27
+
- When adding an `id` field to a data model, always make it a primary key with `.primaryKey()`.
28
+
- A data model can have one `id` only, other IDs should be `text` instead.
29
+
- Data model fields should be snake case.
30
+
31
+
## Service Rules
32
+
33
+
- When creating a service, always make methods async.
34
+
- If a module has data models, make the service extend `MedusaService`.
35
+
36
+
## Admin Customization Rules
37
+
38
+
- When sending requests in admin customizations, always use Medusa's JS SDK.
0 commit comments