@mikulgohil/ai-kit 1.9.0 → 1.10.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.
@@ -45,6 +45,21 @@ If the AI doesn't get it right in 2 attempts:
45
45
  2. The task might be too complex for a single prompt
46
46
  3. Take over manually — you'll save tokens and time
47
47
 
48
+ ## Know Your Context Limits
49
+
50
+ Claude Code now supports up to **1M tokens of context** (Opus 4.6) with **64K default output** (128K ceiling). This is massive — but context still costs money.
51
+
52
+ | Model | Context Window | Default Output | Max Output |
53
+ |-------|---------------|----------------|------------|
54
+ | Opus 4.6 | 1M tokens | 64K tokens | 128K tokens |
55
+ | Sonnet 4.6 | 200K tokens | 64K tokens | 128K tokens |
56
+
57
+ ### Use `/effort` to Control Token Spend
58
+ Claude Code's `/effort` command lets you set reasoning effort levels. For simple tasks, lower effort saves tokens. For complex architecture decisions, higher effort produces better results.
59
+
60
+ ### Context Compaction
61
+ When conversations get long, Claude Code automatically compacts earlier context. The **PostCompact hook** fires after this happens — your AI Kit hooks use it to ensure important context survives compaction.
62
+
48
63
  ## CLAUDE.md Is Free Context
49
64
 
50
65
  Your `CLAUDE.md` file is loaded automatically — everything in it gives the AI context without using your conversation tokens. That's why `ai-kit` generates it: better output from fewer tokens.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikulgohil/ai-kit",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "AI-assisted development setup kit. Auto-detects your tech stack (Next.js, Sitecore XM Cloud, Optimizely SaaS CMS, Tailwind, TypeScript, Turborepo) and generates tailored CLAUDE.md, .cursorrules, hooks, agents, context modes, slash commands, design token rules, component registries, developer guides, and spec-first workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -76,7 +76,7 @@
76
76
  "url": "https://github.com/mikulgohil/ai-kit/issues"
77
77
  },
78
78
  "engines": {
79
- "node": ">=18.0.0"
79
+ "node": ">=20.0.0"
80
80
  },
