Skip to content
Back to skills

Medusa Knowledge Patch

ASecurity

Medusa

  • 25 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
developmenttypescriptgosqlreactgitapidatabasebackendsecurity

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill medusa-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Medusa Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Medusa Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-medusa-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-medusa-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: medusa-knowledge-patch
description: Medusa
version: null
license: MIT
metadata:
  author: Nevaberry
---


# Medusa knowledge patch

Load this skill when upgrading or extending Medusa backends, storefronts,
Admin, modules, payment providers, workflows, or plugins. Use the topic
references for complete guidance, version-specific changes, and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Compatibility and migrations](references/compatibility-and-migrations.md) | Dependency upgrades, framework imports, data scripts, API types, SDK changes, regressions |
| [Authentication, runtime, and query](references/auth-runtime-and-query.md) | OAuth, passwords, middleware, RBAC, server configuration, Index, Search, preview caching |
| [Carts, orders, workflows, and events](references/carts-orders-workflows-and-events.md) | Checkout, payment recovery, idempotency, retention, order changes, drafts, returns, events |
| [Fulfillment, inventory, shipping, and tax](references/fulfillment-inventory-shipping-and-tax.md) | Fulfillment inputs, delivery, reservations, kits, shipping options, tax providers |
| [Modules, models, and extensions](references/modules-models-and-extensions.md) | Generated services, links, plugins, Admin extensions, uploads, experimental Translations |
| [Payments, pricing, and promotions](references/payments-pricing-and-promotions.md) | Provider contracts, account holders, refunds, pricing hooks, promotion budgets, Loyalty, currencies |
| [Admin, storefront, and tooling](references/admin-storefront-and-tooling.md) | UI, views, routes, metadata, product queries, CSV, locales, scaffolding, MCP |

## Breaking changes and deprecations

### Dependency and validator upgrades

- For the 2.4.0 upgrade, update the MikroORM dependencies and CLI to `6.4.3`
  alongside application packages, then install to refresh the lockfile.
- For the 2.11.0 upgrade, remove the direct MikroORM packages, `awilix`, and
  `pg`, then reinstall. The runtime supplies these through `@medusajs/deps`.
  Use the framework's MikroORM, Awilix, PostgreSQL, and OpenTelemetry exports.
- Import Zod from `@medusajs/framework/zod`. The CLI can rewrite imports with
  `npx medusa codemod replace-zod-imports` after upgrading.
- For Zod v4, backends declaring `zod` directly should install `4.2.0`.
  Use the unified `error` option, an explicit key schema in `z.record`, and
  `z.treeifyError(err)` for nested errors.
- Direct Icons consumers on earlier React versions must upgrade to React 19
  or pin the Icons package to an earlier release.
- Upgrade from 2.22.5 to 2.22.6 for security hardening with complete package
  files, including the Yarn-packed Draft Order and Loyalty plugin builds.

### Renamed fields and request contracts

- Replace `remoteLink` with `link`, `remoteQueryConfig` with `queryConfig`,
  and `remote-query-entry-points.d.ts` with `query-entry-points.d.ts`.
- Inventory location-level batch requests use `create`, `delete`, and
  `update`; replace the old `creates` and `deletes` keys.
- Remove `region_id` references on Payment Collection and `cart_id`,
  `order_id`, and `customer_id` references on Payment.
- Remove `context` from `POST /store/payment-collections/:id/payment-sessions`.
- Remove `fulfillment_status` and `payment_status` from order list requests
  and typed filters. From 2.22.6, explicitly request `items` for line items
  in order-list workflow responses.
- Omit the body when marking a fulfillment delivered, including the body
  argument in JS SDK `markAsDelivered` calls.
- Pass an object to `refetchEntity` and `refetchEntities` with `entity`,
  `idOrFilter`, `scope`, and `fields`. Both accept `options`; the plural
  helper also accepts `pagination` and `withDeleted`.

### Payment provider integrations

`IPaymentProvider` methods take a single typed input object. Throw errors
from provider methods so the Payment Module can handle them. This also
applies to the optional `listPaymentMethods` and `savePaymentMethod` methods.

Custom payment integrations must replace `customer.account_holder` with
`customer.account_holders` and select the entry whose `provider_id` matches
the payment provider in use.

### Data migrations

Assign a shipping profile when creating a product. The upgrade data script
assigns all products to the default profile if it finds a profile with
`default` in its name, ignoring case.

Use `medusa db:migrate --skip-scripts` to defer data scripts, then rerun
`medusa db:migrate` when ready. The order line-item adjustment migration
requires data scripts enabled. Currency normalization also requires upgrade
migrations. Stock location address relationships require their migration.

### Upload provider contracts

`/admin/uploads` passes base64-encoded content to providers. Decode it in
custom providers and retain binary handling if they also receive binary
uploads. Built-in Local Storage and S3 already handle the encoding.

For S3 presigned uploads, request the URL with the actual file size and
upload exactly that many bytes; S3 rejects a different content length.

## Authentication and request handling

Send `callback_url` in the initial Google or GitHub authentication JSON body
to select the actor's callback page. Forward every provider query parameter
to callback validation, including `code`, `state`, and `error` when present.
An override of `@medusajs/medusa/auth` must include `Modules.CACHE` in its
dependencies for temporary OAuth state storage.

The `authCallbackValidated` hook receives the authenticated identity and
raw provider authentication data after successful validation. Use the
callback workflow's `storeTokens` option to persist tokens from the subscriber.

