medusa-customers

Manage Medusa v2 customers — customer profiles, email and social authentication, customer groups, addresses, and account management. Use when working with customer data and auth.

17 stars

Best use case

medusa-customers is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Manage Medusa v2 customers — customer profiles, email and social authentication, customer groups, addresses, and account management. Use when working with customer data and auth.

Teams using medusa-customers should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/medusa-customers/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/medusa-commerce/.agent/skills/medusa-customers/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/medusa-customers/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How medusa-customers Compares

Feature / Agentmedusa-customersStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Manage Medusa v2 customers — customer profiles, email and social authentication, customer groups, addresses, and account management. Use when working with customer data and auth.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Medusa v2 Customer Management

## Before writing code

**Fetch live docs**:
1. Web-search `site:docs.medusajs.com customer module` for customer data model and service methods
2. Web-search `site:docs.medusajs.com auth module` for authentication providers and flows
3. Web-search `site:docs.medusajs.com customer group` for group management and pricing rules
4. Fetch `https://docs.medusajs.com/resources/references/customer` and review the `ICustomerModuleService` interface
5. Web-search `medusajs v2 auth provider social login 2026` for latest authentication patterns

## Customer Data Model

### Entity Relationships

| Entity | Relationship | Key Fields |
|--------|-------------|------------|
| **Customer** | Root | email, first_name, last_name, phone, has_account, metadata |
| **Addresses[]** | Customer → many | address fields, country_code, is_default_shipping/billing |
| **CustomerGroups[]** | Customer ↔ many | Many-to-many group membership |
| **Orders[]** | Customer → many (link) | Via Order Module link |

### Key Fields

| Field | Type | Description |
|-------|------|-------------|
| `email` | string | Unique identifier for the customer |
| `has_account` | boolean | `true` for registered, `false` for guest |
| `first_name` / `last_name` | string | Customer name |
| `phone` | string | Phone number |
| `metadata` | JSONB | Custom key-value data |

## Authentication Architecture

Medusa v2 separates **customer identity** from **authentication** via the Auth Module:

```
Auth Module
├── AuthIdentity
│   ├── provider_identities[] (emailpass, google, github...)
│   └── app_metadata (linked customer_id)
└── Auth Providers (built-in + custom)
```

### Authentication Flow

```
Register/Login ──> Auth Module validates ──> JWT token
  ──> Token includes auth_identity_id ──> Linked to customer_id
```

### Auth Provider Comparison

| Provider | Type | Configuration |
|----------|------|---------------|
| `emailpass` | Built-in | No external config needed |
| `google` | OAuth2 | Client ID + secret |
| `github` | OAuth2 | Client ID + secret |
| Custom | Extensible | Implement `AbstractAuthModuleProvider` |

### Email + Password Flow

| Step | Endpoint | Purpose |
|------|----------|---------|
| Register | `/auth/customer/emailpass/register` | Create auth identity |
| Login | `/auth/customer/emailpass` | Authenticate, get token |
| Create customer | `/store/customers` | Create customer profile (with token) |

### Social Login Flow (OAuth2)

| Step | Endpoint | Purpose |
|------|----------|---------|
| Initiate | `/auth/customer/{provider}` | Get redirect URL |
| Callback | `/auth/customer/{provider}/callback` | Exchange code for token |
| Create/Link | `/store/customers` | Create or link customer profile |

> **Fetch live docs** for OAuth2 callback handling, redirect URIs, and token exchange flow.

## Customer Groups

| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Group name (e.g., "VIP", "Wholesale") |
| `metadata` | JSONB | Custom group data |
| `customers` | relation | Many-to-many with customers |

### Use Cases

| Use Case | Mechanism |
|----------|-----------|
| Group-specific pricing | Price List rules linked to customer groups |
| Conditional promotions | Promotion rules targeting customer groups |
| Access control | Custom middleware checking group membership |

### Key Service Methods

| Operation | Method |
|-----------|--------|
| Create group | `customerModuleService.createCustomerGroups()` |
| Add to group | `customerModuleService.addCustomerToGroup()` |
| Remove from group | `customerModuleService.removeCustomerFromGroup()` |
| List groups | `customerModuleService.listCustomerGroups()` |

## Address Management

| Field | Required | Notes |
|-------|----------|-------|
| `first_name` / `last_name` | Yes | |
| `address_1` | Yes | Street address |
| `city` | Yes | |
| `country_code` | Yes | ISO 2-letter code |
| `postal_code` | Conditional | Required by country |
| `is_default_shipping` / `is_default_billing` | No | Default flags |

| Workflow | Purpose |
|----------|---------|
| `createCustomerAddressesWorkflow` | Add new address |
| `updateCustomerAddressesWorkflow` | Update existing address |
| `deleteCustomerAddressesWorkflow` | Remove address |

