building-with-medusa

Guide Medusa backend development with architectural patterns and type safety.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/aydadevelop/turborepo-starter --skill building-with-medusa-aydadevelop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-with-medusa
Source: https://github.com/aydadevelop/turborepo-starter/tree/main/.agents/skills/medusa/building-with-medusa
Command: npx skills add https://github.com/aydadevelop/turborepo-starter --skill building-with-medusa-aydadevelop

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on building robust Medusa backends, covering architectural patterns, type safety, and critical development rules that go beyond standard documentation.

Core Features & Use Cases

  • Architectural Guidance: Enforces a strict Module → Workflow → API Route pattern for all backend operations.
  • Type Safety: Ensures correct usage of Zod schemas, MedusaRequest types, and other TypeScript patterns.
  • Business Logic Placement: Dictates where business logic should reside (workflows, not routes).
  • Data Access Patterns: Guides on efficient and correct data querying, including critical rules for price handling.
  • Use Case: When developing a new custom module for Medusa, implementing complex business logic in workflows, or building new API endpoints, this Skill ensures adherence to best practices and prevents common pitfalls.

Quick Start

Use the building-with-medusa skill to plan the architecture for a new custom module.

Frequently Asked Questions about building-with-medusa

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure business logic in Medusa backend architecture?

Medusa backend architecture enforces a strict Module → Workflow → API Route pattern. You must place all custom business logic within workflows rather than API routes to ensure proper isolation and maintainability.

What is the best way to query data using Medusa API routes?

The best way to query data in Medusa is by using `query.graph()` and `query.index()` strategies. These methods ensure efficient data access patterns and correct handling of critical operations like price data retrieval.

How do I ensure type safety when developing custom Medusa modules?

To ensure type safety in Medusa backend development, you must correctly implement Zod schemas and MedusaRequest types. Adhering to these TypeScript patterns prevents common architectural pitfalls and enforces strict data validation.

Can I put business logic directly in Medusa API routes instead of workflows?

No, Medusa development rules dictate that business logic should reside in workflows, not API routes. API routes must handle HTTP method conventions and delegate complex operations to workflows to maintain module isolation.

When do I need to use Zod schemas in Medusa backend development?

You need to use Zod schemas in Medusa backend development to enforce type safety and validate data structures. They are essential when defining custom modules and ensuring correct data handling across your architectural workflows.

Why does Medusa enforce module isolation for custom backend features?

Medusa enforces module isolation to maintain a strict architectural pattern for backend operations. This separation ensures that custom modules remain robust, scalable, and adhere to critical data querying and business logic placement rules.