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
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: content-sdk-field-usage-image-link-text
3
+ description: Renders Sitecore fields using SDK field components (Text, RichText, Image, Link) with proper validation and fallbacks. Use when rendering content fields or when the user mentions Text, RichText, Image, Link, or field components.
4
+ ---
5
+
6
+ # Content SDK Field Usage (Pages Router)
7
+
8
+ Use SDK field components to render Sitecore fields with proper validation and fallbacks.
9
+
10
+ ## When to Use
11
+
12
+ - User asks how to render a title, body, image, or link from Sitecore.
13
+ - Task involves displaying content fields, fixing empty/broken images or links, or using RichText/Text/Image/Link components.
14
+ - User mentions "field," "Image," "Link," "Text," "RichText," or "field value."
15
+
16
+ ## How to perform
17
+
18
+ - Use SDK field components: `<Text field={fields?.title} />`, `<RichText field={fields?.content} />`, `<Image field={fields?.image} />`, `<Link field={fields?.link} />`. Guard with `fields?.` when optional; use tag prop on Text when needed. Do not hardcode media or link URLs from Sitecore.
19
+
20
+ ## Hard Rules
21
+
22
+ - Prefer SDK field components over manual field value extraction: `<Text field={fields?.title} />`, `<RichText field={fields?.content} />`, `<Image field={fields?.image} />`, `<Link field={fields?.link} />`. Use tag prop for Text when needed (e.g. tag="h1").
23
+ - Validate or guard field existence before rendering when fields can be optional (e.g. `fields?.title`). Handle null/undefined and empty fields gracefully.
24
+ - Do not hardcode image or link URLs when the data comes from Sitecore; use the field components or helpers that resolve media/URLs.
25
+ - Follow the app's import pattern (e.g. from lib or components).
26
+
27
+ ## Stop Conditions
28
+
29
+ - Stop if the field structure (name or type) is unknown; suggest checking the layout/data shape or asking the user.
30
+ - Do not assume field names (e.g. "title") without confirmation when the template might use different names.
31
+ - Do not commit or log raw field values that might contain PII or secrets.
32
+
33
+ ## References
34
+
35
+ - [AGENTS.md](../../../AGENTS.md) for component and Sitecore patterns.
36
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: content-sdk-graphql-data-fetching
3
+ description: Fetches page, dictionary, and component data via the single Sitecore client. Pages Router: getPage(path, { locale: context.locale }), getDictionary({ site: page.siteName, locale: page.locale }), getComponentData(page.layout, context, components); for SSG use getPagePaths(sites, context?.locales). Use when fetching page or dictionary content.
4
+ ---
5
+
6
+ # Content SDK GraphQL Data Fetching (Pages Router)
7
+
8
+ All Sitecore data fetching goes through the single client in `src/lib/sitecore-client.ts`. Use getPage, getDictionary, and **getComponentData** in the catch-all page. Path from **extractPath(context)**; locale from **context.locale**.
9
+
10
+ ## When to Use
11
+
12
+ - User asks how to fetch page data, layout, or dictionary phrases.
13
+ - Task involves getPage, getDictionary, getComponentData, getPreview, getDesignLibraryData, or getPagePaths.
14
+ - User mentions "sitecore client," "Layout Service," "page data," or "dictionary."
15
+
16
+ ## How to perform
17
+
18
+ - Use the client from `src/lib/sitecore-client.ts` only. In [[...path]].tsx: use `extractPath(context)` and `context.locale`; call getPage(path, { locale: context.locale }), then getDictionary and getComponentData(page.layout, context, components). For SSG use getPagePaths in getStaticPaths. For preview use context.preview and getPreview/getDesignLibraryData(context.previewData).
19
+
20
+ ## Hard Rules
21
+
22
+ - Use the single SitecoreClient instance in `src/lib/sitecore-client.ts`. Do not create a second client or instantiate SitecoreClient elsewhere.
23
+ - **Path and locale:** Use `extractPath(context)` (from `@sitecore-content-sdk/nextjs/utils`) to get the path array; use `context.locale` for locale. Do not assume path or locale from elsewhere.
24
+ - **Catch-all page flow:** In getStaticProps/getServerSideProps: `client.getPage(path, { locale: context.locale })`, then `client.getDictionary({ site: page.siteName, locale: page.locale })` and `client.getComponentData(page.layout, context, components)` for component props. Pass the result to the layout renderer.
25
+ - **SSG:** In getStaticPaths, use `client.getPagePaths(siteNames, context?.locales || [])` where site names come from `.sitecore/sites.json` (e.g. `sites.map((s) => s.name)`). Use `revalidate` in getStaticProps for ISR.
26
+ - **Preview:** Use `context.preview` and `context.previewData`; when in preview, use `client.getPreview(context.previewData)` or `client.getDesignLibraryData(context.previewData)`.
27
+ - Config for the client comes from `sitecore.config.ts`; use environment variables, never hardcode secrets.
28
+
29
+ ## Stop Conditions
30
+
31
+ - Stop if the task requires moving the client to another folder without clear requirement; suggest keeping a single instance in lib.
32
+ - Do not add direct GraphQL or fetch to Layout Service bypassing the client unless the task explicitly requires it.
33
+ - Do not fetch in _app; all data flows from [[...path]].tsx.
34
+
35
+ ## References
36
+
37
+ - [AGENTS.md](../../../AGENTS.md) for SitecoreClient, getPage, getDictionary, getComponentData, and SSG/SSR.
38
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: content-sdk-multisite-management
3
+ description: Handles multisite: site resolution, .sitecore/sites.json, and proxy in src/proxy.ts. Pages Router proxy order is fixed: MultisiteProxy → RedirectsProxy → PersonalizeProxy. Use when working with multiple sites or hostnames.
4
+ ---
5
+
6
+ # Content SDK Multisite Management (Pages Router)
7
+
8
+ Site resolution from request (e.g. hostname or cookie); proxy rewrites to internal path. No [locale] in URL; Next.js i18n handles locale separately.
9
+
10
+ ## When to Use
11
+
12
+ - User asks about multiple sites, hostnames, or site resolution.
13
+ - Task involves .sitecore/sites.json, multisite config, or proxy/middleware for site.
14
+ - User mentions "multisite," "site resolution," "hostname," or "sites.json."
15
+
16
+ ## How to perform
17
+
18
+ - Site list: `.sitecore/sites.json`. Proxy in `src/proxy.ts`; ensure `src/middleware.ts` re-exports it if present. Keep chain order: MultisiteProxy → RedirectsProxy → PersonalizeProxy. Exclude /api, _next, static assets in matcher/skip.
19
+
20
+ ## Hard Rules
21
+
22
+ - Site list is in `.sitecore/sites.json` (typically generated by Sitecore CLI or deployment). Avoid hand-editing unless the format is known.
23
+ - **Proxy:** Implemented in `src/proxy.ts`. Next.js runs middleware from `middleware.ts` at root or in `src/` — if the app only has `proxy.ts`, add `src/middleware.ts` that re-exports it.
24
+ - **Chain order is fixed:** MultisiteProxy → RedirectsProxy → PersonalizeProxy. **Do not change this order.** MultisiteProxy resolves site from request (hostname or cookie) and rewrites; redirects and personalization run after.
25
+ - **Skip / matcher:** Use the skip callback and matcher to exclude /api, /_next, static files, and health checks so the proxy stays lightweight.
26
+ - Config: sitecore.config.ts → multisite (e.g. enabled, useCookieResolution). Single SitecoreClient; pass resolved site (and locale from context.locale) into getPage, getDictionary, getComponentData.
27
+
28
+ ## Stop Conditions
29
+
30
+ - Stop if the user wants to reorder the proxy chain; explain that order is required.
31
+ - Stop if sites.json format is unknown and the change could break resolution; suggest checking SDK docs or CLI output.
32
+ - Do not add a second site resolution mechanism; use the existing proxy and config.
33
+
34
+ ## References
35
+
36
+ - [AGENTS.md](../../../AGENTS.md) for proxy chain, skip, and multisite config.
37
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: content-sdk-route-configuration
3
+ description: Configures routing and layout for Pages Router. Single catch-all at src/pages/[[...path]].tsx; path from extractPath(context), locale from context.locale. Data flows via getStaticProps/getServerSideProps to _app and Layout. Use when changing routing, placeholders, or Layout.
4
+ ---
5
+
6
+ # Content SDK Route Configuration (Pages Router)
7
+
8
+ Single catch-all route; no [site] or [locale] in the URL path. Site is resolved by middleware; locale from Next.js i18n (context.locale).
9
+
10
+ ## When to Use
11
+
12
+ - User asks to change routing, add a route, or fix 404/500 behavior.
13
+ - Task involves catch-all route, placeholders, _app, or Layout.tsx.
14
+ - User mentions "[[...path]]," "placeholder," "layout," or "getStaticProps."
15
+
16
+ ## How to perform
17
+
18
+ - Single Sitecore page: `src/pages/[[...path]].tsx`. Use `extractPath(context)` for path and `context.locale` for locale. Fetch all data in getStaticProps/getServerSideProps and pass to _app and Layout. Not-found/error: use getErrorPage in getStaticProps or 404.tsx / _error.tsx as appropriate.
19
+
20
+ ## Hard Rules
21
+
22
+ - **Single Sitecore page:** `src/pages/[[...path]].tsx`. This is the **only** page that renders Sitecore content. Do not add another page or catch-all for Sitecore content.
23
+ - **Path:** Use `extractPath(context)` (from `@sitecore-content-sdk/nextjs/utils`) to get the path array. **Locale:** Use `context.locale` (Next.js i18n). Do not assume path or locale from headers or elsewhere.
24
+ - **Data flow:** All Sitecore data is fetched in getStaticProps/getServerSideProps in [[...path]].tsx and passed to _app and Layout. Do not fetch Sitecore data in _app.tsx.
25
+ - **Layout:** Layout.tsx renders page layout and placeholders; Providers wrap component props and page context; Bootstrap handles site name and preview mode.
26
+ - Placeholders are rendered by the layout; do not change placeholder names or structure without aligning with Sitecore layout definition.
27
+ - **404 / 500 / _error:** When the catch-all returns `notFound: true`, Next.js renders 404.tsx. For Sitecore-driven error content use `client.getErrorPage(ErrorPage.NotFound)` or `ErrorPage.InternalServerError` in getStaticProps when applicable. _error.tsx is the error boundary; it does not fetch from Sitecore.
28
+
29
+ ## Stop Conditions
30
+
31
+ - Stop if the user wants to add a second catch-all or a different URL shape for Sitecore pages; explain single-entry-point constraint.
32
+ - Stop if changing proxy/middleware order; order is fixed (MultisiteProxy → RedirectsProxy → PersonalizeProxy).
33
+ - Do not move or rename the catch-all file without updating all references.
34
+
35
+ ## References
36
+
37
+ - [AGENTS.md](../../../AGENTS.md) for exact paths, extractPath, and layout flow.
38
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: content-sdk-site-setup-and-env
3
+ description: Configures site and environment: sitecore.config.ts, environment variables, default site and language. Use when configuring the app or adding env vars. Document in .env.example only; never commit .env or .env.local.
4
+ ---
5
+
6
+ # Content SDK Site Setup and Environment (Pages Router)
7
+
8
+ Central config in sitecore.config.ts; all secrets and environment-specific values via env vars.
9
+
10
+ ## When to Use
11
+
12
+ - User asks to configure site, default language, API host, or environment.
13
+ - Task involves sitecore.config.ts, .env, or defaultSite/defaultLanguage.
14
+ - User mentions "config," "environment variables," "API key," or "default site."
15
+
16
+ ## How to perform
17
+
18
+ - Edit `sitecore.config.ts` with `defineConfig`; read all secrets and env-specific values from `process.env.*`. Add or change vars in `.env.example` (or `.env.remote.example` / `.env.container.example`) with placeholders; never commit `.env` or `.env.local`.
19
+
20
+ ## Hard Rules
21
+
22
+ - Use `sitecore.config.ts` with `defineConfig` from the SDK. Expose api (edge, local), defaultSite, defaultLanguage, editingSecret, multisite, redirects, personalize as needed.
23
+ - All sensitive or environment-specific values must come from environment variables (e.g. process.env.SITECORE_API_KEY). Never hardcode API keys, secrets, or production URLs in source.
24
+ - Document every new or changed env var in `.env.example` (or `.env.remote.example` / `.env.container.example`). Use placeholder or empty value and a short comment; never put real secrets in example files.
25
+ - Never commit `.env` or `.env.local`; they are gitignored. Example files are the source of truth for which vars exist.
26
+
27
+ ## Stop Conditions
28
+
29
+ - Stop if the user wants to commit real secrets or production values; insist on env vars and .env.example only.
30
+ - Stop if adding a new env var would require CI or deployment changes without explicit instruction; document the var and note that deployment must set it.
31
+ - Do not edit .next/, node_modules/, or lockfiles unless the task explicitly requires it.
32
+
33
+ ## References
34
+
35
+ - [AGENTS.md](../../../AGENTS.md) for boundaries and env rules.
36
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: content-sdk-sitemap-robots
3
+ description: Sitemap and robots.txt for Pages Router: src/pages/api/sitemap.ts and src/pages/api/robots.ts with SitemapMiddleware(scClient, sites).getHandler() and RobotsMiddleware(scClient, sites).getHandler(). Rewrites in next.config.js. Use when configuring sitemap, robots.txt, or SEO.
4
+ ---
5
+
6
+ # Content SDK Sitemap and Robots (Pages Router)
7
+
8
+ Sitemap and robots.txt are served via **API routes** and rewrites. Use the SDK middleware getHandler pattern and sites from .sitecore/sites.json.
9
+
10
+ ## When to Use
11
+
12
+ - User asks to add or change sitemap or robots.txt.
13
+ - Task involves SEO, sitemap.xml, or robots route.
14
+ - User mentions "sitemap," "robots," "SEO," or "rewrites."
15
+
16
+ ## How to perform
17
+
18
+ - Sitemap: `src/pages/api/sitemap.ts` with `SitemapMiddleware(scClient, sites).getHandler()`; robots: `src/pages/api/robots.ts` with `RobotsMiddleware(scClient, sites).getHandler()`. Use sites from `.sitecore/sites.json`. Add rewrites in next.config.js for /sitemap*.xml and /robots.txt to these API routes.
19
+
20
+ ## Hard Rules
21
+
22
+ - **Sitemap:** `src/pages/api/sitemap.ts` — use `new SitemapMiddleware(scClient, sites).getHandler()`. Export the handler. Use `sites` from `.sitecore/sites.json`.
23
+ - **Robots:** `src/pages/api/robots.ts` — use `new RobotsMiddleware(scClient, sites).getHandler()`. Same pattern.
24
+ - **Rewrites:** In `next.config.js`, add rewrites for `/robots.txt` and `/sitemap*.xml` to the corresponding API routes (e.g. `/sitemap.xml` → `/api/sitemap`).
25
+ - Use the same SitecoreClient instance (e.g. from `src/lib/sitecore-client.ts`) as the rest of the app; do not create a dedicated client for sitemap/robots.
26
+ - Avoid hardcoding the site list; use .sitecore/sites.json.
27
+
28
+ ## Stop Conditions
29
+
30
+ - Stop if the user wants to serve sitemap/robots from a different origin or with different auth; document and suggest proxy or edge config.
31
+ - Do not add new env vars for sitemap/robots without documenting them in .env.example.
32
+ - Do not change rewrite paths without updating docs and any references.
33
+
34
+ ## References
35
+
36
+ - [AGENTS.md](../../../AGENTS.md) for API routes and rewrites.
37
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: content-sdk-troubleshoot-editing
3
+ description: Troubleshoots XM Cloud editing, preview, and design library for Pages Router. Check context.preview, context.previewData, and editing API routes (config, render, feaas/render). Use when editing or preview does not behave as expected.
4
+ ---
5
+
6
+ # Content SDK Troubleshoot Editing (Pages Router)
7
+
8
+ This skill focuses on **diagnosing** editing, preview, and design library issues. For implementing editing-safe rendering (context.preview, getPreview/getDesignLibraryData, API routes), use the **content-sdk-editing-safe-rendering** skill; the two are complementary (implementation vs. troubleshooting).
9
+
10
+ Diagnose and fix editing, preview, and design library issues without breaking the single client or proxy order. This app uses **context.preview** and **context.previewData** in getStaticProps/getServerSideProps.
11
+
12
+ ## When to Use
13
+
14
+ - User reports that editing, preview, or design library is broken or inconsistent.
15
+ - Task involves debugging "not working in editor," missing chromes, or wrong data in preview.
16
+ - User mentions "editing broken," "preview not working," "design library," or "editor issues."
17
+
18
+ ## How to perform
19
+
20
+ - Confirm context.preview and context.previewData and correct path/locale (extractPath, context.locale). Verify editing API routes (config, render, feaas/render) are not rewritten (check proxy matcher) and component-map.ts includes the component. Check env (editingSecret, API config) and .env.example documentation.
21
+
22
+ ## Hard Rules
23
+
24
+ - **Preview flow:** In [[...path]].tsx getStaticProps/getServerSideProps, use `context.preview` and `context.previewData`. When in preview, use `client.getPreview(context.previewData)` or `client.getDesignLibraryData(context.previewData)`. Ensure path and locale come from extractPath(context) and context.locale when not in preview.
25
+ - Editing API routes: `src/pages/api/editing/config.ts` (EditingConfigMiddleware), `render.ts` (EditingRenderMiddleware), `feaas/render.ts` (FEAASRenderMiddleware) must be reachable and use the same component map (`.sitecore/component-map.ts`) and config as the app. Check proxy `config.matcher` so `/api` is excluded and not rewritten or blocked.
26
+ - Check that the component map includes all components used in the layout; missing registration causes "component not found" in editor.
27
+ - Environment: editingSecret and API config must be set (in env); document in .env.example only. Do not log or commit secrets.
28
+ - Common causes: wrong path/locale passed to getPreview/getDesignLibraryData, or component not registered in component-map.ts.
29
+
30
+ ## Stop Conditions
31
+
32
+ - Stop if the fix would require changing CI, deployment, or XM Cloud project settings; suggest the user do that and document the required env or config.
33
+ - Stop if the issue might be in Sitecore (layout, template) rather than the app; suggest checking layout and content in XM Cloud.
34
+ - Do not recommend disabling security (e.g. skipping secret validation) without explicit user request and warning.
35
+
36
+ ## References
37
+
38
+ - content-sdk-editing-safe-rendering skill and [AGENTS.md](../../../AGENTS.md) for preview and editing flow.
39
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: content-sdk-upgrade-assistant
3
+ description: Guides upgrading @sitecore-content-sdk/* packages: version bumps, breaking changes, migration steps. Use when moving to a newer SDK or package version. Check Content SDK repo CHANGELOG and upgrade guides.
4
+ ---
5
+
6
+ # Content SDK Upgrade Assistant (Pages Router)
7
+
8
+ Upgrade @sitecore-content-sdk/* packages safely; follow the Content SDK repo changelog and migration guides.
9
+
10
+ ## When to Use
11
+
12
+ - User asks to upgrade SDK packages, update to a new version, or apply a migration.
13
+ - Task involves version bumps, @sitecore-content-sdk/* dependencies, or breaking changes.
14
+ - User mentions "upgrade," "migration," "new version," or "breaking change."
15
+
16
+ ## How to perform
17
+
18
+ - Bump all @sitecore-content-sdk/* to consistent versions; read the Content SDK repo CHANGELOG (and MIGRATION/upgrade docs) for breaking changes and migration steps. Update package.json, run `npm install` and `npm run build`; test editing and preview after upgrade.
19
+
20
+ ## Hard Rules
21
+
22
+ - Prefer upgrading all @sitecore-content-sdk/* packages together to a consistent set of versions unless the user requests a partial upgrade. Check peer dependencies and compatibility.
23
+ - Update dependencies in package.json; run `npm install` and `npm run build`. Test editing and preview after upgrade.
24
+ - Read the **Content SDK repository** CHANGELOG (and any MIGRATION.md or upgrade guide) for breaking changes and required code/config updates. Apply migration steps before or with the version bump.
25
+ - Do not edit .next/, node_modules/, or lockfiles unless required for the upgrade. Do not change CI or root tooling unless the task explicitly includes it.
26
+
27
+ ## Stop Conditions
28
+
29
+ - Stop if the target version is not specified or unclear; ask or suggest checking the Content SDK CHANGELOG and supported versions.
30
+ - Stop if a breaking change requires product or deployment decisions (e.g. new env vars, config schema); list required changes and ask the user to confirm.
31
+
32
+ ## References
33
+
34
+ - Content SDK repo [CHANGELOG](https://github.com/Sitecore/content-sdk/blob/dev/CHANGELOG.md) and upgrade docs.
35
+ - [AGENTS.md](../../../AGENTS.md) for build commands.
36
+ - [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
@@ -1,81 +1,81 @@
1
- ---
2
- description: Core coding principles for your Sitecore project
3
- alwaysApply: true
4
- globs: []
5
- ---
6
-
7
- # General Coding Principles
8
-
9
- ## Universal Standards
10
-
11
- DRY Principle:
12
-
13
- - Don't Repeat Yourself - extract common functionality
14
- - Create reusable utilities and helper functions
15
- - Use composition over inheritance
16
- - Share types and interfaces across modules
17
-
18
- SOLID Principles:
19
-
20
- - Single Responsibility: each function/class has one purpose
21
- - Open/Closed: extend functionality through composition
22
- - Dependency Inversion: depend on abstractions, not implementations
23
-
24
- Code Clarity:
25
-
26
- - Write self-documenting code with clear intent
27
- - Use meaningful names that express business concepts
28
- - Prefer explicit over implicit behavior
29
- - Make dependencies and requirements obvious
30
-
31
- ## Architecture Patterns
32
-
33
- Modular Design:
34
-
35
- - Organize code into focused, cohesive modules
36
- - Minimize coupling between modules
37
- - Use clear interfaces between layers
38
- - Follow established patterns consistently
39
-
40
- Data Flow:
41
-
42
- - Prefer unidirectional data flow
43
- - Validate inputs at system boundaries
44
- - Transform data at appropriate layers
45
- - Handle errors close to their source
46
-
47
- Testing:
48
-
49
- - Write testable code with minimal dependencies
50
- - Use dependency injection for better testability
51
- - Mock external services and side effects
52
- - Test behavior, not implementation details
53
-
54
- ## Development Standards
55
-
56
- Version Control:
57
-
58
- - Write descriptive commit messages
59
- - Keep commits focused and atomic
60
- - Use branching strategies appropriate to team size
61
- - Review code before merging
62
-
63
- Documentation:
64
-
65
- - Document public APIs and interfaces
66
- - Include usage examples for complex functionality
67
- - Keep documentation close to code
68
- - Update documentation with code changes
69
-
70
- Performance:
71
-
72
- - Optimize for readability first, performance second
73
- - Profile before optimizing
74
- - Cache expensive operations appropriately
75
- - Consider memory usage and cleanup
76
-
77
- Referenced:
78
- @src/components/
79
- @src/lib/
80
- @package.json
81
-
1
+ ---
2
+ description: Core coding principles for your Sitecore project
3
+ alwaysApply: true
4
+ globs: []
5
+ ---
6
+
7
+ # General Coding Principles
8
+
9
+ ## Universal Standards
10
+
11
+ DRY Principle:
12
+
13
+ - Don't Repeat Yourself - extract common functionality
14
+ - Create reusable utilities and helper functions
15
+ - Use composition over inheritance
16
+ - Share types and interfaces across modules
17
+
18
+ SOLID Principles:
19
+
20
+ - Single Responsibility: each function/class has one purpose
21
+ - Open/Closed: extend functionality through composition
22
+ - Dependency Inversion: depend on abstractions, not implementations
23
+
24
+ Code Clarity:
25
+
26
+ - Write self-documenting code with clear intent
27
+ - Use meaningful names that express business concepts
28
+ - Prefer explicit over implicit behavior
29
+ - Make dependencies and requirements obvious
30
+
31
+ ## Architecture Patterns
32
+
33
+ Modular Design:
34
+
35
+ - Organize code into focused, cohesive modules
36
+ - Minimize coupling between modules
37
+ - Use clear interfaces between layers
38
+ - Follow established patterns consistently
39
+
40
+ Data Flow:
41
+
42
+ - Prefer unidirectional data flow
43
+ - Validate inputs at system boundaries
44
+ - Transform data at appropriate layers
45
+ - Handle errors close to their source
46
+
47
+ Testing:
48
+
49
+ - Write testable code with minimal dependencies
50
+ - Use dependency injection for better testability
51
+ - Mock external services and side effects
52
+ - Test behavior, not implementation details
53
+
54
+ ## Development Standards
55
+
56
+ Version Control:
57
+
58
+ - Write descriptive commit messages
59
+ - Keep commits focused and atomic
60
+ - Use branching strategies appropriate to team size
61
+ - Review code before merging
62
+
63
+ Documentation:
64
+
65
+ - Document public APIs and interfaces
66
+ - Include usage examples for complex functionality
67
+ - Keep documentation close to code
68
+ - Update documentation with code changes
69
+
70
+ Performance:
71
+
72
+ - Optimize for readability first, performance second
73
+ - Profile before optimizing
74
+ - Cache expensive operations appropriately
75
+ - Consider memory usage and cleanup
76
+
77
+ Referenced:
78
+ @src/components/
79
+ @src/lib/
80
+ @package.json
81
+