claude-toolkit 0.1.9 → 0.1.12

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 (23) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/bin/cli.ts +0 -0
  3. package/core/skills/{testing-patterns → ct-testing-patterns}/SKILL.md +29 -0
  4. package/core/skills/{typescript-conventions → ct-typescript-conventions}/SKILL.md +41 -0
  5. package/core/skills/{verification-before-completion → ct-verification-before-completion}/SKILL.md +10 -0
  6. package/docs/skills/systematic-debugging.md +1 -1
  7. package/docs/skills/testing-patterns.md +30 -1
  8. package/docs/skills/typescript-conventions.md +42 -1
  9. package/docs/skills/verification-before-completion.md +14 -2
  10. package/docs/stacks/cloudflare-d1-kv.md +35 -1
  11. package/docs/stacks/i18n-typesafe.md +1 -1
  12. package/docs/stacks/protobuf-contracts.md +1 -1
  13. package/docs/stacks/rust-wasm-patterns.md +2 -2
  14. package/docs/stacks/solidjs-patterns.md +1 -1
  15. package/docs/stacks/vanilla-extract-patterns.md +1 -1
  16. package/package.json +3 -3
  17. package/stacks/cloudflare/skills/{cloudflare-d1-kv → ct-cloudflare-d1-kv}/SKILL.md +22 -0
  18. /package/core/skills/{systematic-debugging → ct-systematic-debugging}/SKILL.md +0 -0
  19. /package/stacks/i18n-typesafe/skills/{i18n-typesafe → ct-i18n-typesafe}/SKILL.md +0 -0
  20. /package/stacks/protobuf/skills/{protobuf-contracts → ct-protobuf-contracts}/SKILL.md +0 -0
  21. /package/stacks/rust-wasm/skills/{rust-wasm-patterns → ct-rust-wasm-patterns}/SKILL.md +0 -0
  22. /package/stacks/solidjs/skills/{solidjs-patterns → ct-solidjs-patterns}/SKILL.md +0 -0
  23. /package/stacks/vanilla-extract/skills/{vanilla-extract-patterns → ct-vanilla-extract-patterns}/SKILL.md +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.12 (2026-04-05)
4
+
5
+ - docs: update skills and docs to 2026 best practices
6
+
7
+ ## 0.1.11 (2026-04-05)
8
+
9
+ - refactor: rename skill folders to match ct- prefixed skill names
10
+
11
+ ## 0.1.10 (2026-04-05)
12
+
13
+ - chore: update typescript to ^6.0.2 and require bun >=1.3.0
14
+
3
15
  ## 0.1.9 (2026-04-04)
4
16
 
5
17
  - docs: add Zod/Valibot runtime validation section to SolidJS data fetching
package/bin/cli.ts CHANGED
File without changes
@@ -38,6 +38,35 @@ New required fields update the factory once, not every test.
38
38
  - Keep mocks minimal -- only methods your code calls. Reset between tests.
39
39
  - Verify mocks match the real API. Update when APIs change.
40
40
 
41
+ ## Property-Based Testing
42
+
43
+ When a function has a contract ("for all valid inputs X, property Y holds"), use property-based tests to verify it across generated inputs instead of hand-picked examples:
44
+
45
+ ```
46
+ // Instead of testing 3-4 specific inputs:
47
+ test("sort is idempotent", () => {
48
+ fc.assert(fc.property(fc.array(fc.integer()), (arr) => {
49
+ const sorted = mySort(arr);
50
+ expect(mySort(sorted)).toEqual(sorted);
51
+ }));
52
+ });
53
+ ```
54
+
55
+ Good candidates: serialization round-trips, math properties, parsers, encoding/decoding, sorting invariants.
56
+
57
+ ## Bun Test Runner
58
+
59
+ Bun includes a built-in test runner. Use `bun test` for projects on the Bun runtime:
60
+
61
+ ```
62
+ bun test # run all *.test.ts files
63
+ bun test --watch # re-run on changes
64
+ bun test --coverage # with code coverage
65
+ bun test path/to/file.test.ts # single file
66
+ ```
67
+
68
+ Bun supports `describe`, `it`/`test`, `expect`, lifecycle hooks, and snapshot testing out of the box with no additional dependencies.
69
+
41
70
  ## Test Pyramid
42
71
 
43
72
  Many unit tests (fast, focused) > some integration tests (multi-component) > few E2E tests (full flow).
@@ -40,6 +40,47 @@ type AsyncState<T> =
40
40
  | { status: "error"; error: Error };
