claudify-agent 0.0.0-stage → 1.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 (48) hide show
  1. package/.claude/QUICK-REFERENCE.md +213 -0
  2. package/.claude/cost-dashboard.md +162 -0
  3. package/.claude/docs/COST-OPTIMIZATION.md +403 -0
  4. package/.claude/docs/MCP-INTEGRATION-GUIDE.md +348 -0
  5. package/.claude/docs/PLAN-MODE-OPTIMIZATION.md +836 -0
  6. package/.claude/hooks/auto-learning-review.ts +195 -0
  7. package/.claude/hooks/auto-lint-fix.ts +104 -0
  8. package/.claude/hooks/auto-security-review.ts +354 -0
  9. package/.claude/hooks/auto-validate.ts +348 -0
  10. package/.claude/hooks/plan-quality-tracker.ts +719 -0
  11. package/.claude/rules/anti-patterns.md +22 -0
  12. package/.claude/rules/context-tier-1.md +41 -0
  13. package/.claude/rules/context-tier-2.md +285 -0
  14. package/.claude/rules/general.md +25 -0
  15. package/.claude/rules/mcp-auto-use.md +46 -0
  16. package/.claude/rules/parallel-exploration-auto.md +31 -0
  17. package/.claude/rules/plan-mode-execution.md +289 -0
  18. package/.claude/rules/plan-mode-research.md +34 -0
  19. package/.claude/rules/plan-mode-structure.md +166 -0
  20. package/.claude/rules/plan-mode-validation.md +130 -0
  21. package/.claude/rules/security-critical.md +19 -0
  22. package/.claude/rules/tool-auto-selection.md +45 -0
  23. package/.claude/rules/tool-strategy.md +22 -0
  24. package/.claude/scripts/auto-validate.js +69 -0
  25. package/.claude/scripts/security-scan.js +45 -0
  26. package/.claude/security-dashboard.md +142 -0
  27. package/.claude/skills/backend-concurrency/SKILL.md +203 -0
  28. package/.claude/skills/debug-optimizer/SKILL.md +399 -0
  29. package/.claude/skills/debug-optimizer.md +12 -0
  30. package/.claude/skills/golang-guide/SKILL.md +177 -0
  31. package/.claude/skills/learning-loop/SKILL.md +308 -0
  32. package/.claude/skills/mcp-mastery/SKILL.md +214 -0
  33. package/.claude/skills/nestjs-guide/SKILL.md +197 -0
  34. package/.claude/skills/nextjs-guide/SKILL.md +687 -0
  35. package/.claude/skills/nextjs.md +13 -0
  36. package/.claude/skills/parallel-exploration/SKILL.md +193 -0
  37. package/.claude/skills/plan-mode-mastery/SKILL.md +263 -0
  38. package/.claude/skills/python-guide/SKILL.md +822 -0
  39. package/.claude/skills/react-guide/SKILL.md +762 -0
  40. package/.claude/skills/react.md +12 -0
  41. package/.claude/skills/security.md +18 -0
  42. package/.claude/skills/solidity-guide/SKILL.md +32 -0
  43. package/.claude/skills/tool-selection/SKILL.md +428 -0
  44. package/.claude/skills/vite-guide/SKILL.md +445 -0
  45. package/CLAUDE.md +49 -0
  46. package/README.md +65 -2
  47. package/bin/cli.js +50 -0
  48. package/package.json +44 -4
