You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/skills/react-query-best-practices/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ Read these before analyzing:
31
31
32
32
### Query hooks
33
33
- Every `queryFn` must forward `signal` for request cancellation
34
-
- Every query must have an explicit `staleTime` (default 0 is almost never correct)
34
+
- Every query must have an explicit `staleTime` (default 0 is almost never correct), assigned from a named exported constant — never an inline numeric literal. A server-side prefetch hydrating the same query key must import and reuse that constant instead of restating the number
35
35
-`keepPreviousData` / `placeholderData` only on variable-key queries (where params change), never on static keys
36
36
- Use `enabled` to prevent queries from running without required params
Copy file name to clipboardExpand all lines: .claude/commands/react-query-best-practices.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ Read these before analyzing:
31
31
32
32
### Query hooks
33
33
- Every `queryFn` must forward `signal` for request cancellation
34
-
- Every query must have an explicit `staleTime` (default 0 is almost never correct)
34
+
- Every query must have an explicit `staleTime` (default 0 is almost never correct), assigned from a named exported constant — never an inline numeric literal. A server-side prefetch hydrating the same query key must import and reuse that constant instead of restating the number
35
35
-`keepPreviousData` / `placeholderData` only on variable-key queries (where params change), never on static keys
36
36
- Use `enabled` to prevent queries from running without required params
Copy file name to clipboardExpand all lines: .claude/rules/sim-queries.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Next.js rewrites **every** export of a `'use client'` module into a *client refe
34
34
So any **query-key factory, standalone `requestJson` fetcher, mapper, or constant** that a server module imports must live in a **non-`'use client'`** module:
35
35
36
36
- key factories → `hooks/queries/utils/<entity>-keys.ts` (see `folder-keys.ts`, `table-keys.ts`, `credential-keys.ts`)
37
-
- standalone fetchers/mappers → `hooks/queries/utils/fetch-*.ts` / `*-list-query.ts` (see `fetch-workflow-envelope.ts`, `fetch-credential-set.ts`)
37
+
- standalone fetchers/mappers → `hooks/queries/utils/fetch-*.ts` / `*-list-query.ts` (see `fetch-workflow-envelope.ts`, `fetch-workspace-credentials.ts`)
38
38
39
39
The `'use client'` hook module then imports these back for its hooks. **Never** define a server-imported factory/fetcher directly in a `'use client'` hooks file — it crashes SSR (this caused the tables-page crash). Enforced for prefetch/route/trigger/block files by `scripts/check-client-boundary-imports.ts` (`bun run check:client-boundary`, run in CI). Escape hatch for a genuinely browser-only path: `// client-boundary-allow: <reason>` on the line above the import.
40
40
@@ -50,14 +50,16 @@ The `'use client'` hook module then imports these back for its hooks. **Never**
50
50
## Query Hook
51
51
52
52
- Every `queryFn` must destructure and forward `signal` for request cancellation
53
-
- Every query must have an explicit `staleTime`
53
+
- Every query must have an explicit `staleTime`, assigned from a named exported constant (`ENTITY_LIST_STALE_TIME`), never an inline numeric literal. A server-side prefetch (`prefetch.ts`) hydrating the same query key must import and reuse that constant, not restate the number — this is what keeps a prefetched cache entry from going stale out of sync with the client hook that reads it
54
54
- Use `keepPreviousData` only on variable-key queries (where params change), never on static keys
55
55
- Same-origin JSON calls must go through `requestJson(contract, ...)` from `@/lib/api/client/request` against the contract in `@/lib/api/contracts/**`
`Label`'s own default styling (`font-medium text-[var(--text-primary)]
139
+
text-small`) already matches the established title treatment — do not add a
140
+
`className` overriding its size/color unless the row genuinely needs something
141
+
different.
142
+
143
+
`--text-primary`/`--text-secondary` and `--text-body`/`--text-muted` are both real,
144
+
independently-defined tokens (not interchangeable — they resolve to different
145
+
colors) and both see legitimate use across settings pages; this rule only pins
146
+
down the **row title/subtitle** shape above, not every text element on every page.
147
+
99
148
## Other shared settings primitives (do not re-roll these)
100
149
101
150
-**`SettingsEmptyState`** (`…/components/settings-empty-state`) — the canonical
@@ -154,7 +203,7 @@ changes" modal:
154
203
## Detail sub-views
155
204
156
205
A drill-down view reached from a list row (selected MCP server, workflow MCP
157
-
server, credential set, permission group, retention policy) renders through
206
+
server, permission group, retention policy) renders through
158
207
`SettingsPanel` like a list page: pass `back={{ text, icon: ArrowLeft, onSelect }}`
159
208
for the left back chip, `title` (the entity name), and the header `actions`, then
160
209
render the body. Do NOT hand-roll a shell or header bar; a tab bar renders as the
@@ -175,4 +224,5 @@ A settings page is design-system-clean when:
175
224
-[ ] Detail sub-views and entitlement/loading gates keep their own chrome (intentional).
176
225
-[ ] If it has editable state: Save/Discard go through `SaveDiscardActions`, dirty is wired via `useSettingsUnsavedGuard` (called before any early-return gate), and there is **no** hand-rolled Save button / `beforeunload` / "Unsaved changes" modal.
177
226
-[ ] No business logic, handlers, or conditional rendering changed by the migration.
227
+
-[ ] No literal `text-[Npx]` classes — named scale tokens only (see "Text-scale tokens" above).
Copy file name to clipboardExpand all lines: .cursor/commands/react-query-best-practices.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Read these before analyzing:
26
26
27
27
### Query hooks
28
28
- Every `queryFn` must forward `signal` for request cancellation
29
-
- Every query must have an explicit `staleTime` (default 0 is almost never correct)
29
+
- Every query must have an explicit `staleTime` (default 0 is almost never correct), assigned from a named exported constant — never an inline numeric literal. A server-side prefetch hydrating the same query key must import and reuse that constant instead of restating the number
30
30
-`keepPreviousData` / `placeholderData` only on variable-key queries (where params change), never on static keys
31
31
- Use `enabled` to prevent queries from running without required params
const data =awaitrequestJson(listEntitiesContract, {
295
297
query: { workspaceId },
@@ -303,7 +305,7 @@ export function useEntityList(workspaceId?: string) {
303
305
queryKey: entityKeys.list(workspaceId),
304
306
queryFn: ({ signal }) =>fetchEntities(workspaceIdasstring, signal),
305
307
enabled: Boolean(workspaceId),
306
-
staleTime: 60*1000,
308
+
staleTime: ENTITY_LIST_STALE_TIME,
307
309
placeholderData: keepPreviousData,
308
310
})
309
311
}
@@ -326,7 +328,7 @@ export const entityKeys = {
326
328
### Query Hooks
327
329
328
330
- Every `queryFn` must forward `signal` for request cancellation
329
-
- Every query must have an explicit `staleTime`
331
+
- Every query must have an explicit `staleTime`, assigned from a named exported constant, never an inline numeric literal — a server-side prefetch hydrating the same query key must import and reuse that constant so the two never drift out of sync
330
332
- Use `keepPreviousData` only on variable-key queries (where params change), never on static keys
331
333
332
334
```typescript
@@ -335,7 +337,7 @@ export function useEntityList(workspaceId?: string) {
335
337
queryKey: entityKeys.list(workspaceId),
336
338
queryFn: ({ signal }) =>fetchEntities(workspaceIdasstring, signal),
0 commit comments