41
41
  ```
42
42
 
43
+ ## `satisfies` Operator
44
+
45
+ Validate a value matches a type without widening it. Preserves the narrowest inferred type while ensuring conformance.
46
+
47
+ ```typescript
48
+ type Route = { path: string; children?: Route[] };
49
+
50
+ const routes = {
51
+ home: { path: "/" },
52
+ user: { path: "/user/:id", children: [{ path: "settings" }] },
53
+ } satisfies Record<string, Route>;
54
+
55
+ // routes.home.path is still "/" (literal), not string
56
+ ```
57
+
58
+ ## `const` Type Parameters
59
+
60
+ Infer literal types from arguments without requiring callers to write `as const`:
61
+
62
+ ```typescript
63
+ function createConfig<const T extends readonly string[]>(names: T): Record<T[number], boolean> {
64
+ return Object.fromEntries(names.map(n => [n, false])) as Record<T[number], boolean>;
65
+ }
66
+
67
+ // result type: Record<"debug" | "verbose", boolean> -- not Record<string, boolean>
68
+ const flags = createConfig(["debug", "verbose"]);
69
+ ```
70
+
71
+ ## Template Literal Types
72
+
73
+ Build precise string types from unions:
74
+
75
+ ```typescript
76
+ type EventName = "click" | "focus" | "blur";
77
+ type Handler = `on${Capitalize<EventName>}`; // "onClick" | "onFocus" | "onBlur"
78
+
79
+ type Locale = "en" | "fr" | "ja";
80
+ type Currency = "USD" | "EUR" | "JPY";
81
+ type PriceKey = `price:${Locale}:${Currency}`; // 9 valid combinations
82
+ ```
83
+
43
84
  ## Generic Constraints
44
85
 
45
86
  ```typescript
@@ -31,12 +31,22 @@ Do not assume edge cases work because the happy path works.
31
31
  - Verify consumers of changed APIs/schemas still work.
32
32
  - Smoke test the running application if applicable.
33
33
 
34
+ ## Security Check
35
+
36
+ Before completing work that touches dependencies, inputs, or external data:
37
+
38
+ - **Dependency audit** -- Run `bun audit` or `npm audit` and resolve critical/high vulnerabilities.
39
+ - **Input validation** -- Verify user-facing inputs are validated at system boundaries (no SQL injection, XSS, command injection).
40
+ - **Secret exposure** -- Confirm no secrets, API keys, or credentials in committed code or logs.
41
+
34
42
  ## Evidence Format
35
43
 
36
44
  ```
37
45
  ## Completed: [task name]
38
46
  - Tests: X passing (Y new, Z existing) -- [command output]
39
47
  - Types: tsc --noEmit: 0 errors
48
+ - Lint: 0 violations
49
+ - Security: audit clean, no exposed secrets
40
50
  - Manual: [endpoint/action]: [status/result]
41
51
  - Edge cases: [what was verified]
42
52
  ```
@@ -3,7 +3,7 @@
3
3
  > Four-phase methodology for diagnosing and fixing bugs efficiently without guesswork.
4
4
 
5
5
  **Type:** Core Skill (always included)
6
- **Source:** [`core/skills/systematic-debugging/SKILL.md`](../core/skills/systematic-debugging/SKILL.md)
6
+ **Source:** [`core/skills/ct-systematic-debugging/SKILL.md`](../core/skills/ct-systematic-debugging/SKILL.md)
7
7
 
8
8
  ## Overview
9
9
 
@@ -3,7 +3,7 @@
3
3
  > Generic test-driven development practices and patterns applicable to any language or test framework.
4
4
 
5
5
  **Type:** Core Skill (always included)
6
- **Source:** [`core/skills/testing-patterns/SKILL.md`](../core/skills/testing-patterns/SKILL.md)
6
+ **Source:** [`core/skills/ct-testing-patterns/SKILL.md`](../core/skills/ct-testing-patterns/SKILL.md)
7
7
 
8
8
  ## Overview
9
9
 
@@ -71,6 +71,35 @@ const admin = getMockUser({ role: "admin" });
71
71
 
72
72
  The ratio should be roughly pyramid-shaped: many unit tests, some integration tests, few E2E tests.
73
73
 
