@karedo-hq/agents 0.1.1 → 0.1.3

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.
@@ -0,0 +1,66 @@
1
+ # Publish to Agents
2
+
3
+ Publishes the `@karedo/agents` package after adding new rules or commands.
4
+
5
+ ## Instructions
6
+
7
+ Follow these steps in order:
8
+
9
+ ### 1. Verify Changes
10
+
11
+ Check what files have been added or modified in `packages/agents/`:
12
+
13
+ ```bash
14
+ git status packages/agents/
15
+ ```
16
+
17
+ Confirm the changes include new rules (`.mdc` files in `rules/`) or commands (`.md` files in `commands/`).
18
+
19
+ ### 2. Bump Version
20
+
21
+ Update the version in `packages/agents/package.json`:
22
+
23
+ ```json
24
+ "version": "X.X.X"
25
+ ```
26
+
27
+ Use semantic versioning:
28
+
29
+ - **Patch (X.X.1)**: Minor rule updates, typo fixes
30
+ - **Minor (X.1.0)**: New rules or commands
31
+ - **Major (1.0.0)**: Breaking changes to rule structure
32
+
33
+ ### 3. Commit and Push
34
+
35
+ ```bash
36
+ git add packages/agents/ && git commit -m "chore(agents): bump to vX.X.X
37
+
38
+ - Brief description of changes" && git push
39
+ ```
40
+
41
+ ### 4. Publish to npm
42
+
43
+ From the `packages/agents` directory:
44
+
45
+ ```bash
46
+ pnpm publish --access public
47
+ ```
48
+
49
+ **Note**: You must be logged in to npm with publish access to `@karedo` scope.
50
+
51
+ ### 5. Verify Publication
52
+
53
+ ```bash
54
+ npm view @karedo/agents version
55
+ ```
56
+
57
+ Confirm the version matches what you just published.
58
+
59
+ ## Example Output
60
+
61
+ ```
62
+ ✅ Changes verified in packages/agents/
63
+ ✅ Version bumped to X.X.X
64
+ ✅ Committed and pushed to remote
65
+ ✅ Published @karedo/agents@X.X.X to npm
66
+ ```
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.3",
4
4
  "description": "Centralized agent skills, rules, and commands for our engineering team",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2,6 +2,7 @@
2
2
  description: General NestJS guidelines for our backend development.
3
3
  alwaysApply: false
4
4
  ---
5
+
5
6
  # NestJS Guidelines
6
7
 
7
8
  ## Module Organization
@@ -34,3 +35,19 @@ alwaysApply: false
34
35
  - Throw NestJS built-in exceptions (`NotFoundException`, `BadRequestException`, etc.)
35
36
  - Create custom exceptions extending `HttpException` when needed
36
37
  - Use exception filters for consistent error responses
38
+
39
+ ## Logging
40
+
41
+ - Use `new Logger(ClassName.name)` for service-scoped loggers
42
+ - **Always pass stack trace** as second argument to `logger.error()`:
43
+ ```ts
44
+ this.logger.error(`Failed to process: ${error.message}`, error.stack);
45
+ ```
46
+ - **Include metadata in the message** via `JSON.stringify` (ConsoleLogger ignores object params):
47
+ ```ts
48
+ this.logger.error(
49
+ `Operation failed: ${error.message} ${JSON.stringify({ userId, context })}`,
50
+ error.stack
51
+ );
52
+ ```
53
+ - Never log sensitive data (passwords, tokens, secrets)
@@ -7,6 +7,7 @@ alwaysApply: true
7
7
  ## TypeScript Guidelines
8
8
 
9
9
  ### Types
10
+
10
11
  - Declare types for all variables, function params, and return values
11
12
  - Don't cast to `any` to get around type issues. Use `unknown` with type guards
12
13
  - Prefer `type` over `interface`.
@@ -14,19 +15,22 @@ alwaysApply: true
14
15
  - Use `readonly` and `as const` for immutable data
