codecruise 0.1.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 (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/bin/codecruise.js +68 -0
  4. package/config/CLAUDE.md +107 -0
  5. package/config/agents/analyst.md +48 -0
  6. package/config/agents/architect-reviewer.md +161 -0
  7. package/config/agents/architect.md +119 -0
  8. package/config/agents/critic.md +63 -0
  9. package/config/agents/developer.md +96 -0
  10. package/config/agents/devops.md +81 -0
  11. package/config/agents/orchestrator.md +91 -0
  12. package/config/agents/planner.md +139 -0
  13. package/config/agents/retro.md +52 -0
  14. package/config/agents/reviewer.md +101 -0
  15. package/config/agents/security-reviewer.md +57 -0
  16. package/config/agents/stack/expo/AGENT.md +473 -0
  17. package/config/agents/stack/expo/rules/critical.md +427 -0
  18. package/config/agents/stack/expo/rules/native.md +455 -0
  19. package/config/agents/stack/expo/rules/navigation.md +445 -0
  20. package/config/agents/stack/expo/rules/performance.md +415 -0
  21. package/config/agents/stack/fastify/AGENT.md +397 -0
  22. package/config/agents/stack/fastify/rules/api-design.md +283 -0
  23. package/config/agents/stack/fastify/rules/critical.md +232 -0
  24. package/config/agents/stack/fastify/rules/queues.md +303 -0
  25. package/config/agents/stack/fastify/rules/security.md +384 -0
  26. package/config/agents/stack/index.yaml +48 -0
  27. package/config/agents/stack/nextjs/AGENT.md +421 -0
  28. package/config/agents/stack/nextjs/rules/components.md +413 -0
  29. package/config/agents/stack/nextjs/rules/critical.md +391 -0
  30. package/config/agents/stack/nextjs/rules/performance.md +403 -0
  31. package/config/agents/stack/nextjs/rules/styling.md +334 -0
  32. package/config/agents/stack/shared-ts/AGENT.md +384 -0
  33. package/config/agents/stack/shared-ts/rules/critical.md +315 -0
  34. package/config/agents/stack/shared-ts/rules/patterns.md +384 -0
  35. package/config/agents/stack/shared-ts/rules/zod.md +427 -0
  36. package/config/agents/tester.md +79 -0
  37. package/config/commands/architect-discuss.md +366 -0
  38. package/config/commands/architect-list.md +160 -0
  39. package/config/commands/architect-review.md +111 -0
  40. package/config/commands/architect.md +118 -0
  41. package/config/commands/compact.md +118 -0
  42. package/config/commands/companion.md +279 -0
  43. package/config/commands/dashboard.md +152 -0
  44. package/config/commands/doctor.md +227 -0
  45. package/config/commands/dogfood-report.md +101 -0
  46. package/config/commands/flags/run-autonomous.md +110 -0
  47. package/config/commands/flags/run-pause.md +80 -0
  48. package/config/commands/ingest.md +173 -0
  49. package/config/commands/init.md +128 -0
  50. package/config/commands/metrics.md +87 -0
  51. package/config/commands/parallel.md +320 -0
  52. package/config/commands/pause.md +55 -0
  53. package/config/commands/plan-review.md +130 -0
  54. package/config/commands/plan.md +216 -0
  55. package/config/commands/production-check.md +308 -0
  56. package/config/commands/refine.md +323 -0
  57. package/config/commands/resume.md +72 -0
  58. package/config/commands/retro.md +121 -0
  59. package/config/commands/retry.md +75 -0
  60. package/config/commands/role.md +310 -0
  61. package/config/commands/run.md +417 -0
  62. package/config/commands/scope.md +85 -0
  63. package/config/commands/setup-permissions.md +104 -0
  64. package/config/commands/skip.md +75 -0
  65. package/config/commands/spec-forge.md +213 -0
  66. package/config/commands/spec-help.md +194 -0
  67. package/config/commands/spec-patch.md +342 -0
  68. package/config/commands/spec-resolve.md +110 -0
  69. package/config/commands/spec-review.md +153 -0
  70. package/config/commands/status.md +114 -0
  71. package/config/commands/sync.md +131 -0
  72. package/config/commands/task.md +138 -0
  73. package/config/commands/verify.md +124 -0
  74. package/config/hooks/README.md +632 -0
  75. package/config/hooks/activity-log.sh +187 -0
  76. package/config/hooks/anti-rationalize.sh +52 -0
  77. package/config/hooks/capture-verification.sh +112 -0
  78. package/config/hooks/collect-metrics.sh +135 -0
  79. package/config/hooks/enforce-file-scope.sh +75 -0
  80. package/config/hooks/enforce-state-machine.sh +161 -0
  81. package/config/hooks/enforce-tdd.sh +180 -0
  82. package/config/hooks/format.sh +40 -0
  83. package/config/hooks/lib/activity-helpers.sh +162 -0
  84. package/config/hooks/lib/read-settings.sh +71 -0
  85. package/config/hooks/load-context-skills.sh +95 -0
  86. package/config/hooks/notify.sh +81 -0
  87. package/config/hooks/pre-commit.sample +35 -0
  88. package/config/hooks/protect-files.sh +63 -0
  89. package/config/hooks/track-agents.sh +41 -0
  90. package/config/hooks/track-commands.sh +37 -0
  91. package/config/hooks/track-enforcement.sh +44 -0
  92. package/config/hooks/track-ooda.sh +77 -0
  93. package/config/hooks/validate-commit-msg.sh +35 -0
  94. package/config/hooks/validate-plan.sh +213 -0
  95. package/config/hooks/verify-criteria.sh +46 -0
  96. package/config/hooks/verify-todo-completion.sh +140 -0
  97. package/config/rules/comments.md +25 -0
  98. package/config/rules/decision-rules.md +308 -0
  99. package/config/rules/hygiene.md +247 -0
  100. package/config/rules/pattern-detection.md +372 -0
  101. package/config/rules/profiles.md +193 -0
  102. package/config/rules/recovery.md +83 -0
  103. package/config/rules/scope-detection.md +213 -0
  104. package/config/rules/standards.md +127 -0
  105. package/config/rules/workflow.md +121 -0
  106. package/config/schemas.md +767 -0
  107. package/config/settings.json +195 -0
  108. package/config/skills/backend/SKILL.md +734 -0
  109. package/config/skills/database/SKILL.md +426 -0
  110. package/config/skills/frontend/SKILL.md +434 -0
  111. package/config/skills/git/SKILL.md +396 -0
  112. package/config/skills/index.yaml +36 -0
  113. package/config/skills/observability/SKILL.md +430 -0
  114. package/config/skills/package-dev/SKILL.md +498 -0
  115. package/config/skills/performance/SKILL.md +378 -0
  116. package/config/skills/resilience/SKILL.md +573 -0
  117. package/config/skills/testing/SKILL.md +398 -0
  118. package/config/skills/testing-patterns/SKILL.md +276 -0
  119. package/config/skills/typescript/SKILL.md +152 -0
  120. package/config/templates/CLAUDE.md +70 -0
  121. package/config/templates/README.md +117 -0
  122. package/config/templates/steering/adr-template.md +102 -0
  123. package/config/templates/steering/product.md +60 -0
  124. package/config/templates/steering/rfc-template.md +159 -0
  125. package/config/templates/steering/structure.md +146 -0
  126. package/config/templates/steering/tech.md +85 -0
  127. package/package.json +40 -0
  128. package/src/install.js +163 -0
  129. package/src/report.js +310 -0
@@ -0,0 +1,498 @@
1
+ ---
2
+ name: package-dev
3
+ description: NPM package development patterns. Use when building libraries, SDKs, or reusable packages.
4
+ ---
5
+
6
+ # Package Development Skill
7
+
8
+ Standards for building production-grade NPM packages.
9
+
10
+ ## Package.json Structure
11
+
12
+ ```json
13
+ {
14
+ "name": "@scope/package-name",
15
+ "version": "1.0.0",
16
+ "description": "Clear, concise description",
17
+ "type": "module",
18
+ "main": "./dist/index.cjs",
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "import": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "require": {
28
+ "types": "./dist/index.d.cts",
29
+ "default": "./dist/index.cjs"
30
+ }
31
+ }
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "sideEffects": false,
37
+ "engines": {
38
+ "node": ">=18"
39
+ },
40
+ "scripts": {
41
+ "build": "tsup",
42
+ "test": "vitest run",
43
+ "test:coverage": "vitest run --coverage",
44
+ "typecheck": "tsc --noEmit",
45
+ "lint": "eslint .",
46
+ "prepublishOnly": "npm run build && npm run test && npm run typecheck"
47
+ },
48
+ "peerDependencies": {},
49
+ "dependencies": {},
50
+ "devDependencies": {}
51
+ }
52
+ ```
53
+
54
+ ## API Surface Control
55
+
56
+ ### Minimal Exports
57
+
58
+ Only export what consumers need:
59
+
60
+ ```typescript
61
+ // src/index.ts
62
+
63
+ // Public API - explicitly exported
64
+ export { createClient } from './client';
65
+ export { configure } from './config';
66
+ export type { ClientOptions, Config } from './types';
67
+
68
+ // Internal - NOT exported
69
+ // - src/internal/parser.ts
70
+ // - src/utils/helpers.ts
71
+ ```
72
+
73
+ ### No Accidental Public APIs
74
+
75
+ ```typescript
76
+ // BAD - leaky abstraction
77
+ export class Client {
78
+ public internalCache: Map<string, unknown>; // Exposed implementation detail
79
+
80
+ public _parseResponse(data: unknown) { // Internal method exposed
81
+ // ...
82
+ }
83
+ }
84
+
85
+ // GOOD - controlled API
86
+ export class Client {
87
+ private cache: Map<string, unknown>;
88
+
89
+ private parseResponse(data: unknown) {
90
+ // ...
91
+ }
92
+
93
+ // Only public methods are part of API
94
+ public async fetch(url: string): Promise<Response> {
95
+ // ...
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### Barrel Files
101
+
102
+ ```typescript
103
+ // src/index.ts - single entry point
104
+ export * from './client';
105
+ export * from './types';
106
+
107
+ // src/client/index.ts - submodule barrel
108
+ export { Client } from './client';
109
+ export { createClient } from './factory';
110
+ // Don't export: ./internal.ts, ./helpers.ts
111
+ ```
112
+
113
+ ## Dependency Management
114
+
115
+ ### Required vs Dev Dependencies
116
+
117
+ | Category | Classification | Examples |
118
+ |----------|---------------|----------|
119
+ | Runtime requirement | `dependencies` | zod, axios |
120
+ | Build tool | `devDependencies` | typescript, tsup |
121
+ | Test framework | `devDependencies` | vitest, jest |
122
+ | Linting | `devDependencies` | eslint, prettier |
123
+ | Type definitions | `devDependencies` | @types/* |
124
+
125
+ ### Peer Dependencies
126
+
127
+ Use for:
128
+ - Frameworks the consumer must provide (React, Vue)
129
+ - Packages that must be shared (avoiding duplicate instances)
130
+
131
+ ```json
132
+ {
133
+ "peerDependencies": {
134
+ "react": "^18.0.0"
135
+ },
136
+ "peerDependenciesMeta": {
137
+ "react": {
138
+ "optional": true
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### Dependency Checklist
145
+
146
+ Before adding any dependency:
147
+
148
+ - [ ] Is it actively maintained? (commits in last 6 months)
149
+ - [ ] Is it production-tested? (> 10k weekly downloads)
150
+ - [ ] What's the bundle size impact? (use bundlephobia.com)
151
+ - [ ] Are there security advisories?
152
+ - [ ] Can we implement it ourselves in < 50 lines?
153
+ - [ ] Is it tree-shakeable?
154
+
155
+ ### No Bloated Dependencies
156
+
157
+ ```typescript
158
+ // BAD - pulling in huge library for one function
159
+ import _ from 'lodash'; // 70KB
160
+ const result = _.debounce(fn, 100);
161
+
162
+ // GOOD - use native or small focused package
163
+ import debounce from 'just-debounce-it'; // 0.3KB
164
+ const result = debounce(fn, 100);
165
+
166
+ // BETTER - implement simple utilities
167
+ function debounce<T extends (...args: unknown[]) => unknown>(
168
+ fn: T,
169
+ ms: number
170
+ ): T {
171
+ let timeoutId: ReturnType<typeof setTimeout>;
172
+ return ((...args) => {
173
+ clearTimeout(timeoutId);
174
+ timeoutId = setTimeout(() => fn(...args), ms);
175
+ }) as T;
176
+ }
177
+ ```
178
+
179
+ ## Bundle Optimization
180
+
181
+ ### Tree-Shaking
182
+
183
+ ```typescript
184
+ // tsconfig.json
185
+ {
186
+ "compilerOptions": {
187
+ "module": "ESNext",
188
+ "moduleResolution": "bundler"
189
+ }
190
+ }
191
+
192
+ // package.json
193
+ {
194
+ "sideEffects": false
195
+ }
196
+ ```
197
+
198
+ ### Named Exports Only
199
+
200
+ ```typescript
201
+ // BAD - prevents tree-shaking
202
+ export default {
203
+ createClient,
204
+ configure,
205
+ parseResponse,
206
+ };
207
+
208
+ // GOOD - enables tree-shaking
209
+ export { createClient };
210
+ export { configure };
211
+ export { parseResponse };
212
+ ```
213
+
214
+ ### Code Splitting
215
+
216
+ ```typescript
217
+ // Heavy functionality in separate entry point
218
+ // package.json
219
+ {
220
+ "exports": {
221
+ ".": "./dist/index.js",
222
+ "./heavy": "./dist/heavy.js"
223
+ }
224
+ }
225
+
226
+ // Consumer only imports what they need
227
+ import { createClient } from '@scope/package';
228
+ import { heavyOperation } from '@scope/package/heavy'; // Only when needed
229
+ ```
230
+
231
+ ### Bundle Size Budget
232
+
233
+ Track in CI:
234
+
235
+ ```yaml
236
+ # .github/workflows/bundle.yml
237
+ - name: Check bundle size
238
+ run: |
239
+ npm run build
240
+ size=$(du -sb dist | cut -f1)
241
+ if [ $size -gt 50000 ]; then
242
+ echo "Bundle size $size exceeds 50KB limit"
243
+ exit 1
244
+ fi
245
+ ```
246
+
247
+ ## Versioning & Breaking Changes
248
+
249
+ ### Semver Compliance
250
+
251
+ | Change Type | Version Bump | Example |
252
+ |-------------|--------------|---------|
253
+ | Bug fix | PATCH (0.0.X) | Fix null handling |
254
+ | New feature (backward compatible) | MINOR (0.X.0) | Add new method |
255
+ | Breaking change | MAJOR (X.0.0) | Remove/rename API |
256
+
257
+ ### Breaking Change Checklist
258
+
259
+ Before making a breaking change:
260
+
261
+ - [ ] Document in CHANGELOG.md
262
+ - [ ] Provide migration guide
263
+ - [ ] Consider deprecation period first
264
+ - [ ] Update all examples and docs
265
+ - [ ] Communicate in release notes
266
+
267
+ ### Deprecation Pattern
268
+
269
+ ```typescript
270
+ /**
271
+ * @deprecated Use `newMethod` instead. Will be removed in v3.0.0.
272
+ */
273
+ export function oldMethod(options: OldOptions): void {
274
+ console.warn(
275
+ 'Deprecation warning: oldMethod is deprecated. ' +
276
+ 'Use newMethod instead. This will be removed in v3.0.0.'
277
+ );
278
+
279
+ // Convert to new API internally
280
+ return newMethod(convertOptions(options));
281
+ }
282
+
283
+ export function newMethod(options: NewOptions): void {
284
+ // New implementation
285
+ }
286
+ ```
287
+
288
+ ## Error Handling
289
+
290
+ ### Custom Error Classes
291
+
292
+ ```typescript
293
+ export class PackageError extends Error {
294
+ constructor(
295
+ public code: string,
296
+ message: string,
297
+ public cause?: Error
298
+ ) {
299
+ super(message);
300
+ this.name = 'PackageError';
301
+ }
302
+ }
303
+
304
+ export class ConfigurationError extends PackageError {
305
+ constructor(message: string, cause?: Error) {
306
+ super('CONFIGURATION_ERROR', message, cause);
307
+ this.name = 'ConfigurationError';
308
+ }
309
+ }
310
+
311
+ export class NetworkError extends PackageError {
312
+ constructor(message: string, cause?: Error) {
313
+ super('NETWORK_ERROR', message, cause);
314
+ this.name = 'NetworkError';
315
+ }
316
+ }
317
+ ```
318
+
319
+ ### Error Messages
320
+
321
+ ```typescript
322
+ // BAD - unhelpful
323
+ throw new Error('Invalid config');
324
+
325
+ // GOOD - actionable
326
+ throw new ConfigurationError(
327
+ `Invalid configuration: 'timeout' must be a positive number, received ${typeof timeout}. ` +
328
+ `See https://pkg.example.com/docs/config for valid options.`
329
+ );
330
+ ```
331
+
332
+ ## TypeScript Patterns
333
+
334
+ ### Strict Types
335
+
336
+ ```typescript
337
+ // tsconfig.json
338
+ {
339
+ "compilerOptions": {
340
+ "strict": true,
341
+ "declaration": true,
342
+ "declarationMap": true,
343
+ "sourceMap": true
344
+ }
345
+ }
346
+ ```
347
+
348
+ ### Generic Constraints
349
+
350
+ ```typescript
351
+ // Flexible but type-safe
352
+ export function createStore<T extends Record<string, unknown>>(
353
+ initial: T
354
+ ): Store<T> {
355
+ // ...
356
+ }
357
+
358
+ // Consumer gets full type inference
359
+ const store = createStore({ count: 0, name: 'test' });
360
+ store.get('count'); // number
361
+ store.get('name'); // string
362
+ ```
363
+
364
+ ### Overloads for Better DX
365
+
366
+ ```typescript
367
+ // Multiple signatures for different use cases
368
+ export function configure(options: FullOptions): Client;
369
+ export function configure(apiKey: string): Client;
370
+ export function configure(optionsOrKey: FullOptions | string): Client {
371
+ const options = typeof optionsOrKey === 'string'
372
+ ? { apiKey: optionsOrKey }
373
+ : optionsOrKey;
374
+
375
+ return new Client(options);
376
+ }
377
+ ```
378
+
379
+ ## Testing
380
+
381
+ ### Test Public API Only
382
+
383
+ ```typescript
384
+ // BAD - testing internals
385
+ import { parseInternalFormat } from '../src/internal/parser';
386
+ test('parseInternalFormat handles edge case', () => {
387
+ // Testing implementation detail
388
+ });
389
+
390
+ // GOOD - testing public behavior
391
+ import { createClient } from '../src';
392
+ test('client handles malformed response gracefully', () => {
393
+ const client = createClient({ apiKey: 'test' });
394
+ // Test observable behavior
395
+ });
396
+ ```
397
+
398
+ ### Compatibility Tests
399
+
400
+ ```typescript
401
+ // Test against multiple Node versions in CI
402
+ // Test ESM and CJS imports work
403
+ test('ESM import works', async () => {
404
+ const pkg = await import('../dist/index.js');
405
+ expect(pkg.createClient).toBeDefined();
406
+ });
407
+
408
+ test('CJS require works', () => {
409
+ const pkg = require('../dist/index.cjs');
410
+ expect(pkg.createClient).toBeDefined();
411
+ });
412
+ ```
413
+
414
+ ## Documentation
415
+
416
+ ### README Structure
417
+
418
+ ```markdown
419
+ # Package Name
420
+
421
+ Brief description (1 sentence).
422
+
423
+ ## Installation
424
+
425
+ \`\`\`bash
426
+ npm install @scope/package
427
+ \`\`\`
428
+
429
+ ## Quick Start
430
+
431
+ \`\`\`typescript
432
+ import { createClient } from '@scope/package';
433
+
434
+ const client = createClient({ apiKey: 'xxx' });
435
+ const result = await client.fetch('/endpoint');
436
+ \`\`\`
437
+
438
+ ## API Reference
439
+
440
+ ### createClient(options)
441
+
442
+ Creates a new client instance.
443
+
444
+ **Parameters:**
445
+ - `options.apiKey` (string, required) - Your API key
446
+ - `options.timeout` (number, optional) - Request timeout in ms. Default: 5000
447
+
448
+ **Returns:** `Client` instance
449
+
450
+ **Example:**
451
+ \`\`\`typescript
452
+ const client = createClient({
453
+ apiKey: process.env.API_KEY,
454
+ timeout: 10000,
455
+ });
456
+ \`\`\`
457
+
458
+ ## License
459
+
460
+ MIT
461
+ ```
462
+
463
+ ### JSDoc for Public APIs
464
+
465
+ ```typescript
466
+ /**
467
+ * Creates a configured client instance.
468
+ *
469
+ * @param options - Configuration options
470
+ * @returns Configured client ready for use
471
+ *
472
+ * @example
473
+ * ```typescript
474
+ * const client = createClient({ apiKey: 'xxx' });
475
+ * ```
476
+ *
477
+ * @throws {ConfigurationError} If options are invalid
478
+ */
479
+ export function createClient(options: ClientOptions): Client {
480
+ // ...
481
+ }
482
+ ```
483
+
484
+ ## Publishing Checklist
485
+
486
+ Before `npm publish`:
487
+
488
+ - [ ] Version bumped appropriately (semver)
489
+ - [ ] CHANGELOG.md updated
490
+ - [ ] All tests pass
491
+ - [ ] TypeScript compiles without errors
492
+ - [ ] Bundle size within budget
493
+ - [ ] `npm audit` shows no vulnerabilities
494
+ - [ ] README is accurate and up-to-date
495
+ - [ ] Examples work with new version
496
+ - [ ] Breaking changes documented with migration guide
497
+ - [ ] `files` field in package.json is correct
498
+ - [ ] No sensitive files in published package