74
+ ## Property-Based Testing
75
+
76
+ When a function has a contract ("for all valid inputs X, property Y holds"), use property-based tests to verify across generated inputs instead of hand-picked examples:
77
+
78
+ ```typescript
79
+ // Instead of testing 3-4 specific inputs:
80
+ test("sort is idempotent", () => {
81
+ fc.assert(fc.property(fc.array(fc.integer()), (arr) => {
82
+ const sorted = mySort(arr);
83
+ expect(mySort(sorted)).toEqual(sorted);
84
+ }));
85
+ });
86
+ ```
87
+
88
+ Good candidates: serialization round-trips, math properties, parsers, encoding/decoding, sorting invariants.
89
+
90
+ ## Bun Test Runner
91
+
92
+ Bun includes a built-in test runner with no additional dependencies:
93
+
94
+ ```bash
95
+ bun test # run all *.test.ts files
96
+ bun test --watch # re-run on changes
97
+ bun test --coverage # with code coverage
98
+ bun test path/to/file.test.ts # single file
99
+ ```
100
+
101
+ Supports `describe`, `it`/`test`, `expect`, lifecycle hooks, and snapshot testing out of the box.
102
+
74
103
  ## Anti-patterns
75
104
 
76
105
  | Anti-pattern | Description |
@@ -3,7 +3,7 @@
3
3
  > Strict TypeScript patterns for type safety, readability, and maintainable codebases.
4
4
 
5
5
  **Type:** Core Skill (always included)
6
- **Source:** [`core/skills/typescript-conventions/SKILL.md`](../core/skills/typescript-conventions/SKILL.md)
6
+ **Source:** [`core/skills/ct-typescript-conventions/SKILL.md`](../core/skills/ct-typescript-conventions/SKILL.md)
7
7
 
8
8
  ## Overview
9
9
 
@@ -94,6 +94,47 @@ type AsyncState<T> =
94
94
  | { status: "error"; error: Error };