15
16
 
16
17
  ### Exports & Imports
18
+
17
19
  - One primary named export per file. Avoid `export default`
18
20
  - Use `export type { ... }` and `import type { ... }` for types
19
21
 
20
22
  ### Naming
23
+
21
24
  - **PascalCase:** Classes, types, components
22
25
  - **camelCase:** Variables, functions, methods
23
26
  - **kebab-case:** Files and directories
24
27
  - **UPPERCASE:** Environment variables, constants
25
28
  - Functions: verb prefix (`findUser`, `isValid`, `handleClick`)
26
29
  - Booleans: `is`, `has`, `can` prefix
27
- - Use complete, descriptive names for variables. Avoid things like (c => c._id). Exceptions: err, ctx, req, res, next
30
+ - Use complete, descriptive names for variables. Avoid things like (c => c.\_id). Exceptions: err, ctx, req, res, next
28
31
 
29
32
  ### Functions
33
+
30
34
  - Single purpose, short functions
31
35
  - Early returns to avoid nesting
32
36
  - Use `function` to define them. Arrow functions only for functions inside functions.
@@ -35,26 +39,55 @@ alwaysApply: true
35
39
  - Maintain single level of abstraction
36
40
 
37
41
  ### Async
42
+
38
43
  - `async/await` over `.then()`
39
44
  - `Promise.all`/`Promise.allSettled` for concurrent operations
40
45
  - Move `await` into branches where actually needed
41
46
 
42
47
  ### Caching
48
+
43
49
  - Build `Map`/`Set` for repeated O(1) lookups
44
50
  - Cache object properties in loops (`const len = arr.length`)
45
51
  - Cache function results at module level for expensive computations
46
52
  - Check array length before expensive comparisons
47
53
 
48
54
  ### Errors
55
+
49
56
  - Use exceptions for unexpected errors
50
57
  - Catch only to: fix, add context, or re-throw
51
58
 
52
59
  ### Testing
60
+
53
61
  - Arrange-Act-Assert pattern
54
62
  - Clear naming: `inputX`, `mockX`, `actualX`, `expectedX`
55
63
  - Mock external dependencies
56
64
 
57
65
  ### Comments
66
+
58
67
  - DO NOT ADD VERBOSE STEP-BY-STEP COMMENTS
59
68
  - Only comment genuinely non-obvious logic when strictly necessary
60
- - Comments should explain *why*, not *what*
69
+ - Comments should explain _why_, not _what_
70
+
71
+ ### Framework-Specific Rules
72
+
73
+ **IMPORTANT:** Before implementing, read the applicable rules from the table below. Only read rules that match your task.
74
+
75
+ **Backend tasks (`apps/api/`)** — Read from `/rules/api/`:
76
+ | Rule | When to read |
77
+ |------|--------------|
78
+ | `nestjs.mdc` | Always for any backend work |
79
+ | `controllers.mdc` | Creating/modifying API endpoints |
80
+ | `services.mdc` | Creating/modifying services |
81
+ | `dtos.mdc` | Creating/modifying request/response DTOs |
82
+ | `mongodb-schemas.mdc` | Creating/modifying database schemas |
83
+ | `tiptap-templates.mdc` | Working with Tiptap document templates |
84
+ | `mail-from-template.mdc` | Implementing email sending |
85
+
86
+ **Frontend tasks (`apps/web/`)** — Read from `/rules/web/`:
87
+ | Rule | When to read |
88
+ |------|--------------|
89
+ | `nextjs.mdc` | Always for any frontend work |
90
+ | `pages.mdc` | Creating new pages |
91
+ | `tables.mdc` | Implementing data tables |
92
+ | `data-fetching-and-server-actions.mdc` | Data fetching or server actions |
93
+ | `responsive-dialog-drawer.mdc` | Dialog/drawer components |
@@ -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