@hdwebsoft/hdcode-ai-darwin-x64 0.0.6 → 0.0.8

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 (55) hide show
  1. package/bin/hdcode +0 -0
  2. package/bin/index.js.map +1 -1
  3. package/bin/worker.js.map +1 -1
  4. package/package.json +1 -1
  5. package/resources/agents/finder.md +1 -1
  6. package/resources/agents/mermaid.md +1 -1
  7. package/resources/opencode.json +2 -1
  8. package/resources/skills/hd-code-review/CODING_STANDARDS.md +14 -114
  9. package/resources/skills/hd-code-review/REVIEW_STANDARDS.md +76 -0
  10. package/resources/skills/hd-code-review/SKILL.md +314 -90
  11. package/resources/skills/hd-code-review/reference/review-checklist.md +104 -101
  12. package/resources/skills/hd-code-review/reference/stacks/apex.md +49 -0
  13. package/resources/skills/hd-code-review/reference/stacks/aura.md +39 -0
  14. package/resources/skills/hd-code-review/reference/stacks/cakephp.md +50 -0
  15. package/resources/skills/hd-code-review/reference/stacks/django.md +53 -0
  16. package/resources/skills/hd-code-review/reference/stacks/dotnet.md +52 -0
  17. package/resources/skills/hd-code-review/reference/stacks/expo.md +39 -0
  18. package/resources/skills/hd-code-review/reference/stacks/flutter.md +48 -0
  19. package/resources/skills/hd-code-review/reference/stacks/go.md +51 -0
  20. package/resources/skills/hd-code-review/reference/stacks/laravel.md +56 -0
  21. package/resources/skills/hd-code-review/reference/stacks/lwc.md +49 -0
  22. package/resources/skills/hd-code-review/reference/stacks/nodejs.md +51 -0
  23. package/resources/skills/hd-code-review/reference/stacks/php.md +52 -0
  24. package/resources/skills/hd-code-review/reference/stacks/python.md +50 -0
  25. package/resources/skills/hd-code-review/reference/stacks/react.md +51 -0
  26. package/resources/skills/hd-code-review/reference/stacks/reactnative.md +54 -0
  27. package/resources/skills/hd-code-review/reference/stacks/scala.md +48 -0
  28. package/resources/skills/hd-code-review/reference/stacks/visualforce.md +38 -0
  29. package/resources/skills/hd-code-review/reference/stacks/vuejs.md +52 -0
  30. package/resources/skills/hd-code-review/reference/stacks/wordpress.md +54 -0
  31. package/resources/skills/hd-daily-goals/SKILL.md +41 -9
  32. package/resources/skills/hd-daily-goals/reference/ticket-autofill.md +104 -0
  33. package/resources/skills/hd-daily-goals/reference/validation-rules.md +13 -0
  34. package/resources/skills/hd-daily-report/SKILL.md +70 -14
  35. package/resources/skills/hd-daily-report/reference/sample-report-qc.md +44 -0
  36. package/resources/skills/hd-daily-report/reference/sample-report.md +18 -15
  37. package/resources/skills/hd-daily-report/reference/validation-rules.md +28 -7
  38. package/resources/skills/hd-daily-viewer/SKILL.md +222 -0
  39. package/resources/skills/hd-docs-init/SKILL.md +33 -0
  40. package/resources/skills/hd-docs-parse/SKILL.md +2 -0
  41. package/resources/skills/hd-docs-parse/scripts/parse_document.py +6 -0
  42. package/resources/skills/hd-docs-sync/SKILL.md +65 -3
  43. package/resources/skills/hd-docs-sync/reference/doc-mapping.md +1 -0
  44. package/resources/skills/hd-help/SKILL.md +24 -0
  45. package/resources/skills/hd-help/reference/skill-map.md +122 -7
  46. package/resources/skills/hd-iso/SKILL.md +409 -0
  47. package/resources/skills/hd-iso/reference/iso-27001-requirements.md +166 -0
  48. package/resources/skills/hd-iso/reference/iso-9001-requirements.md +91 -0
  49. package/resources/skills/hd-iso/reference/role-profiles.md +115 -0
  50. package/resources/skills/hd-iso-ready/SKILL.md +146 -0
  51. package/resources/skills/hd-iso-sync/SKILL.md +217 -0
  52. package/resources/skills/hd-iso-sync/reference/frontmatter-schema.md +89 -0
  53. package/resources/skills/hd-iso-verify/SKILL.md +294 -0
  54. package/resources/skills/hd-issue-resolution/SKILL.md +20 -0
  55. package/resources/skills/hd-task/SKILL.md +12 -0
