@softspark/ai-toolkit 3.0.2 → 3.1.1

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 (42) hide show
  1. package/AGENTS.md +13 -0
  2. package/CHANGELOG.md +35 -0
  3. package/README.md +25 -39
  4. package/app/.claude-plugin/plugin.json +1 -1
  5. package/app/skills/cpp-rules/SKILL.md +275 -0
  6. package/app/skills/csharp-rules/SKILL.md +282 -0
  7. package/app/skills/dart-rules/SKILL.md +299 -0
  8. package/app/skills/golang-rules/SKILL.md +262 -0
  9. package/app/skills/java-rules/SKILL.md +273 -0
  10. package/app/skills/kotlin-rules/SKILL.md +271 -0
  11. package/app/skills/medplum-rules/SKILL.md +271 -0
  12. package/app/skills/php-rules/SKILL.md +292 -0
  13. package/app/skills/python-rules/SKILL.md +257 -0
  14. package/app/skills/ruby-rules/SKILL.md +286 -0
  15. package/app/skills/rust-rules/SKILL.md +276 -0
  16. package/app/skills/swift-rules/SKILL.md +293 -0
  17. package/app/skills/typescript-rules/SKILL.md +249 -0
  18. package/benchmarks/ecosystem-doctor-snapshot.json +14 -14
  19. package/kb/history/completed/deep-coverage-v3-20260423.md +3 -3
  20. package/kb/history/completed/ecosystem-deep-sweep-20260423.md +1 -1
  21. package/kb/procedures/release-preparation-sop.md +4 -4
  22. package/kb/procedures/release-verification-sop.md +11 -12
  23. package/kb/reference/architecture-overview.md +1 -1
  24. package/kb/reference/global-install-model.md +29 -6
  25. package/kb/reference/language-rules.md +54 -18
  26. package/kb/reference/mcp-editor-compatibility.md +4 -3
  27. package/kb/reference/mcp-templates.md +3 -2
  28. package/kb/reference/supported-tools-registry.md +10 -8
  29. package/llms-full.txt +133 -58
  30. package/manifest.json +3 -3
  31. package/package.json +10 -3
  32. package/scripts/codex_skill_adapter.py +19 -3
  33. package/scripts/ecosystem_tools.json +7 -7
  34. package/scripts/generate_cline_rules.py +17 -8
  35. package/scripts/generate_codex_skills.py +33 -96
  36. package/scripts/generate_language_rules_skills.py +232 -0
  37. package/scripts/generate_roo_rules.py +11 -3
  38. package/scripts/install.py +6 -1
  39. package/scripts/install_steps/ai_tools.py +154 -51
  40. package/scripts/install_steps/install_state.py +14 -2
  41. package/scripts/install_steps/project_registry.py +38 -5
  42. package/scripts/mcp_editors.py +7 -0