95
95
  ```
96
96
 
97
+ ### `satisfies` Operator
98
+
99
+ Validate a value conforms to a type without widening its inferred type:
100
+
101
+ ```typescript
102
+ type Route = { path: string; children?: Route[] };
103
+
104
+ const routes = {
105
+ home: { path: "/" },
106
+ user: { path: "/user/:id", children: [{ path: "settings" }] },
107
+ } satisfies Record<string, Route>;
108
+
109
+ // routes.home.path is "/" (literal), not string
110
+ ```
111
+
112
+ ### `const` Type Parameters
113
+
114
+ Infer literal types from arguments without requiring callers to write `as const`:
115
+
116
+ ```typescript
117
+ function createConfig<const T extends readonly string[]>(names: T): Record<T[number], boolean> {
118
+ return Object.fromEntries(names.map(n => [n, false])) as Record<T[number], boolean>;
119
+ }
120
+
121
+ // result: Record<"debug" | "verbose", boolean>
122
+ const flags = createConfig(["debug", "verbose"]);
123
+ ```
124
+
125
+ ### Template Literal Types
126
+
127
+ Build precise string types from unions:
128
+
129
+ ```typescript
130
+ type EventName = "click" | "focus" | "blur";
131
+ type Handler = `on${Capitalize<EventName>}`; // "onClick" | "onFocus" | "onBlur"
132
+
133
+ type Locale = "en" | "fr" | "ja";
134
+ type Currency = "USD" | "EUR" | "JPY";
135
+ type PriceKey = `price:${Locale}:${Currency}`; // 9 valid combinations
136
+ ```
137
+
97
138
  ### Generic Constraints
98
139
 
99
140
  Use `extends` to constrain generics, documenting expectations and catching misuse:
@@ -3,7 +3,7 @@
3
3
  > Evidence-based completion claims -- never say "done" without proof that the work is correct.
4
4
 
5
5
  **Type:** Core Skill (always included)
6
- **Source:** [`core/skills/verification-before-completion/SKILL.md`](../core/skills/verification-before-completion/SKILL.md)
6
+ **Source:** [`core/skills/ct-verification-before-completion/SKILL.md`](../core/skills/ct-verification-before-completion/SKILL.md)
7
7
 
8
8
  ## Overview
9
9
 
@@ -46,7 +46,15 @@ Test boundaries and unusual inputs explicitly:
46
46
  - **Concurrent access** -- simultaneous requests or operations
47
47
  - **Error paths** -- network failures, database errors, permission denied
48
48
 
49
- ### 6. Regression Check
49
+ ### 6. Security Check
50
+
51
+ Before completing work that touches dependencies, inputs, or external data:
52
+
53
+ - **Dependency audit** -- Run `bun audit` or `npm audit` and resolve critical/high vulnerabilities
54
+ - **Input validation** -- Verify user-facing inputs are validated at system boundaries (no SQL injection, XSS, command injection)
55
+ - **Secret exposure** -- Confirm no secrets, API keys, or credentials in committed code or logs
56
+
57
+ ### 7. Regression Check
50
58
 
51
59
  - Run related tests, not just the tests you wrote
52
60
  - Check integration points if you changed a shared utility, API contract, or database schema
@@ -66,6 +74,10 @@ When reporting completion, include concrete evidence:
66
74
  ### Type check
67
75
  - `tsc --noEmit`: 0 errors
68
76
 
77
+ ### Security
78
+ - `bun audit`: 0 vulnerabilities
79
+ - No secrets in committed files
80
+
69
81
  ### Manual verification
70
82
  - POST /api/auth/login with valid credentials: 200 + JWT token
71
83
  - POST /api/auth/login with wrong password: 401 + error message
@@ -3,7 +3,7 @@
3
3
  > Cloudflare D1 SQL database and KV cache patterns.
4
4
 
5
5
  **Type:** Stack Skill (requires `cloudflare` stack)
6
- **Source:** [`stacks/cloudflare/skills/cloudflare-d1-kv/SKILL.md`](../stacks/cloudflare/skills/cloudflare-d1-kv/SKILL.md)
6
+ **Source:** [`stacks/cloudflare/skills/ct-cloudflare-d1-kv/SKILL.md`](../stacks/cloudflare/skills/ct-cloudflare-d1-kv/SKILL.md)
7
7
  **Directory Mappings:** `src/db/`, `migrations/`
8
8
  **File Extensions:** `.sql`
9
9
 
@@ -98,6 +98,40 @@ cache:feed:{userId}:page:{pageNum}
98
98
 
99
99
  Invalidate on write operations by deleting the corresponding cache key after updating D1.
100
100
 
101
+ ## Hyperdrive (External Database Acceleration)
102
+
103
+ Hyperdrive accelerates connections to external PostgreSQL/MySQL databases from Workers by maintaining regional connection pools close to your database, eliminating per-request TCP/TLS handshake overhead.
104
+
105
+ ### Setup
106
+
107
+ ```toml
108
+ # wrangler.toml
109
+ [[hyperdrive]]
110
+ binding = "HYPERDRIVE"
111
+ id = "<hyperdrive-config-id>"
112
+ ```
113
+
114
+ ```typescript
115
+ // Access the connection string in your Worker
116
+ const sql = env.HYPERDRIVE.connectionString;
117
+ // Pass to your Postgres/MySQL client (e.g., node-postgres, drizzle)
118
+ ```
119
+
120
+ ### When to Use
121
+
122
+ | Scenario | Use |
123
+ |---|---|
124
+ | Simple data, edge-native | **D1** (serverless SQLite) |
125
+ | Read-heavy caching layer | **KV** (eventually consistent) |
126
+ | Full relational DB (Postgres/MySQL) | **Hyperdrive** + external DB |
127
+
128
+ ### Key Points
129
+
130
+ - Always use Hyperdrive when connecting to external databases from Workers
131
+ - Caches common read queries automatically, reducing origin load
132
+ - Connection pool size is configurable per Hyperdrive config (minimum 5 connections)
133
+ - Understands read vs write queries for intelligent caching
134
+
101
135
  ## Anti-patterns
102
136
 
103
137
  | Anti-pattern | Why it's wrong |
@@ -3,7 +3,7 @@
3
3
  > Typesafe-i18n internationalization patterns for SolidJS.
4
4
 
5
5
  **Type:** Stack Skill (requires `i18n-typesafe` stack)
6
- **Source:** [`stacks/i18n-typesafe/skills/i18n-typesafe/SKILL.md`](../stacks/i18n-typesafe/skills/i18n-typesafe/SKILL.md)
6
+ **Source:** [`stacks/i18n-typesafe/skills/ct-i18n-typesafe/SKILL.md`](../stacks/i18n-typesafe/skills/ct-i18n-typesafe/SKILL.md)
7
7
  **Directory Mappings:** `src/locales/`, `src/i18n/`
8
8
 
9
9
  ## Overview
@@ -3,7 +3,7 @@
3
3
  > Protocol Buffer definitions and code generation for frontend/backend contracts.
4
4
 
5
5
  **Type:** Stack Skill (requires `protobuf` stack)
6
- **Source:** [`stacks/protobuf/skills/protobuf-contracts/SKILL.md`](../stacks/protobuf/skills/protobuf-contracts/SKILL.md)
6
+ **Source:** [`stacks/protobuf/skills/ct-protobuf-contracts/SKILL.md`](../stacks/protobuf/skills/ct-protobuf-contracts/SKILL.md)
7
7
  **Directory Mappings:** `proto/`
8
8
  **File Extensions:** `.proto`
9
9
 
@@ -3,7 +3,7 @@
3
3
  > Rust WASM patterns for Cloudflare Workers with worker-rs.
4
4
 
5
5
  **Type:** Stack Skill (requires `rust-wasm` stack)
6
- **Source:** [`stacks/rust-wasm/skills/rust-wasm-patterns/SKILL.md`](../stacks/rust-wasm/skills/rust-wasm-patterns/SKILL.md)
6
+ **Source:** [`stacks/rust-wasm/skills/ct-rust-wasm-patterns/SKILL.md`](../stacks/rust-wasm/skills/ct-rust-wasm-patterns/SKILL.md)
7
7
  **Directory Mappings:** `worker/`, `worker/src/`
8
8
  **File Extensions:** `.rs`, `.toml`
9
9
 
@@ -88,7 +88,7 @@ Use `#[derive(Serialize, Deserialize)]` for request/response types. Parse reques
88
88
  crate-type = ["cdylib"]
