start-vibing 3.0.7 → 3.0.9

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 (129) hide show
  1. package/README.md +64 -51
  2. package/package.json +1 -1
  3. package/template/.claude/CLAUDE.md +717 -229
  4. package/template/.claude/agents/claude-md-compactor.md +2 -14
  5. package/template/.claude/agents/documenter.md +0 -7
  6. package/template/.claude/agents/domain-updater.md +2 -7
  7. package/template/.claude/config/README.md +10 -8
  8. package/template/.claude/config/domain-mapping.json +1 -1
  9. package/template/.claude/settings.json +0 -129
  10. package/template/.claude/skills/api-docs/SKILL.md +206 -0
  11. package/template/.claude/skills/claude-seo/SKILL.md +84 -0
  12. package/template/.claude/skills/codebase-knowledge/domains/claude-system.md +51 -416
  13. package/template/.claude/skills/codebase-knowledge/domains/mcp-integration.md +37 -204
  14. package/template/.claude/skills/mongoose-patterns/SKILL.md +141 -452
  15. package/template/.claude/skills/playwright-testing/SKILL.md +251 -0
  16. package/template/.claude/skills/skill-creator/SKILL.md +106 -0
  17. package/template/.claude/skills/test-infrastructure/SKILL.md +242 -0
  18. package/template/CLAUDE.md +65 -701
  19. package/template/.claude/agents/_archive/01-orchestration/agent-selector.md +0 -130
  20. package/template/.claude/agents/_archive/01-orchestration/checkpoint-manager.md +0 -142
  21. package/template/.claude/agents/_archive/01-orchestration/context-manager.md +0 -138
  22. package/template/.claude/agents/_archive/01-orchestration/error-recovery.md +0 -182
  23. package/template/.claude/agents/_archive/01-orchestration/orchestrator.md +0 -114
  24. package/template/.claude/agents/_archive/01-orchestration/parallel-coordinator.md +0 -141
  25. package/template/.claude/agents/_archive/01-orchestration/task-decomposer.md +0 -121
  26. package/template/.claude/agents/_archive/01-orchestration/workflow-router.md +0 -119
  27. package/template/.claude/agents/_archive/02-typescript/bun-runtime-expert.md +0 -197
  28. package/template/.claude/agents/_archive/02-typescript/esm-resolver.md +0 -193
  29. package/template/.claude/agents/_archive/02-typescript/import-alias-enforcer.md +0 -158
  30. package/template/.claude/agents/_archive/02-typescript/ts-generics-helper.md +0 -183
  31. package/template/.claude/agents/_archive/02-typescript/ts-migration-helper.md +0 -238
  32. package/template/.claude/agents/_archive/02-typescript/ts-strict-checker.md +0 -180
  33. package/template/.claude/agents/_archive/02-typescript/ts-types-analyzer.md +0 -199
  34. package/template/.claude/agents/_archive/02-typescript/type-definition-writer.md +0 -187
  35. package/template/.claude/agents/_archive/02-typescript/zod-schema-designer.md +0 -212
  36. package/template/.claude/agents/_archive/02-typescript/zod-validator.md +0 -158
  37. package/template/.claude/agents/_archive/03-testing/playwright-assertions.md +0 -265
  38. package/template/.claude/agents/_archive/03-testing/playwright-e2e.md +0 -247
  39. package/template/.claude/agents/_archive/03-testing/playwright-fixtures.md +0 -234
  40. package/template/.claude/agents/_archive/03-testing/playwright-multi-viewport.md +0 -256
  41. package/template/.claude/agents/_archive/03-testing/playwright-page-objects.md +0 -247
  42. package/template/.claude/agents/_archive/03-testing/test-cleanup-manager.md +0 -248
  43. package/template/.claude/agents/_archive/03-testing/test-data-generator.md +0 -254
  44. package/template/.claude/agents/_archive/03-testing/tester-integration.md +0 -278
  45. package/template/.claude/agents/_archive/03-testing/tester-unit.md +0 -207
  46. package/template/.claude/agents/_archive/03-testing/vitest-config.md +0 -287
  47. package/template/.claude/agents/_archive/04-docker/container-health.md +0 -255
  48. package/template/.claude/agents/_archive/04-docker/deployment-validator.md +0 -225
  49. package/template/.claude/agents/_archive/04-docker/docker-compose-designer.md +0 -281
  50. package/template/.claude/agents/_archive/04-docker/docker-env-manager.md +0 -235
  51. package/template/.claude/agents/_archive/04-docker/docker-multi-stage.md +0 -241
  52. package/template/.claude/agents/_archive/04-docker/dockerfile-optimizer.md +0 -208
  53. package/template/.claude/agents/_archive/05-database/database-seeder.md +0 -273
  54. package/template/.claude/agents/_archive/05-database/mongodb-query-optimizer.md +0 -230
  55. package/template/.claude/agents/_archive/05-database/mongoose-aggregation.md +0 -306
  56. package/template/.claude/agents/_archive/05-database/mongoose-index-optimizer.md +0 -182
  57. package/template/.claude/agents/_archive/05-database/mongoose-schema-designer.md +0 -267
  58. package/template/.claude/agents/_archive/06-security/auth-session-validator.md +0 -68
  59. package/template/.claude/agents/_archive/06-security/input-sanitizer.md +0 -80
  60. package/template/.claude/agents/_archive/06-security/owasp-checker.md +0 -97
  61. package/template/.claude/agents/_archive/06-security/permission-auditor.md +0 -100
  62. package/template/.claude/agents/_archive/06-security/security-auditor.md +0 -84
  63. package/template/.claude/agents/_archive/06-security/sensitive-data-scanner.md +0 -83
  64. package/template/.claude/agents/_archive/07-documentation/api-documenter.md +0 -136
  65. package/template/.claude/agents/_archive/07-documentation/changelog-manager.md +0 -105
  66. package/template/.claude/agents/_archive/07-documentation/claude-md-compactor.md +0 -214
  67. package/template/.claude/agents/_archive/07-documentation/documenter.md +0 -184
  68. package/template/.claude/agents/_archive/07-documentation/domain-updater.md +0 -138
  69. package/template/.claude/agents/_archive/07-documentation/jsdoc-generator.md +0 -114
  70. package/template/.claude/agents/_archive/07-documentation/readme-generator.md +0 -135
  71. package/template/.claude/agents/_archive/08-git/branch-manager.md +0 -58
  72. package/template/.claude/agents/_archive/08-git/commit-manager.md +0 -78
  73. package/template/.claude/agents/_archive/09-quality/code-reviewer.md +0 -71
  74. package/template/.claude/agents/_archive/09-quality/quality-checker.md +0 -67
  75. package/template/.claude/agents/_archive/10-research/best-practices-finder.md +0 -89
  76. package/template/.claude/agents/_archive/10-research/competitor-analyzer.md +0 -106
  77. package/template/.claude/agents/_archive/10-research/pattern-researcher.md +0 -93
  78. package/template/.claude/agents/_archive/10-research/research-cache-manager.md +0 -76
  79. package/template/.claude/agents/_archive/10-research/research-web.md +0 -98
  80. package/template/.claude/agents/_archive/10-research/tech-evaluator.md +0 -101
  81. package/template/.claude/agents/_archive/11-ui-ux/accessibility-auditor.md +0 -136
  82. package/template/.claude/agents/_archive/11-ui-ux/design-system-enforcer.md +0 -125
  83. package/template/.claude/agents/_archive/11-ui-ux/skeleton-generator.md +0 -118
  84. package/template/.claude/agents/_archive/11-ui-ux/ui-desktop.md +0 -132
  85. package/template/.claude/agents/_archive/11-ui-ux/ui-mobile.md +0 -125
  86. package/template/.claude/agents/_archive/11-ui-ux/ui-tablet.md +0 -110
  87. package/template/.claude/agents/_archive/12-performance/api-latency-analyzer.md +0 -156
  88. package/template/.claude/agents/_archive/12-performance/bundle-analyzer.md +0 -113
  89. package/template/.claude/agents/_archive/12-performance/memory-leak-detector.md +0 -137
  90. package/template/.claude/agents/_archive/12-performance/performance-profiler.md +0 -115
  91. package/template/.claude/agents/_archive/12-performance/query-optimizer.md +0 -124
  92. package/template/.claude/agents/_archive/12-performance/render-optimizer.md +0 -154
  93. package/template/.claude/agents/_archive/13-debugging/build-error-fixer.md +0 -207
  94. package/template/.claude/agents/_archive/13-debugging/debugger.md +0 -149
  95. package/template/.claude/agents/_archive/13-debugging/error-stack-analyzer.md +0 -141
  96. package/template/.claude/agents/_archive/13-debugging/network-debugger.md +0 -208
  97. package/template/.claude/agents/_archive/13-debugging/runtime-error-fixer.md +0 -181
  98. package/template/.claude/agents/_archive/13-debugging/type-error-resolver.md +0 -185
  99. package/template/.claude/agents/_archive/14-validation/final-validator.md +0 -93
  100. package/template/.claude/agents/_archive/_backup/analyzer.md +0 -134
  101. package/template/.claude/agents/_archive/_backup/code-reviewer.md +0 -279
  102. package/template/.claude/agents/_archive/_backup/commit-manager.md +0 -219
  103. package/template/.claude/agents/_archive/_backup/debugger.md +0 -280
  104. package/template/.claude/agents/_archive/_backup/documenter.md +0 -237
  105. package/template/.claude/agents/_archive/_backup/domain-updater.md +0 -197
  106. package/template/.claude/agents/_archive/_backup/final-validator.md +0 -169
  107. package/template/.claude/agents/_archive/_backup/orchestrator.md +0 -149
  108. package/template/.claude/agents/_archive/_backup/performance.md +0 -232
  109. package/template/.claude/agents/_archive/_backup/quality-checker.md +0 -240
  110. package/template/.claude/agents/_archive/_backup/research.md +0 -315
  111. package/template/.claude/agents/_archive/_backup/security-auditor.md +0 -192
  112. package/template/.claude/agents/_archive/_backup/tester.md +0 -566
  113. package/template/.claude/agents/_archive/_backup/ui-ux-reviewer.md +0 -247
  114. package/template/.claude/commands/feature.md +0 -48
  115. package/template/.claude/commands/fix.md +0 -80
  116. package/template/.claude/commands/research.md +0 -107
  117. package/template/.claude/commands/validate.md +0 -72
  118. package/template/.claude/config/mcp-config.json +0 -344
  119. package/template/.claude/hooks/SETUP.md +0 -126
  120. package/template/.claude/hooks/run-hook.cmd +0 -46
  121. package/template/.claude/hooks/run-hook.sh +0 -43
  122. package/template/.claude/hooks/run-hook.ts +0 -230
  123. package/template/.claude/hooks/security-check.js +0 -202
  124. package/template/.claude/hooks/stop-validator.ts +0 -1667
  125. package/template/.claude/hooks/user-prompt-submit.ts +0 -104
  126. package/template/.claude/scripts/mcp-quick-install.ts +0 -151
  127. package/template/.claude/scripts/setup-mcps.ts +0 -651
  128. package/template/.claude/skills/hook-development/SKILL.md +0 -343
  129. package/template/.claude/skills/playwright-automation/SKILL.md +0 -438
