claude-toolkit 0.1.25 → 0.9.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.
- package/CHANGELOG.md +42 -0
- package/README.md +7 -6
- package/core/hooks/skill-eval.js +3 -20
- package/core/skills/ct-testing-patterns/SKILL.md +12 -0
- package/package.json +1 -1
- package/src/detect.ts +204 -71
- package/stacks/capacitor/skills/ct-capacitor-ota/SKILL.md +16 -0
- package/stacks/capacitor/skills/ct-capacitor-ui/SKILL.md +66 -0
- package/stacks/capacitor/stack.json +47 -1
- package/stacks/cloudflare/skills/ct-cloudflare-d1-kv/SKILL.md +86 -0
- package/stacks/i18n-typesafe/skills/ct-i18n-typesafe/SKILL.md +52 -0
- package/stacks/i18n-typesafe/stack.json +2 -1
- package/stacks/playwright/skills/ct-playwright-patterns/SKILL.md +70 -2
- package/stacks/protobuf/skills/ct-protobuf-contracts/SKILL.md +36 -0
- package/stacks/rust-wasm/skills/ct-rust-wasm-patterns/SKILL.md +62 -0
- package/stacks/solidjs/skills/ct-solidjs-patterns/SKILL.md +70 -0
- package/stacks/solidjs/stack.json +2 -1
- package/stacks/storybook/skills/ct-storybook-patterns/SKILL.md +62 -0
- package/stacks/vanilla-extract/skills/ct-vanilla-extract-patterns/SKILL.md +62 -0
- package/stacks/vanilla-extract/stack.json +1 -1
- package/stacks/vite/skills/ct-vite-vitest-patterns/SKILL.md +71 -0
|
@@ -470,6 +470,67 @@ The compat layer auto-converts old keys. New code should use the new keys.
|
|
|
470
470
|
|
|
471
471
|
---
|
|
472
472
|
|
|
473
|
+
## Performance
|
|
474
|
+
|
|
475
|
+
> _Verified against Vite 8 / Rolldown / Vitest 4 (2026-06)._
|
|
476
|
+
|
|
477
|
+
### Dev Cold-Start & HMR: optimizeDeps
|
|
478
|
+
|
|
479
|
+
Vite pre-bundles bare-import deps on first run, cached in `node_modules/.vite`. A missing entry triggers a mid-session "new dependency optimized, reloading" full reload -- the #1 HMR killer.
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
optimizeDeps: {
|
|
483
|
+
include: ['lodash-es', 'pkg/cjs-only'], // force-bundle CJS / plugin-injected / lazy deps not auto-discovered
|
|
484
|
+
exclude: ['small-pure-esm-lib'], // only small pure-ESM pkgs, or deps that break when bundled
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
Do **not** `exclude` a large multi-file ESM dep (e.g. `lodash-es` ships 600+ modules) -- unbundled it floods the browser with parallel requests and slows page loads; keep it pre-bundled. Never `exclude` a CJS dep. If an excluded ESM dep has a nested CJS dep, add that nested dep to `include`.
|
|
489
|
+
|
|
490
|
+
`vite --force` (or `rm -rf node_modules/.vite`) busts a stale cache. Pair with `server.warmup.clientFiles` (already covered).
|
|
491
|
+
|
|
492
|
+
### Bundle Size: measure, then split
|
|
493
|
+
|
|
494
|
+
```typescript
|
|
495
|
+
import { visualizer } from 'rollup-plugin-visualizer' // ^7 for Vite 8 / Rolldown
|
|
496
|
+
process.env.ANALYZE && visualizer({ gzipSize: true, brotliSize: true }) // ANALYZE=1 vite build
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
Read the gzip/brotli column to find oversized chunks. Route-level dynamic `import()` is the primary code-split. Use manual chunks only to isolate stable vendor deps. In Vite 8 / Rolldown the `manualChunks` object form is removed and the function form is deprecated -- use `rolldownOptions.output.codeSplitting` (the old `advancedChunks` key is a deprecated alias):
|
|
500
|
+
|
|
501
|
+
```typescript
|
|
502
|
+
build: { rolldownOptions: { output: {
|
|
503
|
+
codeSplitting: { groups: [{ name: 'vendor', test: /node_modules/ }] },
|
|
504
|
+
} } }
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### build.target & CSS
|
|
508
|
+
|
|
509
|
+
Don't lower `target: 'baseline-widely-available'` without cause. A low target (`es2015`) makes Oxc down-level async/await, optional chaining, and spread into verbose helpers -- bigger bundles, slower transforms. Match real browser support.
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
css: { transformer: 'lightningcss' }, // experimental: faster + smaller than the postcss default
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
`build.cssMinify` already defaults to `'lightningcss'` in Vite 8 -- no action needed for minification; the opt-in above is only for the CSS *transformer*.
|
|
516
|
+
|
|
517
|
+
### Vitest Run Speed: pool & isolate
|
|
518
|
+
|
|
519
|
+
`isolate: true` (default) builds a fresh environment per test file -- safe but slow. Disabling it is often the single biggest speedup for pure-logic suites.
|
|
520
|
+
|
|
521
|
+
| Goal | Setting |
|
|
522
|
+
|---|---|
|
|
523
|
+
| Safe default (global mutation, `process.env`, fake timers) | `pool: 'forks'`, `isolate: true` |
|
|
524
|
+
| Fastest, pure side-effect-free Node logic | `pool: 'threads'`, `isolate: false` |
|
|
525
|
+
| Fast jsdom (leaks globals -- verify) | `pool: 'vmThreads'` (isolation can't be disabled) |
|
|
526
|
+
| Debug a flaky/order-dependent test | `--no-file-parallelism` or `poolOptions.threads.singleThread` |
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
test: { pool: 'threads', isolate: false } // big speedup for logic suites; leaks global state between files
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
> `pool: 'forks'` and `isolate: true` are the Vitest defaults. Gains from `threads` show mostly in larger suites; `forks` stays safer for native-module / segfault-prone tests.
|
|
533
|
+
|
|
473
534
|
## Anti-Patterns
|
|
474
535
|
|
|
475
536
|
### Vite
|
|
@@ -479,6 +540,10 @@ The compat layer auto-converts old keys. New code should use the new keys.
|
|
|
479
540
|
3. **Duplicating resolve config for tests** -- Vitest inherits Vite's aliases and plugins. Don't redeclare.
|
|
480
541
|
4. **Using `rollupOptions` in Vite 8** -- Works via compat but generates warnings. Use `rolldownOptions`.
|
|
481
542
|
5. **Not externalizing peer deps in library mode** -- Bundling framework deps causes duplicate instances.
|
|
543
|
+
6. **Lowering `build.target` by habit** -- Down-levels modern syntax into helper bloat and slows transforms. Set it to your actual browser support.
|
|
544
|
+
7. **Tuning chunks without measuring** -- Run `ANALYZE=1 vite build` with `visualizer` first. Over-grouping into manual chunks defeats per-route lazy loading and cache granularity.
|
|
545
|
+
8. **`optimizeDeps.exclude` on large ESM deps** -- Unbundling a multi-file ESM package floods the browser with requests. Exclude only small pure-ESM or bundle-breaking deps.
|
|
546
|
+
9. **Ignoring the "new dependency optimized, reloading" warning** -- A dep escaped pre-bundle discovery. Add it to `optimizeDeps.include` to stop full reloads.
|
|
482
547
|
|
|
483
548
|
### Vitest
|
|
484
549
|
|
|
@@ -490,3 +555,9 @@ The compat layer auto-converts old keys. New code should use the new keys.
|
|
|
490
555
|
6. **Snapshot-only testing** -- Snapshots catch regressions but don't verify correctness. Add explicit assertions.
|
|
491
556
|
7. **Global jsdom environment** -- Use `test.projects` to run DOM tests in jsdom and logic tests in node.
|
|
492
557
|
8. **Using `vi.spyOn` in browser mode** -- Use `vi.mock('./module', { spy: true })` instead.
|
|
558
|
+
9. **Leaving `isolate: true` on pure-logic suites** -- A large run-speed cost. Set `isolate: false` + `pool: 'threads'` for side-effect-free tests; keep `forks` + `isolate: true` where global/env mutation needs isolation.
|
|
559
|
+
|
|
560
|
+
## See Also
|
|
561
|
+
|
|
562
|
+
- `ct-testing-patterns` — the canonical cross-runner test-speed rule (parallelism, file-level `--shard` + blob/merge-reports, isolate trade-off).
|
|
563
|
+
- `ct-solidjs-patterns` — `lazy()` route/screen code-splitting relies on Vite's dynamic-import chunking.
|