Agent skill

Medusa Development

by Mindrally in Mindrally/skills

Best practices for building commerce applications with Medusa v2, the headless e-commerce framework.

Apache-2.0Auto-check passedSales & Support

Install Medusa Development

skills CLI
$ npx skills add Mindrally/skills --skill medusa-development -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Mindrally/skills medusa-development --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Mindrally/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/medusa-development .claude/skills/medusa-development && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
medusa-development
GitHub stars
268
Token cost
~2.7k tokens
SKILL.md length
805 words
Files
1
Skills in repo
34
Repo updated
First seen
Licence
Apache-2.0

At a glance

Best practices for building commerce applications with Medusa v2, the headless e-commerce framework.

  • Works in 7 steps: Define or extend the data model — Use… → Write the module service — Create a… → Register the module — Add the module to… → …
  • Defining Medusa data models
  • SKILL.md covers Workflow for Building a Medusa…, General Rules, Data Model Rules and Service Rules, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Medusa Development is an agent skill from Mindrally/skills. Best practices for building commerce applications with Medusa v2, the headless e-commerce framework. Use when defining Medusa data models, writing workflows and steps with the Workflow SDK, creating API routes or subscribers, building module services that extend MedusaService, throwing MedusaError, or customizing the Medusa admin dashboard.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Sales & Support, covering E-commerce operations. It works with Medusa. The repository describes itself as: 255+ Claude Code skills converted from Cursor rules. Expert coding guidelines for every major framework and language. The licence is Apache-2.0.

When your agent uses it

  • Defining Medusa data models
  • Writing workflows and steps with the Workflow SDK
  • Creating API routes
  • Building module services that extend MedusaService

Example prompts

  • “/medusa-development”

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Define or extend the data model — Use the model utility from @medusajs/framework/utils to declare the module's data model(s) under…
  2. Write the module service — Create a service in src/modules//service.ts that extends MedusaService when the module has data models…
  3. Register the module — Add the module to medusa-config.ts so Medusa's container can resolve it.
  4. Build steps — Define each unit of work as a step with createStep from @medusajs/framework/workflows-sdk, including a compensation function…
  5. Compose the workflow — Wire steps together with createWorkflow, using transform for data shaping and when for conditional branches.
  6. Expose the workflow — Call the workflow from an API route, a scheduled job, or a subscriber — never put business logic directly in the…
  7. Read data with Query — Use Medusa's Query (req.scope.resolve("query") or the workflow-level useQueryGraphStep) to fetch data instead of…

What it can do on your machine

Read from SKILL.md and the folder at commit 9718410. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.medusajs.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Medusa Development loads about 2.7k tokens when it runs. Until then it costs about 90 tokens; SKILL.md has 805 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~90
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Mindrally/skills at commit 9718410, republished under its Apache-2.0 licence (© Mindrally). 805 words, ~2,708 tokens.

