building-with-medusa
Audited by Runlayer on Feb 22, 2026
Malicious tool definition detected
Tool: reference/custom-modules.md [1/2] Description: # Custom Modules ## Contents - [When to Create a Custom Module](#when-to-create-a-custom-module) - [Module Structure](#module-structure) - [Creating a Custom Module - Implementation Checklist](#creating-a-custom-module---implementation-checklist) - [Step 1: Create the Data Model](#step-1-create-the-data-model) - [Step 2: Create the Service](#step-2-create-the-service) - [Step 3: Export Module Definition](#step-3-export-module-definition) - [St
Tool: reference/custom-modules.md [2/2] Description: Medusa application starts.
Malicious tool definition detected
Tool: reference/module-links.md [1/2] Description: # Module Links ## Contents - [When to Use Links](#when-to-use-links) - [Implementing Module Links - Workflow Checklist](#implementing-module-links---workflow-checklist) - [Step 1: Defining a Link](#step-1-defining-a-link) - [Step 2: Link Configuration Options](#step-2-link-configuration-options) - [List Links (One-to-Many)](#list-links-one-to-many) - [Delete Cascades](#delete-cascades) - [Step 3: Sync Links (Run Migrations)](#step-3-sync-links-r
Tool passed security scan
Malicious tool definition detected
Tool: reference/scheduled-jobs.md [2/2] Description: } } ``` ### 3.
Malicious tool definition detected
Retrieve the full entity data using services or query: ```typescript // src/subscribers/order-placed.ts import { SubscriberArgs, type SubscriberConfig } from "@medusajs/framework" export default async function orderPlacedHandler({ event: { data }, container, }: SubscriberArgs<{ id: string }>) { const logger = container.resolve("logger") const query = container.resolve("query") // data.id contains the order ID logger.info(`Handling order.placed event for order: ${data.id}`) // Retrieve full order
For long-running tasks, consider: - Queuing the task for background processing - Using scheduled jobs instead - Breaking the work into smaller steps ```typescript // ✅ GOOD: Quick operation export default async function orderPlacedHandler({ event: { data }, container, }: SubscriberArgs<{ id: string }>) { const notificationService = container.resolve("notification") // Quick: Queue email for sending await notificationService.createNotifications({ to: "customer@example.com", template: "order-confi
Malicious tool definition detected
If custom prefix, add authentication middleware: ```typescript export default defineMiddlewares({ routes: [ { matcher: "/custom/admin*", middlewares: [authenticate("user", ["session", "bearer", "api-key"])], }, ], }) ``` 3. For optional auth, check if `auth_context` exists: ```typescript const userId = req.auth_context?.actor_id if (!userId) { // Handle unauthenticated case } ``` ## General Debugging Tips ### Enable Debug Logging ```bash # Set log level to debug LOG_LEVEL=debug npx medusa develo
Malicious tool definition detected
Create these tasks in your todo list: - Define the input type for your workflow - Create step function (one mutation per step) - Add compensation function to steps for rollback - Create workflow composition function - Follow workflow composition rules (no async, no arrow functions, etc.) - Return WorkflowResponse with results - Test idempotency (workflow can be retried safely) - **CRITICAL: Run build to validate implementation** (catches type errors and issues) ## Basic Workflow Structure **File
Tool: reference/workflows.md [2/3] Description: { const { items } = req.body // Execute the workflow once for each item for (const item of items) { await myWorkflow(req.scope) .run({ item }) } res.status(200).send({ success: true }) } // Workflow definition - processes a single item const myWorkflow = createWorkflow( "hello-world", function (input: WorkflowInput) { step1(input.item) }) ``` **Alternative 2: Use `transform` for Array Operations (Prepare step inputs)** When you need to iterate over
Tool passed security scan
Malicious tool definition detected
Tool: SKILL.md [2/3] Description: ] Bypassing workflows for mutations - [ ] Setting `fields` explicitly with `req.queryConfig` - [ ] Skipping migrations after creating module links **Type Safety:** - [ ] Forgetting `MedusaRequest<SchemaType>` type argument - [ ] Using `MedusaRequest` instead of `AuthenticatedMedusaRequest` for protected routes - [ ] Not exporting Zod inferred type from middlewares - [ ] Adding `.linkable()` to data models - [ ] Using dashes in module names (must be camelCase) **
Tool passed security scan
Tool passed security scan
Tool passed security scan
Passed Files (4)Click to expand
Tool passed security scan
Tool passed security scan
Tool passed security scan
Tool passed security scan