Send password-reset tokens in the `Authorization` header, removing the
`token` query parameter. Reset-password subscribers read `actor_type`;
the deprecated `actorType` field was dropped.

Customer account email must match the authenticated identity's email.
Account creation skips the comparison when that identity has no email;
custom validation uses `createCustomerAccountWorkflow.hooks.validate`.

In `defineMiddlewares`, omit HTTP methods for global middleware and specify
methods for route middleware. Middleware stacks with built-in validation.
Application routes can override matching core or plugin routes; core-route
overrides are slated for removal.

Route query `allowed` settings and `http.restrictedFields` strip disallowed
fields even with RBAC disabled. Admin role-based access control requires
an Enterprise license and supports enforcement across Admin and API routes.

## Checkout, orders, and workflows

Every cart workflow has a pre-operation `validate` hook; throw to reject the
operation. Cart operations enforce customer ownership. Use the owning
customer's identity for customer-owned carts.

From 2.23.1, completion requires a shipping method for every line item whose
variant is linked to a shipping profile. Custom checkouts must collect these
shipping methods before completing the cart.

Checkout can complete without payment when the remaining balance is zero
and accepts payment sessions with status `captured`. On failure, checkout
compensation can void or refund an active provider payment and recreate the
session so the customer can attach new payment details.

With `idempotent: true`, workflows deduplicate in-progress executions and
retain completed executions only with explicit `retentionTime`. Cart
workflows enable idempotency from 2.10.0. The earlier completion setting and
transaction-ID guidance are in the workflow reference.

Specify `retentionTime` in seconds; an hourly job deletes expired executions.
Use `retryIntervalAwaiting` and `maxAwaitingRetries` for an asynchronous step's
retry interval and limit while it awaits completion.

Order cancellation rejects completed orders. Cancellation immediately
cancels uncaptured payments and attempts to refund captured payments for
the captured amount. A return cannot exceed an item's returnable quantity.

## Events and extension hooks

Sub-workflow events remain pending while the parent runs. Compensation via
`emitEventsStep` clears queued events; use a custom emit step that omits
compensation if subscribers need those events on rollback.

The event bus emits or queues an event only when at least one subscriber is
registered. Lower numbers give queued events higher priority: order placement
uses `10`, ordinary events default to `100`, and internal system events have
the lowest priority.

## Pricing and promotions

Use `hooks.setPricingContext` to add custom rule attributes for variant or
shipping-option pricing. Core Flows preserve the existing customer and
region when merging the result. Price calculations consider only attributes
defined in price rules; a `sale` price list preserves an available lower price.

New promotions default to `draft` unless a different `status` is supplied;
upgrades set existing promotions to `active`. Invalid promotion codes return
HTTP `400` and an explanatory message.

Campaign budgets using `USE_BY_ATTRIBUTE` apply their `limit` separately to
each chosen attribute value. The Promotion Module also tracks and enforces
`spend_by_attribute` budgets. Individual promotion usage limits are independent
of campaign-level and per-customer campaign budgets.

Allocation `once` with `max_quantity` covers up to that many eligible units across
the cart, starting with the lowest-priced units. Automatic promotion `ne`
rules can match missing attributes. Buy-get discounts honor `is_tax_inclusive`.

## Models, plugins, and fulfillment

Register a custom module and start the development server to generate
`.medusa/types/module-bindings.d.ts`. Generated create/update inputs infer
model properties as optional in TypeScript; database-required fields still
need values. A `{ selector, data }` update always returns an array.

`link.create` enforces `defineLink` cardinality. Set `isList: true` on the
related model for several related records per product, or on both sides for
many-to-many links. One-to-one unique indexes exclude soft-deleted rows.

Plugins can supply routes, workflows, subscribers, custom modules, and links.
Publish a `./admin` export for compiled Admin extensions; the extension build
emits ESM and CommonJS entry points. Plugin builds include server assets.

For experimental Translations, mark eligible text fields `.translatable()`
and select fields in Admin. Remove a previously configured Translation
Module `entities` option in favor of these model fields and Admin selections.

Fulfillment creation requires at least one item. The optional
`shipping_option_id` overrides the shipping option. Moving an inventory
reservation releases its reserved quantity at the original location.

## Queries, search, and preview caching

Experimental cross-module queries use `@medusajs/index`,
`MEDUSA_FF_INDEX_ENGINE=true`, migration, and server startup for ingestion.
`query.index` uses the `query.graph` query shape; its PostgreSQL-estimated
result count can be inaccurate for small results. Filters support `$and`,
`$or`, `$nin`, and `$not`.

Use `defineSearchIndex` for products or other models and enable storefront
access for `/store/search`. From 2.21.2, this route returns only indexed
fields. Add needed fields to the index or fetch them separately; the route
no longer hydrates extra fields through `query.graph`.

Preview caching requires `featureFlags.caching` and a Redis provider. Set
`options.cache.enable` on graph queries for automatic keys and invalidation
tags; module service mutations invalidate matching entries. The preview
deprecates `@medusajs/cache`, `@medusajs/cache-redis`, and `@medusajs/cache-inmemory`.

Files in this skill

  • SKILL.md8.1 KB
  • coverage.json1.5 KB
  • references/admin-storefront-and-tooling.md4.6 KB
  • references/auth-runtime-and-query.md5 KB
  • references/carts-orders-workflows-and-events.md6.4 KB
  • references/compatibility-and-migrations.md9.9 KB
  • references/fulfillment-inventory-shipping-and-tax.md4.1 KB
  • references/modules-models-and-extensions.md5.1 KB
  • references/payments-pricing-and-promotions.md5.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.