@@ -0,0 +1,293 @@
1
+ ---
2
+ name: swift-rules
3
+ description: "Swift coding rules from ai-toolkit: coding-style, frameworks, patterns, security, testing. Triggers: .swift, Package.swift, .xcodeproj, SwiftUI, Combine, async/await, XCTest. Load when writing, reviewing, or editing Swift code."
4
+ effort: medium
5
+ user-invocable: false
6
+ allowed-tools: Read
7
+ ---
8
+
9
+ # Swift Rules
10
+
11
+ These rules come from `app/rules/swift/` in ai-toolkit. They cover
12
+ the project's standards for coding style, frameworks, patterns,
13
+ security, and testing in Swift. Apply them when writing or
14
+ reviewing Swift code.
15
+
16
+ # Swift Coding Style
17
+
18
+ ## Naming
19
+ - PascalCase: types, protocols, enums, struct, class.
20
+ - camelCase: functions, methods, properties, variables, enum cases.
21
+ - No prefixes: Swift has module namespacing (no `NS` or `UI` prefix for your types).
22
+ - Use descriptive names: `removeElement(at:)` not `remove(i:)`.
23
+ - Boolean properties read as assertions: `isEmpty`, `hasChildren`, `canSubmit`.
24
+
25
+ ## Types
26
+ - Prefer `struct` over `class` by default (value semantics, no reference cycles).
27
+ - Use `class` only when reference semantics or inheritance is required.
28
+ - Use `enum` with associated values for modeling finite states.
29
+ - Use `protocol` for defining capabilities. Prefer protocol composition.
30
+ - Use `typealias` for complex generic signatures for readability.
31
+
32
+ ## Optionals
33
+ - Use `guard let` for early exit on nil. Use `if let` for conditional binding.
34
+ - Never force-unwrap (`!`) unless failure is a programming error.
35
+ - Use `??` for default values: `let name = user?.name ?? "Unknown"`.
36
+ - Use optional chaining: `user?.address?.city`.
37
+ - Use `map` / `flatMap` on optionals for transformations.
38
+
39
+ ## Properties
40
+ - Use `let` by default. Use `var` only when mutation is required.
41
+ - Use computed properties for derived values: `var fullName: String { ... }`.
42
+ - Use property observers (`willSet`, `didSet`) for side effects on change.
43
+ - Use `lazy var` for expensive initialization deferred until first access.
44
+ - Use `@Published` (Combine) for observable properties in classes.
45
+
46
+ ## Functions
47
+ - Use argument labels for clarity: `func move(from source: Int, to destination: Int)`.
48
+ - Omit argument labels when the function name makes the role clear: `func contains(_ element: T)`.
49
+ - Use default parameter values instead of multiple overloads.
50
+ - Use `throws` / `async throws` for fallible operations.
51
+ - Use trailing closure syntax for the last closure parameter.
52
+
53
+ ## Access Control
54
+ - Use `private` for implementation details. Use `fileprivate` sparingly.
55
+ - Use `internal` (default) for module-scoped access.
56
+ - Use `public` for framework API. Use `open` only when subclassing is intended.
57
+ - Prefer `private(set)` for read-only external access with internal mutation.
58
+
59
+ ## Formatting
60
+ - Use SwiftLint for automated style enforcement.
61
+ - Use SwiftFormat for automated code formatting.
62
+ - Commit `.swiftlint.yml` and `.swiftformat` to the repository.
63
+ - Max line length: 120 characters (SwiftLint default).
64
+ - Use trailing commas in multi-line arrays and dictionaries.
65
+
66
+ # Swift Frameworks
67
+
68
+ ## SwiftUI
69
+ - Use `VStack`, `HStack`, `ZStack` for layout composition.
70
+ - Use `List` with `ForEach` for dynamic content. Use `LazyVStack` for large lists.
71
+ - Use `NavigationStack` (iOS 16+) with `navigationDestination(for:)` for type-safe navigation.
72
+ - Use `.task { }` modifier for async data loading tied to view lifecycle.
73
+ - Use `@ViewBuilder` for conditional view composition in custom containers.
74
+ - Use `PreviewProvider` or `#Preview` macro for rapid UI iteration.
75
+
76
+ ## UIKit (Legacy / Hybrid)
77
+ - Use `UIHostingController` to embed SwiftUI views in UIKit.
78
+ - Use `UIViewRepresentable` to wrap UIKit views in SwiftUI.
79
+ - Use Auto Layout with constraints or `UIStackView` for layout.
80
+ - Use `UICollectionViewCompositionalLayout` for complex collection layouts.
81
+ - Use `Coordinator` pattern for delegate-based UIKit interop in SwiftUI.
82
+
83
+ ## Combine
84
+ - Use `Publisher` / `Subscriber` for reactive data streams.
85
+ - Use `sink` for subscribing. Store cancellables in `Set<AnyCancellable>`.
86
+ - Use `map`, `filter`, `flatMap`, `combineLatest` for stream transformation.
87
+ - Use `@Published` on class properties for automatic publisher generation.
88
+ - Prefer `AsyncSequence` (async/await) over Combine for new code.
89
+
90
+ ## Swift Data
91
+ - Use `@Model` macro for persistent model definitions.
92
+ - Use `@Query` in SwiftUI views for automatic fetching and observation.
93
+ - Use `ModelContext` for CRUD operations: `context.insert(item)`, `context.delete(item)`.
94
+ - Use `#Predicate` macro for type-safe query filtering.
95
+ - Use `ModelConfiguration` for custom store locations and migration options.
96
+
97
+ ## Core Data (Legacy)
98
+ - Use `NSPersistentContainer` for stack setup.
99
+ - Use `NSFetchRequest` with `NSPredicate` for querying.
100
+ - Use `performBackgroundTask` for background context operations.
101
+ - Use lightweight migrations for schema changes when possible.
102
+ - Prefer SwiftData for new projects (iOS 17+).
103
+
104
+ ## Vapor (Server-Side)
105
+ - Use `routes.get("users")` for route definitions.
106
+ - Use `Content` protocol for request/response body codable conformance.
107
+ - Use Fluent ORM with migrations for database access.
108
+ - Use middleware for authentication, CORS, and error handling.
109
+ - Use `async`/`await` natively (Vapor 4+ is fully async).
110
+
111
+ ## Networking
112
+ - Use `URLSession` with `async/await` for HTTP requests.
113
+ - Use `Codable` with `JSONDecoder` for response parsing.
114
+ - Use `URLCache` and `ETag` for response caching.
115
+ - Set `timeoutIntervalForRequest` on `URLSessionConfiguration`.
116
+ - Use `TaskLocal` for request-scoped values (tracing, auth context).
117
+
118
+ ## Package Management
119
+ - Use Swift Package Manager (SPM) for dependency management.
120
+ - Define dependencies in `Package.swift` with exact version or version ranges.
121
+ - Use `Package.resolved` committed to the repository for reproducible builds.
122
+ - Prefer SPM over CocoaPods/Carthage for new projects.
123
+
124
+ # Swift Patterns
125
+
126
+ ## Error Handling
127
+ - Use `enum AppError: Error` for typed, exhaustive error handling.
128
+ - Use `throws` functions with `do-catch` for recoverable errors.
129
+ - Use `Result<Success, Failure>` for asynchronous error propagation.
130
+ - Use `try?` for optional conversion. Use `try!` only in tests or guaranteed paths.
131
+ - Add `LocalizedError` conformance for user-facing error messages.
132
+
133
+ ## Protocol-Oriented Design
134
+ - Define capabilities as protocols: `protocol Fetchable { func fetch() async throws -> Data }`.
135
+ - Use protocol extensions for default implementations.
136
+ - Use protocol composition: `func process(_ item: Sendable & Codable)`.
137
+ - Use associated types for generic protocols: `associatedtype Output`.
138
+ - Use `some Protocol` (opaque types) for return types hiding concrete implementations.
139
+
140
+ ## Async/Await
141
+ - Use `async` functions for all asynchronous operations.
142
+ - Use `async let` for concurrent, independent operations.
143
+ - Use `TaskGroup` for dynamic parallelism with collected results.
144
+ - Use `Task { }` to bridge sync to async. Avoid `.task { }` in views for complex logic.
145
+ - Use `withThrowingTaskGroup` for concurrent operations that can fail.
146
+
147
+ ## Actors
148
+ - Use `actor` for thread-safe mutable state (replaces manual locks).
149
+ - Use `@MainActor` for UI-related state and methods.
150
+ - Use `nonisolated` for actor methods that do not access mutable state.
151
+ - Use `GlobalActor` for custom isolation domains.
152
+ - Minimize `await` calls on actors to reduce suspension points.
153
+
154
+ ## SwiftUI Patterns
155
+ - Use `@State` for view-local mutable state.
156
+ - Use `@Binding` for child-to-parent state communication.
157
+ - Use `@Observable` (Observation framework) for model objects (preferred over `@ObservedObject`).
158
+ - Use `@Environment` for dependency injection: `@Environment(\.modelContext)`.
159
+ - Use `ViewModifier` for reusable view transformations.
160
+ - Extract subviews into separate structs for readability and performance.
161
+
162
+ ## Codable
163
+ - Use `Codable` for JSON serialization/deserialization.
164
+ - Use `CodingKeys` enum for custom key mapping.
165
+ - Use `JSONDecoder` with `.convertFromSnakeCase` for API compatibility.
166
+ - Use `@propertyWrapper` for custom decoding strategies (e.g., date formats).
167
+ - Use `nestedContainer` for flattening nested JSON structures.
168
+
169
+ ## Dependency Injection
170
+ - Use initializer injection for required dependencies.
171
+ - Use `@Environment` in SwiftUI for framework-provided values.
172
+ - Use `swift-dependencies` library for testable, controlled dependency management.
173
+ - Use `@Dependency(\.apiClient) var apiClient` for automatic resolution.
174
+
175
+ ## Anti-Patterns
176
+ - Force-unwrapping optionals: use `guard let` or `??`.
177
+ - Massive view controllers/views: split into subviews and view models.
178
+ - Reference cycles: use `[weak self]` in closures capturing `self`.
179
+ - Blocking the main thread: use `Task` or `DispatchQueue.global()`.
180
+ - Stringly-typed APIs: use enums, protocols, and strong types.
181
+
182
+ # Swift Security
183
+
184
+ ## Keychain
185
+ - Use Keychain Services for storing passwords, tokens, and cryptographic keys.
186
+ - Use `kSecAttrAccessibleWhenUnlockedThisDeviceOnly` for sensitive items.
187
+ - Use `KeychainAccess` or similar wrapper libraries for cleaner API.
188
+ - Never store secrets in `UserDefaults` (unencrypted plist on disk).
189
+ - Delete keychain items on user logout.
190
+
191
+ ## App Transport Security (ATS)
192
+ - Use HTTPS for all network connections. ATS enforces this by default.
193
+ - Never add blanket `NSAllowsArbitraryLoads` exception.
194
+ - Use per-domain exceptions only when connecting to legacy servers.
195
+ - Implement certificate pinning for high-security connections.
196
+ - Validate server certificates in `URLSessionDelegate` for custom pinning.
197
+
198
+ ## Input Validation
199
+ - Validate all user input before processing or displaying.
200
+ - Use `NSRegularExpression` or Swift Regex for pattern validation.
201
+ - Sanitize strings before using in URL construction, SQL, or HTML.
202
+ - Validate deep link URL parameters before navigation.
203
+ - Limit input lengths in `UITextField` / `TextField` to prevent abuse.
204
+
205
+ ## Data Protection
206
+ - Use `Data Protection` API: set `FileProtectionType.complete` on sensitive files.
207
+ - Use `CryptoKit` for hashing (`SHA256`), encryption (`AES.GCM`), and signing.
208
+ - Use `SecureEnclave` for hardware-backed key storage on supported devices.
209
+ - Zero sensitive data in memory after use: `withUnsafeMutableBytes { $0.initializeMemory(as: UInt8.self, repeating: 0) }`.
210
+ - Use `@Sendable` closures to prevent data races in concurrent access.
211
+
212
+ ## Authentication
213
+ - Use `AuthenticationServices` for Sign in with Apple and passkeys.
214
+ - Use `LocalAuthentication` (Face ID / Touch ID) for biometric auth.
215
+ - Store authentication tokens in Keychain, not in memory or UserDefaults.
216
+ - Use short-lived access tokens with refresh token rotation.
217
+ - Implement session timeout for inactive users.
218
+
219
+ ## Network Security
220
+ - Use `URLSession` with certificate pinning for sensitive API calls.
221
+ - Validate response `Content-Type` headers before parsing.
222
+ - Use `Codable` for structured deserialization (prevents injection).
223
+ - Set request timeouts to prevent hanging connections.
224
+ - Do not log request/response bodies containing sensitive data.
225
+
226
+ ## Code Security
227
+ - Use `[weak self]` in closures to prevent retain cycles and memory leaks.
228
+ - Use `@Sendable` and actor isolation for thread-safe concurrent code.
229
+ - Avoid `UnsafePointer` / `UnsafeMutablePointer` unless absolutely necessary.
230
+ - Use `#if DEBUG` guards for debug-only code. Never ship debug features.
231
+ - Enable Xcode hardened runtime for macOS apps.
232
+
233
+ ## Dependency Security
234
+ - Audit SPM dependencies before adding. Check maintainer reputation.
235
+ - Pin dependency versions in `Package.resolved`.
236
+ - Review `Package.swift` of dependencies for unusual build plugins.
237
+ - Prefer dependencies with active security response and disclosure processes.
238
+ - Minimize third-party dependencies for security-critical modules.
239
+
240
+ # Swift Testing
241
+
242
+ ## Framework
243
+ - Use Swift Testing (`import Testing`) for new projects (Swift 5.10+).
244
+ - Use XCTest for existing projects and UIKit-based UI tests.
245
+ - Use swift-snapshot-testing for visual regression testing.
246
+ - Use swift-dependencies for controlled dependency injection in tests.
247
+
248
+ ## File Naming
249
+ - Test files: `FooTests.swift` in `Tests/` target.
250
+ - Mirror source module structure in test target.
251
+ - Use `@Test` attribute (Swift Testing) or `test` prefix (XCTest) for test methods.
252
+ - Use `@Suite` (Swift Testing) for test grouping.
253
+
254
+ ## Structure (Swift Testing)
255
+ - Use `@Test("description")` for individual test cases.
256
+ - Use `@Test(arguments: [...])` for parameterized tests.
257
+ - Use `#expect(condition)` for assertions. Use `#require(condition)` for preconditions.
258
+ - Use `#expect(throws: FooError.self) { try riskyOperation() }` for error testing.
259
+ - Use `@Suite` structs for grouping. Properties serve as shared setup.
260
+
261
+ ## Structure (XCTest)
262
+ - Use `setUp()` / `tearDown()` for per-test initialization and cleanup.
263
+ - Use `setUpWithError()` for throwing setup code.
264
+ - Use `XCTAssertEqual`, `XCTAssertTrue`, `XCTAssertNil` for assertions.
265
+ - Use `XCTAssertThrowsError` for exception testing.
266
+ - Use `expectation(description:)` + `wait(for:timeout:)` for async assertions.
267
+
268
+ ## Async Testing
269
+ - Use `async` test functions: `@Test func fetchUser() async throws { ... }`.
270
+ - Use `confirmation()` (Swift Testing) for event-based async assertions.
271
+ - XCTest: use `XCTestExpectation` with `fulfillment()` for callback-based async.
272
+ - Test `AsyncSequence` with `for await` loops and assertion on collected values.
273
+
274
+ ## Mocking
275
+ - Use protocol-based dependency injection for testability.
276
+ - Create manual mock implementations conforming to protocols.
277
+ - Use `swift-dependencies` for environment-controlled dependency overrides.
278
+ - Use `@Dependency` property wrapper for automatic mock injection in tests.
279
+ - Avoid mocking frameworks when protocol mocks are straightforward.
280
+
281
+ ## UI Testing (XCTest)
282
+ - Use `XCUIApplication` for UI automation tests.
283
+ - Use accessibility identifiers for reliable element lookup.
284
+ - Use `app.buttons["Submit"].tap()` for interaction simulation.
285
+ - Use `waitForExistence(timeout:)` for async UI element appearance.
286
+ - Keep UI tests focused on critical user flows only (slow to run).
287
+
288
+ ## Best Practices
289
+ - Test behavior through public API. Avoid `@testable import` when possible.
290
+ - Use `@testable import Module` only when testing internal members is necessary.
291
+ - Use `withDependencies { }` for scoped dependency overrides in tests.
292
+ - Test on multiple platforms (iOS, macOS) when shipping cross-platform.
293
+ - Run tests with `swift test` or `xcodebuild test` in CI.
@@ -0,0 +1,249 @@
1
+ ---
2
+ name: typescript-rules
3
+ description: "TypeScript/JavaScript coding rules from ai-toolkit: coding-style, frameworks, patterns, security, testing. Triggers: .ts, .tsx, .js, .jsx, package.json, tsconfig.json, React, Next.js, Vue, Vite, Vitest, Jest, ESLint. Load when writing, reviewing, or editing TypeScript/JavaScript code."
4
+ effort: medium
5
+ user-invocable: false
6
+ allowed-tools: Read
7
+ ---
8
+
9
+ # TypeScript/JavaScript Rules
10
+
11
+ These rules come from `app/rules/typescript/` in ai-toolkit. They cover
12
+ the project's standards for coding style, frameworks, patterns,
13
+ security, and testing in TypeScript/JavaScript. Apply them when writing or
14
+ reviewing TypeScript/JavaScript code.
15
+
16
+ # TypeScript Coding Style
17
+
18
+ ## Strict Mode
19
+ - Always use `strict: true` in tsconfig.json.
20
+ - Never use `any` -- use `unknown` + type guards instead.
21
+ - Prefer `interface` over `type` for object shapes (extendable).
22
+ - Use `as const` for literal types and readonly tuples.
23
+
24
+ ## Naming
25
+ - PascalCase: types, interfaces, enums, classes, components.
26
+ - camelCase: variables, functions, methods, properties.
27
+ - UPPER_SNAKE: constants, env vars.
28
+ - Prefix interfaces with `I` only if project convention requires it.
29
+
30
+ ## Functions
31
+ - Prefer arrow functions for callbacks and inline.
32
+ - Use `function` declarations for hoisted, named functions.
33
+ - Max 3 parameters -- use options object beyond that.
34
+ - Always type return values for public/exported functions.
35
+
36
+ ## Imports
37
+ - Group: node builtins, external, internal, relative.
38
+ - Use `type` imports: `import type { Foo } from './foo'`.
39
+ - No barrel exports unless at package boundary.
40
+ - Prefer named exports over default exports.
41
+
42
+ ## Types
43
+ - Use discriminated unions over class hierarchies for state.
44
+ - Use `readonly` for arrays and objects that should not be mutated.
45
+ - Use `satisfies` operator to validate types without widening.
46
+ - Prefer `unknown` over `any` at API boundaries.
47
+ - Use template literal types for string patterns.
48
+
49
+ ## Avoid
50
+ - `enum` -- use `as const` objects or union types.
51
+ - `namespace` -- use ES modules.
52
+ - `private` keyword -- use `#` private fields.
53
+ - Non-null assertion `!` -- use proper type narrowing.
54
+ - `as` type casting -- use type guards and narrowing.
55
+
56
+ ## Configuration
57
+ - Enable `noUncheckedIndexedAccess` for safer array/object access.
58
+ - Enable `exactOptionalPropertyTypes` to distinguish `undefined` from missing.
59
+ - Use `moduleResolution: "bundler"` for modern projects.
60
+ - Set `isolatedModules: true` for bundler compatibility.
61
+
62
+ # TypeScript Frameworks
63
+
64
+ ## React
65
+ - Use function components exclusively. No class components.
66
+ - Colocate state with the component that owns it. Lift only when needed.
67
+ - Use `useCallback` and `useMemo` only when profiling shows a need.
68
+ - Use `React.lazy()` + Suspense for code-splitting routes.
69
+ - Avoid prop drilling past 2 levels -- use Context or state management.
70
+
71
+ ## Next.js (App Router)
72
+ - Default to Server Components. Add `"use client"` only when needed.
73
+ - Use Server Actions for mutations. Never expose internal APIs to client.
74
+ - Use `loading.tsx` and `error.tsx` for streaming and error boundaries.
75
+ - Fetch data in Server Components, not in useEffect on client.
76
+ - Use `revalidatePath` / `revalidateTag` for cache invalidation.
77
+
78
+ ## Express / Fastify / Hono
79
+ - Use layered architecture: route -> controller -> service -> repository.
80
+ - Validate request body/params/query with Zod middleware.
81
+ - Centralize error handling in a single error middleware.
82
+ - Use async route handlers with proper error forwarding.
83
+ - Return consistent response shapes: `{ data }` or `{ error }`.
84
+
85
+ ## State Management
86
+ - Use Zustand or Jotai for client state. Redux only for complex existing apps.
87
+ - Use TanStack Query (React Query) for server state.
88
+ - Separate server state (fetched data) from client state (UI state).
89
+ - Never duplicate server data in client state stores.
90
+
91
+ ## ORM / Database
92
+ - Use Drizzle for new projects (SQL-like, type-safe, lightweight).
93
+ - Use Prisma for rapid prototyping (schema-first, great DX).
94
+ - Always use migrations. Never modify schema manually in production.
95
+ - Use transactions for multi-table operations.
96
+
97
+ ## Node.js Runtime
98
+ - Use `node:` prefix for built-in modules: `import { readFile } from 'node:fs/promises'`.
99
+ - Prefer `fetch` (built-in since Node 18) over axios/node-fetch.
100
+ - Use `structuredClone()` for deep cloning.
101
+ - Set `"type": "module"` in package.json for ESM.
102
+
103
+ ## Monorepo
104
+ - Use Turborepo or Nx for monorepo orchestration.
105
+ - Share types via internal packages, not copy-paste.
106
+ - Use workspace protocols: `"@org/shared": "workspace:*"`.
107
+
108
+ # TypeScript Patterns
109
+
110
+ ## Error Handling
111
+ - Use Result type pattern: `{ success: true; data: T } | { success: false; error: E }`.
112
+ - Use Zod `.safeParse()` for validation -- returns typed result, never throws.
113
+ - Create domain-specific error classes extending `Error` with error codes.
114
+ - Centralize error handling in middleware, not in each handler.
115
+ - Never catch errors silently. Log or rethrow with context.
116
+
117
+ ## Discriminated Unions
118
+ - Use discriminated unions for state machines and polymorphic data.
119
+ - Always include a `type` or `kind` literal field as discriminant.
120
+ - Use `switch` with exhaustive checking (`never` in default) on unions.
121
+ - Prefer unions over optional fields for mutually exclusive states.
122
+
123
+ ## Async Patterns
124
+ - Use `async/await` everywhere. Never use raw `.then()` chains.
125
+ - Use `Promise.all()` for independent concurrent operations.
126
+ - Use `Promise.allSettled()` when some failures are acceptable.
127
+ - Implement cancellation with `AbortController` for long operations.
128
+ - Wrap callbacks in Promises at the boundary, then use async/await.
129
+
130
+ ## Validation
131
+ - Validate at API boundaries with Zod, Valibot, or ArkType.
132
+ - Derive TypeScript types from schemas: `z.infer<typeof Schema>`.
133
+ - Never trust runtime data to match TypeScript types without validation.
134
+ - Use branded types for domain primitives: `UserId`, `Email`, `Slug`.
135
+
136
+ ## Dependency Injection
137
+ - Use constructor injection for services and repositories.
138
+ - Accept interfaces, not concrete classes, in constructors.
139
+ - Use factory functions for creating configured instances.
140
+ - Avoid service locator pattern and global singletons.
141
+
142
+ ## Immutability
143
+ - Use `readonly` on interface properties by default.
144
+ - Use `Readonly<T>`, `ReadonlyArray<T>` for function parameters.
145
+ - Use `Object.freeze()` only for runtime safety in config objects.
146
+ - Prefer spread/map/filter over mutating methods (push, splice).
147
+
148
+ ## Type Guards
149
+ - Use `is` return type for custom type guards: `(x: unknown): x is User`.
150
+ - Use `in` operator for discriminating object shapes.
151
+ - Prefer `satisfies` over `as` for type validation without casting.
152
+ - Use assertion functions (`asserts x is T`) for preconditions.
153
+
154
+ # TypeScript Security
155
+
156
+ ## Input Validation
157
+ - Validate ALL request data with Zod/Valibot at API boundary.
158
+ - Use `.strip()` / `.strict()` to reject unexpected fields.
159
+ - Validate URL params and query strings, not just request bodies.
160
+ - Never pass raw user input to `eval()`, `Function()`, or template literals in SQL.
161
+
162
+ ## XSS Prevention
163
+ - Use framework auto-escaping (React JSX, Angular templates).
164
+ - Never use `dangerouslySetInnerHTML` without DOMPurify sanitization.
165
+ - Sanitize user content before storing, not just before rendering.
166
+ - Set CSP headers: `default-src 'self'; script-src 'self'`.
167
+
168
+ ## Authentication
169
+ - Use `httpOnly`, `secure`, `sameSite: 'strict'` for auth cookies.
170
+ - Implement CSRF protection for cookie-based auth (double-submit or token).
171
+ - Use short-lived JWTs (15min) with refresh token rotation.
172
+ - Validate JWT signature, expiration, issuer, and audience on every request.
173
+
174
+ ## SQL / NoSQL Injection
175
+ - Use parameterized queries with Drizzle/Prisma/TypeORM. Never concatenate.
176
+ - For raw queries, use tagged template literals: `sql\`SELECT * FROM users WHERE id = ${id}\``.
177
+ - Validate and cast IDs to expected types (UUID, integer) before queries.
178
+ - Use ORM query builders for dynamic filters.
179
+
180
+ ## Dependency Security
181
+ - Run `npm audit` in CI. Fail on high/critical vulnerabilities.
182
+ - Use `npm audit signatures` to verify package provenance.
183
+ - Pin exact versions with lockfile. Review lockfile changes in PRs.
184
+ - Avoid packages with postinstall scripts unless trusted.
185
+
186
+ ## Secrets
187
+ - Use `process.env` with Zod validation for env vars.
188
+ - Never import `.env` files in production -- use platform env injection.
189
+ - Never log `req.headers.authorization` or session tokens.
190
+ - Use `crypto.timingSafeEqual()` for comparing secrets.
191
+
192
+ ## Server Hardening
193
+ - Set security headers: HSTS, X-Content-Type-Options, X-Frame-Options.
194
+ - Use `helmet` middleware in Express, built-in security in Fastify.
195
+ - Implement rate limiting on all endpoints (`express-rate-limit`, `@fastify/rate-limit`).
196
+ - Disable `X-Powered-By` header. Do not expose server technology.
197
+
198
+ ## File Uploads
199
+ - Validate file type by magic bytes, not just extension or MIME type.
200
+ - Set maximum file size limits on the server.
201
+ - Store uploads outside the web root. Serve through a proxy with CDN.
202
+ - Generate random filenames. Never use user-provided filenames for storage.
203
+
204
+ # TypeScript Testing
205
+
206
+ ## Framework
207
+ - Use Vitest for new projects (faster, native ESM, TypeScript-first).
208
+ - Use Jest only for existing projects already using it.
209
+ - Use Playwright for E2E browser testing.
210
+ - Use Supertest or built-in fetch for API integration tests.
211
+
212
+ ## File Naming
213
+ - Test files: `*.test.ts` or `*.spec.ts` colocated with source.
214
+ - Test utilities: `tests/helpers/` or `tests/utils/`.
215
+ - Fixtures: `tests/fixtures/` with typed factory functions.
216
+
217
+ ## Structure
218
+ - Use `describe` for grouping by function/class/feature.
219
+ - Use `it` with behavior descriptions: `it('returns 404 when user not found')`.
220
+ - Avoid deeply nested `describe` blocks (max 2 levels).
221
+ - Use `beforeEach` for setup, avoid `beforeAll` for mutable state.
222
+
223
+ ## Type-Safe Mocking
224
+ - Use `vi.fn()` with type parameters: `vi.fn<[string], Promise<User>>()`.
225
+ - Use `vi.mock()` for module-level mocking.
226
+ - Prefer dependency injection over module mocking for testability.
227
+ - Use `vi.spyOn()` for partial mocks on existing objects.
228
+
229
+ ## React/Component Testing
230
+ - Use React Testing Library. Query by role, label, text -- not test IDs.
231
+ - Use `userEvent` over `fireEvent` for realistic user interactions.
232
+ - Test behavior and rendered output, not component internals.
233
+ - Use `renderHook` for testing custom hooks in isolation.
234
+
235
+ ## Assertions
236
+ - Use `expect().toBe()` for primitives, `expect().toEqual()` for objects.
237
+ - Use `expect().toMatchInlineSnapshot()` for complex output verification.
238
+ - Avoid `toBeTruthy/toBeFalsy` -- use specific matchers.
239
+ - Use `expect().rejects.toThrow()` for async error testing.
240
+
241
+ ## Async Testing
242
+ - Always `await` async operations. Never use `done` callback.
243
+ - Use `vi.useFakeTimers()` for timer-dependent code.
244
+ - Use `waitFor` from Testing Library for async DOM updates.
245
+
246
+ ## Performance
247
+ - Run tests in parallel (Vitest default). Isolate state to enable this.
248
+ - Use `vi.mock()` for heavy dependencies (DB, network) in unit tests.
249
+ - Keep unit test suite under 30 seconds.
@@ -1,5 +1,5 @@
1
1
  {
2
- "last_run": "2026-04-24T08:04:02Z",
2
+ "last_run": "2026-04-28T09:44:52Z",
3
3
  "schema_version": 1,
4
4
  "tools": {
5
5
  "aider": {
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "augment": {
27
- "docs_hash": "5754553b0e436fd7",
27
+ "docs_hash": "7e632fc04e405f60",
28
28
  "headings": [
29
29
  "Agent",
30
30
  "Code Completions",
@@ -57,7 +57,7 @@
57
57
  }
58
58
  },
59
59
  "claude-code": {
60
- "docs_hash": "0c111b1b1f28960d",
60
+ "docs_hash": "e51d7d44c72cd522",
61
61
  "headings": [
62
62
  "Claude Code overview",
63
63
  "\u200bGet started",
@@ -102,10 +102,10 @@
102
102
  "slash command": true,
103
103
  "sub-agent": true
104
104
  },
105
- "version": "2.1.119 (Claude Code)"
105
+ "version": "2.1.121 (Claude Code)"
106
106
  },
107
107
  "cline": {
108
- "docs_hash": "17c24d27216f70cf",
108
+ "docs_hash": "0c69984492abf906",
109
109
  "headings": [
110
110
  "Cline CLI",
111
111
  "Cline Documentation",
@@ -135,7 +135,7 @@
135
135
  }
136
136
  },
137
137
  "codex-cli": {
138
- "docs_hash": "7a7f5cdf9411c5e2",
138
+ "docs_hash": "9e188e7e454523b6",
139
139
  "headings": [
140
140
  "About",
141
141
  "Contributing",
@@ -154,7 +154,7 @@
154
154
  "Packages 0",
155
155
  "Provide feedback",
156
156
  "Quickstart",
157
- "Releases 735",
157
+ "Releases 744",
158
158
  "Repository files navigation",
159
159
  "Resources",
160
160
  "Saved searches",
@@ -168,7 +168,7 @@
168
168
  "openai/codex"
169
169
  ],
170
170
  "markers": {
171
- ".codex/skills": true,
171
+ ".agents/skills": false,
172
172
  "AGENTS.md": true,
173
173
  "config.toml": false,
174
174
  "hook event: PermissionRequest": false,
@@ -184,10 +184,10 @@
184
184
  "mcp_servers": false,
185
185
  "sandbox": true
186
186
  },
187
- "version": "codex-cli 0.124.0"
187
+ "version": "codex-cli 0.125.0"
188
188
  },
189
189
  "cursor": {
190
- "docs_hash": "a94b8e8f685b0831",
190
+ "docs_hash": "56983669e33487e2",
191
191
  "headings": [],
192
192
  "markers": {
193
193
  ".cursor/rules": false,
@@ -203,7 +203,7 @@
203
203
  }
204
204
  },
205
205
  "gemini-cli": {
206
- "docs_hash": "9415ea08e344013d",
206
+ "docs_hash": "fa8989b65df2bb73",
207
207
  "headings": [
208
208
  "Breadcrumbs",
209
209
  "Directory actions",
@@ -242,7 +242,7 @@
242
242
  }
243
243
  },
244
244
  "github-copilot": {
245
- "docs_hash": "8bcd2db0db925807",
245
+ "docs_hash": "c2100e9dca8dce0d",
246
246
  "headings": [
247
247
  "About Copilot auto model selection",
248
248
  "About Copilot integrations",
@@ -290,7 +290,7 @@
290
290
  }
291
291
  },
292
292
  "opencode": {
293
- "docs_hash": "760fbf466036892f",
293
+ "docs_hash": "5c0f3f9c9b031f49",
294
294
  "headings": [
295
295
  "Add features",
296
296
  "Ask questions",
@@ -351,7 +351,7 @@
351
351
  }
352
352
  },
353
353
  "windsurf": {
354
- "docs_hash": "81d0aafbf97b18c8",
354
+ "docs_hash": "9cadd867b0cec6da",
355
355
  "headings": [
356
356
  "Advanced",
357
357
  "App Deploys",
@@ -33,7 +33,7 @@ Definition of "100% coverage" chosen: **each editor works at 100% of its native
33
33
 
34
34
  | # | Decision | Rule |
35
35
  |---|----------|------|
36
- | 1 | Skill propagation | `.claude/skills/` canonical. Cursor/Windsurf/opencode → compat-read (nothing). Augment/Gemini/Antigravity → **pointer skill** (1 file per editor). Codex → opt-in `--codex-skills` flag emits full mirror |
36
+ | 1 | Skill propagation | `.claude/skills/` canonical. Cursor/Windsurf/opencode → compat-read (nothing). Augment/Gemini/Antigravity → **pointer skill** (1 file per editor). Codex → native `.agents/skills/` mirror |
37
37
  | 2 | Global writes | Only `~/.claude/`. Cursor/Windsurf/opencode get global coverage via compat-read. Augment/Gemini/Roo require `--local` |
38
38
  | 3 | Surface activation | **`--profile full`** turns on every native surface. `standard` stays close to today's defaults but adds niepodważalne wypełnienia (Copilot wiring + Gemini hooks). `minimal` unchanged |
39
39
  | 4 | Default behavior | `--editors <name>` alone uses `standard`. Users who want the full stack pass `--profile full` |
@@ -77,13 +77,13 @@ Definition of "100% coverage" chosen: **each editor works at 100% of its native
77
77
  **Owned files**
78
78
  - New: `scripts/generate_gemini_skills.py` (`.gemini/skills/ai-toolkit-skill-catalogue/SKILL.md` — pointer)
79
79
  - New: `scripts/generate_augment_skills.py` (`.augment/skills/ai-toolkit-skill-catalogue/SKILL.md` — pointer)
80
- - New: `scripts/generate_codex_skills.py` (full mirror to `.codex/skills/<name>/SKILL.md` — gated by `--codex-skills` flag)
80
+ - New: `scripts/generate_codex_skills.py` (Codex-native mirror to `.agents/skills/<name>/SKILL.md`)
81
81
  - New: `tests/test_skills_native.bats` (≥15 tests)
82
82
 
83
83
  **Must-haves**
84
84
  - Pointer pattern same as Antigravity: 1 file per editor referencing `~/.claude/skills/<name>` and listing the catalogue.
85
85
  - Codex mirror respects `user-invocable: false` (knowledge skills stay, task skills stay — Codex reads them all).
86
- - `--codex-skills` must be opt-in; default OFF.
86
+ - Codex skills use the upstream `.agents/skills` discovery path.
87
87
 
88
88
  ### Bucket 4 — Install wiring + profile full + docs (devops-implementer)
89
89