@sentry/warden 0.0.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 (199) hide show
  1. package/.agents/skills/find-bugs/SKILL.md +75 -0
  2. package/.agents/skills/vercel-react-best-practices/AGENTS.md +2934 -0
  3. package/.agents/skills/vercel-react-best-practices/SKILL.md +136 -0
  4. package/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  5. package/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
  6. package/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
  7. package/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  8. package/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
  9. package/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
  10. package/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  11. package/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  12. package/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
  13. package/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  14. package/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  15. package/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  16. package/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  17. package/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  18. package/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
  19. package/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  20. package/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  21. package/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
  22. package/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  23. package/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  24. package/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  25. package/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  26. package/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  27. package/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  28. package/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  29. package/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  30. package/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  31. package/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  32. package/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  33. package/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  34. package/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  35. package/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  36. package/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  37. package/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  38. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  39. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  40. package/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  41. package/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  42. package/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  43. package/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  44. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  45. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  46. package/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  47. package/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  48. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  49. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  50. package/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  51. package/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  52. package/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  53. package/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  54. package/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  55. package/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
  56. package/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  57. package/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
  58. package/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
  59. package/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
  60. package/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  61. package/.claude/settings.json +57 -0
  62. package/.claude/settings.local.json +88 -0
  63. package/.claude/skills/agent-prompt/SKILL.md +54 -0
  64. package/.claude/skills/agent-prompt/references/agentic-patterns.md +94 -0
  65. package/.claude/skills/agent-prompt/references/anti-patterns.md +140 -0
  66. package/.claude/skills/agent-prompt/references/context-design.md +124 -0
  67. package/.claude/skills/agent-prompt/references/core-principles.md +75 -0
  68. package/.claude/skills/agent-prompt/references/model-guidance.md +118 -0
  69. package/.claude/skills/agent-prompt/references/output-formats.md +98 -0
  70. package/.claude/skills/agent-prompt/references/skill-structure.md +115 -0
  71. package/.claude/skills/agent-prompt/references/system-prompts.md +115 -0
  72. package/.claude/skills/notseer/SKILL.md +131 -0
  73. package/.claude/skills/skill-writer/SKILL.md +140 -0
  74. package/.claude/skills/testing-guidelines/SKILL.md +132 -0
  75. package/.claude/skills/warden-skill/SKILL.md +250 -0
  76. package/.claude/skills/warden-skill/references/config-schema.md +133 -0
  77. package/.dex/config.toml +2 -0
  78. package/.github/workflows/ci.yml +33 -0
  79. package/.github/workflows/release.yml +54 -0
  80. package/.github/workflows/warden.yml +40 -0
  81. package/AGENTS.md +89 -0
  82. package/CONTRIBUTING.md +60 -0
  83. package/LICENSE +105 -0
  84. package/README.md +43 -0
  85. package/SPEC.md +263 -0
  86. package/action.yml +87 -0
  87. package/assets/favicon.png +0 -0
  88. package/assets/warden-icon-bw.svg +5 -0
  89. package/assets/warden-icon-purple.png +0 -0
  90. package/assets/warden-icon-purple.svg +5 -0
  91. package/docs/.claude/settings.local.json +11 -0
  92. package/docs/astro.config.mjs +43 -0
  93. package/docs/package.json +19 -0
  94. package/docs/pnpm-lock.yaml +4000 -0
  95. package/docs/public/favicon.svg +5 -0
  96. package/docs/src/components/Code.astro +141 -0
  97. package/docs/src/components/PackageManagerTabs.astro +183 -0
  98. package/docs/src/components/Terminal.astro +212 -0
  99. package/docs/src/layouts/Base.astro +380 -0
  100. package/docs/src/pages/cli.astro +167 -0
  101. package/docs/src/pages/config.astro +394 -0
  102. package/docs/src/pages/guide.astro +449 -0
  103. package/docs/src/pages/index.astro +490 -0
  104. package/docs/src/styles/global.css +551 -0
  105. package/docs/tsconfig.json +3 -0
  106. package/docs/vercel.json +5 -0
  107. package/eslint.config.js +33 -0
  108. package/package.json +73 -0
  109. package/src/action/index.ts +1 -0
  110. package/src/action/main.ts +868 -0
  111. package/src/cli/args.test.ts +477 -0
  112. package/src/cli/args.ts +415 -0
  113. package/src/cli/commands/add.ts +447 -0
  114. package/src/cli/commands/init.test.ts +136 -0
  115. package/src/cli/commands/init.ts +132 -0
  116. package/src/cli/commands/setup-app/browser.ts +38 -0
  117. package/src/cli/commands/setup-app/credentials.ts +45 -0
  118. package/src/cli/commands/setup-app/manifest.ts +48 -0
  119. package/src/cli/commands/setup-app/server.ts +172 -0
  120. package/src/cli/commands/setup-app.ts +156 -0
  121. package/src/cli/commands/sync.ts +114 -0
  122. package/src/cli/context.ts +131 -0
  123. package/src/cli/files.test.ts +155 -0
  124. package/src/cli/files.ts +89 -0
  125. package/src/cli/fix.test.ts +310 -0
  126. package/src/cli/fix.ts +387 -0
  127. package/src/cli/git.test.ts +119 -0
  128. package/src/cli/git.ts +318 -0
  129. package/src/cli/index.ts +14 -0
  130. package/src/cli/main.ts +672 -0
  131. package/src/cli/output/box.ts +235 -0
  132. package/src/cli/output/formatters.test.ts +187 -0
  133. package/src/cli/output/formatters.ts +269 -0
  134. package/src/cli/output/icons.ts +13 -0
  135. package/src/cli/output/index.ts +44 -0
  136. package/src/cli/output/ink-runner.tsx +337 -0
  137. package/src/cli/output/jsonl.test.ts +347 -0
  138. package/src/cli/output/jsonl.ts +126 -0
  139. package/src/cli/output/reporter.ts +435 -0
  140. package/src/cli/output/tasks.ts +374 -0
  141. package/src/cli/output/tty.test.ts +117 -0
  142. package/src/cli/output/tty.ts +60 -0
  143. package/src/cli/output/verbosity.test.ts +40 -0
  144. package/src/cli/output/verbosity.ts +31 -0
  145. package/src/cli/terminal.test.ts +148 -0
  146. package/src/cli/terminal.ts +301 -0
  147. package/src/config/index.ts +3 -0
  148. package/src/config/loader.test.ts +313 -0
  149. package/src/config/loader.ts +103 -0
  150. package/src/config/schema.ts +168 -0
  151. package/src/config/writer.test.ts +119 -0
  152. package/src/config/writer.ts +84 -0
  153. package/src/diff/classify.test.ts +162 -0
  154. package/src/diff/classify.ts +92 -0
  155. package/src/diff/coalesce.test.ts +208 -0
  156. package/src/diff/coalesce.ts +133 -0
  157. package/src/diff/context.test.ts +226 -0
  158. package/src/diff/context.ts +201 -0
  159. package/src/diff/index.ts +4 -0
  160. package/src/diff/parser.test.ts +212 -0
  161. package/src/diff/parser.ts +149 -0
  162. package/src/event/context.ts +132 -0
  163. package/src/event/index.ts +2 -0
  164. package/src/event/schedule-context.ts +101 -0
  165. package/src/examples/examples.integration.test.ts +66 -0
  166. package/src/examples/index.test.ts +101 -0
  167. package/src/examples/index.ts +122 -0
  168. package/src/examples/setup.ts +25 -0
  169. package/src/index.ts +115 -0
  170. package/src/output/dedup.test.ts +419 -0
  171. package/src/output/dedup.ts +607 -0
  172. package/src/output/github-checks.test.ts +300 -0
  173. package/src/output/github-checks.ts +476 -0
  174. package/src/output/github-issues.ts +329 -0
  175. package/src/output/index.ts +5 -0
  176. package/src/output/issue-renderer.ts +197 -0
  177. package/src/output/renderer.test.ts +727 -0
  178. package/src/output/renderer.ts +217 -0
  179. package/src/output/stale.test.ts +375 -0
  180. package/src/output/stale.ts +155 -0
  181. package/src/output/types.ts +34 -0
  182. package/src/sdk/index.ts +1 -0
  183. package/src/sdk/runner.test.ts +806 -0
  184. package/src/sdk/runner.ts +1232 -0
  185. package/src/skills/index.ts +36 -0
  186. package/src/skills/loader.test.ts +300 -0
  187. package/src/skills/loader.ts +423 -0
  188. package/src/skills/remote.test.ts +704 -0
  189. package/src/skills/remote.ts +604 -0
  190. package/src/triggers/matcher.test.ts +277 -0
  191. package/src/triggers/matcher.ts +152 -0
  192. package/src/types/index.ts +194 -0
  193. package/src/utils/async.ts +18 -0
  194. package/src/utils/index.test.ts +84 -0
  195. package/src/utils/index.ts +50 -0
  196. package/tsconfig.json +25 -0
  197. package/vitest.config.ts +8 -0
  198. package/vitest.integration.config.ts +11 -0
  199. package/warden.toml +19 -0
