Skip to content

Commit 15badee

Browse files
authored
add context about prompt that works with cc (#20)
1 parent 60bc7f5 commit 15badee

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed

src/mcp-prompts/nextjs-16.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Next.js 16 (cacheComponents Mode): The Complete AI Agent Guide
1+
# Cache Components Mode: The Complete AI Agent Guide
22

33
## Authoritative Reference Based on E2E Test Suite Patterns
44

@@ -7,19 +7,21 @@
77
**Source**: Derived from 125+ E2E test fixtures and behavioral assertions
88
**Last Updated**: January 2025
99

10+
**⚠️ SCOPE**: This guide covers Cache Components mode (`experimental.cacheComponents: true`). These rules do NOT apply to standard Next.js 16 without Cache Components enabled.
11+
1012
---
1113

1214
## 🎯 What AI Agents Get Wrong (And Why)
1315

14-
Based on analyzing the complete E2E test suite, AI agents consistently make these mistakes:
16+
Based on analyzing the complete E2E test suite, AI agents consistently make these mistakes **when Cache Components is enabled**:
1517

16-
### **CRITICAL ERRORS AI AGENTS MAKE:**
18+
### **CRITICAL ERRORS AI AGENTS MAKE (with cacheComponents enabled):**
1719

1820
1. **Using `loading.tsx` for loading states** (deprecated for PPR shell generation)
1921
2. **Using `export const dynamic = 'force-static'`** (completely incompatible with cacheComponents)
20-
3. **Using `export const fetchCache`** (raises build error)
21-
4. **Using `export const revalidate`** (raises build error)
22-
5. **Using `export const dynamicParams`** (raises build error)
22+
3. **Using `export const fetchCache`** (raises build error with cacheComponents)
23+
4. **Using `export const revalidate`** (raises build error with cacheComponents)
24+
5. **Using `export const dynamicParams`** (raises build error with cacheComponents)
2325
6. **Using `export const runtime`** (raises build error when incompatible with cacheComponents)
2426
7. **Accessing `cookies()`/`headers()` in `'use cache'`** (throws runtime error)
2527
8. **Using `'use cache: private'` without `<Suspense>`** (build error)
@@ -163,10 +165,12 @@ This is THE CORE DIFFERENCE that AI agents must understand.
163165

164166
**Test Source**: Multiple test files
165167

166-
#### Behavior 1: Segment Configs Are Forbidden
168+
#### Behavior 1: Route Segment Configs Are Incompatible with Cache Components
169+
170+
**⚠️ NOTE**: These configs work fine in Next.js 16 WITHOUT cacheComponents. They're only forbidden when `experimental.cacheComponents: true` is enabled.
167171

168172
```typescript
169-
//TEST SHOWS THIS ERRORS AT BUILD:
173+
//BUILD ERROR (when cacheComponents is enabled):
170174
export const dynamic = "force-static"
171175
export const revalidate = 60
172176
export const fetchCache = "force-cache"
@@ -176,6 +180,8 @@ export const runtime = "edge" // If incompatible
176180
// Error message from test:
177181
// "Route segment config "revalidate" is not compatible with
178182
// `nextConfig.experimental.cacheComponents`. Please remove it."
183+
184+
// ✅ These work fine in Next.js 16 if cacheComponents is NOT enabled
179185
```
180186

181187
**Test Source**: `test/e2e/app-dir/cache-components-segment-configs/`
@@ -2424,15 +2430,18 @@ Two-stage load? → unstable_dynamicOnHover={true}
24242430
24252431
### The Complete Picture from Tests
24262432
2433+
**⚠️ IMPORTANT: These rules apply ONLY when `experimental.cacheComponents: true` is enabled in next.config**
2434+
24272435
```typescript
24282436
// ═══════════════════════════════════════════════════════════
2429-
// RULE 1: SEGMENT CONFIGS ARE FORBIDDEN
2437+
// RULE 1: SEGMENT CONFIGS ARE FORBIDDEN (with cacheComponents)
24302438
// ═══════════════════════════════════════════════════════════
2439+
// NOTE: These work fine in Next.js 16 WITHOUT cacheComponents enabled
24312440
2432-
export const dynamic = 'force-static' // ❌ BUILD ERROR
2433-
export const revalidate = 60 // ❌ BUILD ERROR
2434-
export const fetchCache = 'force-cache' // ❌ BUILD ERROR
2435-
export const dynamicParams = false // ❌ BUILD ERROR
2441+
export const dynamic = 'force-static' // ❌ BUILD ERROR (with cacheComponents)
2442+
export const revalidate = 60 // ❌ BUILD ERROR (with cacheComponents)
2443+
export const fetchCache = 'force-cache' // ❌ BUILD ERROR (with cacheComponents)
2444+
export const dynamicParams = false // ❌ BUILD ERROR (with cacheComponents)
24362445
24372446
// ═══════════════════════════════════════════════════════════
24382447
// RULE 2: THREE CACHE TYPES

src/mcp-resources/nextjs-16-knowledge/00-overview.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Next.js 16 (cacheComponents Mode): The Complete AI Agent Guide
1+
# Cache Components Mode: The Complete AI Agent Guide
22

33
## Authoritative Reference Based on E2E Test Suite Patterns
44

@@ -7,19 +7,21 @@
77
**Source**: Derived from 125+ E2E test fixtures and behavioral assertions
88
**Last Updated**: January 2025
99

10+
**⚠️ SCOPE**: This guide covers Cache Components mode (`experimental.cacheComponents: true`). These rules do NOT apply to standard Next.js 16 without Cache Components enabled.
11+
1012
---
1113

1214
## 🎯 What AI Agents Get Wrong (And Why)
1315

14-
Based on analyzing the complete E2E test suite, AI agents consistently make these mistakes:
16+
Based on analyzing the complete E2E test suite, AI agents consistently make these mistakes **when Cache Components is enabled**:
1517

16-
### **CRITICAL ERRORS AI AGENTS MAKE:**
18+
### **CRITICAL ERRORS AI AGENTS MAKE (with cacheComponents enabled):**
1719

1820
1. **Using `loading.tsx` for loading states** (deprecated for PPR shell generation)
1921
2. **Using `export const dynamic = 'force-static'`** (completely incompatible with cacheComponents)
20-
3. **Using `export const fetchCache`** (raises build error)
21-
4. **Using `export const revalidate`** (raises build error)
22-
5. **Using `export const dynamicParams`** (raises build error)
22+
3. **Using `export const fetchCache`** (raises build error with cacheComponents)
23+
4. **Using `export const revalidate`** (raises build error with cacheComponents)
24+
5. **Using `export const dynamicParams`** (raises build error with cacheComponents)
2325
6. **Using `export const runtime`** (raises build error when incompatible with cacheComponents)
2426
7. **Accessing `cookies()`/`headers()` in `'use cache'`** (throws runtime error)
2527
8. **Using `'use cache: private'` without `<Suspense>`** (build error)

src/mcp-resources/nextjs-16-knowledge/01-core-mechanics.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ This is THE CORE DIFFERENCE that AI agents must understand.
5353

5454
**Test Source**: Multiple test files
5555

56-
#### Behavior 1: Segment Configs Are Forbidden
56+
#### Behavior 1: Route Segment Configs Are Incompatible with Cache Components
57+
58+
**⚠️ NOTE**: These configs work fine in Next.js 16 WITHOUT cacheComponents. They're only forbidden when `experimental.cacheComponents: true` is enabled.
5759

5860
```typescript
59-
//TEST SHOWS THIS ERRORS AT BUILD:
61+
//BUILD ERROR (when cacheComponents is enabled):
6062
export const dynamic = "force-static"
6163
export const revalidate = 60
6264
export const fetchCache = "force-cache"
@@ -66,6 +68,8 @@ export const runtime = "edge" // If incompatible
6668
// Error message from test:
6769
// "Route segment config "revalidate" is not compatible with
6870
// `nextConfig.experimental.cacheComponents`. Please remove it."
71+
72+
// ✅ These work fine in Next.js 16 if cacheComponents is NOT enabled
6973
```
7074

7175
**Test Source**: `test/e2e/app-dir/cache-components-segment-configs/`

src/mcp-resources/nextjs-16-knowledge/12-reference.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
### The Complete Picture from Tests
44

5+
**⚠️ IMPORTANT: These rules apply ONLY when `experimental.cacheComponents: true` is enabled in next.config**
6+
57
```typescript
68
// ═══════════════════════════════════════════════════════════
7-
// RULE 1: SEGMENT CONFIGS ARE FORBIDDEN
9+
// RULE 1: SEGMENT CONFIGS ARE FORBIDDEN (with cacheComponents)
810
// ═══════════════════════════════════════════════════════════
11+
// NOTE: These work fine in Next.js 16 WITHOUT cacheComponents enabled
912

10-
export const dynamic = 'force-static' // ❌ BUILD ERROR
11-
export const revalidate = 60 // ❌ BUILD ERROR
12-
export const fetchCache = 'force-cache' // ❌ BUILD ERROR
13-
export const dynamicParams = false // ❌ BUILD ERROR
13+
export const dynamic = 'force-static' // ❌ BUILD ERROR (with cacheComponents)
14+
export const revalidate = 60 // ❌ BUILD ERROR (with cacheComponents)
15+
export const fetchCache = 'force-cache' // ❌ BUILD ERROR (with cacheComponents)
16+
export const dynamicParams = false // ❌ BUILD ERROR (with cacheComponents)
1417

1518
// ═══════════════════════════════════════════════════════════
1619
// RULE 2: THREE CACHE TYPES

0 commit comments

Comments
 (0)