create-content-sdk-app 2.0.0 → 2.0.2-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE.MD +202 -202
  2. package/dist/templates/nextjs/.agents/skills/content-sdk-component-data-strategy/SKILL.md +37 -0
  3. package/dist/templates/nextjs/.agents/skills/content-sdk-component-registration/SKILL.md +36 -0
  4. package/dist/templates/nextjs/.agents/skills/content-sdk-component-scaffold/SKILL.md +34 -0
  5. package/dist/templates/nextjs/.agents/skills/content-sdk-component-variants/SKILL.md +36 -0
  6. package/dist/templates/nextjs/.agents/skills/content-sdk-dictionary-and-i18n/SKILL.md +35 -0
  7. package/dist/templates/nextjs/.agents/skills/content-sdk-editing-safe-rendering/SKILL.md +37 -0
  8. package/dist/templates/nextjs/.agents/skills/content-sdk-field-usage-image-link-text/SKILL.md +36 -0
  9. package/dist/templates/nextjs/.agents/skills/content-sdk-graphql-data-fetching/SKILL.md +38 -0
  10. package/dist/templates/nextjs/.agents/skills/content-sdk-multisite-management/SKILL.md +37 -0
  11. package/dist/templates/nextjs/.agents/skills/content-sdk-route-configuration/SKILL.md +38 -0
  12. package/dist/templates/nextjs/.agents/skills/content-sdk-site-setup-and-env/SKILL.md +36 -0
  13. package/dist/templates/nextjs/.agents/skills/content-sdk-sitemap-robots/SKILL.md +37 -0
  14. package/dist/templates/nextjs/.agents/skills/content-sdk-troubleshoot-editing/SKILL.md +39 -0
  15. package/dist/templates/nextjs/.agents/skills/content-sdk-upgrade-assistant/SKILL.md +36 -0
  16. package/dist/templates/nextjs/.cursor/rules/general.mdc +81 -81
  17. package/dist/templates/nextjs/.cursor/rules/javascript.mdc +112 -112
  18. package/dist/templates/nextjs/.cursor/rules/project-setup.mdc +100 -100
  19. package/dist/templates/nextjs/.cursor/rules/sitecore.mdc +150 -150
  20. package/dist/templates/nextjs/.env.container.example +27 -27
  21. package/dist/templates/nextjs/.env.remote.example +51 -51
  22. package/dist/templates/nextjs/.gitattributes +11 -11
  23. package/dist/templates/nextjs/.prettierrc +8 -8
  24. package/dist/templates/nextjs/.vscode/extensions.json +8 -8
  25. package/dist/templates/nextjs/.vscode/launch.json +15 -15
  26. package/dist/templates/nextjs/.windsurfrules +186 -186
  27. package/dist/templates/nextjs/AGENTS.md +1 -0
  28. package/dist/templates/nextjs/CLAUDE.md +6 -170
  29. package/dist/templates/nextjs/LICENSE.txt +202 -202
  30. package/dist/templates/nextjs/Skills.md +79 -0
  31. package/dist/templates/nextjs/eslint.config.mjs +81 -81
  32. package/dist/templates/nextjs/gitignore +28 -28
  33. package/dist/templates/nextjs/package.json +68 -68
  34. package/dist/templates/nextjs/sitecore.config.ts.example +40 -40
  35. package/dist/templates/nextjs/src/Bootstrap.tsx +20 -13
  36. package/dist/templates/nextjs/src/byoc/index.tsx +1 -1
  37. package/dist/templates/nextjs/src/components/content-sdk/CdpPageView.tsx +1 -1
  38. package/dist/templates/nextjs/tsconfig.json +40 -40
  39. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-data-strategy/SKILL.md +37 -0
  40. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-registration/SKILL.md +38 -0
  41. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-scaffold/SKILL.md +38 -0
  42. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-variants/SKILL.md +36 -0
  43. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-dictionary-and-i18n/SKILL.md +37 -0
  44. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-editing-safe-rendering/SKILL.md +37 -0
  45. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-field-usage-image-link-text/SKILL.md +36 -0
  46. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-graphql-data-fetching/SKILL.md +37 -0
  47. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-multisite-management/SKILL.md +37 -0
  48. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-route-configuration/SKILL.md +38 -0
  49. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-site-setup-and-env/SKILL.md +36 -0
  50. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-sitemap-robots/SKILL.md +37 -0
  51. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-troubleshoot-editing/SKILL.md +39 -0
  52. package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-upgrade-assistant/SKILL.md +36 -0
  53. package/dist/templates/nextjs-app-router/.cursor/rules/app-router-setup.mdc +116 -116
  54. package/dist/templates/nextjs-app-router/.cursor/rules/general.mdc +80 -80
  55. package/dist/templates/nextjs-app-router/.cursor/rules/javascript.mdc +112 -112
  56. package/dist/templates/nextjs-app-router/.cursor/rules/sitecore.mdc +174 -174
  57. package/dist/templates/nextjs-app-router/.env.container.example +27 -27
  58. package/dist/templates/nextjs-app-router/.env.remote.example +51 -51
  59. package/dist/templates/nextjs-app-router/.gitattributes +11 -11
  60. package/dist/templates/nextjs-app-router/.sitecore/import-map.server.ts +2 -2
  61. package/dist/templates/nextjs-app-router/.windsurfrules +290 -290
  62. package/dist/templates/nextjs-app-router/AGENTS.md +6 -6
  63. package/dist/templates/nextjs-app-router/CLAUDE.md +6 -271
  64. package/dist/templates/nextjs-app-router/README.md +0 -36
  65. package/dist/templates/nextjs-app-router/Skills.md +79 -0
  66. package/dist/templates/nextjs-app-router/eslint.config.mjs +29 -29
  67. package/dist/templates/nextjs-app-router/gitignore +31 -31
  68. package/dist/templates/nextjs-app-router/package.json +55 -54
  69. package/dist/templates/nextjs-app-router/postcss.config.mjs +5 -5
  70. package/dist/templates/nextjs-app-router/sitecore.config.ts.example +40 -40
  71. package/dist/templates/nextjs-app-router/src/Bootstrap.tsx +20 -12
  72. package/dist/templates/nextjs-app-router/src/app/[site]/[locale]/[[...path]]/layout.tsx +19 -0
  73. package/dist/templates/nextjs-app-router/src/app/[site]/[locale]/[[...path]]/not-found.tsx +3 -28
  74. package/dist/templates/nextjs-app-router/src/app/[site]/[locale]/[[...path]]/page.tsx +6 -21
  75. package/dist/templates/nextjs-app-router/src/app/[site]/layout.tsx +5 -21
  76. package/dist/templates/nextjs-app-router/src/app/globals.css +1 -1
  77. package/dist/templates/nextjs-app-router/src/app/not-found.tsx +1 -23
  78. package/dist/templates/nextjs-app-router/src/byoc/index.tsx +1 -1
  79. package/dist/templates/nextjs-app-router/src/components/content-sdk/CdpPageView.tsx +1 -1
  80. package/dist/templates/nextjs-app-router/tsconfig.json +48 -48
  81. package/package.json +2 -2
  82. package/dist/initializers/angular/args.js +0 -2
  83. package/dist/initializers/angular/index.js +0 -30
  84. package/dist/initializers/angular/prompts.js +0 -20
  85. package/dist/templates/angular/.postcssrc.json +0 -5
  86. package/dist/templates/angular/.vscode/extensions.json +0 -4
  87. package/dist/templates/angular/README.md +0 -3
  88. package/dist/templates/angular/angular.json +0 -79
  89. package/dist/templates/angular/package.json +0 -58
  90. package/dist/templates/angular/public/favicon.ico +0 -0
  91. package/dist/templates/angular/src/app/app.config.server.ts +0 -12
  92. package/dist/templates/angular/src/app/app.config.ts +0 -31
  93. package/dist/templates/angular/src/app/app.css +0 -0
  94. package/dist/templates/angular/src/app/app.html +0 -1
  95. package/dist/templates/angular/src/app/app.routes.server.ts +0 -15
  96. package/dist/templates/angular/src/app/app.routes.ts +0 -28
  97. package/dist/templates/angular/src/app/app.ts +0 -12
  98. package/dist/templates/angular/src/app/loaders/error.loader.ts +0 -12
  99. package/dist/templates/angular/src/app/loaders/index.ts +0 -14
  100. package/dist/templates/angular/src/app/loaders/not-found.loader.ts +0 -12
  101. package/dist/templates/angular/src/app/loaders/page.loader.ts +0 -15
  102. package/dist/templates/angular/src/app/loaders/stub-utils.ts +0 -83
  103. package/dist/templates/angular/src/app/pages/error.component.ts +0 -124
  104. package/dist/templates/angular/src/app/pages/not-found.component.ts +0 -85
  105. package/dist/templates/angular/src/app/pages/page.component.ts +0 -58
  106. package/dist/templates/angular/src/app/shared/layout.component.ts +0 -106
  107. package/dist/templates/angular/src/index.html +0 -13
  108. package/dist/templates/angular/src/main.server.ts +0 -8
  109. package/dist/templates/angular/src/main.ts +0 -6
  110. package/dist/templates/angular/src/server.ts +0 -65
  111. package/dist/templates/angular/src/styles.css +0 -3
  112. package/dist/templates/angular/tsconfig.json +0 -38
  113. package/dist/templates/angular/tsconfig.spec.json +0 -10
  114. package/dist/templates/nextjs/LLMs.txt +0 -179
  115. package/dist/templates/nextjs-app-router/LLMs.txt +0 -236