89
89
 
90
90
  [dependencies]
91
- worker = "0.4"
91
+ worker = "0.5"
92
92
  serde = { version = "1", features = ["derive"] }
93
93
  serde_json = "1"
94
94
  console_error_panic_hook = "0.1"
@@ -3,7 +3,7 @@
3
3
  > SolidJS reactivity, signals, effects, and component patterns.
4
4
 
5
5
  **Type:** Stack Skill (requires `solidjs` stack)
6
- **Source:** [`stacks/solidjs/skills/solidjs-patterns/SKILL.md`](../stacks/solidjs/skills/solidjs-patterns/SKILL.md)
6
+ **Source:** [`stacks/solidjs/skills/ct-solidjs-patterns/SKILL.md`](../stacks/solidjs/skills/ct-solidjs-patterns/SKILL.md)
7
7
  **Directory Mappings:** `src/components/`, `src/hooks/`, `src/pages/`
8
8
  **File Extensions:** `.tsx`, `.jsx`
9
9
 
@@ -3,7 +3,7 @@
3
3
  > Type-safe CSS with vanilla-extract, sprinkles, and recipes.
4
4
 
5
5
  **Type:** Stack Skill (requires `vanilla-extract` stack)
6
- **Source:** [`stacks/vanilla-extract/skills/vanilla-extract-patterns/SKILL.md`](../stacks/vanilla-extract/skills/vanilla-extract-patterns/SKILL.md)
6
+ **Source:** [`stacks/vanilla-extract/skills/ct-vanilla-extract-patterns/SKILL.md`](../stacks/vanilla-extract/skills/ct-vanilla-extract-patterns/SKILL.md)
7
7
  **Directory Mappings:** `src/styles/`, `src/theme/`
8
8
  **File Extensions:** `.css.ts`
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-toolkit",
3
- "version": "0.1.9",
3
+ "version": "0.1.12",
4
4
  "description": "Reusable Claude Code configuration toolkit with stack-specific connectors",
5
5
  "type": "module",
6
6
  "bin": {
@@ -49,10 +49,10 @@
49
49
  "@types/bun": "latest",
50
50
  "husky": "^9.1.7",
51
51
  "lint-staged": "^16.4.0",
52
- "typescript": "^5.8.0"
52
+ "typescript": "^6.0.2"
53
53
  },
54
54
  "engines": {
55
- "bun": ">=1.0.0"
55
+ "bun": ">=1.3.0"
56
56
  },
57
57
  "module": "src/index.ts"
58
58
  }
@@ -74,6 +74,28 @@ Colon-separated hierarchical: `user:{id}`, `user:{id}:profile`, `cache:feed:{uid
74
74
  | Config | 5min | Needs fast propagation |
75
75
  | Public listings | 15min | Freshness vs load balance |
76
76
 
77
+ ## Hyperdrive (External Database Acceleration)
78
+
79
+ Hyperdrive accelerates connections to external PostgreSQL/MySQL databases from Workers by maintaining regional connection pools. Use it when D1 is insufficient and you need a full relational database.
80
+
81
+ ```toml
82
+ # wrangler.toml
83
+ [[hyperdrive]]
84
+ binding = "HYPERDRIVE"
85
+ id = "<hyperdrive-config-id>"
86
+ ```
87
+
88
+ ```typescript
89
+ const sql = env.HYPERDRIVE.connectionString;
90
+ // Pass to your Postgres/MySQL client (e.g., node-postgres, drizzle)
91
+ ```
92
+
93
+ Key points:
94
+ - Eliminates per-request TCP/TLS handshake overhead.
95
+ - Caches common read queries automatically.
96
+ - Always use Hyperdrive for external database connections from Workers.
97
+ - Connection pool size is configurable per Hyperdrive config.
98
+
77
99
  ## Anti-Patterns
78
100
 
79
101
  1. **Unbounded queries** -- Always LIMIT. D1 has 5MB response cap.