## Store API Routes

| Route Pattern | Method | Purpose |
|---------------|--------|---------|
| `/store/customers` | POST | Create customer profile |
| `/store/customers/me` | GET | Retrieve authenticated customer |
| `/store/customers/me` | POST | Update customer profile |
| `/store/customers/me/addresses` | GET/POST | List/add addresses |
| `/store/customers/me/addresses/:id` | POST/DELETE | Update/remove address |

All `/store/customers/me` routes require a valid JWT in the `Authorization` header.

## Admin API Routes

| Route Pattern | Method | Purpose |
|---------------|--------|---------|
| `/admin/customers` | GET/POST | List/create customers |
| `/admin/customers/:id` | GET/POST | Retrieve/update customer |
| `/admin/customer-groups` | GET/POST | Manage groups |
| `/admin/customer-groups/:id/customers` | POST | Add customers to group |

> **Fetch live docs** for request body shapes and query parameters on each route.

## Best Practices

### Authentication
- Use the **Auth Module** for all authentication -- never implement custom auth logic outside it
- Support both `emailpass` and at least one OAuth2 provider for user convenience
- Store provider-specific data in `provider_identities`, not in customer metadata
- Always link auth identities to customer profiles via `app_metadata.customer_id`

### Customer Data
- Use `has_account` to distinguish registered customers from guest checkouts
- Store loyalty points, preferences, and custom attributes in `metadata`
- Use customer groups for segmentation -- avoid duplicating group logic in app code

### Address Management
- Validate addresses against country-specific requirements (postal code formats)
- Set `is_default_shipping` and `is_default_billing` to streamline checkout

### Security
- Validate JWT tokens on every authenticated request
- Scope Store API customer data to the authenticated customer only
- Never expose customer lists or group memberships via the Store API

Fetch the Medusa v2 customer module and auth module documentation for exact service method signatures, auth provider configuration, and JWT handling before implementing.

Related Skills

shopify-customers

17
from OrcaQubits/agentic-commerce-skills-plugins

Manage Shopify customers — Customer Account API, new vs classic accounts, Multipass SSO, customer segmentation, B2B company accounts, metafields, and marketing consent. Use when working with Shopify customer data.

sf-customers

17
from OrcaQubits/agentic-commerce-skills-plugins

Manage Salesforce Commerce customers — B2C (customer objects, customer groups, segmentation, SLAS authentication, wishlists) and B2B (Account/Contact, buyer groups, buyer permissions, self-registration). Both platforms share Data Cloud for unified customer profiles and consent management.

saleor-customers

17
from OrcaQubits/agentic-commerce-skills-plugins

Manage Saleor customers and staff — customer accounts, registration, addresses, staff users, permission groups, and authentication. Use when working with user management.

medusa-workflows

17
from OrcaQubits/agentic-commerce-skills-plugins

Build Medusa v2 workflows — steps with createStep, compensation/rollback, parallel execution, hooks for extending built-in workflows, and when conditions. Use when orchestrating multi-step operations.

medusa-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Medusa v2 applications — Jest setup, module unit tests, workflow integration tests, API route tests, medusaIntegrationTestRunner, and mock patterns. Use when writing tests for Medusa projects.

medusa-subscribers

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Medusa v2 event subscribers — pub/sub event handling, subscriber handler functions, scheduled jobs with cron, and the event module (Redis or in-memory). Use when reacting to commerce events.

medusa-storefront

17
from OrcaQubits/agentic-commerce-skills-plugins

Build Medusa v2 storefronts with Next.js 15 — App Router, JS SDK client setup, Tanstack Query, server components, product pages, cart, and checkout flow. Use when developing headless storefronts.

medusa-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Set up a Medusa v2 development environment — CLI, PostgreSQL/Redis prerequisites, project creation, medusa-config.ts, directory structure, environment variables. Use when starting a new Medusa project.

medusa-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Secure Medusa v2 applications — authentication strategies, API key types (publishable vs secret), CORS configuration, JWT and cookie secrets, admin vs store auth, and session management. Use when configuring security.

medusa-pricing

17
from OrcaQubits/agentic-commerce-skills-plugins

Configure Medusa v2 pricing — pricing module, price lists with rules, currencies, tax calculation, regions, and promotion campaigns. Use when setting up pricing and discounts.

medusa-plugins

17
from OrcaQubits/agentic-commerce-skills-plugins

Develop and publish Medusa v2 plugins — plugin structure, plugin vs module comparison, npm packaging, and reusable plugin template. Use when building distributable Medusa extensions.

medusa-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Medusa v2 payment processing — payment module, provider abstraction, payment sessions, authorization/capture/refund lifecycle, and Stripe/PayPal integration. Use when adding payment providers.