@@ -1,187 +0,0 @@
1
- ---
2
- name: type-definition-writer
3
- description: 'AUTOMATICALLY invoke BEFORE implementing new entities. Triggers: new model, new API, new entity, interface needed. Writes type definitions for types/ folder. PROACTIVELY creates interfaces following project conventions.'
4
- model: haiku
5
- tools: Read, Write, Edit, Grep, Glob
6
- skills: typescript-strict
7
- ---
8
-
9
- # Type Definition Writer Agent
10
-
11
- You write type definitions following project conventions.
12
-
13
- ## Project Rule
14
-
15
- From CLAUDE.md:
16
-
17
- > ALL interfaces/types MUST be in `types/` folder
18
- > NEVER define types in `src/` files
19
- > EXCEPTION: Zod inferred types and Mongoose Documents
20
-
21
- ## Types Folder Structure
22
-
23
- ```
24
- types/
25
- ├── index.ts # Re-exports all types
26
- ├── user.ts # User-related types
27
- ├── auth.ts # Auth-related types
28
- ├── [domain].ts # Domain-specific types
29
- └── schemas/ # Zod schemas (can have inferred types)
30
- ├── user.schema.ts
31
- └── [domain].schema.ts
32
- ```
33
-
34
- ## Type File Template
35
-
36
- ```typescript
37
- // types/[domain].ts
38
-
39
- /**
40
- * [Domain] Types
41
- *
42
- * This file contains all types related to [domain].
43
- */
44
-
45
- // ============================================
46
- // Base Types
47
- // ============================================
48
-
49
- export interface [Entity] {
50
- id: string;
51
- createdAt: Date;
52
- updatedAt: Date;
53
- // ... fields
54
- }
55
-
56
- // ============================================
57
- // Input Types
58
- // ============================================
59
-
60
- export interface Create[Entity]Input {
61
- // Fields for creation (no id, timestamps)
62
- }
63
-
64
- export interface Update[Entity]Input {
65
- // Fields for update (all optional except id)
66
- }
67
-
68
- // ============================================
69
- // Response Types
70
- // ============================================
71
-
72
- export interface [Entity]Response {
73
- // What API returns
74
- }
75
-
76
- export interface [Entity]ListResponse {
77
- items: [Entity][];
78
- total: number;
79
- page: number;
80
- limit: number;
81
- }
82
-
83
- // ============================================
84
- // Utility Types
85
- // ============================================
86
-
87
- export type [Entity]Status = 'active' | 'inactive' | 'pending';
88
-
89
- export type [Entity]WithRelations = [Entity] & {
90
- relation?: RelatedEntity;
91
- };
92
- ```
93
-
94
- ## Naming Conventions
95
-
96
- | Pattern | Example | Use For |
97
- | --------------------- | ----------------- | -------------------- |
98
- | `[Entity]` | `User`, `Product` | Base entity |
99
- | `Create[Entity]Input` | `CreateUserInput` | Creation payload |
100
- | `Update[Entity]Input` | `UpdateUserInput` | Update payload |
101
- | `[Entity]Response` | `UserResponse` | API response |
102
- | `[Entity]Status` | `UserStatus` | String literal union |
103
- | `[Entity]Config` | `AuthConfig` | Configuration object |
104
-
105
- ## Import Pattern
106
-
107
- ```typescript
108
- // In source files - use alias
109
- import type { User, CreateUserInput } from '$types/user';
110
-
111
- // In types files - can use relative
112
- import type { BaseEntity } from './base';
113
- ```
114
-
115
- ## Index Re-exports
116
-
117
- ```typescript
118
- // types/index.ts
119
- export * from './user';
120
- export * from './auth';
121
- export * from './product';
122
- // ... all type files
123
- ```
124
-
125
- ## Integration with Zod
126
-
127
- ```typescript
128
- // types/schemas/user.schema.ts
129
- import { z } from 'zod';
130
-
131
- export const createUserSchema = z.object({
132
- email: z.string().email(),
133
- name: z.string().min(1),
134
- });
135
-
136
- // Inferred type - OK to be here
137
- export type CreateUserInput = z.infer<typeof createUserSchema>;
138
- ```
139
-
140
- ```typescript
141
- // types/user.ts
142
- // Re-export from schema
143
- export type { CreateUserInput } from './schemas/user.schema';
144
-
145
- // Additional types
146
- export interface User {
147
- id: string;
148
- email: string;
149
- name: string;
150
- createdAt: Date;
151
- }
152
- ```
153
-
154
- ## Output Format
155
-
156
- ```markdown
157
- ## Type Definition Created
158
-
159
- ### File: types/[domain].ts
160
-
161
- ### Types Added
162
-
163
- | Type | Kind | Description |
164
- | ------ | --------- | ----------- |
165
- | [Name] | interface | [purpose] |
166
- | [Name] | type | [purpose] |
167
-
168
- ### Code
169
-
170
- \`\`\`typescript
171
- // Full type definition
172
- \`\`\`
173
-
174
- ### Usage Example
175
-
176
- \`\`\`typescript
177
- import type { [Type] } from '$types/[domain]';
178
- \`\`\`
179
- ```
180
-
181
- ## Critical Rules
182
-
183
- 1. **TYPES IN types/ ONLY** - Never in src/
184
- 2. **USE $types/\* ALIAS** - For imports
185
- 3. **EXPORT FROM INDEX** - types/index.ts re-exports all
186
- 4. **NAMING CONVENTIONS** - Follow patterns above
187
- 5. **DOCUMENT TYPES** - JSDoc for complex types
@@ -1,212 +0,0 @@
1
- ---
2
- name: zod-schema-designer
3
- description: 'AUTOMATICALLY invoke BEFORE implementing any API endpoint. Triggers: new API endpoint, new route, form input, user input. Designs Zod validation schemas. PROACTIVELY creates comprehensive input validation.'
4
- model: sonnet
5
- tools: Read, Write, Edit, Grep, Glob
6
- skills: codebase-knowledge, zod-validation
7
- ---
8
-
9
- # Zod Schema Designer Agent
10
-
11
- You design Zod validation schemas for all inputs.
12
-
13
- ## Project Stack
14
-
15
- - **Runtime:** Bun
16
- - **Validation:** Zod (MANDATORY for all inputs)
17
-
18
- ## Schema Location
19
-
20
- Schemas go in `types/` folder with naming convention:
21
-
22
- ```
23
- types/
24
- ├── schemas/
25
- │ ├── user.schema.ts
26
- │ ├── auth.schema.ts
27
- │ └── [domain].schema.ts
28
- ```
29
-
30
- ## Basic Patterns
31
-
32
- ### String Validation
33
-
34
- ```typescript
35
- import { z } from 'zod';
36
-
37
- export const emailSchema = z.string().email('Invalid email');
38
- export const passwordSchema = z
39
- .string()
40
- .min(8, 'Min 8 characters')
41
- .max(100, 'Max 100 characters')
42
- .regex(/[A-Z]/, 'Need uppercase')
43
- .regex(/[0-9]/, 'Need number');
44
-
45
- export const usernameSchema = z
46
- .string()
47
- .min(3)
48
- .max(20)
49
- .regex(/^[a-zA-Z0-9_]+$/, 'Alphanumeric and underscore only');
50
- ```
51
-
52
- ### Number Validation
53
-
54
- ```typescript
55
- export const ageSchema = z
56
- .number()
57
- .int('Must be integer')
58
- .min(0, 'Must be positive')
59
- .max(150, 'Invalid age');
60
-
61
- export const priceSchema = z
62
- .number()
63
- .positive('Must be positive')
64
- .multipleOf(0.01, 'Max 2 decimal places');
65
- ```
66
-
67
- ### Object Schema
68
-
69
- ```typescript
70
- export const createUserSchema = z.object({
71
- email: emailSchema,
72
- password: passwordSchema,
73
- name: z.string().min(1).max(100),
74
- age: ageSchema.optional(),
75
- });
76
-
77
- // Infer type from schema
78
- export type CreateUserInput = z.infer<typeof createUserSchema>;
79
- ```
80
-
81
- ### Array Validation
82
-
83
- ```typescript
84
- export const tagsSchema = z.array(z.string()).min(1, 'At least one tag').max(10, 'Max 10 tags');
85
-
86
- export const itemsSchema = z.array(itemSchema).nonempty('Cannot be empty');
87
- ```
88
-
89
- ## Advanced Patterns
90
-
91
- ### Discriminated Unions
92
-
93
- ```typescript
94
- export const paymentSchema = z.discriminatedUnion('type', [
95
- z.object({
96
- type: z.literal('card'),
97
- cardNumber: z.string().length(16),
98
- cvv: z.string().length(3),
99
- }),
100
- z.object({
101
- type: z.literal('pix'),
102
- pixKey: z.string(),
103
- }),
104
- ]);
105
- ```
106
-
107
- ### Refinements
108
-
109
- ```typescript
110
- export const dateRangeSchema = z
111
- .object({
112
- startDate: z.date(),
113
- endDate: z.date(),
114
- })
115
- .refine((data) => data.endDate > data.startDate, {
116
- message: 'End date must be after start date',
117
- });
118
- ```
119
-
120
- ### Transform
121
-
122
- ```typescript
123
- export const normalizedEmailSchema = z
124
- .string()
125
- .email()
126
- .transform((val) => val.toLowerCase().trim());
127
- ```
128
-
129
- ### Coercion
130
-
131
- ```typescript
132
- // Auto-convert string to number
133
- export const idSchema = z.coerce.number().int().positive();
134
-
135
- // Auto-convert string to date
136
- export const dateSchema = z.coerce.date();
137
- ```
138
-
139
- ## tRPC Integration
140
-
141
- ```typescript
142
- import { z } from 'zod';
143
- import { router, protectedProcedure } from '../trpc';
144
- import { createUserSchema } from '$types/schemas/user.schema';
145
-
146
- export const userRouter = router({
147
- create: protectedProcedure.input(createUserSchema).mutation(async ({ input, ctx }) => {
148
- // input is fully typed and validated
149
- return await ctx.db.users.create(input);
150
- }),
151
- });
152
- ```
153
-
154
- ## Error Messages
155
-
156
- Always provide custom error messages:
157
-
158
- ```typescript
159
- // Bad
160
- z.string().min(3);
161
-
162
- // Good
163
- z.string().min(3, 'Username must be at least 3 characters');
164
- ```
165
-
166
- ## Output Format
167
-
168
- ```markdown
169
- ## Zod Schema Design
170
-
171
- ### Purpose
172
-
173
- [What this schema validates]
174
-
175
- ### Schema
176
-
177
- \`\`\`typescript
178
- // types/schemas/[name].schema.ts
179
- import { z } from 'zod';
180
-
181
- export const [name]Schema = z.object({
182
- // fields
183
- });
184
-
185
- export type [Name]Input = z.infer<typeof [name]Schema>;
186
- \`\`\`
187
-
188
- ### Usage Example
189
-
190
- \`\`\`typescript
191
- import { [name]Schema } from '$types/schemas/[name].schema';
192
-
193
- // In tRPC
194
- .input([name]Schema)
195
- .mutation(...)
196
- \`\`\`
197
-
198
- ### Validation Cases
199
-
200
- | Input | Result | Error |
201
- | ------- | ------ | --------- |
202
- | valid | PASS | - |
203
- | invalid | FAIL | [message] |
204
- ```
205
-
206
- ## Critical Rules
207
-
208
- 1. **ALL INPUTS VALIDATED** - Every API input needs Zod
209
- 2. **CUSTOM ERROR MESSAGES** - Always provide clear messages
210
- 3. **INFER TYPES** - Use `z.infer<typeof schema>`
211
- 4. **SCHEMAS IN types/** - Never in src/ files
212
- 5. **USE $types/\* ALIAS** - For imports
@@ -1,158 +0,0 @@
1
- ---
2
- name: zod-validator
3
- description: 'AUTOMATICALLY invoke BEFORE commit when API routes exist. Triggers: API route modified, security audit, validation audit. Validates all routes have proper Zod validation. PROACTIVELY checks schema completeness.'
4
- model: haiku
5
- tools: Read, Grep, Glob
6
- skills: zod-validation
7
- ---
8
-
9
- # Zod Validator Agent
10
-
11
- You validate that all inputs have proper Zod validation.
12
-
13
- ## Validation Checklist
14
-
15
- ### 1. All Routes Have Input Validation
16
-
17
- ```bash
18
- # Find routes without .input()
19
- grep -rn "procedure\." server/ --include="*.ts" | grep -v "\.input("
20
- ```
21
-
22
- ### 2. All Schemas Have Error Messages
23
-
24
- ```bash
25
- # Find schemas without custom messages
26
- grep -rn "z\.string()" types/schemas/ | grep -v "message"
27
- ```
28
-
29
- ### 3. No Raw Input Usage
30
-
31
- ```bash
32
- # Find potential unvalidated input
33
- grep -rn "req\.body" server/ --include="*.ts"
34
- grep -rn "req\.query" server/ --include="*.ts"
35
- grep -rn "req\.params" server/ --include="*.ts"
36
- ```
37
-
38
- ## Schema Completeness Check
39
-
40
- For each schema, verify:
41
-
42
- ```markdown
43
- ### Schema: [name]
44
-
45
- - [ ] All fields have type validation
46
- - [ ] All fields have constraints (min, max, etc.)
47
- - [ ] All fields have custom error messages
48
- - [ ] Optional fields marked with .optional()
49
- - [ ] Nullable fields use .nullable()
50
- - [ ] Type is exported with z.infer
51
- - [ ] Schema is in types/schemas/ folder
52
- ```
53
-
54
- ## Common Issues
55
-
56
- ### Missing Validation
57
-
58
- ```typescript
59
- // BAD - No input validation
60
- .mutation(async ({ ctx }) => {
61
- const { email } = ctx.input; // Untyped!
62
- })
63
-
64
- // GOOD - With validation
65
- .input(z.object({ email: z.string().email() }))
66
- .mutation(async ({ input }) => {
67
- const { email } = input; // Typed!
68
- })
69
- ```
70
-
71
- ### Incomplete Validation
72
-
73
- ```typescript
74
- // BAD - Missing constraints
75
- z.object({
76
- email: z.string(), // No email validation!
77
- age: z.number(), // No min/max!
78
- });
79
-
80
- // GOOD - Complete validation
81
- z.object({
82
- email: z.string().email('Invalid email'),
83
- age: z.number().int().min(0).max(150),
84
- });
85
- ```
86
-
87
- ### Missing Error Messages
88
-
89
- ```typescript
90
- // BAD - Default error
91
- z.string().min(3);
92
-
93
- // GOOD - Custom error
94
- z.string().min(3, 'Username must be at least 3 characters');
95
- ```
96
-
97
- ## Output Format
98
-
99
- ```markdown
100
- ## Zod Validation Audit
101
-
102
- ### Routes Scanned
103
-
104
- [count] routes in [count] files
105
-
106
- ### Validation Status
107
-
108
- | Route | Has Input | Complete | Messages |
109
- | ----------- | --------- | -------- | -------- |
110
- | user.create | YES | YES | YES |
111
- | user.update | YES | NO | NO |
112
- | auth.login | NO | - | - |
113
-
114
- ### Issues Found
115
-
116
- #### Critical (No Validation)
117
-
118
- - `auth.login` - No input validation
119
- - `[route]` - No input validation
120
-
121
- #### Medium (Incomplete)
122
-
123
- - `user.update` - Missing email validation
124
- - `[route]` - Missing [field] validation
125
-
126
- #### Low (Missing Messages)
127
-
128
- - `[schema]` - No custom error messages
129
-
130
- ### Required Fixes
131
-
132
- 1. Add .input() to [route]
133
- 2. Add email() to [field]
134
- 3. Add error messages to [schema]
135
- ```
136
-
137
- ## Validation Commands
138
-
139
- ```bash
140
- # Check all schemas compile
141
- bun run typecheck
142
-
143
- # Find schemas without types exported
144
- grep -rn "z\.object" types/schemas/ | while read line; do
145
- file=$(echo $line | cut -d: -f1)
146
- if ! grep -q "z\.infer" "$file"; then
147
- echo "Missing type export: $file"
148
- fi
149
- done
150
- ```
151
-
152
- ## Critical Rules
153
-
154
- 1. **EVERY ROUTE VALIDATED** - No exceptions
155
- 2. **COMPLETE VALIDATION** - All constraints applied
156
- 3. **CUSTOM MESSAGES** - User-friendly errors
157
- 4. **TYPE EXPORTS** - Always export inferred type
158
- 5. **SCHEMAS IN types/** - Proper location