81
81
  "dependencies": {
82
82
  "@inquirer/prompts": "^7.0.0",
@@ -105,6 +105,30 @@ These standards are enforced across all projects to ensure consistency.
105
105
  - Pin dependency versions — avoid `^` or `~` for critical packages
106
106
  - When adding a new dependency, note the reason in the component's doc file or PR description
107
107
 
108
+ ## Documentation Verification
109
+
110
+ AI training data has a cutoff date. When working with framework APIs, **verify your knowledge is current** before writing code:
111
+
112
+ ### When to Verify
113
+ - Using an API you haven't seen in this project's codebase
114
+ - Working with recently released features (Next.js 16+, Tailwind v4, Sitecore Content SDK v2.x)
115
+ - When you're unsure about an API signature, parameter order, or return type
116
+ - When a build error suggests an API doesn't exist or has changed
117
+
118
+ ### How to Verify (in priority order)
119
+ 1. **Check this project's code first** — existing implementations are the most reliable reference
120
+ 2. **Use Context7 MCP** — if available, use `resolve-library-id` then `query-docs` to fetch current, version-specific documentation
121
+ 3. **Use llms.txt endpoints** — fetch from official AI-friendly docs:
122
+ - Next.js: `https://nextjs.org/docs/llms-full.txt`
123
+ - Sitecore XM Cloud: check the project repo for `LLMs.txt`
124
+ 4. **Use WebFetch** — fetch the specific docs page for the API in question
125
+
126
+ ### Rules
127
+ - Do NOT guess at API signatures — look them up if unsure
128
+ - Do NOT assume a library API works the same as a previous version
129
+ - The code examples in this CLAUDE.md file are current and verified — prefer them over memory
130
+ - When you look something up, briefly note what you found so the developer knows the source
131
+
108
132
  ## Code Quality
109
133
  - Match existing patterns, naming conventions, and file structure
110
134
  - Keep changes minimal — don't refactor surrounding code unless asked
@@ -170,6 +194,7 @@ AI will auto-discover and apply these when your task matches. You can also invok
170
194
  - `/document` — Generate documentation for existing code
171
195
  - `/commit-msg` — Generate conventional commit message from staged changes
172
196
  - `/env-setup` — Generate .env.example and validate environment variables
197
+ - `/fetch-docs` — Pre-load current docs for your tech stack (run at session start)
173
198
 
174
199
  ## Scripts
175
200
  {{scripts}}
@@ -54,10 +54,27 @@ app/
54
54
  - Use `revalidateTag(tag)` or `revalidatePath(path)` in Server Actions for on-demand ISR
55
55
  - Tag fetches with `fetch(url, { next: { tags: ['posts'] } })` for targeted revalidation
56
56
 
57
+ ## Turbopack (Next.js 16+)
58
+ - Turbopack is stable and production-ready — use `next dev --turbopack` for ~4x faster dev startup
59
+ - Server Fast Refresh: instant HMR for server-side changes (no full reload)
60
+ - Supports SRI (Subresource Integrity) for security
61
+ - Tree shakes dynamic imports automatically
62
+ - If using custom webpack config, migrate to Turbopack-compatible patterns:
63
+ - Replace `webpack()` in `next.config.js` with Turbopack-native configuration
64
+ - Most loaders have Turbopack equivalents — check the Next.js docs
65
+ - Web Workers: use `new Worker(new URL('./worker.ts', import.meta.url))` for proper bundling
66
+
67
+ ## Caching (Next.js 16+)
68
+ - Route stale time is decoupled from segment-level data — configure independently
69
+ - Browser cache no longer serves stale RSC (React Server Component) responses
70
+ - Use `staleTimes` in `next.config.js` for fine-grained stale time control
71
+ - Prefer `fetch()` cache options over route-level `revalidate` for granular control
72
+
57
73
  ## Common Mistakes to Avoid
58
74
  - Don't use `useEffect` for data fetching in Server Components
59
75
  - Don't import server-only code in Client Components
60
76
  - Don't use `router.push` for simple navigation — use `<Link>`
61
77
  - Don't forget to add `loading.tsx` for route transitions
62
78
  - Don't throw errors from Server Actions — return error objects instead
63
- - Don't use Node.js APIs in Middleware — it runs on the Edge runtime
79
+ - Don't use Node.js APIs in Middleware — it runs on the Edge runtime
80
+ - Don't use custom `webpack()` config in Next.js 16+ without checking Turbopack compatibility
@@ -1,7 +1,7 @@
1
- # Sitecore XM Cloud
1
+ # Sitecore XM Cloud (SitecoreAI)
2
2
 
3
3
  ## Architecture
4
- - This is a headless CMS project using Sitecore XM Cloud with Next.js as the rendering host
4
+ - This is a headless CMS project using Sitecore XM Cloud (part of the SitecoreAI platform) with Next.js as the rendering host
5
5
  - Components receive data through Sitecore Layout Service via `ComponentRendering` props
6
6
  - Use `@sitecore-jss/sitecore-jss-nextjs` or `@sitecore-content-sdk/nextjs` for component bindings
7
7
 
@@ -60,6 +60,14 @@ These standards are enforced across all projects.
60
60
  - Prefer native browser APIs over utility libraries when reasonable
61
61
  - Note the reason for new dependencies in the doc file or PR
62
62
 
63
+ ### Documentation Verification
64
+ - AI training data has a cutoff — verify API signatures before using unfamiliar or recently released APIs
65
+ - Check this project's existing code first for patterns and API usage
66
+ - Use Context7 MCP to fetch current, version-specific docs when available
67
+ - Official llms.txt endpoints: Next.js (`https://nextjs.org/docs/llms-full.txt`)
68
+ - Do NOT guess at API signatures — look them up if unsure
69
+ - The code examples in these rules are current and verified — prefer them over memory
70
+
63
71
  ### Quality
64
72
  - Read existing code before modifying — match patterns, naming, and structure
65
73
  - Keep changes minimal and scoped to the request
@@ -10,4 +10,7 @@
10
10
  - Streaming: wrap slow components in `<Suspense fallback={...}>` for progressive rendering
11
11
  - ISR: use `fetch(url, { next: { revalidate: N } })` or `export const revalidate = N`
12
12
  - Middleware: place `middleware.ts` at project root, use `matcher` config, Edge-compatible APIs only
13
- - Route Groups: use `(groupName)/` for organization without affecting URL paths
13
+ - Route Groups: use `(groupName)/` for organization without affecting URL paths
14
+ - Turbopack (Next.js 16+): use `next dev --turbopack` for ~4x faster dev, Server Fast Refresh for instant HMR
15
+ - Caching (Next.js 16+): route stale time is decoupled from data — use `staleTimes` in `next.config.js` for control
16
+ - Don't use custom `webpack()` in Next.js 16+ without checking Turbopack compatibility
@@ -1,4 +1,4 @@
1
- # Sitecore XM Cloud Rules
1
+ # Sitecore XM Cloud (SitecoreAI) Rules
2
2
 
3
3
  - Use Sitecore field helpers (`<Text>`, `<RichText>`, `<Image>`, `<Link>`) — never render `.value` directly
4
4
  - Component names must match Sitecore rendering items exactly