@@ -1,274 +1,9 @@
1
- # Claude Code Agent Guide for Sitecore Content SDK Next.js App Router Project
1
+ # Claude Code Sitecore Content SDK Next.js (App Router) App
2
2
 
3
- ## Project Purpose and Tech Stack
3
+ At the start of every session, read these files for full project guidance:
4
4
 
5
- This is a **Sitecore Content SDK** application built with **Next.js App Router** and **TypeScript**. The project follows Sitecore best practices for XM Cloud development and leverages the latest Next.js App Router features for improved performance and developer experience.
5
+ 1. **`AGENTS.md`** Canonical source of truth for this app: overview, commands, App Router structure, middleware, SitecoreClient, [site]/[locale]/[[...path]], next-intl, DO/DON'T, guardrails, boundaries
6
+ 2. **`.cursor/rules/`** — Coding rules for this template: general, javascript, sitecore, app-router-setup
7
+ 3. **`Skills.md`** and **`.agents/skills/`** — Capability-specific guidance (component registration, data fetching, editing, i18n, etc.) for tools that support the [Agent Skills](https://agentskills.io) standard.
6
8
 
7
- ### Key Technologies
8
- - **Next.js App Router** - React framework with Server Components and modern routing
9
- - **Sitecore Content SDK** - Official SDK for Sitecore XM Cloud integration
10
- - **TypeScript** - Type-safe JavaScript development
11
- - **Sitecore XM Cloud** - Headless CMS platform
12
- - **React Server Components** - Server-side rendering for better performance
13
- - **next-intl** - Internationalization support
14
-
15
- ## Coding Standards
16
-
17
- ### TypeScript Standards
18
- - Use **strict mode** in tsconfig.json
19
- - Prefer type assertions over `any`: `value as ContentItem`
20
- - Use discriminated unions for complex state management
21
- - Enable strict null checks and strict function types
22
-
23
- ### Naming Conventions
24
- - **Variables/Functions**: camelCase (`getUserData()`, `isLoading`, `currentUser`)
25
- - **Components**: PascalCase (`SitecoreComponent`, `PageLayout`, `ContentBlock`)
26
- - **Constants**: UPPER_SNAKE_CASE (`API_ENDPOINT`, `DEFAULT_TIMEOUT`)
27
- - **Directories**: kebab-case (`src/components`, `src/api-clients`)
28
- - **Types/Interfaces**: PascalCase (`ContentItem`, `LayoutProps`, `SitecoreConfig`)
29
-
30
- ### Modular Layout (App Router)
31
- ```
32
- src/
33
- app/ # App Router pages and layouts
34
- components/ # UI components (React)
35
- lib/ # Configuration and utilities
36
- i18n/ # Internationalization setup
37
- types/ # TypeScript type definitions
38
- hooks/ # Custom React hooks
39
- ```
40
-
41
- ## Library Usage
42
-
43
- ### @sitecore-content-sdk
44
- - Use `SitecoreClient` for content fetching
45
- - Implement proper error handling with try/catch blocks
46
- - Cache API responses using React Query or SWR
47
- - Handle content preview vs. published content scenarios
48
-
49
- ```typescript
50
- import { SitecoreClient } from '@sitecore-content-sdk/nextjs/client';
51
- import scConfig from 'sitecore.config';
52
-
53
- const client = new SitecoreClient({
54
- ...scConfig,
55
- });
56
- ```
57
-
58
- ### React App Router Patterns
59
- - Use **Server Components** for data fetching and static content (default)
60
- - Use **Client Components** for interactivity (use 'use client' directive)
61
- - Implement proper error boundaries with error.tsx
62
- - Use loading.tsx for loading states
63
- - Leverage layout.tsx for shared page structure
64
-
65
- ### Sitecore Field Components
66
- - Always use Sitecore field components: `<Text>`, `<RichText>`, `<Image>`
67
- - Validate field existence before rendering
68
- - Handle empty/null fields gracefully
69
- - Prefer Sitecore field components over manual rendering
70
-
71
- ```typescript
72
- // Good: Using Sitecore field components
73
- <Text field={fields?.title} tag="h1" />
74
- <RichText field={fields?.content} />
75
- <Image field={fields?.backgroundImage} />
76
-
77
- // Avoid: Manual field value extraction unless necessary
78
- ```
79
-
80
- ## Example Patterns and Prompts
81
-
82
- ### Server Component Development
83
- ```typescript
84
- // Server Component example (default in App Router)
85
- import { SitecoreClient } from '@sitecore-content-sdk/nextjs/client';
86
- import scConfig from 'sitecore.config';
87
-
88
- const client = new SitecoreClient({
89
- ...scConfig,
90
- });
91
-
92
- export default async function SitecorePage({ params }: { params: { path: string[] } }) {
93
- try {
94
- const pageData = await client.getPage(params.path.join('/'));
95
- return <SitecoreLayout layoutData={pageData?.layout} />;
96
- } catch (error) {
97
- return <div>Content not found</div>;
98
- }
99
- }
100
- ```
101
-
102
- ### Client Component Integration
103
-
104
- Interactive Sitecore Components:
105
-
106
- - Use 'use client' directive when needed
107
- - Keep client components focused on interactivity
108
- - Pass server-fetched data as props
109
- - Handle hydration mismatches carefully
110
-
111
- ```typescript
112
- 'use client';
113
-
114
- interface InteractiveSitecoreComponentProps {
115
- fields: {
116
- title: Field;
117
- content: Field;
118
- };
119
- }
120
-
121
- export default function InteractiveSitecoreComponent({
122
- fields,
123
- }: InteractiveSitecoreComponentProps) {
124
- // Client-side interactivity here
125
- return (
126
- <div>
127
- <Text field={fields?.title} tag="h2" />
128
- <RichText field={fields?.content} />
129
- </div>
130
- );
131
- }
132
- ```
133
-
134
- ### Component Development
135
- ```typescript
136
- // Component props interface
137
- interface HeroProps {
138
- fields: {
139
- title: Field;
140
- subtitle: Field;
141
- backgroundImage: Field;
142
- };
143
- }
144
-
145
- export default function Hero({ fields }: HeroProps) {
146
- return (
147
- <div>
148
- <Text field={fields?.title} tag="h1" />
149
- <Text field={fields?.subtitle} tag="p" />
150
- <Image field={fields?.backgroundImage} />
151
- </div>
152
- );
153
- }
154
- ```
155
-
156
- ### Error Handling
157
-
158
- API Calls:
159
-
160
- - Always wrap in try/catch blocks
161
- - Throw custom errors with context: `SitecoreFetchError`, `ConfigurationError`
162
- - Handle edge cases with guard clauses
163
-
164
- ```typescript
165
- async function fetchPageData(path: string): Promise<Page | null> {
166
- if (!path) {
167
- throw new Error('Page path is required');
168
- }
169
-
170
- try {
171
- const pageData = await client.getPage(path);
172
- return pageData;
173
- } catch (error) {
174
- throw new SitecoreFetchError(`Failed to fetch page data for ${path}`, error);
175
- }
176
- }
177
- ```
178
-
179
- ### Configuration
180
- ```typescript
181
- // sitecore.config.ts
182
- import { defineConfig } from '@sitecore-content-sdk/nextjs/config';
183
-
184
- export default defineConfig({
185
- api: {
186
- edge: {
187
- contextId: process.env.SITECORE_EDGE_CONTEXT_ID || '',
188
- clientContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID,
189
- edgeUrl:
190
- process.env.NEXT_PUBLIC_SITECORE_EDGE_PLATFORM_HOSTNAME ||
191
- process.env.SITECORE_EDGE_PLATFORM_HOSTNAME ||
192
- 'https://edge-platform.sitecorecloud.io',
193
- },
194
- local: {
195
- apiKey: process.env.SITECORE_API_KEY || '',
196
- apiHost: process.env.SITECORE_API_HOST || '',
197
- },
198
- },
199
- defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME || 'default',
200
- defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
201
- editingSecret: process.env.SITECORE_EDITING_SECRET,
202
- });
203
- ```
204
-
205
- ### Internationalization
206
-
207
- Multi-language Support:
208
-
209
- - Configure next-intl for language routing
210
- - Handle Sitecore language contexts
211
- - Implement language switching
212
- - Use proper locale-based data fetching
213
-
214
- ```typescript
215
- // Language-aware data fetching
216
- import { getTranslations } from 'next-intl/server';
217
-
218
- export default async function LocalizedPage() {
219
- const t = await getTranslations('common');
220
- // Fetch Sitecore content for current locale
221
- }
222
- ```
223
-
224
- ## Development Workflow
225
-
226
- 1. **Install dependencies**: `npm install`
227
- 2. **Configure environment**: Copy `.env.example` to `.env.local`
228
- 3. **Start development**: `npm run dev`
229
- 4. **Build for production**: `npm run build`
230
-
231
- ## App Router Best Practices
232
-
233
- ### Server vs Client Components
234
- - Use Server Components for Sitecore content rendering (default)
235
- - Use Client Components for user interactions
236
- - Minimize client-side JavaScript
237
- - Leverage server-side data fetching
238
-
239
- ### Routing and Layouts
240
- - Use layout.tsx for shared page structure
241
- - Implement loading.tsx for loading states
242
- - Create error.tsx for error boundaries
243
- - Use page.tsx for route content
244
- - Use [...path] for Sitecore catch-all routes
245
-
246
- ### Performance Optimization
247
- - Leverage Server Components for better performance
248
- - Use streaming for improved loading experience
249
- - Implement proper caching strategies
250
- - Optimize images with Next.js Image component
251
-
252
- ## Best Practices
253
-
254
- ### Performance
255
- - Optimize images using Next.js Image component
256
- - Implement proper loading states
257
- - Cache expensive operations appropriately
258
- - Consider server-side rendering implications
259
- - Lazy-load non-critical modules
260
- - Use Server Components for better performance
261
-
262
- ### Security
263
- - Sanitize user inputs before processing
264
- - Validate data at application boundaries
265
- - Use HTTPS for all Sitecore connections
266
- - Never expose sensitive configuration in client-side code
267
- - Escape content when rendering to prevent XSS
268
-
269
- ### Code Quality
270
- - Follow DRY principle - extract common functionality
271
- - Use SOLID principles for maintainable code
272
- - Write self-documenting code with clear intent
273
- - Implement proper error boundaries
274
- - Test behavior, not implementation details
9
+ This file applies to **this scaffolded head application only**. For the Content SDK monorepo (packages, CLI, templates source), use that repo's root `AGENTS.md` and `.cursor/rules/`.
@@ -5,39 +5,3 @@
5
5
  -->
6
6
 
7
7
  [Documentation](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
8
-
9
- ## Next.js Cache Components
10
-
11
- Cache Components is **disabled by default** in this template. To enable it:
12
-
13
- 1. **Enable in `next.config.ts`**:
14
- ```typescript
15
- const nextConfig: NextConfig = {
16
- cacheComponents: true,
17
- // ... rest of config
18
- };
19
- ```
20
-
21
- 2. **Add uncached data access** in all server components that call client methods:
22
-
23
- Next.js 16 with Cache Components requires accessing uncached data (`draftMode()`, `cookies()`, `headers()`, or `searchParams`) before any operations that might use `new Date()` or other time-related functions.
24
-
25
- Example:
26
- ```typescript
27
- export default async function Page({ params, searchParams }: PageProps) {
28
- // Access uncached data first
29
- await draftMode();
30
-
31
- const { site, locale, path } = await params;
32
- // ... rest of component
33
- }
34
- ```
35
-
36
- Apply this pattern to:
37
- - Page components that call `client.getPage()`, `client.getPreview()`, etc.
38
- - `generateMetadata` functions
39
- - Layout components that call client methods
40
- - Not-found handlers
41
- - Any server component calling Sitecore client methods
42
-
43
- 3. **See the sample app** (`samples/nextjs-app-router`) for a working example with Cache Components enabled.
@@ -0,0 +1,79 @@
1
+ # Skills.md — Capability groupings for this app (Next.js App Router)
2
+
3
+ This file describes **this application** in terms of **capability-style groupings**: high-level areas that help AI tools and developers map tasks to the right part of the app. This is an App Router app with `[site]`/`[locale]` segments, next-intl, and separate server/client component maps. For concrete steps and patterns, see [AGENTS.md](AGENTS.md) and the [official Content SDK documentation](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
4
+
5
+ **Agent Skills:** Each grouping is also available as a skill in [.agents/skills/](.agents/skills/) in the standard [Agent Skills](https://agentskills.io) format (`SKILL.md` per capability). Tools that support this standard load skills from `.agents/skills/`; Cursor's built-in skills use `.cursor/skills/` unless it also supports the Agent Skills standard. The skills here are tailored for **App Router** (e.g. setRequestLocale, draftMode(), component-map.ts + component-map.client.ts).
6
+
7
+ ---
8
+
9
+ ## Why capability grouping
10
+
11
+ Grouping related capabilities makes it easier to know which area of the app applies to a given task and to point to the right docs and patterns. Map the task to one or more of the groupings below; use AGENTS.md and the official docs for concrete steps.
12
+
13
+ ---
14
+
15
+ ## Capability groupings
16
+
17
+ ### content-sdk-component-scaffold
18
+
19
+ Creating new Sitecore components: file structure, props interface, and placement under `src/components/`. Use when adding a new component from scratch. In App Router, decide Server vs Client and register in the appropriate map.
20
+
21
+ ### content-sdk-component-registration
22
+
23
+ Registering components in `.sitecore/component-map.ts` (Server) and `.sitecore/component-map.client.ts` (Client). Required so layout and editing can resolve and render components. App Router has separate server and client maps.
24
+
25
+ ### content-sdk-editing-safe-rendering
26
+
27
+ Safe rendering in XM Cloud editing and preview: `draftMode()`, editing chromes, and design library. Use when ensuring components work in the Sitecore editor and preview. Use `client.getPreview(searchParams)` or `client.getDesignLibraryData(searchParams)` when draft mode is enabled.
28
+
29
+ ### content-sdk-field-usage-image-link-text
30
+
31
+ Using SDK field components: `<Text>`, `<RichText>`, `<Image>`, `<Link>`, with proper validation and fallbacks. Use when rendering Sitecore fields.
32
+
33
+ ### content-sdk-graphql-data-fetching
34
+
35
+ Page and dictionary fetching via the single Sitecore client in `src/lib/sitecore-client.ts`. Use `getPage(path ?? [], { site, locale })`, `getDictionary`, `getAppRouterStaticParams` for SSG. For preview use `draftMode()` and `getPreview`/`getDesignLibraryData` from searchParams.
36
+
37
+ ### content-sdk-route-configuration
38
+
39
+ Routing: single catch-all at `src/app/[site]/[locale]/[[...path]]/page.tsx`. Layout: app/layout.tsx → app/[site]/layout.tsx → page. Call `setRequestLocale(\`${site}_${locale}\`)` at top of page. Use placeholders and Layout.tsx as in AGENTS.md.
40
+
41
+ ### content-sdk-site-setup-and-env
42
+
43
+ Site and environment: `sitecore.config.ts`, environment variables, default site and language. Document vars in `.env.example` only; never commit `.env` or `.env.local`.
44
+
45
+ ### content-sdk-multisite-management
46
+
47
+ Multisite: `.sitecore/sites.json`, proxy in `src/proxy.ts`. Chain order is **fixed:** LocaleProxy → AppRouterMultisiteProxy → RedirectsProxy → PersonalizeProxy. Do not change proxy order.
48
+
49
+ ### content-sdk-dictionary-and-i18n
50
+
51
+ Dictionary and i18n: next-intl with `src/i18n/routing.ts` and `src/i18n/request.ts`. Request locale is `${site}_${locale}`; call `setRequestLocale(\`${site}_${locale}\`)` in the page; in request.ts parse and load dictionary with `client.getDictionary({ locale, site })`.
52
+
53
+ ### content-sdk-sitemap-robots
54
+
55
+ Sitemap and robots: `src/app/api/sitemap/route.ts` and `src/app/api/robots/route.ts` with `createSitemapRouteHandler` and `createRobotsRouteHandler`. Rewrites in next.config.ts for /sitemap*.xml and /robots.txt.
56
+
57
+ ### content-sdk-component-variants
58
+
59
+ Component variants: different renderings or data-driven variants of the same component type. Use when one component has multiple presentations. Register in the appropriate component map (server or client).
60
+
61
+ ### content-sdk-troubleshoot-editing
62
+
63
+ Troubleshooting XM Cloud editing, preview, and design library. Use when editing or preview does not behave as expected. Check draftMode(), getPreview/getDesignLibraryData from searchParams, and component maps.
64
+
65
+ ### content-sdk-upgrade-assistant
66
+
67
+ Upgrading @sitecore-content-sdk/* packages: version bumps, breaking changes, migration steps. Use when moving to a newer SDK version. Check the Content SDK repo CHANGELOG and upgrade guides.
68
+
69
+ ### content-sdk-component-data-strategy
70
+
71
+ Component data: layout data from getPage (or getPreview/getDesignLibraryData in editing). Pass site and locale from route params; Server Components use the client in server context; Client Components receive serializable props from parent. BYOC must be registered in the component map.
72
+
73
+ ---
74
+
75
+ ## How to use this
76
+
77
+ Map the task to one or more groupings above. Use [AGENTS.md](AGENTS.md) for app-level instructions and the [official documentation](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html) for APIs.
78
+
79
+ **If your tool supports Agent Skills:** Load skills from [.agents/skills/](.agents/skills/) (one folder per capability). They provide when-to-use, hard rules, and stop conditions tailored for this App Router app.
@@ -1,29 +1,29 @@
1
- import { dirname } from "path";
2
- import { fileURLToPath } from "url";
3
- import { FlatCompat } from "@eslint/eslintrc";
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
-
8
- const compat = new FlatCompat({
9
- baseDirectory: __dirname,
10
- });
11
-
12
- const eslintConfig = [
13
- ...compat.extends("next/core-web-vitals", "next/typescript"),
14
- {
15
- rules: {
16
- // Don't force alt for <Image/> (sourced from Sitecore media)
17
- "jsx-a11y/alt-text": "off",
18
- },
19
- ignores: [
20
- "node_modules/**",
21
- ".next/**",
22
- "out/**",
23
- "build/**",
24
- "next-env.d.ts",
25
- ],
26
- },
27
- ];
28
-
29
- export default eslintConfig;
1
+ import { dirname } from "path";
2
+ import { fileURLToPath } from "url";
3
+ import { FlatCompat } from "@eslint/eslintrc";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ const compat = new FlatCompat({
9
+ baseDirectory: __dirname,
10
+ });
11
+
12
+ const eslintConfig = [
13
+ ...compat.extends("next/core-web-vitals", "next/typescript"),
14
+ {
15
+ rules: {
16
+ // Don't force alt for <Image/> (sourced from Sitecore media)
17
+ "jsx-a11y/alt-text": "off",
18
+ },
19
+ ignores: [
20
+ "node_modules/**",
21
+ ".next/**",
22
+ "out/**",
23
+ "build/**",
24
+ "next-env.d.ts",
25
+ ],
26
+ },
27
+ ];
28
+
29
+ export default eslintConfig;
@@ -1,31 +1,31 @@
1
- # See https://help.github.com/ignore-files/ for more about ignoring files.
2
-
3
- # dependencies
4
- /node_modules
5
-
6
- # next.js
7
- /.next*/
8
- /out/
9
-
10
- # misc
11
- .DS_Store
12
-
13
- # local env files
14
- .env.local
15
- .env.*.local
16
- .env
17
-
18
- # Log files
19
- *.log*
20
-
21
- # vercel
22
- .vercel
23
-
24
- # sitecore temp files
25
- .sitecore/*
26
- # except for component-map
27
- !.sitecore/component-map.ts
28
- !.sitecore/component-map.client.ts
29
- !.sitecore/import-map.ts
30
- !.sitecore/import-map.server.ts
31
- !.sitecore/import-map.client.ts
1
+ # See https://help.github.com/ignore-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+
6
+ # next.js
7
+ /.next*/
8
+ /out/
9
+
10
+ # misc
11
+ .DS_Store
12
+
13
+ # local env files
14
+ .env.local
15
+ .env.*.local
16
+ .env
17
+
18
+ # Log files
19
+ *.log*
20
+
21
+ # vercel
22
+ .vercel
23
+
24
+ # sitecore temp files
25
+ .sitecore/*
26
+ # except for component-map
27
+ !.sitecore/component-map.ts
28
+ !.sitecore/component-map.client.ts
29
+ !.sitecore/import-map.ts
30
+ !.sitecore/import-map.server.ts
31
+ !.sitecore/import-map.client.ts
@@ -1,55 +1,56 @@
1
- {
2
- "name": "content-sdk-nextjs-app-router",
3
- "description": "Application utilizing Content SDK and Next.js",
4
- "version": "0.1.0",
5
- "private": true,
6
- "author": {
7
- "name": "Sitecore Corporation",
8
- "url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/sitecore/content-sdk.git"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/sitecore/content-sdk/issues"
16
- },
17
- "license": "Apache-2.0",
18
- "scripts": {
19
- "build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
20
- "lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
21
- "next:build": "next build",
22
- "next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
23
- "next:start": "next start",
24
- "sitecore-tools:generate-map": "sitecore-tools project component generate-map",
25
- "sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
26
- "sitecore-tools:build": "sitecore-tools project build",
27
- "dev": "cross-env NODE_ENV=development npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build --parallel next:dev sitecore-tools:generate-map:watch",
28
- "start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
29
- },
30
- "dependencies": {
31
- "@sitecore-cloudsdk/core": "^0.5.4",
32
- "@sitecore-cloudsdk/events": "^0.5.4",
33
- "@sitecore-content-sdk/nextjs": "<%- version %>",
34
- "@sitecore-feaas/clientside": "^0.6.0",
35
- "@sitecore/components": "~2.1.0",
36
- "next": "^16.1.1",
37
- "react": "^19.2.1",
38
- "react-dom": "^19.2.1",
39
- "next-intl": "^4.3.5"
40
- },
41
- "devDependencies": {
42
- "@eslint/eslintrc": "^3",
43
- "@sitecore-content-sdk/cli": "<%- version %>",
44
- "@tailwindcss/postcss": "^4",
45
- "@types/node": "^24.10.4",
46
- "@types/react": "^19.2.7",
47
- "@types/react-dom": "^19.2.3",
48
- "cross-env": "^10.0.0",
49
- "eslint": "^9.33.0",
50
- "eslint-config-next": "15.5.3",
51
- "npm-run-all2": "^8.0.4",
52
- "tailwindcss": "^4",
53
- "typescript": "~5.8.3"
54
- }
1
+ {
2
+ "name": "content-sdk-nextjs-app-router",
3
+ "description": "Application utilizing Content SDK and Next.js",
4
+ "version": "0.1.0",
5
+ "private": true,
6
+ "author": {
7
+ "name": "Sitecore Corporation",
8
+ "url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/sitecore/content-sdk.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/sitecore/content-sdk/issues"
16
+ },
17
+ "license": "Apache-2.0",
18
+ "scripts": {
19
+ "build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
20
+ "lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
21
+ "next:build": "next build",
22
+ "next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
23
+ "next:start": "next start",
24
+ "sitecore-tools:generate-map": "sitecore-tools project component generate-map",
25
+ "sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
26
+ "sitecore-tools:build": "sitecore-tools project build",
27
+ "dev": "cross-env NODE_ENV=development npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build --parallel next:dev sitecore-tools:generate-map:watch",
28
+ "start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
29
+ },
30
+ "dependencies": {
31
+ "@sitecore-content-sdk/nextjs": "<%- version %>",
32
+ "@sitecore-content-sdk/analytics-core": "<%- version %>",
33
+ "@sitecore-content-sdk/personalize": "<%- version %>",
34
+ "@sitecore-content-sdk/events": "<%- version %>",
35
+ "@sitecore-feaas/clientside": "^0.6.0",
36
+ "@sitecore/components": "~2.1.0",
37
+ "next": "^16.1.1",
38
+ "react": "^19.2.1",
39
+ "react-dom": "^19.2.1",
40
+ "next-intl": "^4.3.5"
41
+ },
42
+ "devDependencies": {
43
+ "@eslint/eslintrc": "^3",
44
+ "@sitecore-content-sdk/cli": "<%- version %>",
45
+ "@tailwindcss/postcss": "^4",
46
+ "@types/node": "^24.10.4",
47
+ "@types/react": "^19.2.7",
48
+ "@types/react-dom": "^19.2.3",
49
+ "cross-env": "^10.0.0",
50
+ "eslint": "^9.33.0",
51
+ "eslint-config-next": "15.5.3",
52
+ "npm-run-all2": "^8.0.4",
53
+ "tailwindcss": "^4",
54
+ "typescript": "~5.8.3"
55
+ }
55
56
  }
@@ -1,5 +1,5 @@
1
- const config = {
2
- plugins: ["@tailwindcss/postcss"],
3
- };
4
-
5
- export default config;
1
+ const config = {
2
+ plugins: ["@tailwindcss/postcss"],
3
+ };
4
+
5
+ export default config;