Download SKILL.mdSave it as .claude/skills/medusa-development/SKILL.md (or your agent's skills folder).
name
medusa-development
description
Best practices for building commerce applications with Medusa v2, the headless e-commerce framework. Use when defining Medusa data models, writing workflows and steps with the Workflow SDK, creating API routes or subscribers, building module services that extend MedusaService, throwing MedusaError, or customizing the Medusa admin dashboard.

Medusa Development

Medusa is a headless commerce framework built around modules, data models, and workflows; almost every piece of business logic — from an API route to a scheduled job — should be expressed as a workflow made of discrete, composable steps.

Workflow for Building a Medusa Feature

  1. Define or extend the data model — Use the model utility from @medusajs/framework/utils to declare the module's data model(s) under src/modules/<module>/models/.
  2. Write the module service — Create a service in src/modules/<module>/service.ts that extends MedusaService when the module has data models, exposing async methods for domain operations.
  3. Register the module — Add the module to medusa-config.ts so Medusa's container can resolve it.
  4. Build steps — Define each unit of work as a step with createStep from @medusajs/framework/workflows-sdk, including a compensation function for anything that needs to be undone on failure.
  5. Compose the workflow — Wire steps together with createWorkflow, using transform for data shaping and when for conditional branches.
  6. Expose the workflow — Call the workflow from an API route, a scheduled job, or a subscriber — never put business logic directly in the route/job/subscriber handler.
  7. Read data with Query — Use Medusa's Query (req.scope.resolve("query") or the workflow-level useQueryGraphStep) to fetch data instead of calling module services directly for reads.

General Rules

  • Don't use type aliases when importing files — import types and values directly from their source module rather than re-exporting through a local alias.
  • When throwing errors, always throw MedusaError (from @medusajs/framework/utils) instead of a plain Error, so the API layer can map it to the correct HTTP status and error code.
  • Always use Query to retrieve data rather than calling a module's service methods directly for reads — Query understands module links and can join data across modules in one call.
ts
import { MedusaError } from "@medusajs/framework/utils"

if (!product) {
  throw new MedusaError(
    MedusaError.Types.NOT_FOUND,
    `Product with id "${productId}" was not found`
  )
}

Data Model Rules

  • Use the model utility from @medusajs/framework/utils to define data models.
  • Data model variables should be camelCase; the name 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 only one id field — any other identifier should be a text field instead.
  • Data model fields should be snake_case.
ts
// src/modules/loyalty/models/loyalty-account.ts
import { model } from "@medusajs/framework/utils"

const LoyaltyAccount = model.define("loyalty_account", {
  id: model.id().primaryKey(),
  customer_id: model.text(),
  points_balance: model.number().default(0),
  tier: model.enum(["bronze", "silver", "gold"]).default("bronze"),
})

export default LoyaltyAccount

Service Rules

  • When creating a service, always make its methods async.
  • If a module has data models, make the service extend MedusaService so it inherits generated CRUD methods for each model.
ts
// src/modules/loyalty/service.ts
import { MedusaService } from "@medusajs/framework/utils"
import LoyaltyAccount from "./models/loyalty-account"

class LoyaltyModuleService extends MedusaService({
  LoyaltyAccount,
}) {
  async addPoints(accountId: string, points: number) {
    const account = await this.retrieveLoyaltyAccount(accountId)
    return await this.updateLoyaltyAccounts({
      id: account.id,
      points_balance: account.points_balance + points,
    })
  }
}

export default LoyaltyModuleService

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 rather than inlining the logic in the handler.
  • When creating a workflow, always create a step for each discrete unit of work in it.
  • In workflows, use transform for any data transformation between steps — don't manipulate step output directly in the workflow function body.
  • In workflows, use when to define conditional branches instead of a plain if around step calls.
  • Don't use await when calling steps inside a workflow — step invocation returns a special reference the workflow engine resolves, and await-ing it breaks the workflow's ability to orchestrate compensation and retries.
  • In workflows, don't make the workflow function itself async — the function body only describes the step graph, it doesn't execute imperatively.
  • Don't add typing to a compensation function's input — the compensation function receives whatever the step's invoke function returned, and Medusa infers this automatically.
  • Only use steps in a workflow — don't call services, Query, or other side-effecting code directly inside the workflow function; put that logic in a step.
ts
// src/workflows/redeem-loyalty-points.ts
import {
  createStep,
  createWorkflow,
  StepResponse,
  transform,
  when,
  WorkflowResponse,
} from "@medusajs/framework/workflows-sdk"
import { MedusaError } from "@medusajs/framework/utils"
import { LOYALTY_MODULE } from "../modules/loyalty"
import LoyaltyModuleService from "../modules/loyalty/service"

type RedeemPointsInput = {
  accountId: string
  points: number
}

const deductPointsStep = createStep(
  "deduct-points-step",
  async (input: RedeemPointsInput, { container }) => {
    const loyaltyService: LoyaltyModuleService = container.resolve(LOYALTY_MODULE)
    const account = await loyaltyService.retrieveLoyaltyAccount(input.accountId)

    if (account.points_balance < input.points) {
      throw new MedusaError(
        MedusaError.Types.INVALID_DATA,
        "Insufficient points balance"
      )
    }

    const previousBalance = account.points_balance
    const updated = await loyaltyService.updateLoyaltyAccounts({
      id: account.id,
      points_balance: previousBalance - input.points,
    })

    return new StepResponse(updated, { accountId: account.id, previousBalance })
  },
  async (compensationInput, { container }) => {
    if (!compensationInput) return
    const loyaltyService: LoyaltyModuleService = container.resolve(LOYALTY_MODULE)
    await loyaltyService.updateLoyaltyAccounts({
      id: compensationInput.accountId,
      points_balance: compensationInput.previousBalance,
    })
  }
)

export const redeemLoyaltyPointsWorkflow = createWorkflow(
  "redeem-loyalty-points",
  (input: RedeemPointsInput) => {
    const account = deductPointsStep(input)

    const tierDowngrade = when(account, (acc) => acc.points_balance === 0)
      .then(() => {
        return transform({ account }, (data) => ({
          ...data.account,
          tier: "bronze" as const,
        }))
      })

    return new WorkflowResponse(account)
  }
)
Show full SKILL.md (225 more words)Show less

API Routes and Reading Data

  • Expose workflows through API routes under src/api/; the route handler should validate input, call the workflow, and shape the HTTP response — nothing more.
  • Always use Query to retrieve data for reads (list/detail endpoints) instead of resolving a module service directly.
ts
// src/api/store/loyalty/[id]/route.ts
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"

export async function GET(req: MedusaRequest, res: MedusaResponse) {
  const query = req.scope.resolve("query")

  const { data: accounts } = await query.graph({
    entity: "loyalty_account",
    fields: ["id", "points_balance", "tier"],
    filters: { id: req.params.id },
  })

  res.json({ loyalty_account: accounts[0] })
}

export async function POST(req: MedusaRequest, res: MedusaResponse) {
  const { result } = await redeemLoyaltyPointsWorkflow(req.scope).run({
    input: req.validatedBody as { accountId: string; points: number },
  })

  res.json({ loyalty_account: result })
}

Subscribers and Scheduled Jobs

  • Subscribers and scheduled jobs should call a workflow, exactly like API routes — they are just a different trigger for the same business logic.
ts
// src/subscribers/order-placed.ts
import type { SubscriberArgs, SubscriberConfig } from "@medusajs/framework"
import { redeemLoyaltyPointsWorkflow } from "../workflows/redeem-loyalty-points"

export default async function orderPlacedHandler({ event, container }: SubscriberArgs<{ id: string }>) {
  await redeemLoyaltyPointsWorkflow(container).run({
    input: { accountId: event.data.id, points: 0 },
  })
}

export const config: SubscriberConfig = { event: "order.placed" }

Admin Customization Rules

  • When sending requests from admin customizations (widgets, custom pages), always use Medusa's JS SDK (@medusajs/js-sdk) rather than raw fetch.
  • Use TailwindCSS for styling admin customizations, matching the conventions of Medusa Admin's own UI.
tsx
// src/admin/widgets/loyalty-widget.tsx
import { defineWidgetConfig } from "@medusajs/admin-sdk"
import { useQuery } from "@tanstack/react-query"
import { sdk } from "../lib/sdk"

const LoyaltyWidget = ({ data }: { data: { id: string } }) => {
  const { data: result } = useQuery({
    queryFn: () => sdk.admin.customer.retrieve(data.id),
    queryKey: ["customer", data.id],
  })
  return <p className="text-ui-fg-subtle">{result?.customer.email}</p>
}

export const config = defineWidgetConfig({ zone: "customer.details.after" })
export default LoyaltyWidget

Common Mistakes

  • Calling a module service directly from an API route handler instead of going through a workflow — this skips retries, compensation, and the standard event/observability hooks workflows provide.
  • Throwing a plain Error instead of MedusaError, which loses the mapped HTTP status code and structured error type on the API response.
  • Awaiting a step call inside a workflow function, which breaks the workflow engine's ability to build the step graph.
  • Reading data by resolving a module service instead of using Query, which misses cross-module joins and links that Query resolves automatically.
  • Naming a data model field or model.define name in camelCase instead of snake_case, causing inconsistency with the rest of the schema.

Additional Resources

© Mindrally, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in medusa-development of Mindrally/skills.

Open the folder on GitHubat commit 9718410

Compare with similar skills

Medusa Development next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Medusa Development compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Medusa Development this skillMindrally/skills268—~2.7kAutomated safety check: PassApache-2.0
Zach Sif Cvr Threshold Analyzerzach22-1999/amazon-skills2071 repos~982Automated safety check: NotesMIT
Maishouaahl/skills1622 repos~175Automated safety check: PassMIT
Checkout Purchasekeypo-us/keypo-cli182—~880Automated safety check: NotesNone
Afaafadtc/afa-dtc-skills168—~2.6kAutomated safety check: PassCustom licence
Fix Visual StabilityEtaYang10th/spark-skills111—~3.7kAutomated safety check: PassNone

Similar skills

  • Zach Sif Cvr Threshold Analyzer

    zach22-1999/amazon-skills

    基于领星 ASIN 360 或同类日业务报表,以及用户自己 SIF MCP 导出的日级关键词自然排名 JSON,回测 CVR 与核心词/稳定词自然排名波动的关系,并输出观察线、危险线、广告 CVR 确认线。

    207 GitHub starsUsed in 1 repo~982 tokens
    Sales & SupportAuto-check: notes
  • Maishou

    aahl/skills

    商品价格全网对比技能,获取商品在淘宝(Taobao)、天猫(TMall)、京东(JD.com)、拼多多(PinDuoDuo)、抖音(Douyin)、快手(KaiShou)的最优价格、优惠券,当用户想购物或者获取优惠信息时使用。Get the best price, coupons for goods on Chinese e-commerce platforms, compare…

    162 GitHub starsUsed in 2 repos~175 tokens
    Sales & SupportAuto-check passed
  • Checkout Purchase

    keypo-us/keypo-cli

    A skill your agent uses when the user asks to buy a product from the Shopify store.

    182 GitHub stars~880 tokensUpdated 6 mo ago
    Sales & SupportAuto-check: notes
  • Afa

    afadtc/afa-dtc-skills

    AFA DTC 全链路独立站操盘系统——系统入口、一级路由器、工作流编排器,统筹品牌基建、付费获客、有机增长、变现留存、运营扩张五大业务线。Use when user mentions: 独立站, DTC, 电商, ecommerce, Shopify, 品牌站, 独立站运营, DTC品牌, 全链路, 操盘, 独立站诊断, 独立站增长, 独立站策略.

    168 GitHub stars~2.6k tokensUpdated 10 days ago
    Sales & SupportAuto-check passed
  • Fix Visual Stability

    EtaYang10th/spark-skills

    Fix visual stability issues in Next.js e-commerce apps — covers CLS (Cumulative Layout Shift), FOIT (Flash of Invisible Text), and theme flicker

    111 GitHub stars~3.7k tokensUpdated 3 mo ago
    Sales & SupportAuto-check passed
  • Taobao Keyword Search

    browser-act/skills

    Search Taobao and Tmall product listings by keyword, returning paginated product cards with title, price, shop, image, sales, and tags.

    6.1k GitHub starsUsed in 1 repo~1.6k tokens
    Sales & SupportAuto-check passed

More from Mindrally/skills

All 34 skills in this repo
  • Analytics Data Analysis

    Mindrally/skills

    Best practices for analytics, data analysis, and visualization using Python, pandas, matplotlib, seaborn, and Jupyter notebooks.

    268 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Best practices for AutoML and hyperparameter search with Optuna, Ray Tune, and PyCaret, covering search-space design, validation splits, and leakage prevention.

    268 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Blender Python Addon

    Mindrally/skills

    Best practices for writing Blender Python add-ons using the bpy API, covering operators, panels, properties, registration, and API-safe scripting.

    268 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Expert guidelines for Chrome extension development with Manifest V3, covering security, performance, and best practices.

    268 GitHub stars~1.7k tokensUpdated 1 mo ago
    Auto-check passed
  • Clean Code

    Mindrally/skills

    Clean, maintainable, human-readable code principles combined with anti-over-engineering discipline: naming, single responsibility, DRY, and scoping changes to exactly what was requested.

    268 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Design Systems

    Mindrally/skills

    Comprehensive design system guidelines for building consistent, accessible, and scalable component libraries.

    268 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Medusa Development

What does Medusa Development do?

Best practices for building commerce applications with Medusa v2, the headless e-commerce framework. Medusa Development is an agent skill from Mindrally/skills. Best practices for building commerce applications with Medusa v2, the headless e-commerce framework.

When should I use Medusa Development?

Medusa Development fits situations like: defining Medusa data models; writing workflows and steps with the Workflow SDK; creating API routes; building module services that extend MedusaService.

How do I install Medusa Development in Claude Code?

Run `npx skills add Mindrally/skills --skill medusa-development -a claude-code`. Or copy the skill folder (medusa-development in Mindrally/skills) into .claude/skills/medusa-development in your project. Claude Code loads it when a task matches its description.

How do I install Medusa Development in Codex?

Run `npx skills add Mindrally/skills --skill medusa-development -a codex`. Or copy the skill folder (medusa-development in Mindrally/skills) into .agents/skills/medusa-development in your project. Codex loads it when a task matches its description.

Can I use Medusa Development in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Mindrally/skills --skill medusa-development -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/medusa-development, .gemini/skills/medusa-development, .github/skills/medusa-development and .opencode/skills/medusa-development in your project.

What does Medusa Development need to run?

SKILL.md names no scripts, command-line tools or credentials: Medusa Development is instructions for the agent only.

Does Medusa Development access the network?

SKILL.md names 1 domain. As links in the text: docs.medusajs.com. This is read from the text; nothing was executed.

Is Medusa Development safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Medusa Development use?

Medusa Development is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Medusa Development use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Medusa Development?

Skills that share tags, products or a category with Medusa Development: Zach Sif Cvr Threshold Analyzer (zach22-1999/amazon-skills, 207 stars), Maishou (aahl/skills, 162 stars), Checkout Purchase (keypo-us/keypo-cli, 182 stars) and Afa (afadtc/afa-dtc-skills, 168 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Medusa Development?

Mindrally (a GitHub organization) maintains it in Mindrally/skills, which has 268 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on September 3, 2026.

Source: Mindrally/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.