> ## 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.

Commerce Engine is designed for agent-assisted development. The recommended workflow combines three sources of truth:

<CardGroup cols={2}>
  <Card title="Agent skills" icon="route">
    Decision trees, architecture rules, implementation patterns, and known pitfalls for complete commerce features.
  </Card>

  <Card title="LLM-first reference" icon="robot">
    Exact, current SDK methods, operation examples, request types, response types, and schemas retrieved only when needed.
  </Card>

  <Card title="Production starters" icon="code-branch">
    Working storefront implementations across supported frameworks, including rendering, performance, SEO, session, and deployment patterns.
  </Card>
</CardGroup>

## Install the skills package

Run this command in the storefront repository:

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

The package installs a Commerce Engine router and task-specific skills for setup, authentication, catalog, cart and checkout, orders, webhooks, first-party SSR frameworks, custom SSR bindings, storefront SEO/AEO (`ce-seo`), and browser agent tools (`ce-ai`).

<Info>
  Start broad Commerce Engine tasks through the `ce` router when your agent supports skills or slash commands. The router identifies the framework and loads the relevant specialist guidance.
</Info>

<Tip>
  Looking for **runtime** AI capabilities for shoppers and browser agents rather than coding-assistant guidance? See [SEO & AI for Storefronts](/docs/seo-ai/overview) and [`@commercengine/ai`](/docs/seo-ai/ai).
</Tip>

For Claude Code, you can also install the plugin marketplace:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
/plugin marketplace add commercengine/skills
/plugin install ce@commercengine/skills
```

## The agent workflow

A reliable agent should follow this sequence rather than generating from memory:

<Steps>
  <Step title="Inspect the project">
    Read `package.json`, framework configuration, existing routes, styling conventions, package manager, deployment configuration, and environment-variable patterns.
  </Step>

  <Step title="Load the relevant skills">
    Load setup plus every feature skill needed by the request. A complete storefront normally spans framework setup, catalog, Hosted Checkout, authentication, and orders.
  </Step>

  <Step title="Retrieve exact contracts on demand">
    Before writing an SDK call, fetch the current operation page or schema from the LLM-first reference. Do not guess method signatures or duplicate API interfaces.
  </Step>

  <Step title="Use a starter as implementation evidence">
    Compare framework boundaries, bootstrap, session ownership, rendering, SEO, loading states, and deployment configuration with the closest production starter.
  </Step>

  <Step title="Implement and validate">
    Run the repository's typecheck, lint/check, and production build commands. Exercise the relevant customer journeys and report anything that could not be verified.
  </Step>
</Steps>

## Context-efficient SDK lookup

The LLM reference is available at `llm-docs.commercengine.io`. Every page supports raw Markdown through content negotiation or a `.md` suffix.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Discover Storefront SDK methods
curl -H "Accept: text/markdown" \
  https://llm-docs.commercengine.io/sdk/storefront

# Retrieve one operation
curl -H "Accept: text/markdown" \
  https://llm-docs.commercengine.io/storefront/operations/search-products

# Retrieve one schema
curl -H "Accept: text/markdown" \
  https://llm-docs.commercengine.io/storefront/schemas/Item
```

Equivalent `.md` URLs work in agents that cannot send custom headers:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
https://llm-docs.commercengine.io/sdk/storefront.md
https://llm-docs.commercengine.io/storefront/operations/search-products.md
https://llm-docs.commercengine.io/storefront/schemas/Item.md
```

This progressive-disclosure model keeps context small: load the architectural skill first, then retrieve only the operation and schemas required for the feature being implemented.

## Current SDK mental model

All supported frameworks install the unified package:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
npm install @commercengine/storefront
```

The core rule is:

* **Public reads** use the public accessor. They are publishable-key-backed and do not create a user session.
* **Live user flows** use a session accessor. Authentication, cart, wishlist, account, orders, and payments belong to the anonymous or logged-in session.
* **Hosted Checkout** should use `authMode: "provided"` with two-way token synchronization whenever the application also uses `@commercengine/storefront`.

Framework wrappers expose the same distinction with context-appropriate accessors:

| Runtime | Public reads | Browser session | Server session |
| - | - | - | - |
| SPA | `storefront.public()` | `storefront.session()` | — |
| Next.js | `publicStorefront()` | `clientStorefront()` | `await serverStorefront()` |
| TanStack Start | `publicStorefront()` | `clientStorefront()` | server-only `serverStorefront()` |
| Astro | `publicStorefront()` | `clientStorefront()` | `serverStorefront(cookies)` |
| SvelteKit | `publicStorefront()` | `clientStorefront()` | `serverStorefront(cookies)` |

## Type lookup rule

Import Commerce Engine schema and operation types directly from `@commercengine/storefront`. Do not recreate API interfaces in application code.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import type {
  Cart,
  Item,
  Product,
  SearchProductsBody,
  SearchProductsContent,
} from "@commercengine/storefront";
```

Operation types follow a predictable naming scheme:

* `{OperationName}Body`
* `{OperationName}Content`
* `{OperationName}Query`
* `{OperationName}PathParams`

Use the LLM-first operation page to confirm the exact exported names before importing them.

## Build a complete storefront

<CardGroup cols={2}>
  <Card title="Production storefront workflow" icon="store" href="/docs/ai/production-storefront">
    A complete agent execution contract, route matrix, validation gates, and copy-paste prompt.
  </Card>

  <Card title="Production starters" icon="code-branch" href="/docs/ai/starter-projects">
    Framework-by-framework reference implementations and the patterns agents should study before generating code.
  </Card>

  <Card title="Prompt library" icon="terminal" href="/docs/ai/prompts">
    Prompts for new storefronts, existing-project integrations, feature work, debugging, and production review.
  </Card>

  <Card title="LLM API/SDK reference" icon="robot" href="https://llm-docs.commercengine.io">
    Browse exact methods, operations, schemas, webhook payloads, parameters, and responses.
  </Card>
</CardGroup>

<Warning>
  Skills and generated code do not replace validation. An agent should not claim a storefront is production-ready until the project builds successfully and the implemented customer journeys have been exercised.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.