You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/docs/content/docs/getting-started/extending-with-agents.mdx
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Vercel Shop is built for agentic development. Instead of copy-pasting snippets f
11
11
This works because the template ships with structured context that agents read automatically:
12
12
13
13
-**`AGENTS.md`** - architecture rules and conventions. Tells the agent things like "every cart mutation must call `invalidateCartCache()`" or "components in `ui/` must not import domain types."
14
-
-**Project-scoped plugins** - `vercel-shop`, `vercel-plugin`, and `shopify-ai-toolkit` provide skills, platform guidance, and live Shopify schema tooling.
14
+
-**Project-scoped plugins** - `vercel-shop`, `vercel-plugin`, and `shopify-ai-toolkit` provide template conventions, platform guidance, and authoritative Shopify documentation and validation.
15
15
16
16
For best results, use an agent that reads `AGENTS.md` and supports skills and project-scoped plugins - for example [Claude Code](https://claude.ai/code), [Cursor](https://cursor.sh), or [Codex](https://openai.com/index/introducing-codex/). Claude Code has the deepest integration via the plugin install flow; Cursor and Codex lean more on the repo context and docs.
17
17
@@ -21,7 +21,7 @@ After [creating your project](/docs/getting-started), `create-vercel-shop` insta
21
21
22
22
-`vercel-shop` for initialization and storefront skills plus drift and upgrade-planning commands
23
23
-`vercel-plugin` for generic Vercel and Next.js guidance
24
-
-`shopify-ai-toolkit` for Shopify-aware tooling and schema access
24
+
-`shopify-ai-toolkit` for current Shopify documentation, schemas, operation validation, and store execution
25
25
26
26
If you already have a project and only want the agent setup:
27
27
@@ -93,6 +93,9 @@ You can also follow any skill manually from the docs, or inspect the source in t
93
93
### Available skills
94
94
95
95
<Cards>
96
+
<Cardtitle="Build with Vercel Shop"href="/docs/skills/build-shop">
97
+
Source-backed storefront architecture and commerce behavior.
@@ -146,6 +149,24 @@ Make the accordion closed by default on mobile
146
149
147
150
The agent retains context from the previous exchange.
148
151
152
+
### Use a browser feedback loop
153
+
154
+
Storefront changes should be checked in a real browser, not only by reading diffs. v0 has this feedback loop built in. For agents without built-in browser control, install the standalone [`agent-browser`](https://github.com/vercel-labs/agent-browser) CLI:
155
+
156
+
```bash
157
+
npm install -g agent-browser
158
+
agent-browser install
159
+
```
160
+
161
+
Then ask the agent to start the dev server, open the affected route, capture a snapshot and screenshot, interact through the changed commerce flow, and repeat until the browser result matches the intended behavior.
162
+
163
+
```bash
164
+
agent-browser open http://localhost:3000/products/example
165
+
agent-browser wait --load networkidle
166
+
agent-browser snapshot
167
+
agent-browser screenshot --full
168
+
```
169
+
149
170
### When something breaks, name the failure
150
171
151
172
Specific error messages and likely files beat "fix it":
Copy file name to clipboardExpand all lines: apps/docs/content/docs/reference/storefront-api.mdx
+28-20Lines changed: 28 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ Output lands in `lib/shopify/types/generated/`, which is **gitignored**. Nothing
72
72
73
73
Because codegen resolves interpolations of other `#graphql` consts by name, every fragment in `lib/shopify/fragments.ts` is also tagged `#graphql ... as const`. A raw selection snippet that isn't a valid standalone document (it can't be `#graphql`-tagged) must be inlined into each operation rather than interpolated.
74
74
75
-
Always verify fields against the live Storefront API schema with `shopify-ai-toolkit` or [`/vercel-shop:shopify-graphql-reference`](/docs/skills/shopify-graphql-reference)when adding or modifying queries - don't guess field names.
75
+
Always use Shopify AI Toolkit to search current Shopify documentation and validate the final operation. Then use [`/vercel-shop:shopify-graphql-reference`](/docs/skills/shopify-graphql-reference)for Vercel Shop integration conventions. The Vercel Shop skill is not a schema source.
76
76
77
77
## Fragments
78
78
@@ -131,14 +131,23 @@ export async function getProduct({
131
131
132
132
Key elements:
133
133
134
-
1.**`"use cache"`** - uses the local Next.js cache for stable, low-cardinality reads
134
+
1.**`"use cache"`** - includes the stable product body coherently in the PDP's prerendered shell
135
135
2.**`cacheLife("max")`** - caches indefinitely until manually revalidated
136
136
3.**`cacheTag(...)`** - assigns tags for granular invalidation via `revalidateTag()`
137
137
4.**Transform** - convert the Shopify response to a domain type before returning. Components never import Shopify types directly.
138
138
139
139
## Caching
140
140
141
-
Read operations use `"use cache"` or `"use cache: remote"` with `cacheLife("max")` and one or more cache tags. Stable, low-cardinality reads (product detail, single collection) can use plain `"use cache"` so they inline into the static shell; high-cardinality operations that depend on search, filters, sort, or cursors use `"use cache: remote"`, which stores entries in Vercel's shared Runtime Cache so they persist across serverless instances and between requests. Tags follow a hierarchy:
141
+
Read operations choose cache behavior from their render role:
| Public identity/body that belongs coherently in the prerendered shell | Plain `"use cache"`|
146
+
| Public results resolved after request inputs such as filters, search, or cursor |`"use cache: remote"` when shared Runtime Cache is justified |
147
+
| Cart, session, authorization, or Customer Account data | Request-scoped or private; never public remote cache |
148
+
| Mutation | No read-cache directive; invalidate affected state after success |
149
+
150
+
Cached public operations use the established `cacheLife` and tags. Combined with webhook-driven invalidation, those tags refresh the intended shell or runtime entry when Shopify changes. Tags follow a hierarchy:
Copy file name to clipboardExpand all lines: apps/docs/content/docs/reference/troubleshooting.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ images: {
45
45
46
46
This usually means the query references a field, argument, or enum value that doesn't exist on the live Shopify API version your store is using.
47
47
48
-
Re-check the operation with `shopify-ai-toolkit` or the [`shopify-graphql-reference` skill](/docs/skills/shopify-graphql-reference)and confirm each field against the live schema before changing the query.
48
+
Re-check and validate the operation with Shopify AI Toolkit first. Then use the [`shopify-graphql-reference` skill](/docs/skills/shopify-graphql-reference)for the template integration and cache role.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/shopify/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ Menu items can link to collections, products, pages, or custom URLs.
38
38
39
39
## Webhooks and cache invalidation
40
40
41
-
All read operations are cached with `"use cache: remote"`and `cacheLife("max")`. Without webhooks, changes in Shopify won't appear until the cache expires. To get near-instant updates, configure Shopify webhooks to hit the template's invalidation endpoint.
41
+
Public reads use either plain `"use cache"`for content that belongs coherently in a prerendered shell or `"use cache: remote"` for reusable request-time results. Both use established cache tags. Without webhooks, Shopify changes may remain cached until the configured lifetime expires, so configure Shopify webhooks to hit the template's invalidation endpoint.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/shopify/writing-shopify-queries.mdx
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,11 @@ prerequisites:
8
8
9
9
This guide walks through adding a new Shopify Storefront API operation from scratch. We'll fetch a shop's privacy policy as a concrete example.
10
10
11
-
If you're using a coding agent, run `/vercel-shop:shopify-graphql-reference` in Claude Code or ask the agent to use the `shopify-graphql-reference`skill first. The skill is the reference source for Shopify GraphQL work and uses `shopify-ai-toolkit` for live schema checks while keeping the agent anchored to the template guardrails.
11
+
If you're using a coding agent, use Shopify AI Toolkit's Storefront GraphQL skill first so it searches current Shopify documentation and validates the operation. Then run `/vercel-shop:shopify-graphql-reference` to integrate that validated operation with the template's files, domain types, cache role, and invalidation.
12
12
13
13
## 1. Check the schema
14
14
15
-
Use `shopify-ai-toolkit`, Shopify's GraphQL docs, or your preferred GraphQL explorer to confirm the field exists before writing the query. For our example, the `QueryRoot` type has a `shop` field with a `privacyPolicy` property that returns a `ShopPolicy`:
15
+
Use Shopify AI Toolkit to confirm the operation against the intended Storefront API version before writing template code. For this example, validate the `shop.privacyPolicy` selection and its return fields rather than relying on this guide as API reference:
16
16
17
17
```graphql
18
18
typeShopPolicy {
@@ -86,15 +86,14 @@ Codegen parses every `#graphql`-tagged query and **fails the command if a field,
86
86
Create a new file in `lib/shopify/operations/` or add to an existing one. The function calls `storefront.request`, asserts the response is OK, applies caching, and returns the result:
-**`storefront`** is the shared `@shopify/storefront-api-client` instance from `lib/shopify/storefront.ts`. Pass your response type as the generic; the query is the first argument and variables go in the options object.
115
114
-**`assertStorefrontOk(response, name)`** throws on a transport/GraphQL failure (no `data`), warns on partial errors, and narrows `response.data` to non-null.
116
-
-**`"use cache"`** uses the local Next.js cache for stable, low-cardinality reads
117
-
-**`cacheLife("max")`** caches until you manually invalidate
118
-
-**`cacheTag("policies")`** lets you invalidate with `revalidateTag("policies")` later
119
-
- Use `"use cache: remote"` instead for high-cardinality reads that depend on search, filters, sort, or cursors
115
+
-**`"use cache"`** allows this stable policy body to become part of the page's prerendered shell.
116
+
-**`cacheLife("days")`** refreshes content that has no matching webhook invalidation path.
120
117
- Always pass `locale` and extract `country`/`language` from it
121
118
119
+
Cache behavior follows the consuming route, not a universal default. Use plain `"use cache"` for public identity/body content that must be coherent in the static shell. Use `"use cache: remote"` for reusable public results resolved after request inputs such as filters, search, or cursors. Keep cart, session, and Customer Account data request-scoped or private. Use `cacheLife("max")` only when a webhook, mutation, or deliberate manual path invalidates every associated tag.
120
+
122
121
## 6. Add a transform (if needed)
123
122
124
123
If the Shopify response shape differs from how your components want to consume the data, add a transform in `lib/shopify/transforms/`. This keeps Shopify-specific types out of your UI:
@@ -195,10 +194,11 @@ Expose mutations to the client through server actions in `components/cart/action
195
194
-[ ] Query string starts with `#graphql` and the declaration ends with `as const`
196
195
-[ ] Query/mutation is **named** so codegen can parse it
197
196
-[ ] Document is static — dynamic parts passed as variables, not interpolated into the query string
197
+
-[ ] Validated the final operation with Shopify AI Toolkit
198
198
-[ ]`pnpm --filter template codegen` passes (validates fields against the live schema); generated types are gitignored and regenerate at dev/build
199
199
-[ ]`@inContext` directive included if data is locale-sensitive
200
200
-[ ]`storefront.request<ResponseType>(QUERY, { variables })` followed by `assertStorefrontOk(response, name)`
201
-
-[ ]`"use cache"` or `"use cache: remote"`, `cacheLife`, and `cacheTag`set for read operations
201
+
-[ ]Cache directive chosen from the route's render role, with `cacheLife` and `cacheTag`where applicable
202
202
-[ ] Transform added if the Shopify response shape needs mapping
203
203
-[ ] Components import domain types from `lib/types`, not Shopify response types
0 commit comments