@@ -0,0 +1,48 @@
1
+ # Stack: Flutter — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `.dart` or `pubspec.yaml` files are detected in the diff (or `tech_stack: flutter` declared).
4
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
5
+
6
+ ---
7
+
8
+ ## Aspect 2 — Correctness (additional)
9
+
10
+ - `BuildContext` used across an `async` gap without a `mounted` check — after any `await`, the widget may have been disposed; accessing `context` after the gap causes "use of BuildContext after async gap" errors. Guard with `if (!mounted) return;`.
11
+ - `initState` launching async operations without `mounted` checks on completion — the async callback may call `setState` after the widget is disposed.
12
+ - `setState` called after `dispose()` — any async operation started in `initState` or a callback that completes after navigation away causes a framework error.
13
+ - `late` variable accessed before initialization — `LateInitializationError` at runtime; ensure assignment happens before first use, or use nullable type.
14
+
15
+ ---
16
+
17
+ ## Aspect 3 — Possible Breakage (additional)
18
+
19
+ - `StreamSubscription` not cancelled in `dispose()` — memory leak; the stream keeps a reference to the widget after it is removed from the tree.
20
+ - `AnimationController`, `TextEditingController`, `FocusNode`, `ScrollController`, `PageController` not disposed — each holds native resources; must call `.dispose()` in the widget's `dispose()` override.
21
+ - `Timer` / `Timer.periodic` not cancelled in `dispose()` — fires callbacks on a disposed widget.
22
+ - `GlobalKey` reused across different widget types or subtrees — causes framework assertion errors and incorrect state transfer.
23
+
24
+ ---
25
+
26
+ ## Aspect 7 — Security (additional)
27
+
28
+ - Sensitive data (tokens, passwords, PII) stored with `SharedPreferences` — stored as plain text; use `flutter_secure_storage` for sensitive values.
29
+ - API keys or secrets hardcoded in Dart source or `pubspec.yaml` — Dart code and assets are extractable from the APK/IPA; use server-side secrets or secure environment injection via `--dart-define`.
30
+ - `WebView` loading user-supplied URLs without validation — XSS or phishing risk; validate scheme and domain before loading.
31
+
32
+ ---
33
+
34
+ ## Aspect 10 — Code Quality (additional)
35
+
36
+ - Missing `const` constructor on widgets that could be `const` — non-const widgets are rebuilt on every parent rebuild; `const` widgets are only built once and reused.
37
+ - `build()` method longer than ~50 lines — extract into smaller private widget methods or separate `StatelessWidget` classes; large `build()` is a maintenance and rebuild-scope problem.
38
+ - Complex business logic inside `build()` — computed values, data transformations, and conditionals belong in the widget state, a controller, or a dedicated model; `build()` should be declarative.
39
+ - `print()` in production code — use a proper logging package (`logger`, `talker`) with level filtering so debug output does not reach production.
40
+
41
+ ---
42
+
43
+ ## Aspect 12 — Architecture & Design (additional)
44
+
45
+ - Business logic directly in `StatefulWidget` or `StatelessWidget` — use a state management solution (BLoC/Cubit, Riverpod, Provider, GetX per project convention) to separate UI from logic.
46
+ - Deep widget nesting (> 5–6 levels without extraction) — leads to the "pyramid of doom"; extract subtrees into named widget classes for readability and testability.
47
+ - `setState` used in a widget that is also shared across routes or has complex state — indicates the state belongs at a higher level or in a dedicated state management class.
48
+ - Platform channel calls (`MethodChannel`) not abstracted behind an interface — makes testing difficult; wrap in a repository or service class that can be mocked.
@@ -0,0 +1,51 @@
1
+ # Stack: Go — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `.go` or `go.mod` files are detected in the diff (or `tech_stack: go` declared).
4
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
5
+
6
+ ---
7
+
8
+ ## Aspect 2 — Correctness (additional)
9
+
10
+ - Goroutine started but never terminates — no quit channel, context cancellation, or `WaitGroup` tracking; goroutine leaks accumulate over time in long-running services.
11
+ - `defer` inside a loop — deferred calls execute when the **function** returns, not at the end of each iteration; resource handles (files, locks) accumulate until the outer function exits.
12
+ - Value receiver on a method that modifies state — only pointer receivers mutate the original; value receivers get a copy. Check consistency across the method set.
13
+ - Nil pointer dereference on interface — a non-nil interface variable holding a nil pointer is NOT nil (`var p *T; var i I = p; i == nil` is `false`); guard with the concrete type check.
14
+ - Integer overflow — `int` is platform-width (32-bit on 32-bit targets); use `int64` / `uint64` explicitly for values that may exceed 2³¹.
15
+
16
+ ---
17
+
18
+ ## Aspect 3 — Possible Breakage (additional)
19
+
20
+ - `sync.WaitGroup.Add()` called inside the goroutine instead of before launching it — race condition; the main goroutine may call `Wait()` before `Add()` is reached.
21
+ - Unbounded channel send or receive without a `select + timeout` or context deadline — potential deadlock if the other side is never ready.
22
+ - `sync.Mutex` (or `sync.RWMutex`) copied by value — passing by value creates an independent copy that is unlocked; always use a pointer (`*sync.Mutex`).
23
+ - `http.Response.Body` not closed, or not fully drained before closing — keep-alive connections are not returned to the pool, causing connection leaks.
24
+ - Context not threaded through I/O calls — functions making DB queries or HTTP requests should accept and forward `context.Context` to support cancellation and timeout propagation.
25
+
26
+ ---
27
+
28
+ ## Aspect 7 — Security (additional)
29
+
30
+ - SQL built with `fmt.Sprintf` or string concatenation — SQL injection. Use parameterized queries (`db.QueryContext(ctx, "SELECT ... WHERE id=$1", id)`).
31
+ - `exec.Command` with user-controlled arguments and `shell`-like expansion — command injection. Pass arguments as separate strings, never via `sh -c`.
32
+ - `http.Get(userURL)` or outbound HTTP to a user-supplied URL without validation — SSRF (Server-Side Request Forgery). Validate scheme, host, and port against an allowlist.
33
+ - Sensitive values (tokens, passwords) passed as command-line arguments — appear in `ps` output and process env; use environment variables or files with restricted permissions.
34
+
35
+ ---
36
+
37
+ ## Aspect 10 — Code Quality (additional)
38
+
39
+ - Error wrapped without `%w` verb — `fmt.Errorf("context: %v", err)` breaks `errors.Is` / `errors.As`; use `fmt.Errorf("context: %w", err)`.
40
+ - Errors ignored with `_` in non-trivial cases — `_, err = ...` without checking `err`; or return values discarded silently.
41
+ - Naked return in a function longer than ~10 lines — hard to reason about what is being returned; use explicit return values.
42
+ - `init()` function with complex logic or side effects — runs at package load time, order is non-deterministic across packages; keep `init()` minimal.
43
+
44
+ ---
45
+
46
+ ## Aspect 12 — Architecture & Design (additional)
47
+
48
+ - Business logic directly in `http.Handler` or `http.HandlerFunc` — separate transport (HTTP) from domain logic using handler → service → repository layers.
49
+ - Circular package dependency — Go forbids this at compile time, but circular `_test` package imports or subtle import paths can introduce it; check import graph.
50
+ - `interface{}` / `any` used where a specific type or generic would be clearer — loses compile-time safety; prefer typed parameters or generics (Go 1.18+).
51
+ - Package-level mutable state (package-level `var`) in non-main packages — makes packages non-reentrant and hard to test; use dependency injection.
@@ -0,0 +1,56 @@
1
+ # Stack: Laravel — Additional Review Checks
2
+
3
+ Injected IN ADDITION to `php` preset when Laravel signals are detected:
4
+ - `artisan` file in the diff or repo root
5
+ - `app/Http/Controllers/` paths in the diff
6
+ - `routes/web.php` or `routes/api.php` in the diff
7
+ - `"laravel/framework"` in `composer.json`
8
+
9
+ Contains Laravel-specific checks only — PHP-level checks are in `php.md`.
10
+
11
+ ---
12
+
13
+ ## Aspect 2 — Correctness (additional)
14
+
15
+ - `Model::find($id)` without null check — returns `null` if not found; chaining methods directly causes `Call to a member function on null`. Use `findOrFail()` or explicit null guard.
16
+ - N+1 query: accessing a relationship in a loop without `with()` eager loading — `foreach ($users as $u) { $u->posts; }` fires N+1 queries. Use `User::with('posts')->get()`.
17
+ - `$request->input()` vs `$request->validated()` — using unvalidated `input()` data directly in models bypasses Form Request validation rules that were written for that purpose.
18
+ - Eloquent `where` with column name from user input — `->where($column, $value)` allows column injection if `$column` is user-controlled. Validate column against an allowlist.
19
+
20
+ ---
21
+
22
+ ## Aspect 3 — Possible Breakage (additional)
23
+
24
+ - Missing database transaction around multiple related writes — partial failure leaves data in an inconsistent state. Wrap with `DB::transaction()` or `DB::beginTransaction()` / `commit()` / `rollBack()`.
25
+ - Queue job without `tries` limit or failed job handler — a failing job retries indefinitely, filling the queue; define `$tries`, `$backoff`, and a `failed()` method or `$failOnTimeout`.
26
+ - `Storage::disk()->put()` without checking available disk space in long-running file processing.
27
+ - Scheduled command (`$schedule->command()`) overlapping itself — use `->withoutOverlapping()` for commands that should not run concurrently.
28
+
29
+ ---
30
+
31
+ ## Aspect 7 — Security (additional)
32
+
33
+ - Raw query via `DB::statement()` / `DB::select()` with string interpolation — SQL injection. Use binding: `DB::select('SELECT * FROM t WHERE id = ?', [$id])`.
34
+ - Missing `$fillable` or over-broad `$guarded = []` on Eloquent models — mass assignment vulnerability; `Model::create($request->all())` with `$guarded = []` allows setting any column.
35
+ - Route missing `auth` / `auth:sanctum` / `auth:api` middleware — endpoint accessible without authentication.
36
+ - Missing CSRF protection on state-changing web routes — ensure `VerifyCsrfToken` middleware is active; `api` routes are exempt and should use token-based auth instead.
37
+ - `Response::make()` or `return response($userContent)` with `Content-Type: text/html` and user-controlled content — XSS.
38
+ - Sensitive data logged via `Log::info($request->all())` — passwords, tokens, and PII in log files.
39
+
40
+ ---
41
+
42
+ ## Aspect 10 — Code Quality (additional)
43
+
44
+ - Fat controller: complex business logic, multiple model queries, or conditional branching directly in controller methods — extract to Service classes, Action classes, or Eloquent scopes.
45
+ - Direct `Mail::send()` / `Notification::send()` in controller without queuing — blocks the HTTP response for the duration of the send; use `Mail::queue()` or `->delay()`.
46
+ - Eloquent model with no `$casts` for JSON columns, booleans, or dates — accessing uncasted columns returns raw strings, causing type bugs.
47
+ - `dd()` / `dump()` / `var_dump()` committed to non-test code.
48
+
49
+ ---
50
+
51
+ ## Aspect 12 — Architecture & Design (additional)
52
+
53
+ - Business logic in Blade templates — templates should only render data, not compute or fetch it; move logic to controllers, view composers, or view models.
54
+ - Direct `Model::` static calls deep in service or domain classes — tight coupling to Eloquent; inject a repository or use the model through a service boundary.
55
+ - Event listeners doing synchronous heavy work — use `ShouldQueue` on listeners to push work to the queue and avoid blocking the request.
56
+ - `config()` / `env()` called outside of service providers or config files at request time — `env()` always returns null after config is cached (`php artisan config:cache`); use `config()` everywhere except config files themselves.
@@ -0,0 +1,49 @@
1
+ # Stack: LWC (Lightning Web Components) — Additional Review Checks
2
+
3
+ Injected when `.html` or `.js` files under a `lwc/` path segment are detected in the diff
4
+ (or `tech_stack: lwc` declared). Combines with `apex` preset when `.cls` files are also present.
5
+ Apply these checks IN ADDITION TO the universal checklist items.
6
+
7
+ ---
8
+
9
+ ## Aspect 2 — Correctness (additional)
10
+
11
+ - Imperative Apex call result not re-fetched when `@wire` reactive property changes — stale data displayed until hard reload; use `@wire` with reactive `$property` syntax or re-call imperatively in a `@wire` handler.
12
+ - `this.template.querySelector()` called in `constructor()` — DOM not yet attached; move to `connectedCallback()` or `renderedCallback()`.
13
+ - `renderedCallback()` modifying a tracked property unconditionally — triggers re-render → re-runs `renderedCallback()` → infinite loop; guard with a `_rendered` boolean flag.
14
+ - `@track` decorator applied to a primitive (`string`, `number`, `boolean`) — primitives are automatically reactive; `@track` is only needed for nested object/array mutation detection.
15
+
16
+ ---
17
+
18
+ ## Aspect 3 — Possible Breakage (additional)
19
+
20
+ - Custom event dispatched before `connectedCallback()` completes — parent component not yet listening; dispatch after the component is fully connected.
21
+ - Manual event listener added in `connectedCallback()` without a matching `removeEventListener()` in `disconnectedCallback()` — memory leak on SPA navigation.
22
+ - `@api` property value mutated directly inside the child component — violates one-way data flow; raises framework warnings and produces unpredictable state; emit an event instead.
23
+
24
+ ---
25
+
26
+ ## Aspect 7 — Security (additional)
27
+
28
+ - `innerHTML` assignment using user-controlled data — XSS vector; use `lwc:inner-html` with a sanitized string or bind via template expressions only.
29
+ - Direct access to `window`, `document`, or `eval()` — blocked by Lightning Web Security (LWS) and will throw at runtime; use `this.template` APIs and LWC-approved patterns.
30
+ - Sensitive data (tokens, session IDs, PII) stored in `@track` / `@api` component state — readable via browser DevTools; keep sensitive data server-side.
31
+ - External JS or CSS hotlinked from a CDN or external URL instead of bundled as a Static Resource — AppExchange auto-fail; all third-party assets must be versioned static resources within the package.
32
+ - Third-party npm package with known CVEs shipped to the org — run `npm audit` or Snyk on the LWC project; outdated libraries bundled into component JS are in scope for the AppExchange security review.
33
+ - `LightningMessageChannel` component with `isExposed: true` — exposes the channel to all subscriber orgs; leave `false` unless intentional cross-cloud messaging is documented.
34
+
35
+ ---
36
+
37
+ ## Aspect 10 — Code Quality (additional)
38
+
39
+ - Business logic (calculations, data transformations, conditional rules) placed in component JS — move to Apex or a shared LWC utility module; components should orchestrate, not compute.
40
+ - `@wire` adapter result used without handling the `error` property — silent failures invisible to the user; always check `if (error)` and surface a message.
41
+ - Layout built without SLDS utility classes — produces inconsistent spacing and theming across Experience Cloud, App Builder, and standard Salesforce UI contexts.
42
+
43
+ ---
44
+
45
+ ## Aspect 12 — Architecture & Design (additional)
46
+
47
+ - Parent-to-child communication via direct method calls on the child element reference instead of reactive `@api` property bindings — tight coupling; method calls are harder to test and break declarative data flow.
48
+ - Child-to-parent communication by holding a direct reference to the parent instead of dispatching custom events — breaks component encapsulation and makes reuse impossible.
49
+ - `@wire` result destructured into multiple separate tracked properties — verbose and fragile when the wire shape changes; bind to a single object and access properties in the template.
@@ -0,0 +1,51 @@
1
+ # Stack: Node.js — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `tech_stack: nodejs` is declared in `docs/REVIEW_STANDARDS.md`.
4
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
5
+
6
+ ---
7
+
8
+ ## Aspect 2 — Correctness (additional)
9
+
10
+ - `==` / `!=` instead of `===` / `!==` — type coercion produces unexpected results (e.g., `0 == false`, `null == undefined`).
11
+ - Callback error argument silently ignored — `callback(err, data)` where `err` is not checked before using `data`.
12
+ - Missing `await` on an async function call — promise is created but result is lost; errors are swallowed.
13
+ - `parseInt` without explicit radix — `parseInt("08")` was `0` in legacy engines; always pass `10`.
14
+ - `typeof null === 'object'` trap — null checks must use `=== null`, not `typeof`.
15
+
16
+ ---
17
+
18
+ ## Aspect 3 — Possible Breakage (additional)
19
+
20
+ - CPU-intensive synchronous operation inside an async handler — blocks the event loop for all concurrent requests. Offload to worker threads or use async alternatives (`fs.promises.*`, `crypto.subtle`).
21
+ - `fs.readFileSync` / `execSync` / `spawnSync` in request handlers or hot paths.
22
+ - Unhandled `EventEmitter` `'error'` event — crashes the process if no listener is registered. Always attach `.on('error', handler)`.
23
+ - `process.nextTick` in a tight loop — starves I/O callbacks; prefer `setImmediate` for deferring to next iteration.
24
+ - `JSON.parse` on arbitrarily large request bodies without size guard — OOM risk.
25
+
26
+ ---
27
+
28
+ ## Aspect 7 — Security (additional)
29
+
30
+ - `eval()` / `new Function(code)` with any user-controlled input — arbitrary code execution.
31
+ - `require()` with user-controlled path — path traversal / arbitrary module load.
32
+ - RegEx with catastrophic backtracking (ReDoS) on untrusted input — nested quantifiers like `(a+)+`, `(a|aa)+`. Test with abnormal input.
33
+ - `Buffer.allocUnsafe()` — allocates uninitialized memory; may expose prior memory contents. Use `Buffer.alloc()`.
34
+ - `child_process.exec` / `execFile` / `spawn` with shell: true and user input — shell injection.
35
+
36
+ ---
37
+
38
+ ## Aspect 9 — Implication Assessment (additional)
39
+
40
+ - `JSON.parse` / `JSON.stringify` on large payloads in request handlers — consider streaming parsers (e.g., `stream-json`).
41
+ - Synchronous crypto (`crypto.createHash(...).update(...).digest(...)`) in a hot request path — non-trivial CPU cost; evaluate if async or worker thread is needed.
42
+ - `setInterval` without a corresponding `clearInterval` — memory/CPU leak in long-running processes.
43
+
44
+ ---
45
+
46
+ ## Aspect 10 — Code Quality (additional)
47
+
48
+ - Callback hell (> 3 levels of nesting) when `async/await` or `Promise` chains are available.
49
+ - Sequential `await` in a loop where `Promise.all` would parallelize independent async ops.
50
+ - `console.log` / `console.error` in production code paths — use structured logger (pino, winston, etc.).
51
+ - Catching and re-throwing without adding context — `catch (e) { throw e; }` loses stack augmentation opportunity.
@@ -0,0 +1,52 @@
1
+ # Stack: PHP — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `.php` files are detected in the diff (or `tech_stack: php` declared).
4
+ When Laravel signals are present, `laravel` preset is loaded IN ADDITION to this one.
5
+ When CakePHP signals are present, `cakephp` preset is loaded IN ADDITION to this one.
6
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
7
+
8
+ ---
9
+
10
+ ## Aspect 2 — Correctness (additional)
11
+
12
+ - Loose comparison (`==`) with type-juggling surprises — `0 == "foo"` is `true` in PHP ≤7; `"1" == "01"` is `true`. Use strict comparison (`===`) unless type coercion is explicitly intended.
13
+ - `isset()` vs `empty()` vs `null` check confusion — `empty("")`, `empty(0)`, `empty([])` all return `true`; use explicit type checks when zero or empty string is a valid value.
14
+ - Integer overflow on 32-bit PHP — `PHP_INT_MAX` is 2³¹−1 on 32-bit; use `bcmath` or `GMP` for large integer arithmetic.
15
+ - Array functions that return `false` on failure vs. an empty array — e.g., `preg_match()` returns `false` on error, not `0`; check with `=== false`.
16
+
17
+ ---
18
+
19
+ ## Aspect 3 — Possible Breakage (additional)
20
+
21
+ - Database connection or PDO statement not closed in long-running scripts (CLI / workers) — connection pool exhaustion; use `null`-ing the PDO instance or explicit `$pdo = null`.
22
+ - `preg_replace` with `/e` modifier (PHP 5) — executes matched content as PHP code (removed in PHP 7; if seen in a legacy codebase, critical security issue).
23
+ - `@` error-suppression operator hiding actual errors — masks failures silently; remove and handle errors explicitly.
24
+ - Session started after output sent — `session_start()` after any echo/print causes `Cannot send session cookie - headers already sent`.
25
+
26
+ ---
27
+
28
+ ## Aspect 7 — Security (additional)
29
+
30
+ - SQL built with string concatenation or `sprintf` without prepared statements — SQL injection. Use PDO prepared statements or a query builder.
31
+ - `$_GET` / `$_POST` / `$_COOKIE` values echoed directly into HTML — XSS. Escape with `htmlspecialchars($val, ENT_QUOTES, 'UTF-8')` or use a templating engine with auto-escaping.
32
+ - `eval()` with any user-controlled input — arbitrary code execution.
33
+ - `include` / `require` with user-controlled path — Local File Inclusion (LFI) / Remote File Inclusion (RFI). Validate against an allowlist.
34
+ - `system()` / `exec()` / `shell_exec()` / `passthru()` with user input — OS command injection. Use `escapeshellarg()` or avoid shell entirely.
35
+ - File upload handler not validating MIME type and extension server-side — never trust `$_FILES['type']`; validate with `finfo_file()`.
36
+ - `unserialize()` on untrusted input — PHP object injection / arbitrary code execution. Use JSON instead.
37
+
38
+ ---
39
+
40
+ ## Aspect 10 — Code Quality (additional)
41
+
42
+ - Missing strict types declaration — `declare(strict_types=1)` at top of file catches type coercion bugs at call sites; recommended for all new files.
43
+ - Mixed `echo` and `return` in functions — functions should return values; presentation logic should echo; mixing makes code untestable.
44
+ - Global variables accessed via `global $var` inside functions — avoid shared mutable global state; pass dependencies explicitly.
45
+
46
+ ---
47
+
48
+ ## Aspect 12 — Architecture & Design (additional)
49
+
50
+ - Business logic in view templates (`.php` files directly rendered) — separate presentation from logic; use a controller or service layer.
51
+ - Direct `$_POST` / `$_GET` access deep in the application stack — input should be validated and bound at the HTTP boundary (controller/request class), not accessed in services or models.
52
+ - `die()` / `exit()` in library or service code — terminates the entire process; throw an exception instead to allow callers to handle errors.
@@ -0,0 +1,50 @@
1
+ # Stack: Python — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `.py` files are detected in the diff (or `tech_stack: python` declared).
4
+ When Django path signals are also present (views.py, models.py, urls.py, migrations/), the `django` preset is loaded IN ADDITION to this one.
5
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
6
+
7
+ ---
8
+
9
+ ## Aspect 2 — Correctness (additional)
10
+
11
+ - Mutable default argument — `def f(items=[])` or `def f(config={})`: the default object is created once and shared across all calls; subsequent calls mutate the same object. Use `None` and initialize inside the function.
12
+ - `is` used for value comparison — `if x is "hello"` or `if x is 42`: identity check, not equality. Use `==` for value comparison. (`is None` / `is not None` are correct.)
13
+ - Float equality without tolerance — `if result == 0.1 + 0.2` is almost always `False`; use `math.isclose()` or `abs(a - b) < epsilon`.
14
+ - Broad `except Exception` with no logging or re-raise — silently swallows unexpected errors and hides bugs.
15
+
16
+ ---
17
+
18
+ ## Aspect 3 — Possible Breakage (additional)
19
+
20
+ - File or resource not closed — `open()`, database cursors, network connections must use `with` (context manager); explicit `.close()` is skipped on exception.
21
+ - Bare `except:` clause — catches `BaseException`, including `KeyboardInterrupt`, `SystemExit`, and `GeneratorExit`. Almost always wrong; use `except Exception:` at minimum.
22
+ - Generator or iterator consumed after the underlying collection was modified — results are undefined.
23
+ - `threading` without proper synchronization on shared mutable state — GIL does not protect compound operations (`dict[k] += 1` is not atomic).
24
+
25
+ ---
26
+
27
+ ## Aspect 7 — Security (additional)
28
+
29
+ - `eval()` / `exec()` with any user-controlled input — arbitrary code execution.
30
+ - `subprocess.run(..., shell=True)` with user-controlled arguments — shell injection. Pass arguments as a list instead.
31
+ - `pickle.loads()` / `yaml.load()` (not `yaml.safe_load()`) from untrusted input — arbitrary code execution during deserialization.
32
+ - SQL via string formatting — `f"SELECT * FROM {table}"` or `"SELECT * FROM " + table` — SQL injection. Use parameterized queries (`cursor.execute("SELECT * FROM t WHERE id = %s", [id])`).
33
+ - Hardcoded secrets or API keys in source files — use environment variables or secrets manager.
34
+
35
+ ---
36
+
37
+ ## Aspect 10 — Code Quality (additional)
38
+
39
+ - Inconsistent string formatting style in the same file — mixing `f"..."`, `"...".format()`, and `%s` formatting without a reason.
40
+ - Missing type hints on new public functions / methods — hurts readability, IDE support, and static analysis.
41
+ - `from module import *` — pollutes the namespace, makes it impossible to know where names come from, and breaks refactoring tools.
42
+ - Shadowing a built-in name — `list = []`, `id = ...`, `input = ...` silently breaks later uses of the built-in.
43
+
44
+ ---
45
+
46
+ ## Aspect 12 — Architecture & Design (additional)
47
+
48
+ - Circular imports — `module A` imports `module B` which imports `module A`; causes `ImportError` or partial initialization bugs. Restructure or use late imports.
49
+ - Heavy computation or I/O at module top-level — code outside functions/classes runs on every `import`; slows startup, causes issues in tests, and runs in unexpected contexts.
50
+ - `global` statement modifying module-level state — use class attributes, return values, or dependency injection instead.
@@ -0,0 +1,51 @@
1
+ # Stack: React / Next.js — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `.tsx` or `.jsx` files are detected in the diff (or `tech_stack: react` declared).
4
+ Covers React and Next.js (Next.js is React with SSR — same checks apply).
5
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
6
+
7
+ ---
8
+
9
+ ## Aspect 2 — Correctness (additional)
10
+
11
+ - `v-for`-equivalent: rendering a list without a stable `key` prop, or using array index as key when the list can be reordered/filtered — causes incorrect DOM reconciliation and stale state.
12
+ - Stale closure in `useState` setter — `setCount(count + 1)` inside an async callback or interval captures the stale `count`; use `setCount(prev => prev + 1)` instead.
13
+ - `async` function passed directly as `useEffect` callback — `useEffect(async () => {...})` returns a Promise, not a cleanup function; wrap in an inner async fn.
14
+ - Hook called conditionally — hooks must be called in the same order on every render (no early returns, no hooks inside `if`, loops, or callbacks).
15
+ - `useRef` value mutated during render — `.current` mutations must happen in effects or event handlers, not during the render phase.
16
+
17
+ ---
18
+
19
+ ## Aspect 3 — Possible Breakage (additional)
20
+
21
+ - Missing `useEffect` cleanup — subscriptions, event listeners, `setInterval`/`setTimeout`, WebSocket connections, and Observables must be cleaned up in the return function; omitting causes memory leaks and state updates on unmounted components.
22
+ - Infinite render loop — object literal, array literal, or inline function in `useEffect`/`useCallback`/`useMemo` dependency array creates a new reference on every render, triggering the effect infinitely. Use `useMemo`/`useCallback` or stable references.
23
+ - `setState` called on unmounted component — async operation completes after unmount and calls `setState`; guard with an `isMounted` ref or abort signal.
24
+ - `React.StrictMode` double-invocation exposing non-idempotent side effects — effects run twice in development; ensure effects are safe to re-run.
25
+
26
+ ---
27
+
28
+ ## Aspect 7 — Security (additional)
29
+
30
+ - `dangerouslySetInnerHTML={{ __html: userInput }}` without sanitization — direct XSS vector. Sanitize with DOMPurify or equivalent before setting.
31
+ - Secrets / API keys in component code or `.env` files with `NEXT_PUBLIC_` prefix — `NEXT_PUBLIC_` variables are bundled into the client build and visible to all users. Backend secrets must never use this prefix.
32
+ - Next.js Server Actions missing authentication check — `use server` functions are exposed as HTTP endpoints; verify session/user before performing privileged operations.
33
+ - `href` or `src` set from user input without validation — `javascript:` URLs in `href` are an XSS vector.
34
+
35
+ ---
36
+
37
+ ## Aspect 10 — Code Quality (additional)
38
+
39
+ - Component with more than one primary responsibility — split into smaller, focused components.
40
+ - Prop drilling deeper than 3 levels — consider React Context or a state management solution.
41
+ - Inline arrow functions or object literals as props on frequently-rendered list items — creates new reference on every render, prevents `React.memo` optimization.
42
+ - `useEffect` with an empty dependency array `[]` doing complex async work that depends on props — silent bug when props change; re-evaluate dependencies.
43
+
44
+ ---
45
+
46
+ ## Aspect 12 — Architecture & Design (additional)
47
+
48
+ - Business logic inside component bodies — extract to custom hooks or service modules; components should orchestrate rendering, not implement domain logic.
49
+ - Direct API calls (`fetch`, `axios`) inside a component body — wrap in a custom hook (`useUserData`, `useProducts`) to enable reuse, testing, and loading/error state management.
50
+ - Missing error boundaries around async data-fetching subtrees — unhandled promise rejection in a child component crashes the entire tree; add `<ErrorBoundary>`.
51
+ - `useContext` used for high-frequency updates (e.g., mouse position, scroll offset) — every context consumer re-renders on any context change; use a more granular state solution.
@@ -0,0 +1,54 @@
1
+ # Stack: React Native — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when React Native signals are detected in the diff:
4
+ - `react-native` dependency in `package.json`
5
+ - `.native.ts` / `.native.tsx` / `.native.js` platform-specific files
6
+ - Paths containing `android/` or `ios/` Java/Kotlin/Swift/ObjC files alongside JS/TS
7
+
8
+ When Expo signals are also present (`expo` in `package.json`, `app.json`, `app.config.js`),
9
+ the `expo` preset is loaded IN ADDITION to this one.
10
+
11
+ React Native inherits all `react` checks. Apply these IN ADDITION to `react.md` and the universal checklist.
12
+
13
+ ---
14
+
15
+ ## Aspect 2 — Correctness (additional)
16
+
17
+ - `FlatList` / `SectionList` missing `keyExtractor` — React Native uses it for reconciliation and scroll position restoration; without it, list re-renders are incorrect.
18
+ - `renderItem` in `FlatList` not wrapped in `useCallback` — creates a new function reference on every parent render, causing all list items to re-render regardless of data changes.
19
+ - `Platform.OS` check used where `Platform.select` or platform-specific file (`.ios.tsx` / `.android.tsx`) would be clearer and more maintainable.
20
+ - `Dimensions.get('window')` called once at module level — does not update on orientation change or window resize (foldables, tablets); use `useWindowDimensions()` hook or subscribe to `Dimensions.addEventListener`.
21
+
22
+ ---
23
+
24
+ ## Aspect 3 — Possible Breakage (additional)
25
+
26
+ - `AppState`, `BackHandler`, `Keyboard`, `Linking` event listeners added without removal in a cleanup function / `useEffect` return — duplicate handlers accumulate across navigations and cause memory leaks.
27
+ - Navigation `navigate()` or `goBack()` called after the component is unmounted (e.g., in an async callback after a network request) — `setState on unmounted component` warning and potential crash.
28
+ - `InteractionManager.runAfterInteractions()` callbacks not cancelled on unmount — runs after the component is gone.
29
+ - Deep linking / universal link handler not guarded — unvalidated route parameters passed directly to navigation can cause crashes on unexpected input.
30
+
31
+ ---
32
+
33
+ ## Aspect 7 — Security (additional)
34
+
35
+ - Sensitive data (tokens, passwords, PII) stored in `AsyncStorage` — stores plain text on-disk, readable by other apps on rooted/jailbroken devices. Use `expo-secure-store` (Expo) or `react-native-keychain` (bare).
36
+ - API keys or secrets hardcoded in JS source — React Native bundles are extractable from APK/IPA; use environment variables (via `react-native-config` or Expo's `app.config.js`) and never embed secrets in the bundle.
37
+ - Deep link URL parameters used without validation — user or attacker-controlled URLs should be validated before use in navigation or API calls.
38
+ - `WebView` with `javaScriptEnabled` + `onMessage` / `postMessage` handling user-controlled URLs — XSS in the WebView can exfiltrate data via the bridge.
39
+
40
+ ---
41
+
42
+ ## Aspect 9 — Implication Assessment (additional)
43
+
44
+ - `StyleSheet.create()` vs inline style objects — inline styles create new objects on every render; `StyleSheet.create()` optimizes by sending IDs over the bridge. Use `StyleSheet.create()` for static styles.
45
+ - JavaScript thread blocked by heavy computation — RN has a single JS thread; synchronous CPU work (large JSON parse, sorting, image processing) causes frame drops. Offload to a worker or native module.
46
+ - `console.log` in production builds — each log crosses the JS bridge and has measurable overhead; ensure logs are stripped in production (Babel plugin or conditional).
47
+
48
+ ---
49
+
50
+ ## Aspect 12 — Architecture & Design (additional)
51
+
52
+ - Business logic in screen components — extract to hooks, stores (Zustand, Redux, MobX), or service modules; screens should handle rendering and navigation only.
53
+ - Platform-specific code scattered via `if (Platform.OS === 'ios')` throughout business logic — consolidate platform differences in a single abstraction layer or platform-specific files.
54
+ - Missing error boundary around screens loaded via deep link or navigation — a crash in one screen should not bring down the entire navigator stack.
@@ -0,0 +1,48 @@
1
+ # Stack: Scala — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `.scala` or `build.sbt` files are detected in the diff (or `tech_stack: scala` declared).
4
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
5
+
6
+ ---
7
+
8
+ ## Aspect 2 — Correctness (additional)
9
+
10
+ - `.get` called on `Option` without prior `isDefined` check — throws `NoSuchElementException` on `None`; use `getOrElse`, `fold`, pattern match, or `map`/`flatMap`.
11
+ - `Await.result()` / `Await.ready()` with `Duration.Inf` on a Future — blocks the calling thread indefinitely; always set a finite timeout.
12
+ - Mutable shared state in an `Actor` accessed from outside the actor — Akka actors must only be interacted with via messages; direct field access breaks the concurrency model.
13
+ - `==` on case classes vs reference types — works correctly for case classes (structural equality), but reference-type instances use reference equality unless `equals` is overridden; verify intent.
14
+ - `flatMap` / `map` on `Future` that swallows exceptions — unhandled `Future` failures silently disappear; use `.recover` or `.recoverWith` to handle failures explicitly.
15
+
16
+ ---
17
+
18
+ ## Aspect 3 — Possible Breakage (additional)
19
+
20
+ - `Future` started outside an `ExecutionContext` passed as implicit — missing implicit `ec` causes compilation error or picks up an unintended global context (e.g., `scala.concurrent.ExecutionContext.global` for blocking I/O, which exhausts the thread pool).
21
+ - Blocking I/O (`Await`, JDBC, file reads) on the default `ExecutionContext` — the global EC is sized for CPU-bound work; blocking on it starves other Futures. Use a dedicated blocking EC (`ExecutionContext.fromExecutor(Executors.newCachedThreadPool())`).
22
+ - `var` in a class shared across Futures without synchronization — race condition; prefer immutable vals, `Atomic` references, or actor-based state.
23
+ - Pattern match not exhaustive on a sealed trait — `MatchError` at runtime; the compiler warns but it can be suppressed; verify all cases are handled.
24
+
25
+ ---
26
+
27
+ ## Aspect 7 — Security (additional)
28
+
29
+ - String interpolation in SQL queries (`s"SELECT * FROM t WHERE id=$id"`) — SQL injection. Use prepared statements or a type-safe query library (Doobie, Slick, Quill).
30
+ - Deserialization of untrusted Java-serialized objects (`ObjectInputStream`) — arbitrary code execution; avoid Java serialization for external data; use JSON/Protobuf instead.
31
+ - Scala `xml.XML.loadString(userInput)` without entity expansion disabled — XXE (XML External Entity) attack. Use a secure XML parser configuration.
32
+
33
+ ---
34
+
35
+ ## Aspect 10 — Code Quality (additional)
36
+
37
+ - Overuse of `asInstanceOf` casts — defeats the type system; use pattern matching or type-safe abstractions.
38
+ - `null` returned or accepted instead of `Option` — null references in Scala are idiomatic Java but break functional composition; prefer `Option[T]`.
39
+ - Implicit conversions that are not obviously scoped — wide-scope implicits cause surprising behavior; prefer explicit conversions or type classes.
40
+ - `throw` in a for-comprehension or `map` — breaks the monadic chain; return `Try`, `Either`, or `Option` to represent failure.
41
+
42
+ ---
43
+
44
+ ## Aspect 12 — Architecture & Design (additional)
45
+
46
+ - Business logic in Akka Actor `receive` handlers directly — complex logic in receive makes actors untestable; delegate to pure functions or services called from the actor.
47
+ - Mixing `Future`-based and blocking code in the same layer — inconsistent async model creates thread pool starvation and unpredictable behavior.
48
+ - Type class instances defined in a non-companion object or non-package-object scope — may not be picked up by implicit resolution; place in companion objects or import explicitly.
@@ -0,0 +1,38 @@
1
+ # Stack: Visualforce — Additional Review Checks
2
+
3
+ Injected when `.page` files, or `.component` files under a `pages/` path segment, are detected
4
+ in the diff (or `tech_stack: visualforce` declared). Standalone preset.
5
+ Apply these checks IN ADDITION TO the universal checklist items.
6
+
7
+ ---
8
+
9
+ ## Aspect 2 — Correctness (additional)
10
+
11
+ - Merge field rendered in HTML context without `{!HTMLENCODE(field)}` — raw output allows HTML injection; always encode user-controlled or record-sourced values in markup.
12
+ - Merge field used inside a `<script>` block without `{!JSENCODE(field)}` — unencoded value breaks JS syntax or enables injection; use `JSENCODE()` for all script-context merge fields.
13
+ - `<apex:commandButton>` or `<apex:actionFunction>` present on a page without an enclosing `<apex:form>` — actions silently do nothing; all action components require a parent form.
14
+
15
+ ---
16
+
17
+ ## Aspect 3 — Possible Breakage (additional)
18
+
19
+ - Large record collections bound to `<apex:dataTable>`, `<apex:pageBlockTable>`, or `<apex:repeat>` without server-side pagination — view state can exceed the 170 KB limit and throw a runtime exception for end users.
20
+ - `StandardController` extension overriding the `save()` action without calling `super.save()` — record changes are silently discarded; chain to the standard save or implement full DML explicitly.
21
+
22
+ ---
23
+
24
+ ## Aspect 7 — Security (additional)
25
+
26
+ - `{!variable}` used inside a `<script>` block without `JSENCODE()` — classic Visualforce XSS vector; any user-controlled value injected into JS can execute arbitrary code.
27
+ - `@RemoteAction` Apex method on a class without explicit `with sharing` — FLS and record-level sharing not enforced; remote actions bypass standard controller sharing automatically.
28
+ - `<apex:includeLightning>` referencing a third-party or unreviewed Lightning component — executes in the Salesforce session context; verify the component source before including.
29
+ - External JS loaded via `<script src="https://...">` instead of `<apex:includeScript>` with a Static Resource — AppExchange auto-fail; all third-party JS must be packaged as static resources.
30
+ - CSS loaded via `<link href="...">` tag instead of `<apex:stylesheet>` with a Static Resource — improper CSS load, flagged as violation in AppExchange security review.
31
+ - `OnClickJavaScript` in custom buttons or weblinks — AppExchange auto-fail; Classic mode is always in scope even if the org uses Lightning Experience exclusively.
32
+
33
+ ---
34
+
35
+ ## Aspect 10 — Code Quality (additional)
36
+
37
+ - SOQL query placed in a controller property getter (`get { return [SELECT ...]; }`) — re-executes on every partial-page re-render and `<apex:actionFunction>` call; assign to an instance variable in the constructor or an `action` method.
38
+ - `<apex:outputPanel layout="block">` used for inline or flex layout — produces an unexpected `<div>` wrapper; use `layout="none"` to emit a `<span>`, or apply CSS directly.
@@ -0,0 +1,52 @@
1
+ # Stack: Vue.js — Additional Review Checks
2
+
3
+ Injected into Phase 4 aspects when `.vue` files are detected in the diff (or `tech_stack: vuejs` declared).
4
+ Covers Vue 2 and Vue 3 — version-specific differences are noted inline.
5
+ Apply these checks IN ADDITION TO the universal checklist items for each aspect.
6
+
7
+ ---
8
+
9
+ ## Aspect 2 — Correctness (additional)
10
+
11
+ - `v-for` without `:key` or using array index as key when the list can be reordered/filtered — causes incorrect DOM reconciliation and stale component state.
12
+ - `v-if` and `v-for` on the same element:
13
+ - **Vue 2**: `v-for` has higher priority — `v-if` runs on each iterated item (may be intentional, but often a mistake).
14
+ - **Vue 3**: `v-if` has higher priority — the loop variable is not accessible inside `v-if` (always a bug if the intent was to filter).
15
+ - Prefer `<template v-for>` with `v-if` on the inner element, or filter in `computed`.
16
+ - Direct array index mutation in Vue 2 — `this.arr[0] = val` is NOT reactive; use `this.$set(this.arr, 0, val)` or `Vue.set`. (Vue 3 Proxy-based reactivity handles this correctly.)
17
+ - Mutating a prop directly inside a child component — always emit an event to the parent instead.
18
+ - `computed` property with side effects — computed getters must be pure; side effects belong in `watch` or methods.
19
+
20
+ ---
21
+
22
+ ## Aspect 3 — Possible Breakage (additional)
23
+
24
+ - Event listener or DOM subscription added in `mounted`/`created` without corresponding removal in `beforeUnmount` (Vue 3) / `beforeDestroy` (Vue 2) — memory leak and duplicate handlers on re-mount.
25
+ - `$refs` accessed in `created` or before the component is mounted — refs are only populated after `mounted`; earlier access returns `undefined`.
26
+ - `watch` without `{ immediate: true }` when initial state needs to trigger the handler — silent miss on first load.
27
+ - **Vue 3 Composition API**: reactive object destructured into plain variables loses reactivity — `const { count } = reactive({count: 0})` creates a plain number, not a ref.
28
+
29
+ ---
30
+
31
+ ## Aspect 7 — Security (additional)
32
+
33
+ - `v-html` with user-controlled content — direct XSS vector; sanitize with DOMPurify or equivalent before binding, or avoid `v-html` entirely for user content.
34
+ - Dynamic `<component :is="userInput">` with unvalidated values — can render arbitrary registered components.
35
+
36
+ ---
37
+
38
+ ## Aspect 10 — Code Quality (additional)
39
+
40
+ - Mixing Options API and Composition API inconsistently across components in the same project without a documented convention — pick one style per codebase.
41
+ - `this.$parent` or `this.$children` access — creates fragile parent-child coupling; use props/events or provide/inject.
42
+ - Logic-heavy template expressions (ternaries, method chains) — extract to `computed` properties for readability and cacheability.
43
+ - Missing prop `type` and `validator` definitions — prop validation documents the contract and catches bugs early.
44
+
45
+ ---
46
+
47
+ ## Aspect 12 — Architecture & Design (additional)
48
+
49
+ - Business logic inside template expressions or inline event handlers — extract to methods or composables.
50
+ - `this.$store.commit()` called directly in a component (Vuex / Pinia) — prefer dispatching actions, which can handle async logic and logging.
51
+ - **Vue 3**: composable function mutating external state without returning reactive refs — composables should be self-contained and return their state explicitly.
52
+ - Cross-component communication via `EventBus` in Vue 3 — the global event bus pattern is removed; use `mitt` explicitly or Pinia for shared state.