@karedo-hq/agents 0.1.1 → 0.1.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karedo-hq/agents",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Centralized agent skills, rules, and commands for our engineering team",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,8 @@
1
1
  ---
2
- description: How to create data-fetching functions and server actions on the frontend.
2
+ description: How to handle frontend data-fetching and actions.
3
3
  alwaysApply: false
4
4
  ---
5
+
5
6
  # API Layer Patterns
6
7
 
7
8
  ## File Organization
@@ -56,11 +57,42 @@ headers: {
56
57
 
57
58
  ---
58
59
 
59
- ## Client-Side Fetching
60
+ ## Data Fetching Strategy
61
+
62
+ **Rule:** Server-first for page-level data; React Query hooks for nested interactive data.
63
+
64
+ ### Server-Side (Default)
65
+
66
+ - Pages, tables, list views → fetch in RSC with URL-based pagination
67
+ - Keeps payloads explicit and server rendering deterministic
68
+ - Use `preparePaginationParams(dto)` for query string construction
69
+
70
+ ### Client-Side (Nested Interactive Components)
71
+
72
+ - Comboboxes, dialogs, embedded forms/pickers → don't prop-drill giant lists
73
+ - Create `useX` / `useInfiniteX` hooks in feature's `lib/hooks/`
74
+ - Wrap `useQuery` / `useInfiniteQuery` from `@tanstack/react-query`
75
+ - Handle pagination client-side (infinite scroll, search-as-you-type)
76
+ - Use debounced search for text input filtering
77
+ - Never use `useEffect(() => fetch().then(), [])` pattern
78
+
79
+ ### Anti-Pattern: MAX_QUERY_LIMIT
80
+
81
+ Do NOT use `limit: MAX_QUERY_LIMIT` to feed dropdowns/comboboxes with "all" data.
82
+
83
+ **Problems:**
84
+
85
+ - Huge payloads for data the UI only partially needs
86
+ - More memory + CPU on both backend and browser
87
+ - Slower server renders / bigger RSC waterfalls
88
+ - Worse UX for forms/dialogs that block on heavy lists
89
+
90
+ **Signal to refactor:** If you see `MAX_QUERY_LIMIT` in a query feeding a nested UI selector, convert it to a React Query hook with pagination.
91
+
92
+ **Examples:**
60
93
 
61
- - Use react-query for automatic request deduplication on client components.
62
- - Never use `useEffect(() => fetch().then(), [])` pattern.
63
- - Create query hooks when server props are impractical for nested client components.
94
+ - `app/dashboard/contacts/lib/hooks/use-organization-contacts.ts` hook pattern with `useInfiniteQuery`
95
+ - `app/dashboard/clients/components/update-client-health-insurance-form.tsx` combobox consuming the hook with infinite scroll
64
96
 
65
97
  ---
66
98