@@ -0,0 +1,22 @@
1
+ # Anti-Pattern Detection
2
+
3
+ ## Triggers
4
+ Detected automatically by learning-loop skill from plan-metrics.json
5
+
6
+ ## Common Anti-Patterns
7
+ - Over-engineering (using expensive tools unnecessarily)
8
+ - Planning without research (no SemanticSearch)
9
+ - Repeated failures (low accuracy x3)
10
+ - MCP overuse (>3 MCPs with low accuracy)
11
+ - Skipping validation (no ReadLints/tests)
12
+
13
+ ## Actions
14
+ 1. Review `.cursor/plan-metrics.json` for patterns
15
+ 2. Run `/learning-loop-analyze` for detailed report
16
+ 3. Update rules only for repeated patterns (3+ occurrences)
17
+
18
+ ## Prevention
19
+ - Follow tool escalation protocol (Tier 1 → Tier 4)
20
+ - Always research before planning
21
+ - Auto-validate after changes
22
+ - Keep rules minimal (<20 lines)
@@ -0,0 +1,41 @@
1
+ # Context Tier 1 (Always Loaded)
2
+
3
+ ## Minimal Essential Context
4
+
5
+ **Purpose**: Always-loaded context (5-10 lines) providing critical constraints only.
6
+
7
+ ---
8
+
9
+ ## Critical Constraints
10
+
11
+ ```
12
+ - Use ES modules (import/export), not CommonJS
13
+ - TypeScript strict mode, no `any` types
14
+ - All user input validated with Zod schemas
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Essential Commands
20
+
21
+ ```bash
22
+ npm run lint # After substantive changes
23
+ npm run test # Prefer single test files
24
+ npm run typecheck # After TypeScript changes
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Canonical Examples
30
+
31
+ ```
32
+ Component pattern: @components/Button.tsx
33
+ API route pattern: @app/api/users/route.ts
34
+ Test pattern: @__tests__/auth.test.ts
35
+ ```
36
+
37
+ ---
38
+
39
+ **Note**: This is the MINIMAL context. Task-specific context loaded from Tier 2 based on keywords and file patterns.
40
+
41
+ **Rule**: If it's not in this file, agent discovers via search tools (Grep, SemanticSearch, Task).
@@ -0,0 +1,285 @@
1
+ # Context Tier 2 (Task-Specific, Loaded On-Demand)
2
+
3
+ ## Automatic Context Loading
4
+
5
+ **Purpose**: Task-specific context loaded based on keywords, file patterns, and task type.
6
+
7
+ **Loading Mechanism**: Automatic based on triggers below.
8
+
9
+ ---
10
+
11
+ ## Testing Context
12
+
13
+ **Triggers**:
14
+ - Keywords: "test", "spec", "testing", "__tests__", "vitest", "jest"
15
+ - File patterns: `**/__tests__/**`, `**/*.test.ts`, `**/*.spec.ts`
16
+ - Commands: `/test`, `/tdd`
17
+
18
+ **Loaded Context**:
19
+ ```
20
+ ## Testing Requirements
21
+ - Use Vitest for unit tests, Playwright for E2E
22
+ - Place tests in __tests__/ directory
23
+ - Name test files: [feature].test.ts
24
+ - Follow AAA pattern: Arrange, Act, Assert
25
+ - Minimum 80% coverage for new code
26
+ - Mock external APIs with MSW
27
+ - Include error boundary tests
28
+
29
+ ## Test Commands
30
+ npm run test # Full suite
31
+ npm run test:unit # Unit tests only
32
+ npm run test:coverage # With coverage report
33
+ npm run test -- path/to # Specific file
34
+
35
+ ## Test Examples
36
+ - Unit test: @__tests__/auth.test.ts
37
+ - Integration: @__tests__/api/users.test.ts
38
+ - E2E: @e2e/checkout.spec.ts
39
+ ```
40
+
41
+ ---
42
+
43
+ ## API Development Context
44
+
45
+ **Triggers**:
46
+ - Keywords: "API", "endpoint", "route", "REST", "GraphQL"
47
+ - File patterns: `**/app/api/**`, `**/routes/**`, `**/controllers/**`
48
+ - Commands: `/api`, `/endpoint`
49
+
50
+ **Loaded Context**:
51
+ ```
52
+ ## API Structure
53
+ - All routes in app/api/[resource]/route.ts
54
+ - Use Next.js App Router conventions
55
+ - Export GET, POST, PUT, DELETE handlers
56
+
57
+ ## Authentication
58
+ - Validate JWT with @src/auth/validateToken.ts
59
+ - Extract user from token claims
60
+ - Return 401 for unauthorized, 403 for forbidden
61
+
62
+ ## Validation
63
+ - Use Zod schemas for all input validation
64
+ - Return 400 with error details for invalid input
65
+ - Sanitize input before database queries
66
+
67
+ ## Error Handling
68
+ ```typescript
69
+ try {
70
+ // business logic
71
+ } catch (error) {
72
+ logger.error('API error', { error, userId });
73
+ return NextResponse.json(
74
+ { error: 'Internal server error' },
75
+ { status: 500 }
76
+ );
77
+ }
78
+ ```
79
+
80
+ ## API Examples
81
+ - REST pattern: @app/api/users/route.ts
82
+ - Error handling: @app/api/orders/route.ts
83
+ - Validation: @src/validators/orderSchema.ts
84
+ ```
85
+
86
+ ---
87
+
88
+ ## UI/Styling Context
89
+
90
+ **Triggers**:
91
+ - Keywords: "UI", "component", "styling", "CSS", "Tailwind", "frontend"
92
+ - File patterns: `**/components/**`, `**/app/**`, `**/pages/**`, `*.tsx`, `*.css`
93
+ - Commands: `/component`, `/ui`
94
+
95
+ **Loaded Context**:
96
+ ```
97
+ ## CSS Framework
98
+ - Use Tailwind CSS for all styling
99
+ - Follow utility-first approach
100
+ - Use clsx for conditional classes
101
+
102
+ ## Component Structure
103
+ ```tsx
104
+ interface Props {
105
+ variant?: 'primary' | 'secondary';
106
+ children: React.ReactNode;
107
+ }
108
+
109
+ export function Button({ variant = 'primary', children }: Props) {
110
+ return (
111
+ <button className={clsx(
112
+ 'px-4 py-2 rounded font-medium',
113
+ variant === 'primary' ? 'bg-blue-600 text-white' : 'bg-gray-200'
114
+ )}>
115
+ {children}
116
+ </button>
117
+ );
118
+ }
119
+ ```
120
+
121
+ ## Responsive Design
122
+ - Mobile-first approach
123
+ - Use md:, lg:, xl: breakpoints
124
+ - Test on multiple screen sizes
125
+
126
+ ## UI Examples
127
+ - Button: @components/Button.tsx
128
+ - Form: @components/forms/TextInput.tsx
129
+ - Layout: @components/Layout.tsx
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Performance Context
135
+
136
+ **Triggers**:
137
+ - Keywords: "performance", "optimize", "slow", "fast", "lighthouse", "audit"
138
+ - Commands: `/optimize`, `/performance`, `/audit`
139
+
140
+ **Loaded Context**:
141
+ ```
142
+ ## Performance Optimization
143
+ - Profile BEFORE optimizing (cursor-ide-browser or user-chrome-devtools)
144
+ - Use React.memo for expensive components
145
+ - Implement code splitting for large bundles
146
+ - Lazy load non-critical components
147
+ - Cache API responses with React Query or SWR
148
+
149
+ ## Performance Metrics
150
+ - First Contentful Paint: <1.5s
151
+ - Time to Interactive: <3.5s
152
+ - Lighthouse Performance: >90
153
+
154
+ ## Performance Examples
155
+ - Memoization: @components/ExpensiveList.tsx
156
+ - Code splitting: @app/dashboard/page.tsx
157
+ - Caching: @lib/react-query.ts
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Database Context
163
+
164
+ **Triggers**:
165
+ - Keywords: "database", "DB", "Prisma", "Drizzle", "migration", "schema", "query"
166
+ - File patterns: `**/prisma/**`, `**/models/**`, `**/db/**`, `*.prisma`
167
+ - Commands: `/db`, `/migration`, `/schema`
168
+
169
+ **Loaded Context**:
170
+ ```
171
+ ## Database ORM
172
+ - Use Prisma ORM for database operations
173
+ - Schema in prisma/schema.prisma
174
+ - Migrations required for schema changes
175
+
176
+ ## Query Patterns
177
+ - Use transactions for multi-step operations
178
+ - Include related data with include/select
179
+ - Index frequently queried fields
180
+
181
+ ## Database Examples
182
+ - Schema: @prisma/schema.prisma
183
+ - Query pattern: @src/db/queries/users.ts
184
+ - Migration: @prisma/migrations/[latest]
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Security Context
190
+
191
+ **Triggers**:
192
+ - Keywords: "security", "auth", "authentication", "authorization", "encrypt", "hash"
193
+ - File patterns: `**/auth/**`, `**/security/**`, `**/middleware/**`
194
+ - Commands: `/security`, `/auth`, `/review-security`
195
+
196
+ **Loaded Context**:
197
+ ```
198
+ ## Authentication
199
+ - JWT tokens with 15min expiration
200
+ - Refresh tokens with 7day expiration
201
+ - Store tokens in httpOnly cookies
202
+ - Validate tokens on all protected routes
203
+
204
+ ## Password Security
205
+ - Hash passwords with bcrypt (cost: 12)
206
+ - Minimum 8 characters, mixed case, numbers
207
+ - Rate limit login attempts (5 per minute)
208
+
209
+ ## Input Security
210
+ - Sanitize all user input
211
+ - Use parameterized queries (no SQL injection)
212
+ - Escape output to prevent XSS
213
+
214
+ ## Security Examples
215
+ - Auth middleware: @src/middleware/auth.ts
216
+ - Password hashing: @src/lib/password.ts
217
+ - Input validation: @src/validators/userSchema.ts
218
+ ```
219
+
220
+ ---
221
+
222
+ ## Deployment Context
223
+
224
+ **Triggers**:
225
+ - Keywords: "deploy", "production", "staging", "CI/CD", "build"
226
+ - Commands: `/deploy`, `/build`, `/ci`
227
+
228
+ **Loaded Context**:
229
+ ```
230
+ ## Build Process
231
+ - npm run build before deploying
232
+ - Check build output for errors
233
+ - Verify environment variables
234
+
235
+ ## Deployment Pipeline
236
+ - Run tests in CI
237
+ - Run linter in CI
238
+ - Run typecheck in CI
239
+ - Deploy to staging first
240
+ - Manual approval for production
241
+
242
+ ## Deployment Examples
243
+ - CI config: @.github/workflows/ci.yml
244
+ - Build script: @scripts/build.ts
245
+ - Deploy: @scripts/deploy.ts
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Automatic Context Pruning
251
+
252
+ **Rule**: To avoid over-specification (per ETH Zurich research):
253
+
254
+ ```
255
+ 1. Load ONLY relevant Tier 2 context based on triggers
256
+ 2. DO NOT load multiple Tier 2 contexts unless task spans multiple areas
257
+ 3. If task spans multiple areas, load summaries only
258
+ 4. Agent discovers details via search tools (Grep, SemanticSearch)
259
+ ```
260
+
261
+ **Example**:
262
+ ```
263
+ Task: "Add API endpoint" → Load API context only
264
+ Task: "Add UI component" → Load UI context only
265
+ Task: "Add authenticated API" → Load API + Security context (summaries)
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Context Loading Decision Tree
271
+
272
+ ```
273
+ Task involves testing? → Load Testing context
274
+ Task involves API? → Load API context
275
+ Task involves UI/components? → Load UI/Styling context
276
+ Task involves performance? → Load Performance context
277
+ Task involves database? → Load Database context
278
+ Task involves auth/security? → Load Security context
279
+ Task involves deployment? → Load Deployment context
280
+ Multiple areas? → Load summaries of each, agent discovers details
281
+ ```
282
+
283
+ ---
284
+
285
+ **Note**: These contexts load automatically based on task analysis. No manual intervention needed.
@@ -0,0 +1,25 @@
1
+ # General Rules
2
+
3
+ ## Essential Commands
4
+ - `npm run lint`: After substantive changes
5
+ - `npm run test`: Prefer single test files
6
+ - `npm run typecheck`: After TypeScript changes
7
+
8
+ ## Critical Constraints
9
+ - Use ES modules (import/export)
10
+ - TypeScript strict mode, no `any`
11
+ - All user input validated with Zod
12
+ - Security: Never hardcode credentials (use env vars)
13
+
14
+ ## Canonical Examples
15
+ - Component: `@components/Button.tsx`
16
+ - API route: `@app/api/users/route.ts`
17
+ - Test: `@__tests__/auth.test.ts`
18
+
19
+ ## Pre-Commit Checklist
20
+ - [ ] Security review passed (auto-run)
21
+ - [ ] Lint clean (auto-fixed)
22
+ - [ ] Tests passing (auto-run)
23
+ - [ ] Cost within budget (check `.cursor/cost-dashboard.md`)
24
+
25
+ **Note**: See @.cursor/rules/ for task-specific rules. Anti-patterns: @.cursor/rules/anti-patterns.md
@@ -0,0 +1,46 @@
1
+ # MCP Server Auto-Use
2
+
3
+ ## Automatic Triggers
4
+
5
+ ### user-context7 (Library/Framework Questions)
6
+ **Trigger Keywords**: "how to", "implement", "best practice", "pattern", "library", "framework", "package"
7
+
8
+ **Auto-Fetch Examples**:
9
+ - User: "Add authentication" → Fetch: "Next.js auth patterns 2026"
10
+ - User: "Create API endpoint" → Fetch: "REST API best practices"
11
+ - User: "Use WebSocket" → Fetch: "WebSocket implementation guide"
12
+
13
+ **Rule**: **ALWAYS** fetch docs BEFORE implementing unfamiliar patterns
14
+
15
+ ### Other MCP Servers
16
+
17
+ | MCP Server | When to Use | Cost |
18
+ |------------|-------------|------|
19
+ | cursor-ide-browser | UI changes, visual verification | High |
20
+ | user-github | PR/issue operations, git commands | Moderate |
21
+ | user-ESLint | After EVERY code change (automatic) | Low |
22
+ | user-chrome-devtools | Performance audits, Lighthouse | Moderate |
23
+ | user-playwright | E2E testing, cross-browser | High |
24
+
25
+ ## Cost Hierarchy
26
+
27
+ **Tier 1 (Use Liberally)**: user-ESLint, user-context7
28
+ **Tier 2 (Use When Needed)**: user-github, user-chrome-devtools
29
+ **Tier 3 (Use Sparingly)**: cursor-ide-browser, user-playwright
30
+
31
+ ## Rules
32
+
33
+ 1. Always try cheaper tools first (follow escalation protocol)
34
+ 2. Run user-ESLint automatically after code changes
35
+ 3. Fetch docs with user-context7 BEFORE implementing
36
+ 4. Use cursor-ide-browser ONLY for visual verification
37
+ 5. Use user-github for all GitHub operations
38
+
39
+ ## Patterns & Examples
40
+ See `.cursor/docs/MCP-INTEGRATION-GUIDE.md` for complete patterns, chaining examples, and cost optimization strategies.
41
+
42
+ ## Fallback
43
+ - Browser unavailable → Use built-in Browser tools
44
+ - GitHub unavailable → Use Shell with gh CLI
45
+ - ESLint unavailable → Use Shell with npm run lint
46
+ - Context7 unavailable → Use WebSearch
@@ -0,0 +1,31 @@
1
+ # Parallel Exploration Auto
2
+
3
+ ## Automatic Triggers
4
+
5
+ **Launch 2-4 parallel subagents when**:
6
+ - Task spans >3 areas/directories
7
+ - Complexity >10 steps or >5 files
8
+ - Bug investigation (unknown root cause)
9
+ - Agent unfamiliarity detected (>3 questions)
10
+
11
+ ## Configuration
12
+
13
+ ```yaml
14
+ Task:
15
+ subagent_type: "explore"
16
+ model: "fast" # ALWAYS for exploration
17
+ readonly: true
18
+ run_in_background: true
19
+ timeout: 120s
20
+ ```
21
+
22
+ ## Rules
23
+
24
+ 1. Default to 2-3 subagents, scale to 4 for complex tasks
25
+ 2. ALWAYS use `model="fast"` (90% of cases)
26
+ 3. Consolidate findings before planning
27
+ 4. See `.cursor/skills/parallel-exploration/SKILL.md` for patterns
28
+
29
+ ## Anti-Patterns
30
+
31
+ ❌ >4 subagents, ❌ capable model for exploration, ❌ no consolidation