@@ -0,0 +1,73 @@
1
+ ---
2
+ title: Use after() for Non-Blocking Operations
3
+ impact: MEDIUM
4
+ impactDescription: faster response times
5
+ tags: server, async, logging, analytics, side-effects
6
+ ---
7
+
8
+ ## Use after() for Non-Blocking Operations
9
+
10
+ Use Next.js's `after()` to schedule work that should execute after a response is sent. This prevents logging, analytics, and other side effects from blocking the response.
11
+
12
+ **Incorrect (blocks response):**
13
+
14
+ ```tsx
15
+ import { logUserAction } from '@/app/utils'
16
+
17
+ export async function POST(request: Request) {
18
+ // Perform mutation
19
+ await updateDatabase(request)
20
+
21
+ // Logging blocks the response
22
+ const userAgent = request.headers.get('user-agent') || 'unknown'
23
+ await logUserAction({ userAgent })
24
+
25
+ return new Response(JSON.stringify({ status: 'success' }), {
26
+ status: 200,
27
+ headers: { 'Content-Type': 'application/json' }
28
+ })
29
+ }
30
+ ```
31
+
32
+ **Correct (non-blocking):**
33
+
34
+ ```tsx
35
+ import { after } from 'next/server'
36
+ import { headers, cookies } from 'next/headers'
37
+ import { logUserAction } from '@/app/utils'
38
+
39
+ export async function POST(request: Request) {
40
+ // Perform mutation
41
+ await updateDatabase(request)
42
+
43
+ // Log after response is sent
44
+ after(async () => {
45
+ const userAgent = (await headers()).get('user-agent') || 'unknown'
46
+ const sessionCookie = (await cookies()).get('session-id')?.value || 'anonymous'
47
+
48
+ logUserAction({ sessionCookie, userAgent })
49
+ })
50
+
51
+ return new Response(JSON.stringify({ status: 'success' }), {
52
+ status: 200,
53
+ headers: { 'Content-Type': 'application/json' }
54
+ })
55
+ }
56
+ ```
57
+
58
+ The response is sent immediately while logging happens in the background.
59
+
60
+ **Common use cases:**
61
+
62
+ - Analytics tracking
63
+ - Audit logging
64
+ - Sending notifications
65
+ - Cache invalidation
66
+ - Cleanup tasks
67
+
68
+ **Important notes:**
69
+
70
+ - `after()` runs even if the response fails or redirects
71
+ - Works in Server Actions, Route Handlers, and Server Components
72
+
73
+ Reference: [https://nextjs.org/docs/app/api-reference/functions/after](https://nextjs.org/docs/app/api-reference/functions/after)
@@ -0,0 +1,96 @@
1
+ ---
2
+ title: Authenticate Server Actions Like API Routes
3
+ impact: CRITICAL
4
+ impactDescription: prevents unauthorized access to server mutations
5
+ tags: server, server-actions, authentication, security, authorization
6
+ ---
7
+
8
+ ## Authenticate Server Actions Like API Routes
9
+
10
+ **Impact: CRITICAL (prevents unauthorized access to server mutations)**
11
+
12
+ Server Actions (functions with `"use server"`) are exposed as public endpoints, just like API routes. Always verify authentication and authorization **inside** each Server Action—do not rely solely on middleware, layout guards, or page-level checks, as Server Actions can be invoked directly.
13
+
14
+ Next.js documentation explicitly states: "Treat Server Actions with the same security considerations as public-facing API endpoints, and verify if the user is allowed to perform a mutation."
15
+
16
+ **Incorrect (no authentication check):**
17
+
18
+ ```typescript
19
+ 'use server'
20
+
21
+ export async function deleteUser(userId: string) {
22
+ // Anyone can call this! No auth check
23
+ await db.user.delete({ where: { id: userId } })
24
+ return { success: true }
25
+ }
26
+ ```
27
+
28
+ **Correct (authentication inside the action):**
29
+
30
+ ```typescript
31
+ 'use server'
32
+
33
+ import { verifySession } from '@/lib/auth'
34
+ import { unauthorized } from '@/lib/errors'
35
+
36
+ export async function deleteUser(userId: string) {
37
+ // Always check auth inside the action
38
+ const session = await verifySession()
39
+
40
+ if (!session) {
41
+ throw unauthorized('Must be logged in')
42
+ }
43
+
44
+ // Check authorization too
45
+ if (session.user.role !== 'admin' && session.user.id !== userId) {
46
+ throw unauthorized('Cannot delete other users')
47
+ }
48
+
49
+ await db.user.delete({ where: { id: userId } })
50
+ return { success: true }
51
+ }
52
+ ```
53
+
54
+ **With input validation:**
55
+
56
+ ```typescript
57
+ 'use server'
58
+
59
+ import { verifySession } from '@/lib/auth'
60
+ import { z } from 'zod'
61
+
62
+ const updateProfileSchema = z.object({
63
+ userId: z.string().uuid(),
64
+ name: z.string().min(1).max(100),
65
+ email: z.string().email()
66
+ })
67
+
68
+ export async function updateProfile(data: unknown) {
69
+ // Validate input first
70
+ const validated = updateProfileSchema.parse(data)
71
+
72
+ // Then authenticate
73
+ const session = await verifySession()
74
+ if (!session) {
75
+ throw new Error('Unauthorized')
76
+ }
77
+
78
+ // Then authorize
79
+ if (session.user.id !== validated.userId) {
80
+ throw new Error('Can only update own profile')
81
+ }
82
+
83
+ // Finally perform the mutation
84
+ await db.user.update({
85
+ where: { id: validated.userId },
86
+ data: {
87
+ name: validated.name,
88
+ email: validated.email
89
+ }
90
+ })
91
+
92
+ return { success: true }
93
+ }
94
+ ```
95
+
96
+ Reference: [https://nextjs.org/docs/app/guides/authentication](https://nextjs.org/docs/app/guides/authentication)
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: Cross-Request LRU Caching
3
+ impact: HIGH
4
+ impactDescription: caches across requests
5
+ tags: server, cache, lru, cross-request
6
+ ---
7
+
8
+ ## Cross-Request LRU Caching
9
+
10
+ `React.cache()` only works within one request. For data shared across sequential requests (user clicks button A then button B), use an LRU cache.
11
+
12
+ **Implementation:**
13
+
14
+ ```typescript
15
+ import { LRUCache } from 'lru-cache'
16
+
17
+ const cache = new LRUCache<string, any>({
18
+ max: 1000,
19
+ ttl: 5 * 60 * 1000 // 5 minutes
20
+ })
21
+
22
+ export async function getUser(id: string) {
23
+ const cached = cache.get(id)
24
+ if (cached) return cached
25
+
26
+ const user = await db.user.findUnique({ where: { id } })
27
+ cache.set(id, user)
28
+ return user
29
+ }
30
+
31
+ // Request 1: DB query, result cached
32
+ // Request 2: cache hit, no DB query
33
+ ```
34
+
35
+ Use when sequential user actions hit multiple endpoints needing the same data within seconds.
36
+
37
+ **With Vercel's [Fluid Compute](https://vercel.com/docs/fluid-compute):** LRU caching is especially effective because multiple concurrent requests can share the same function instance and cache. This means the cache persists across requests without needing external storage like Redis.
38
+
39
+ **In traditional serverless:** Each invocation runs in isolation, so consider Redis for cross-process caching.
40
+
41
+ Reference: [https://github.com/isaacs/node-lru-cache](https://github.com/isaacs/node-lru-cache)
@@ -0,0 +1,76 @@
1
+ ---
2
+ title: Per-Request Deduplication with React.cache()
3
+ impact: MEDIUM
4
+ impactDescription: deduplicates within request
5
+ tags: server, cache, react-cache, deduplication
6
+ ---
7
+
8
+ ## Per-Request Deduplication with React.cache()
9
+
10
+ Use `React.cache()` for server-side request deduplication. Authentication and database queries benefit most.
11
+
12
+ **Usage:**
13
+
14
+ ```typescript
15
+ import { cache } from 'react'
16
+
17
+ export const getCurrentUser = cache(async () => {
18
+ const session = await auth()
19
+ if (!session?.user?.id) return null
20
+ return await db.user.findUnique({
21
+ where: { id: session.user.id }
22
+ })
23
+ })
24
+ ```
25
+
26
+ Within a single request, multiple calls to `getCurrentUser()` execute the query only once.
27
+
28
+ **Avoid inline objects as arguments:**
29
+
30
+ `React.cache()` uses shallow equality (`Object.is`) to determine cache hits. Inline objects create new references each call, preventing cache hits.
31
+
32
+ **Incorrect (always cache miss):**
33
+
34
+ ```typescript
35
+ const getUser = cache(async (params: { uid: number }) => {
36
+ return await db.user.findUnique({ where: { id: params.uid } })
37
+ })
38
+
39
+ // Each call creates new object, never hits cache
40
+ getUser({ uid: 1 })
41
+ getUser({ uid: 1 }) // Cache miss, runs query again
42
+ ```
43
+
44
+ **Correct (cache hit):**
45
+
46
+ ```typescript
47
+ const getUser = cache(async (uid: number) => {
48
+ return await db.user.findUnique({ where: { id: uid } })
49
+ })
50
+
51
+ // Primitive args use value equality
52
+ getUser(1)
53
+ getUser(1) // Cache hit, returns cached result
54
+ ```
55
+
56
+ If you must pass objects, pass the same reference:
57
+
58
+ ```typescript
59
+ const params = { uid: 1 }
60
+ getUser(params) // Query runs
61
+ getUser(params) // Cache hit (same reference)
62
+ ```
63
+
64
+ **Next.js-Specific Note:**
65
+
66
+ In Next.js, the `fetch` API is automatically extended with request memoization. Requests with the same URL and options are automatically deduplicated within a single request, so you don't need `React.cache()` for `fetch` calls. However, `React.cache()` is still essential for other async tasks:
67
+
68
+ - Database queries (Prisma, Drizzle, etc.)
69
+ - Heavy computations
70
+ - Authentication checks
71
+ - File system operations
72
+ - Any non-fetch async work
73
+
74
+ Use `React.cache()` to deduplicate these operations across your component tree.
75
+
76
+ Reference: [React.cache documentation](https://react.dev/reference/react/cache)
@@ -0,0 +1,65 @@
1
+ ---
2
+ title: Avoid Duplicate Serialization in RSC Props
3
+ impact: LOW
4
+ impactDescription: reduces network payload by avoiding duplicate serialization
5
+ tags: server, rsc, serialization, props, client-components
6
+ ---
7
+
8
+ ## Avoid Duplicate Serialization in RSC Props
9
+
10
+ **Impact: LOW (reduces network payload by avoiding duplicate serialization)**
11
+
12
+ RSC→client serialization deduplicates by object reference, not value. Same reference = serialized once; new reference = serialized again. Do transformations (`.toSorted()`, `.filter()`, `.map()`) in client, not server.
13
+
14
+ **Incorrect (duplicates array):**
15
+
16
+ ```tsx
17
+ // RSC: sends 6 strings (2 arrays × 3 items)
18
+ <ClientList usernames={usernames} usernamesOrdered={usernames.toSorted()} />
19
+ ```
20
+
21
+ **Correct (sends 3 strings):**
22
+
23
+ ```tsx
24
+ // RSC: send once
25
+ <ClientList usernames={usernames} />
26
+
27
+ // Client: transform there
28
+ 'use client'
29
+ const sorted = useMemo(() => [...usernames].sort(), [usernames])
30
+ ```
31
+
32
+ **Nested deduplication behavior:**
33
+
34
+ Deduplication works recursively. Impact varies by data type:
35
+
36
+ - `string[]`, `number[]`, `boolean[]`: **HIGH impact** - array + all primitives fully duplicated
37
+ - `object[]`: **LOW impact** - array duplicated, but nested objects deduplicated by reference
38
+
39
+ ```tsx
40
+ // string[] - duplicates everything
41
+ usernames={['a','b']} sorted={usernames.toSorted()} // sends 4 strings
42
+
43
+ // object[] - duplicates array structure only
44
+ users={[{id:1},{id:2}]} sorted={users.toSorted()} // sends 2 arrays + 2 unique objects (not 4)
45
+ ```
46
+
47
+ **Operations breaking deduplication (create new references):**
48
+
49
+ - Arrays: `.toSorted()`, `.filter()`, `.map()`, `.slice()`, `[...arr]`
50
+ - Objects: `{...obj}`, `Object.assign()`, `structuredClone()`, `JSON.parse(JSON.stringify())`
51
+
52
+ **More examples:**
53
+
54
+ ```tsx
55
+ // ❌ Bad
56
+ <C users={users} active={users.filter(u => u.active)} />
57
+ <C product={product} productName={product.name} />
58
+
59
+ // ✅ Good
60
+ <C users={users} />
61
+ <C product={product} />
62
+ // Do filtering/destructuring in client
63
+ ```
64
+
65
+ **Exception:** Pass derived data when transformation is expensive or client doesn't need original.
@@ -0,0 +1,83 @@
1
+ ---
2
+ title: Parallel Data Fetching with Component Composition
3
+ impact: CRITICAL
4
+ impactDescription: eliminates server-side waterfalls
5
+ tags: server, rsc, parallel-fetching, composition
6
+ ---
7
+
8
+ ## Parallel Data Fetching with Component Composition
9
+
10
+ React Server Components execute sequentially within a tree. Restructure with composition to parallelize data fetching.
11
+
12
+ **Incorrect (Sidebar waits for Page's fetch to complete):**
13
+
14
+ ```tsx
15
+ export default async function Page() {
16
+ const header = await fetchHeader()
17
+ return (
18
+ <div>
19
+ <div>{header}</div>
20
+ <Sidebar />
21
+ </div>
22
+ )
23
+ }
24
+
25
+ async function Sidebar() {
26
+ const items = await fetchSidebarItems()
27
+ return <nav>{items.map(renderItem)}</nav>
28
+ }
29
+ ```
30
+
31
+ **Correct (both fetch simultaneously):**
32
+
33
+ ```tsx
34
+ async function Header() {
35
+ const data = await fetchHeader()
36
+ return <div>{data}</div>
37
+ }
38
+
39
+ async function Sidebar() {
40
+ const items = await fetchSidebarItems()
41
+ return <nav>{items.map(renderItem)}</nav>
42
+ }
43
+
44
+ export default function Page() {
45
+ return (
46
+ <div>
47
+ <Header />
48
+ <Sidebar />
49
+ </div>
50
+ )
51
+ }
52
+ ```
53
+
54
+ **Alternative with children prop:**
55
+
56
+ ```tsx
57
+ async function Header() {
58
+ const data = await fetchHeader()
59
+ return <div>{data}</div>
60
+ }
61
+
62
+ async function Sidebar() {
63
+ const items = await fetchSidebarItems()
64
+ return <nav>{items.map(renderItem)}</nav>
65
+ }
66
+
67
+ function Layout({ children }: { children: ReactNode }) {
68
+ return (
69
+ <div>
70
+ <Header />
71
+ {children}
72
+ </div>
73
+ )
74
+ }
75
+
76
+ export default function Page() {
77
+ return (
78
+ <Layout>
79
+ <Sidebar />
80
+ </Layout>
81
+ )
82
+ }
83
+ ```
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: Minimize Serialization at RSC Boundaries
3
+ impact: HIGH
4
+ impactDescription: reduces data transfer size
5
+ tags: server, rsc, serialization, props
6
+ ---
7
+
8
+ ## Minimize Serialization at RSC Boundaries
9
+
10
+ The React Server/Client boundary serializes all object properties into strings and embeds them in the HTML response and subsequent RSC requests. This serialized data directly impacts page weight and load time, so **size matters a lot**. Only pass fields that the client actually uses.
11
+
12
+ **Incorrect (serializes all 50 fields):**
13
+
14
+ ```tsx
15
+ async function Page() {
16
+ const user = await fetchUser() // 50 fields
17
+ return <Profile user={user} />
18
+ }
19
+
20
+ 'use client'
21
+ function Profile({ user }: { user: User }) {
22
+ return <div>{user.name}</div> // uses 1 field
23
+ }
24
+ ```
25
+
26
+ **Correct (serializes only 1 field):**
27
+
28
+ ```tsx
29
+ async function Page() {
30
+ const user = await fetchUser()
31
+ return <Profile name={user.name} />
32
+ }
33
+
34
+ 'use client'
35
+ function Profile({ name }: { name: string }) {
36
+ return <div>{name}</div>
37
+ }
38
+ ```
@@ -0,0 +1,57 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(ls:*)",
5
+ "Bash(pwd:*)",
6
+ "Bash(find:*)",
7
+ "Bash(file:*)",
8
+ "Bash(stat:*)",
9
+ "Bash(wc:*)",
10
+ "Bash(head:*)",
11
+ "Bash(tail:*)",
12
+ "Bash(cat:*)",
13
+ "Bash(tree:*)",
14
+ "Bash(git status:*)",
15
+ "Bash(git log:*)",
16
+ "Bash(git diff:*)",
17
+ "Bash(git show:*)",
18
+ "Bash(git branch:*)",
19
+ "Bash(git remote:*)",
20
+ "Bash(git tag:*)",
21
+ "Bash(git stash list:*)",
22
+ "Bash(git rev-parse:*)",
23
+ "Bash(gh pr view:*)",
24
+ "Bash(gh pr list:*)",
25
+ "Bash(gh pr checks:*)",
26
+ "Bash(gh pr diff:*)",
27
+ "Bash(gh issue view:*)",
28
+ "Bash(gh issue list:*)",
29
+ "Bash(gh run view:*)",
30
+ "Bash(gh run list:*)",
31
+ "Bash(gh run logs:*)",
32
+ "Bash(gh repo view:*)",
33
+ "Bash(gh api:*)",
34
+ "Bash(node --version:*)",
35
+ "Bash(pnpm list:*)",
36
+ "Bash(pnpm why:*)",
37
+ "Bash(tsc --version:*)",
38
+ "Skill(sentry-skills:commit)",
39
+ "Skill(sentry-skills:create-pr)",
40
+ "Skill(sentry-skills:code-review)",
41
+ "Skill(sentry-skills:find-bugs)",
42
+ "Skill(sentry-skills:iterate-pr)",
43
+ "Skill(sentry-skills:claude-settings-audit)",
44
+ "Skill(sentry-skills:agents-md)",
45
+ "Skill(sentry-skills:brand-guidelines)",
46
+ "WebFetch(domain:docs.github.com)",
47
+ "WebFetch(domain:cli.github.com)",
48
+ "WebFetch(domain:docs.anthropic.com)",
49
+ "WebFetch(domain:npmjs.com)"
50
+ ],
51
+ "deny": []
52
+ },
53
+ "enabledPlugins": {
54
+ "dex@dex": true,
55
+ "sentry-skills@sentry-skills": true
56
+ }
57
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(pnpm build)",
5
+ "Bash(pnpm install:*)",
6
+ "Bash(pnpm test:run:*)",
7
+ "Bash(node dist/cli/index.js:*)",
8
+ "Bash(pnpm lint:*)",
9
+ "Bash(echo:*)",
10
+ "Bash(pnpm add:*)",
11
+ "Bash(pnpm remove:*)",
12
+ "Bash(pnpm cli run:*)",
13
+ "WebSearch",
14
+ "Bash(pnpm lint:fix:*)",
15
+ "WebFetch(domain:github.com)",
16
+ "WebFetch(domain:raw.githubusercontent.com)",
17
+ "Bash(claude skill:*)",
18
+ "Bash(curl:*)",
19
+ "Bash(xxd:*)",
20
+ "Bash(ANTHROPIC_API_KEY=\"\" node dist/cli/index.js:*)",
21
+ "Bash(git add:*)",
22
+ "Bash(git commit:*)",
23
+ "Bash(grep:*)",
24
+ "Bash(dex --help:*)",
25
+ "Bash(npx @zeeg/dex:*)",
26
+ "Bash(dex config --help:*)",
27
+ "Bash(dex sync --help:*)",
28
+ "Bash(dex init:*)",
29
+ "Bash(dex config:*)",
30
+ "Bash(dex create:*)",
31
+ "Bash(dex list:*)",
32
+ "Bash(pnpm test:*)",
33
+ "Bash(git rebase:*)",
34
+ "Bash(pnpm warden:*)",
35
+ "Bash(node /home/dcramer/src/warden/dist/cli/main.js:*)",
36
+ "Bash(git stash:*)",
37
+ "WebFetch(domain:warden.sentry.dev)",
38
+ "Bash(pnpm cli:*)",
39
+ "Bash(xargs cat:*)",
40
+ "Bash(/home/dcramer/src/warden/node_modules/.bin/tsx:*)",
41
+ "Bash(printf:*)",
42
+ "Bash(pnpm info:*)",
43
+ "Bash(npm view:*)",
44
+ "Bash(npm search:*)",
45
+ "Bash(pnpm search:*)",
46
+ "Bash(warden:*)",
47
+ "Bash(dex show:*)",
48
+ "Bash(dex complete:*)",
49
+ "Bash(defined\".\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
50
+ "Bash(git push)",
51
+ "Bash(Warden\"\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
52
+ "Bash(xargs:*)",
53
+ "Bash(./dist/cli/index.js add:*)",
54
+ "Bash(./dist/cli/index.js:*)",
55
+ "Bash(pnpm astro check --help:*)",
56
+ "Bash(npx astro check:*)",
57
+ "Bash(pnpm:*)",
58
+ "Bash(git checkout:*)",
59
+ "Bash(dex plan:*)",
60
+ "Bash(git push:*)",
61
+ "Bash(git -C /home/dcramer/src/warden log --oneline --all -- dist/)",
62
+ "Bash(git -C /home/dcramer/src/warden status:*)",
63
+ "WebFetch(domain:www.anthropic.com)",
64
+ "WebFetch(domain:www.datadoghq.com)",
65
+ "WebFetch(domain:www.endorlabs.com)",
66
+ "WebFetch(domain:arize.com)",
67
+ "WebFetch(domain:platform.openai.com)",
68
+ "WebFetch(domain:www.promptingguide.ai)",
69
+ "WebFetch(domain:vercel.com)",
70
+ "WebFetch(domain:www.npmjs.com)",
71
+ "Bash(done)",
72
+ "Bash(failed\" when reviewing Warden output.\n\nRefs #54\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
73
+ "Bash(git config:*)",
74
+ "Bash(dex start:*)",
75
+ "Bash(node:*)",
76
+ "WebFetch(domain:kudelskisecurity.com)",
77
+ "Bash(dex edit:*)",
78
+ "Bash(gh pr create:*)",
79
+ "Bash(convert:*)",
80
+ "Bash(git -C /home/dcramer/src/warden log --oneline -5)",
81
+ "Bash(git -C /home/dcramer/src/warden add:*)",
82
+ "Bash(git -C /home/dcramer/src/warden commit -m \"$\\(cat <<''EOF''\nchore: Update branding with new warden icons\n\nReplace old icon with new purple and black/white variants. Update\nREADME and docs header to use purple icon, set bw icon as favicon.\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
83
+ "WebFetch(domain:dex.sentry.dev)",
84
+ "WebFetch(domain:dex.rip)",
85
+ "Bash(npm version --help:*)"
86
+ ]
87
+ }
88
+ }
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: agent-prompt
3
+ description: Reference guide for writing effective agent prompts and skills. Use when creating new skills, reviewing prompt quality, or understanding Warden's prompt architecture.
4
+ allowed-tools: Read Grep Glob
5
+ ---
6
+
7
+ You are a prompt engineering specialist helping users write effective agent prompts and Warden skills.
8
+
9
+ ## Reference Documents
10
+
11
+ The following documents contain detailed guidance. Read the relevant ones based on the user's question:
12
+
13
+ | Document | Use When |
14
+ |----------|----------|
15
+ | `references/core-principles.md` | Writing any prompt - foundational rules |
16
+ | `references/skill-structure.md` | Creating or reviewing skill files |
17
+ | `references/system-prompts.md` | Understanding Warden's prompt architecture |
18
+ | `references/output-formats.md` | Designing structured JSON output |
19
+ | `references/agentic-patterns.md` | Building tool-using agents |
20
+ | `references/anti-patterns.md` | Reviewing prompts for common mistakes |
21
+ | `references/model-guidance.md` | Optimizing for Claude 4.x models |
22
+ | `references/context-design.md` | Research on passive vs active context delivery |
23
+
24
+ ## Quick Reference
25
+
26
+ **Skill file location**: `skills/{name}/SKILL.md` or `.warden/skills/{name}/SKILL.md`
27
+
28
+ **Minimum skill structure**:
29
+ ```markdown
30
+ ---
31
+ name: skill-name
32
+ description: One-line description for discovery.
33
+ allowed-tools: Read Grep Glob
34
+ ---
35
+
36
+ [Role statement]
37
+
38
+ ## Your Task
39
+
40
+ [What to analyze and criteria to apply]
41
+
42
+ ## Severity Levels
43
+
44
+ [Definitions tied to impact]
45
+ ```
46
+
47
+ ## Your Task
48
+
49
+ When helping with prompts:
50
+
51
+ 1. Read relevant reference documents before answering
52
+ 2. Provide specific, actionable guidance
53
+ 3. Show examples from existing Warden skills when helpful
54
+ 4. Cite sources (Anthropic docs, etc.) for best practices