> ## Documentation Index
> Fetch the complete documentation index at: https://www.commercengine.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AI-Assisted Development

> Use AI coding assistants to build Commerce Engine integrations faster with LLM-optimized docs, agent skills, and ready-to-use prompts.

# AI-Assisted Development

Commerce Engine provides first-class support for AI-assisted development. We publish a comprehensive [skills package](https://github.com/commercengine/skills) that gives AI coding agents deep knowledge of our platform — SDK patterns, decision trees, code templates, and common pitfall documentation.

## Machine-Readable Documentation

### llms.txt

Our docs site hosts an `llms.txt` file that indexes every page. AI agents use this to discover what documentation is available before diving in.

```
https://www.commercengine.io/docs/llms.txt
```

### LLM-Optimized API Reference

We maintain a dedicated LLM-optimized site with our complete API reference, SDK methods, schemas, and webhooks in clean markdown:

<Card title="LLM API/SDK Reference" icon="robot" href="https://llm-docs.commercengine.io">
  Browse the full LLM-optimized API reference at `llm-docs.commercengine.io`
</Card>

Any page can be fetched as raw markdown by sending an `Accept: text/markdown` header:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -H "Accept: text/markdown" https://llm-docs.commercengine.io/
```

| Section        | URL Path       | Content                                   |
| -------------- | -------------- | ----------------------------------------- |
| Index          | `/`            | Full documentation overview               |
| SDK Methods    | `/sdk/`        | 151 SDK method references with signatures |
| API Operations | `/operations/` | All REST endpoint documentation           |
| Schemas        | `/schemas/`    | 244 request/response type definitions     |
| Webhooks       | `/webhooks/`   | 14 webhook event payload specs            |
| Parameters     | `/parameters/` | Shared API parameter definitions          |
| Responses      | `/responses/`  | Shared response type definitions          |

## Adding Skills to Your Agent

### Using the skills CLI (Recommended)

The fastest way to add Commerce Engine capabilities to your AI agent:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
npx skills add commercengine/skills
```

This installs task-based skills that give your agent deep knowledge of Commerce Engine patterns — SDK setup, auth, catalog, cart, checkout, orders, webhooks, and Next.js integration. Skills follow the [Agent Skills](https://agentskills.io) specification.

### Claude Code Plugin Marketplace

If you're using [Claude Code](https://claude.ai/code), add the Commerce Engine marketplace directly:

```
/plugin marketplace add commercengine/skills
```

Then browse and install individual skills with `/plugin`, or install the router skill that auto-routes to the right one:

```
/plugin install ce@commercengine/skills
```

### Manual

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
git clone https://github.com/commercengine/skills ~/.claude/skills/commercengine
```

## What Agents Can Do

With the skill installed, your AI coding assistant can:

<CardGroup cols={2}>
  <Card title="Generate SDK Code" icon="code">
    Produce correct, type-safe SDK calls with proper error handling and token
    management
  </Card>

  <Card title="Look Up TypeScript Definitions" icon="database">
    Fetch exact TypeScript interfaces for any of the 244 schemas or 151 SDK
    methods on demand
  </Card>

  <Card title="Build Full Features" icon="layer-group">
    Scaffold complete e-commerce flows: auth, catalog, cart, checkout, orders
  </Card>

  <Card title="Debug Issues" icon="bug">
    Understand error codes, token refresh behavior, and framework-specific
    gotchas
  </Card>
</CardGroup>

## Looking Up TypeScript Definitions

The LLM docs site at `llm-docs.commercengine.io` is the definitive reference for TypeScript types. Every schema and every SDK method includes its full TypeScript definition with JSDoc comments.

### Schema Types

To look up the TypeScript definition for any schema (e.g., `Cart`, `Product`, `Order`):

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -H "Accept: text/markdown" https://llm-docs.commercengine.io/storefront/schemas/Cart
```

This returns the complete interface with every field, its type, and a description. Use this when you need to know the exact shape of a response object.

Browse all schemas at [`/schemas/`](https://llm-docs.commercengine.io/schemas/).

### SDK Method Signatures

To look up the full TypeScript signature for any SDK method (e.g., `createCart`, `listProducts`):

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -H "Accept: text/markdown" https://llm-docs.commercengine.io/storefront/operations/create-cart
```

Each page includes the SDK method name, a usage example, and the full TypeScript definition with parameter types, request body, and response shape.

Browse all methods at [`/sdk/storefront`](https://llm-docs.commercengine.io/sdk/storefront).

### Importing Types

All types are auto-generated from the OpenAPI spec and exported as **direct named exports** from the SDK. Always import types from the package — never write custom interfaces for API schemas.

<Info>
  The preferred package is `@commercengine/storefront`, which contains the core SDK plus all framework bindings (Next.js, etc.) in a single install. The older `@commercengine/storefront-sdk` package still works but is no longer the recommended path. See the [SDK installation guide](/docs/sdk/installation) for details.
</Info>

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
// Schema types — import directly by name
import type {
  Cart,
  Product,
  Order,
  UpdateCartItem,
  CartItem,
  Variant,
} from "@commercengine/storefront";

// Operation types — request bodies, responses, query/path params
import type {
  CreateCartBody,
  CreateCartContent,
  ListProductsQuery,
  ListProductsContent,
  GetProductDetailContent,
} from "@commercengine/storefront";

// SDK utility types
import type {
  SessionStorefrontSDK,
  UserInfo,
} from "@commercengine/storefront";
```

Operation types follow a consistent naming convention:

* `{OperationName}Body` — Request body
* `{OperationName}Content` — Response data (the `content` field)
* `{OperationName}Query` — Query parameters
* `{OperationName}PathParams` — Path parameters

For edge cases where a type isn't directly exported, fall back to the raw OpenAPI types:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import type { components } from "@commercengine/storefront";
type MyType = components["schemas"]["SomeSchema"];
```

<Warning>
  Never define custom TypeScript interfaces for Commerce Engine API types. The
  SDK exports all 244 schema types and all operation types as named exports.
  Custom interfaces will drift out of sync and cause runtime bugs that the
  compiler can't catch.
</Warning>

## Ready-to-Use Prompts

We provide a library of [copy-paste prompts](/docs/ai/prompts) for common Commerce Engine tasks. These are designed to give AI assistants the right context to produce production-quality code on the first try.

<Card title="Browse Prompts" icon="terminal" href="/docs/ai/prompts">
  Copy-paste prompts for authentication, catalog, cart, checkout, Next.js, and
  more
</Card>
