@mrciphersmith/keryx 0.4.29 → 0.4.31

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 (123) hide show
  1. package/dist/cli.js +2446 -1391
  2. package/dist/core.js +90 -27
  3. package/dist/keryx-general-worker-entry.js +82 -25
  4. package/package.json +1 -1
  5. package/src/gdskills/bundled/install-manifest.json +2 -0
  6. package/src/gdskills/bundled/rules/core/api-contracts.mdc +21 -136
  7. package/src/gdskills/bundled/rules/core/async-patterns.mdc +18 -171
  8. package/src/gdskills/bundled/rules/core/clean-architecture.mdc +21 -3
  9. package/src/gdskills/bundled/rules/core/cli-interface-design.mdc +63 -194
  10. package/src/gdskills/bundled/rules/core/code-style-patterns.mdc +36 -49
  11. package/src/gdskills/bundled/rules/core/concurrency-patterns.mdc +32 -0
  12. package/src/gdskills/bundled/rules/core/database-patterns.mdc +26 -148
  13. package/src/gdskills/bundled/rules/core/error-handling.mdc +7 -8
  14. package/src/gdskills/bundled/rules/core/frontend-assistant.mdc +14 -29
  15. package/src/gdskills/bundled/rules/core/layout-rendering.mdc +51 -0
  16. package/src/gdskills/bundled/rules/core/mobx-store-template.mdc +69 -511
  17. package/src/gdskills/bundled/rules/core/nestjs-dto.mdc +18 -36
  18. package/src/gdskills/bundled/rules/core/playwright-testing.mdc +35 -308
  19. package/src/gdskills/bundled/rules/core/security-baseline.mdc +18 -140
  20. package/src/gdskills/bundled/rules/core/solid-principles.mdc +31 -7
  21. package/src/gdskills/bundled/rules/core/storybook-guidelines.mdc +20 -22
  22. package/src/gdskills/bundled/rules/core/tdd-workflow.mdc +37 -74
  23. package/src/gdskills/bundled/rules/core/ui-anti-slop.mdc +48 -37
  24. package/src/gdskills/bundled/skills/quality/deprecation-path/SKILL.md +1 -1
  25. package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +24 -60
  26. package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +13 -65
  27. package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +22 -35
  28. package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +16 -309
  29. package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +7 -21
  30. package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +83 -227
  31. package/src/gdskills/bundled/skills/review/review-layout/SKILL.md +22 -28
  32. package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +8 -8
  33. package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +15 -37
  34. package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +7 -7
  35. package/src/gdskills/bundled/skills/review/review-style/SKILL.md +31 -66
  36. package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +21 -39
  37. package/src/gdskills/bundled/skills/review/review-ui-ux/SKILL.md +42 -82
  38. package/src/gdskills/bundled/stacks/angular/rules/coding-style.mdc +15 -57
  39. package/src/gdskills/bundled/stacks/angular/rules/patterns.mdc +16 -60
  40. package/src/gdskills/bundled/stacks/angular/rules/security.mdc +11 -49
  41. package/src/gdskills/bundled/stacks/angular/rules/testing.mdc +13 -52
  42. package/src/gdskills/bundled/stacks/c-cpp/rules/coding-style.mdc +33 -57
  43. package/src/gdskills/bundled/stacks/c-cpp/rules/patterns.mdc +35 -62
  44. package/src/gdskills/bundled/stacks/c-cpp/rules/security.mdc +35 -62
  45. package/src/gdskills/bundled/stacks/c-cpp/rules/testing.mdc +34 -54
  46. package/src/gdskills/bundled/stacks/ci-github-gitlab/rules/patterns.mdc +27 -56
  47. package/src/gdskills/bundled/stacks/ci-github-gitlab/rules/security.mdc +51 -119
  48. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/coding-style.mdc +42 -74
  49. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/patterns.mdc +45 -84
  50. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/security.mdc +34 -59
  51. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/testing.mdc +33 -62
  52. package/src/gdskills/bundled/stacks/django/rules/coding-style.mdc +15 -56
  53. package/src/gdskills/bundled/stacks/django/rules/patterns.mdc +16 -68
  54. package/src/gdskills/bundled/stacks/django/rules/security.mdc +13 -71
  55. package/src/gdskills/bundled/stacks/django/rules/testing.mdc +16 -62
  56. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/coding-style.mdc +30 -53
  57. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/patterns.mdc +20 -56
  58. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/security.mdc +52 -122
  59. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/testing.mdc +23 -42
  60. package/src/gdskills/bundled/stacks/fastapi/rules/coding-style.mdc +13 -47
  61. package/src/gdskills/bundled/stacks/fastapi/rules/patterns.mdc +18 -81
  62. package/src/gdskills/bundled/stacks/fastapi/rules/security.mdc +13 -75
  63. package/src/gdskills/bundled/stacks/fastapi/rules/testing.mdc +14 -58
  64. package/src/gdskills/bundled/stacks/flutter-dart/rules/coding-style.mdc +36 -74
  65. package/src/gdskills/bundled/stacks/flutter-dart/rules/patterns.mdc +30 -66
  66. package/src/gdskills/bundled/stacks/flutter-dart/rules/security.mdc +33 -67
  67. package/src/gdskills/bundled/stacks/flutter-dart/rules/testing.mdc +41 -73
  68. package/src/gdskills/bundled/stacks/go/rules/coding-style.mdc +36 -57
  69. package/src/gdskills/bundled/stacks/go/rules/patterns.mdc +27 -42
  70. package/src/gdskills/bundled/stacks/go/rules/security.mdc +26 -43
  71. package/src/gdskills/bundled/stacks/go/rules/testing.mdc +23 -41
  72. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/coding-style.mdc +18 -37
  73. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/patterns.mdc +26 -43
  74. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/security.mdc +25 -37
  75. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/testing.mdc +34 -50
  76. package/src/gdskills/bundled/stacks/kotlin-android/rules/coding-style.mdc +28 -65
  77. package/src/gdskills/bundled/stacks/kotlin-android/rules/patterns.mdc +34 -78
  78. package/src/gdskills/bundled/stacks/kotlin-android/rules/security.mdc +35 -68
  79. package/src/gdskills/bundled/stacks/kotlin-android/rules/testing.mdc +34 -68
  80. package/src/gdskills/bundled/stacks/mobx/rules/coding-style.mdc +18 -64
  81. package/src/gdskills/bundled/stacks/mobx/rules/patterns.mdc +13 -66
  82. package/src/gdskills/bundled/stacks/mobx/rules/security.mdc +8 -35
  83. package/src/gdskills/bundled/stacks/mobx/rules/testing.mdc +10 -39
  84. package/src/gdskills/bundled/stacks/nestjs/rules/coding-style.mdc +32 -45
  85. package/src/gdskills/bundled/stacks/nestjs/rules/patterns.mdc +40 -60
  86. package/src/gdskills/bundled/stacks/nestjs/rules/security.mdc +30 -50
  87. package/src/gdskills/bundled/stacks/nestjs/rules/testing.mdc +27 -47
  88. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/coding-style.mdc +14 -48
  89. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/patterns.mdc +15 -67
  90. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/security.mdc +12 -50
  91. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/testing.mdc +11 -43
  92. package/src/gdskills/bundled/stacks/php-laravel/rules/coding-style.mdc +17 -58
  93. package/src/gdskills/bundled/stacks/php-laravel/rules/patterns.mdc +15 -56
  94. package/src/gdskills/bundled/stacks/php-laravel/rules/security.mdc +13 -50
  95. package/src/gdskills/bundled/stacks/php-laravel/rules/testing.mdc +14 -55
  96. package/src/gdskills/bundled/stacks/python/rules/coding-style.mdc +13 -41
  97. package/src/gdskills/bundled/stacks/python/rules/patterns.mdc +20 -61
  98. package/src/gdskills/bundled/stacks/python/rules/security.mdc +15 -57
  99. package/src/gdskills/bundled/stacks/python/rules/testing.mdc +16 -50
  100. package/src/gdskills/bundled/stacks/react/rules/coding-style.mdc +14 -40
  101. package/src/gdskills/bundled/stacks/react/rules/patterns.mdc +15 -55
  102. package/src/gdskills/bundled/stacks/react/rules/security.mdc +13 -49
  103. package/src/gdskills/bundled/stacks/react/rules/testing.mdc +10 -37
  104. package/src/gdskills/bundled/stacks/ruby-rails/rules/coding-style.mdc +12 -45
  105. package/src/gdskills/bundled/stacks/ruby-rails/rules/patterns.mdc +18 -67
  106. package/src/gdskills/bundled/stacks/ruby-rails/rules/security.mdc +11 -60
  107. package/src/gdskills/bundled/stacks/ruby-rails/rules/testing.mdc +14 -65
  108. package/src/gdskills/bundled/stacks/rust/rules/coding-style.mdc +39 -65
  109. package/src/gdskills/bundled/stacks/rust/rules/patterns.mdc +33 -60
  110. package/src/gdskills/bundled/stacks/rust/rules/security.mdc +35 -57
  111. package/src/gdskills/bundled/stacks/rust/rules/testing.mdc +29 -52
  112. package/src/gdskills/bundled/stacks/sql-db/rules/coding-style.mdc +12 -48
  113. package/src/gdskills/bundled/stacks/sql-db/rules/patterns.mdc +22 -113
  114. package/src/gdskills/bundled/stacks/sql-db/rules/security.mdc +11 -56
  115. package/src/gdskills/bundled/stacks/sql-db/rules/testing.mdc +14 -59
  116. package/src/gdskills/bundled/stacks/swift-ios/rules/coding-style.mdc +29 -65
  117. package/src/gdskills/bundled/stacks/swift-ios/rules/patterns.mdc +41 -88
  118. package/src/gdskills/bundled/stacks/swift-ios/rules/security.mdc +28 -53
  119. package/src/gdskills/bundled/stacks/swift-ios/rules/testing.mdc +32 -65
  120. package/src/gdskills/bundled/stacks/vue/rules/coding-style.mdc +17 -52
  121. package/src/gdskills/bundled/stacks/vue/rules/patterns.mdc +17 -63
  122. package/src/gdskills/bundled/stacks/vue/rules/security.mdc +11 -41
  123. package/src/gdskills/bundled/stacks/vue/rules/testing.mdc +16 -48
@@ -7,63 +7,43 @@ metadata:
7
7
 
8
8
  # NestJS testing
9
9
 
10
- Test layout and conventions specific to `@nestjs/testing`, narrowing
11
- `ts-js-node`'s general test-runner guidance to Nest's module-compiled test
12
- style. Applies only to `*.ts` files in a NestJS project.
10
+ Test layout and conventions for `@nestjs/testing`, narrowing `ts-js-node`'s
11
+ general test-runner guidance to Nest's module-compiled test style. Applies
12
+ only to `*.ts` files in a NestJS project.
13
13
 
14
14
  ## Layout and runner
15
15
 
16
- - Unit tests for a provider live beside it as `<name>.service.spec.ts` /
17
- `<name>.controller.spec.ts`; end-to-end tests live under `test/` as
18
- `<feature>.e2e-spec.ts`, matching the Nest CLI's own generated layout and
19
- its default `test/jest-e2e.json` config.
20
- - Run the project's own `package.json` test scripts (typically `test` for
21
- unit specs and `test:e2e` for the `test/` suite) rather than invoking
22
- `jest`/`vitest` directly with ad hoc flags — they carry the project's own
23
- module resolution and coverage config.
16
+ - Unit tests beside the provider as `<name>.service.spec.ts` /
17
+ `<name>.controller.spec.ts`; e2e tests under `test/` as
18
+ `<feature>.e2e-spec.ts` with the default `test/jest-e2e.json` config.
19
+ - Run the project's `package.json` scripts (`test`, `test:e2e`), not
20
+ `jest`/`vitest` directly with ad hoc flags.
24
21
 
25
22
  ## Building the test module
26
23
 
27
- - Build the unit under test through `Test.createTestingModule({...}).compile()`
28
- from `@nestjs/testing`, not by `new`-ing the class directly with hand-built
29
- fake dependencies — a hand-built instance skips Nest's own DI wiring and
30
- can pass while the real module graph would fail to compile.
31
- - Replace a real dependency with a test double via `.overrideProvider(Token)
32
- .useValue(...)` (or `.useFactory(...)`/`.useClass(...)`) on the
33
- `TestingModule` builder, not by monkey-patching the class prototype or
34
- mutating an already-compiled module's internals.
35
- - For a guard/interceptor/pipe/filter under test in isolation, override it
36
- the same way (`overrideGuard`/`overrideInterceptor`/`overridePipe`/
37
- `overrideFilter`) rather than constructing it manually when it depends on
24
+ - Build the unit under test through `Test.createTestingModule({...}).compile()`,
25
+ not `new` with hand-built fakes.
26
+ - Replace a dependency via `.overrideProvider(Token).useValue(...)` (or
27
+ `.useFactory(...)`/`.useClass(...)`), not by monkey-patching a prototype or
28
+ a compiled module's internals.
29
+ - Override a guard/interceptor/pipe/filter the same way (`overrideGuard`/
30
+ `overrideInterceptor`/`overridePipe`/`overrideFilter`) when it depends on
38
31
  injected providers (e.g. `Reflector`).
39
- - For an e2e spec, call `moduleRef.createNestApplication()` then
40
- `app.init()` before issuing requests, and `app.close()` in `afterAll` —
41
- a suite that never calls `app.close()` leaks open handles (DB
42
- connections, timers) across spec files and can make later suites hang or
43
- flake.
32
+ - For e2e, `moduleRef.createNestApplication()` then `app.init()` before
33
+ requests, and `app.close()` in `afterAll`.
44
34
 
45
35
  ## Mocking and fixtures
46
36
 
47
- - Mock at the provider boundary (repository/HTTP-client provider), not by
48
- stubbing a private method on the real service under test — the point of
49
- `overrideProvider` is to replace what the unit depends on, not to reach
50
- inside it.
51
- - Build a request-scoped dependency's test double as a plain object/mock
52
- matching its public shape (`{ findAll: jest.fn() }`), not the real
53
- provider with `Scope.REQUEST` instantiated per test — request scope only
54
- matters at the framework's request-handling boundary, which a unit test
55
- bypasses entirely.
56
- - Use `supertest` against `app.getHttpServer()` for e2e assertions on
57
- status code and response shape; do not assert against the service's
58
- return value directly in an e2e spec — that turns the e2e test back into
59
- a unit test and loses the point of exercising the real HTTP pipeline
60
- (guards, pipes, filters included).
37
+ - Mock at the provider boundary (repository/HTTP-client provider), not a
38
+ private method on the service under test.
39
+ - A request-scoped dependency's double is a plain object matching its public
40
+ shape (`{ findAll: jest.fn() }`), not the real `Scope.REQUEST` provider.
41
+ - `supertest` against `app.getHttpServer()` for e2e assertions on status and
42
+ response shape, not the service's return value.
61
43
 
62
44
  ## Determinism
63
45
 
64
- - Reset or recreate mocked providers between tests (`jest.clearAllMocks()`
65
- in `afterEach`, or a fresh `TestingModule` per test) so one spec's mock
66
- call count or return value cannot leak into the next.
67
- - Do not depend on Nest's module compile order across a test file; each
68
- `describe` block that needs a `TestingModule` builds and compiles its
69
- own rather than sharing one built in an outer, unrelated `describe`.
46
+ - Reset mocked providers between tests (`jest.clearAllMocks()` in
47
+ `afterEach`, or a fresh `TestingModule` per test).
48
+ - Each `describe` that needs a `TestingModule` builds and compiles its own,
49
+ not one shared from an outer unrelated `describe`.
@@ -7,63 +7,29 @@ metadata:
7
7
 
8
8
  # Next.js / Nuxt coding style
9
9
 
10
- Narrows `core-common-rules`' stack-agnostic style rules to the two
11
- meta-frameworks this pack covers: Next.js (App Router, React) and Nuxt
12
- (Vue 3). Applies to `.tsx`/`.jsx` (Next.js) and `.vue` (Nuxt) files — a
13
- project using only one of the two frameworks still gets guidance scoped to
14
- that framework from the sections below; a monorepo with both gets both.
10
+ Narrows `core-common-rules`' style rules to Next.js (App Router, React) and
11
+ Nuxt (Vue 3). Applies to `.tsx`/`.jsx` (Next.js) and `.vue` (Nuxt); a project
12
+ using one framework gets only that framework's guidance.
15
13
 
16
14
  ## File and directory naming
17
15
 
18
- - Next.js App Router: route segment folders are `kebab-case`
19
- (`app/order-history/page.tsx`); reserved file names (`page.tsx`,
20
- `layout.tsx`, `loading.tsx`, `error.tsx`, `route.ts`) stay exactly as the
21
- framework requires them — do not rename them for house style.
22
- - Nuxt: page files under `pages/` are `kebab-case` and map to routes by
23
- file-system convention (`pages/order-history.vue` ->
24
- `/order-history`); a dynamic segment is `pages/orders/[id].vue`, a
25
- catch-all `pages/[...slug].vue`. Component files are `PascalCase.vue`.
26
- - Composables (Nuxt) and custom hooks (Next.js/React) both start with
27
- `use` (`useOrderTotals.ts`, `useOrderTotals`), one export per file for a
28
- non-trivial composable/hook.
16
+ - Next.js App Router: `kebab-case` route segment folders (`app/order-history/page.tsx`); keep reserved file names (`page.tsx`, `layout.tsx`, `loading.tsx`, `error.tsx`, `route.ts`) exactly as the framework requires.
17
+ - Nuxt: `kebab-case` files under `pages/` (`pages/order-history.vue`), dynamic segment `pages/orders/[id].vue`, catch-all `pages/[...slug].vue`; `PascalCase.vue` components.
18
+ - Composables (Nuxt) and hooks (Next.js/React) start with `use` (`useOrderTotals`), one export per file for a non-trivial one.
29
19
 
30
20
  ## Component and directive placement
31
21
 
32
- - Next.js: every component file is a Server Component by default; add
33
- `'use client'` as the FIRST line of a file only when that file itself
34
- needs browser state (`useState`, `useEffect`), event handlers, or a
35
- browser-only API — not because an ancestor or descendant needs it. Keep
36
- the directive on the smallest leaf component that actually needs it.
37
- - Nuxt: use `<script setup lang="ts">` for new single-file components
38
- instead of the Options API or a bare `<script>` with `defineComponent` —
39
- it is the current idiomatic form and gives auto-imported
40
- `ref`/`computed`/`watch` without explicit imports.
41
- - Type props explicitly: Next.js components take a typed `props` object
42
- (an interface or inline type, not `any`); Nuxt SFCs declare props with
43
- `defineProps<{ ... }>()` (the type-only generic form), not the runtime
44
- object form, for anything beyond a trivial component.
22
+ - Next.js: put `'use client'` as the first line only in a file that itself needs browser state (`useState`, `useEffect`), event handlers, or a browser-only API, on the smallest leaf component that needs it, not because an ancestor or descendant does.
23
+ - Nuxt: use `<script setup lang="ts">` for new SFCs, not the Options API or a bare `<script>` with `defineComponent`.
24
+ - Type props explicitly: Next.js takes a typed `props` object (not `any`); Nuxt declares props with `defineProps<{ ... }>()`, not the runtime object form, beyond a trivial component.
45
25
 
46
26
  ## Imports and auto-imports
47
27
 
48
- - Nuxt auto-imports composables from `composables/`, components from
49
- `components/`, and utils from `utils/` — do not hand-import something
50
- Nuxt already auto-imports (it adds a redundant, easily-stale import
51
- line); DO explicitly import anything outside those conventional
52
- directories.
53
- - Next.js has no auto-import convention — import explicitly, using the
54
- project's configured path aliases (`@/components/...`) instead of long
55
- relative chains once the project has one configured.
28
+ - Nuxt: do not hand-import what Nuxt auto-imports from `composables/`, `components/`, `utils/`; explicitly import anything outside those directories.
29
+ - Next.js: import explicitly, using the project's configured path aliases (`@/components/...`) over long relative chains.
56
30
 
57
31
  ## Formatting and typing
58
32
 
59
- - Format with the project's configured formatter (Prettier is standard for
60
- both ecosystems); do not hand-format around one that is already
61
- configured.
62
- - Avoid `any` for props, route params, and fetch responses in either
63
- framework — type route params from Next.js's generated `PageProps`
64
- types (or the project's own param type) and Nuxt's `useRoute().params`
65
- by name, not by casting.
66
- - Server-only code (`'use server'` files, Nuxt `server/` routes) and
67
- client-only code should not share a barrel import file that re-exports
68
- both — that is how a server-only secret or a `node:` import ends up
69
- bundled into client JavaScript.
33
+ - Format with the project's configured formatter; do not hand-format around it.
34
+ - No `any` for props, route params, or fetch responses; type route params from Next.js's generated `PageProps` types (or the project's param type) and Nuxt's `useRoute().params` by name, not by casting.
35
+ - Do not share a barrel import file re-exporting both server-only code (`'use server'` files, Nuxt `server/` routes) and client-only code.
@@ -7,82 +7,30 @@ metadata:
7
7
 
8
8
  # Next.js / Nuxt patterns
9
9
 
10
- Idiomatic meta-framework design for Next.js's App Router and Nuxt 3+ —
11
- routing conventions, rendering-mode choice, and data fetching, covering
12
- both where their concerns diverge and where they converge. Narrows
13
- `core-common-rules`; framework-agnostic design patterns still come from
14
- there.
10
+ Meta-framework design for Next.js's App Router and Nuxt 3+: routing,
11
+ rendering-mode choice, and data fetching. Narrows `core-common-rules`.
15
12
 
16
13
  ## Server/client boundary (Next.js) and setup context (Nuxt)
17
14
 
18
- - Fetch data in Server Components (no `'use client'`) by default; push
19
- `'use client'` only to the interactive leaf (a button, a form, a chart
20
- that needs a browser API) so the rest of the tree stays server-rendered
21
- and out of the client bundle.
22
- - Pass data down from a Server Component to a Client Component as plain
23
- serializable props — a Client Component cannot `await` a server-only
24
- data call itself; if it needs fresh data after mount, call a Route
25
- Handler (`app/api/.../route.ts`) or a Server Action, not a re-implemented
26
- server-only fetch client-side.
27
- - A Server Action is declared with `'use server'` (file-level or inline in
28
- an async function) and can be called directly from a form's `action`
29
- prop or a Client Component's event handler; mutate, then call
30
- `revalidatePath()`/`revalidateTag()` so the affected route re-renders
31
- with fresh data in the same round trip — don't hand-roll a client-side
32
- refetch-after-mutation when a Server Action + revalidate already covers
33
- it.
34
- - Nuxt composables (`useX`) must be called synchronously during a
35
- component's `setup()` (top level of `<script setup>`), a plugin, or
36
- middleware — never inside an `async` callback, a `setTimeout`, or after
37
- an `await` inside setup, because Nuxt resolves a composable's injection
38
- context (route, app, Pinia store) synchronously at call time.
15
+ - Fetch data in Server Components by default; push `'use client'` only to the interactive leaf (button, form, chart needing a browser API).
16
+ - Pass data from a Server Component to a Client Component as plain serializable props. For fresh data after mount, call a Route Handler (`app/api/.../route.ts`) or a Server Action, not a client-side re-implementation of a server-only fetch.
17
+ - Declare a Server Action with `'use server'` (file-level or inline in an async function), call it from a form's `action` prop or a Client Component handler, and call `revalidatePath()`/`revalidateTag()` after the mutation instead of a hand-rolled client refetch.
18
+ - Call Nuxt composables (`useX`) synchronously in `setup()` (top level of `<script setup>`), a plugin, or middleware, never in an `async` callback, `setTimeout`, or after an `await` in setup.
39
19
 
40
20
  ## Rendering modes
41
21
 
42
- - Next.js: a route is static by default (build-time render, cached);
43
- reading `cookies()`/`headers()`/a `searchParams` prop, or an uncached
44
- `fetch`, opts it into dynamic per-request rendering. Use
45
- `export const revalidate = <seconds>` for ISR when the data is allowed
46
- to go stale for a bounded window rather than forcing full dynamic
47
- rendering.
48
- - Nuxt: `ssr: true` (default) renders on each request; `routeRules` in
49
- `nuxt.config.ts` set per-route rendering (`{ '/blog/**': { isr: 3600 } }`
50
- for ISR-like caching, `{ '/app/**': { ssr: false } }` for an SPA-only
51
- section, `{ '/': { prerender: true } }` for static). Choose the rule per
52
- route instead of setting `ssr: false` globally when only part of the app
53
- needs it.
54
- - Both frameworks: a component that needs data on first paint should fetch
55
- it where the framework already renders (Server Component / `useFetch`),
56
- not fetch client-side after an empty shell — that trade-off (an extra
57
- client round trip, a loading flash) should be a deliberate choice, not
58
- the default from not knowing the server-fetch path exists.
22
+ - Next.js: a route is static by default; `cookies()`/`headers()`/a `searchParams` prop or an uncached `fetch` opts it into dynamic rendering. Use `export const revalidate = <seconds>` for ISR when data may be stale for a bounded window.
23
+ - Nuxt: `ssr: true` is the default; set per-route rendering in `routeRules` in `nuxt.config.ts` (`{ '/blog/**': { isr: 3600 } }`, `{ '/app/**': { ssr: false } }`, `{ '/': { prerender: true } }`) rather than `ssr: false` globally when only part of the app needs it.
24
+ - Both: fetch first-paint data where the framework already renders (Server Component / `useFetch`), not client-side after an empty shell; a client-side fetch is a deliberate choice.
59
25
 
60
26
  ## Data fetching
61
27
 
62
- - Next.js: `fetch()` inside a Server Component is deduplicated and cached
63
- by the framework across a single render pass — prefer it over a
64
- third-party data-fetching library for simple server-side reads unless
65
- the project already standardizes on one (e.g. a query library for
66
- client-side cache/mutation needs).
67
- - Nuxt: use `useFetch`/`useAsyncData` for data a page needs during SSR
68
- (they dedupe across server and client and hydrate without a second
69
- request); a plain `$fetch` call inside `onMounted` only re-fetches
70
- client-side and loses SSR — use it for a genuinely client-only,
71
- post-interaction call (e.g. in response to a click), not initial page
72
- data.
73
- - Both: key async data explicitly (`useAsyncData('orders', ...)` in Nuxt;
74
- a stable cache key in whatever client-side query library Next.js code
75
- uses) — an unkeyed or auto-keyed-by-reference call can silently refetch
76
- or fail to dedupe across re-renders/navigations.
28
+ - Next.js: prefer `fetch()` in a Server Component (framework-deduplicated and cached) over a third-party data library for simple server reads, unless the project standardizes on one.
29
+ - Nuxt: use `useFetch`/`useAsyncData` for SSR data; `$fetch` in `onMounted` only for a client-only, post-interaction call (e.g. on click), not initial page data.
30
+ - Both: key async data explicitly (`useAsyncData('orders', ...)` in Nuxt; a stable cache key in the client query library Next.js code uses).
77
31
 
78
32
  ## Anti-patterns
79
33
 
80
- - Marking an entire page or layout `'use client'` to fix one interactive
81
- child, instead of isolating the directive to that child.
82
- - Reaching for `ssr: false` on a whole Nuxt page to work around a
83
- hydration mismatch instead of finding the actual nondeterministic
84
- render source.
85
- - Storing derived/computed state in a `ref`/`useState` and syncing it with
86
- an effect/`watch`, instead of computing it inline with `computed()` or
87
- during render — both frameworks' reactivity systems already handle
88
- derivation without an effect.
34
+ - Marking a whole page or layout `'use client'` to fix one interactive child.
35
+ - `ssr: false` on a whole Nuxt page to hide a hydration mismatch instead of finding the nondeterministic render source.
36
+ - Storing derived state in a `ref`/`useState` synced by an effect/`watch`, instead of `computed()` or computing during render.
@@ -8,65 +8,27 @@ metadata:
8
8
  # Next.js / Nuxt security
9
9
 
10
10
  Stack-specific risks for Next.js's App Router and Nuxt's server layer, with
11
- the safe pattern to use instead of each. Narrows `core-common-rules`;
12
- generic web risks (XSS, CSRF fundamentals) still come from there — this
13
- file covers where each framework's own boundary can leak.
11
+ the safe pattern for each. Narrows `core-common-rules`; generic web risks
12
+ (XSS, CSRF fundamentals) come from there.
14
13
 
15
14
  ## Environment variable and secret exposure
16
15
 
17
- - Next.js: only a variable prefixed `NEXT_PUBLIC_` is inlined into the
18
- client bundle; every other `process.env.*` read in a file that ships to
19
- the client is `undefined` at runtime, which itself is a signal — but the
20
- real risk is the reverse: never prefix a secret (API key, DB URL, signing
21
- secret) with `NEXT_PUBLIC_` just to make a client read succeed, and never
22
- read a non-`NEXT_PUBLIC_` secret from a file that lacks a `'use server'`/
23
- server-only boundary and could be pulled into a client bundle by an
24
- import chain.
25
- - Nuxt: `nuxt.config.ts`'s `runtimeConfig` splits `public` (sent to the
26
- client) from the top-level/private keys (server-only). Never move a
27
- secret into the `public` block to reach it from a component — read it
28
- server-side only (`server/api/*` handlers, or a server-only composable)
29
- and expose only the derived, non-sensitive result to the client.
16
+ - Next.js: only `NEXT_PUBLIC_` variables are inlined into the client bundle. Never prefix a secret (API key, DB URL, signing secret) with `NEXT_PUBLIC_` to make a client read work, and never read a non-`NEXT_PUBLIC_` secret in a file without a `'use server'`/server-only boundary that an import chain could pull into the client bundle.
17
+ - Nuxt: `runtimeConfig` splits `public` (sent to the client) from top-level/private keys (server-only). Never move a secret into `public`; read it in `server/api/*` handlers or a server-only composable and expose only the derived, non-sensitive result.
30
18
 
31
19
  ## Server Actions and server routes
32
20
 
33
- - Every Next.js Server Action (`'use server'`) and Nuxt `server/api/**`
34
- handler is a public HTTP endpoint even though it looks like an internal
35
- function call — re-check auth/authorization inside the action/handler
36
- itself; do not rely on the calling component having already checked,
37
- since the endpoint is reachable directly.
38
- - Re-validate every argument a Server Action or Nuxt server route receives
39
- server-side (type, ownership, range) even when the client already
40
- validated the form — client-side validation is a UX affordance, not a
41
- security boundary.
42
- - Nuxt: read cookies/headers via `useRequestEvent()`/`getCookie(event, ...)`
43
- inside `server/api/**`, not by trusting a value the client sent in the
44
- request body for something that should be derived from an authenticated
45
- session.
21
+ - Every Next.js Server Action (`'use server'`) and Nuxt `server/api/**` handler is a public HTTP endpoint: re-check auth/authorization inside it, not in the calling component.
22
+ - Re-validate every argument (type, ownership, range) server-side even when the client validated the form.
23
+ - Nuxt: read cookies/headers with `useRequestEvent()`/`getCookie(event, ...)` in `server/api/**`; derive from the authenticated session, not from a value the client sent in the request body.
46
24
 
47
25
  ## Rendering and injection
48
26
 
49
- - Next.js: `dangerouslySetInnerHTML` with unsanitized user content is an
50
- XSS vector in a Server Component exactly as much as a Client one —
51
- server rendering does not sanitize it; run it through a sanitizer (e.g.
52
- DOMPurify server-side) before it reaches the prop, or avoid raw HTML
53
- injection entirely.
54
- - Nuxt/Vue: `v-html` with unsanitized user content is the equivalent risk
55
- in a `.vue` template — sanitize before binding, never bind raw user
56
- input directly.
57
- - Both: a value interpolated into a `<script>` tag, an inline event
58
- handler string, or a redirect URL built from user input (open-redirect
59
- risk) needs the same scrutiny as any other untrusted-input sink — encode
60
- or allowlist, don't string-concatenate.
27
+ - Next.js: `dangerouslySetInnerHTML` with unsanitized user content is an XSS vector in a Server Component as in a Client one; sanitize (e.g. DOMPurify server-side) before the prop, or avoid raw HTML.
28
+ - Nuxt/Vue: sanitize before binding `v-html`; never bind raw user input.
29
+ - Both: encode or allowlist a value interpolated into a `<script>` tag, an inline event handler string, or a redirect URL built from user input (open redirect); do not string-concatenate.
61
30
 
62
31
  ## Route and middleware auth
63
32
 
64
- - Next.js: `middleware.ts` runs on the Edge runtime and can check auth
65
- before a route renders, but it cannot be the ONLY check — a Server
66
- Component/Route Handler that skips its own auth check because
67
- "middleware already handles it" breaks the moment middleware's matcher
68
- config changes; check again where the data is actually read.
69
- - Nuxt: a route middleware (`defineNuxtRouteMiddleware`) guards
70
- client-side navigation but does not protect the underlying
71
- `server/api/**` endpoint — protect the API handler itself, not just the
72
- page route.
33
+ - Next.js: `middleware.ts` (Edge runtime) cannot be the only check; a Server Component/Route Handler checks auth again where the data is read.
34
+ - Nuxt: a route middleware (`defineNuxtRouteMiddleware`) guards only client-side navigation; protect the `server/api/**` handler itself, not just the page route.
@@ -7,58 +7,26 @@ metadata:
7
7
 
8
8
  # Next.js / Nuxt testing
9
9
 
10
- Test layout, runner, and mocking conventions for Next.js and Nuxt
11
- projects. Narrows `core-common-rules`; generic test-writing guidance
12
- (determinism, one behavior per test) still comes from there.
10
+ Test layout, runner, and mocking conventions for Next.js and Nuxt projects.
11
+ Narrows `core-common-rules`.
13
12
 
14
13
  ## Layout and runner
15
14
 
16
- - Co-locate a component/page test next to what it tests
17
- (`app/orders/page.test.tsx`, `pages/orders.test.ts` next to
18
- `orders.vue`, or a project's existing `__tests__`/`tests` convention —
19
- match what the project already does rather than introducing a second
20
- layout).
21
- - Next.js: Jest or Vitest with React Testing Library is standard for
22
- component/page tests; a Server Component that only renders server-side
23
- (no interactivity) is usually tested by rendering its resolved output or
24
- through an integration/e2e test, since RTL's `render()` alone does not
25
- execute the App Router's server data-fetching lifecycle.
26
- - Nuxt: Vitest with `@nuxt/test-utils` (`mountSuspended` for a component
27
- that uses auto-imported composables or Nuxt context) or Vue Test Utils
28
- directly for a plain, context-free component. Use `@nuxt/test-utils`'s
29
- `mountSuspended`/`renderSuspended` when the component under test calls
30
- `useFetch`/`useAsyncData`/a Nuxt composable — a plain Vue Test Utils
31
- `mount()` has no Nuxt runtime context to resolve those against.
15
+ - Co-locate a component/page test (`app/orders/page.test.tsx`, `pages/orders.test.ts` beside `orders.vue`) or follow the project's `__tests__`/`tests` convention; match the existing layout.
16
+ - Next.js: Jest or Vitest with React Testing Library; test a server-only Server Component through its resolved output or an integration/e2e test, since RTL's `render()` does not run the App Router's server data-fetching lifecycle.
17
+ - Nuxt: Vitest with `@nuxt/test-utils`; use `mountSuspended`/`renderSuspended` for a component calling `useFetch`/`useAsyncData`/a Nuxt composable, Vue Test Utils directly for a context-free component.
32
18
 
33
19
  ## Mocking the network boundary
34
20
 
35
- - Mock at the network boundary (MSW, or the project's existing HTTP mock
36
- layer) for a component/page test that calls `fetch`/`useFetch` — not by
37
- mocking the framework's data-fetching hook itself, which tests the mock
38
- instead of the component's actual request/response handling.
39
- - A Server Action or Nuxt server route under test should be called
40
- through its real handler with a mocked downstream dependency (database
41
- client, external API), not have its entire body replaced by a stub —
42
- the goal is proving the handler's own auth/validation logic runs, not
43
- just that some function returns the expected shape.
21
+ - Mock at the network boundary (MSW or the project's HTTP mock layer) for components/pages calling `fetch`/`useFetch`, not the framework's data-fetching hook.
22
+ - Call a Server Action or Nuxt server route through its real handler with a mocked downstream dependency (database client, external API), not a stub replacing its body.
44
23
 
45
24
  ## Determinism and fixtures
46
25
 
47
- - Freeze or inject time (`vi.setSystemTime`, a clock passed as a
48
- parameter) for any test touching a component that renders `Date.now()`-
49
- or locale-dependent output — the same nondeterminism that causes a
50
- hydration mismatch in the app causes a flaky test in CI.
51
- - Use fixtures/factories for route params, `searchParams`, and Nuxt route
52
- objects (`useRoute()` mocked with a realistic shape) instead of
53
- hand-built partial objects that happen to satisfy today's test but drift
54
- from the real router's shape.
26
+ - Freeze or inject time (`vi.setSystemTime`, a clock parameter) for any component rendering `Date.now()`- or locale-dependent output.
27
+ - Use fixtures/factories for route params, `searchParams`, and Nuxt route objects (`useRoute()` mocked with a realistic shape), not hand-built partial objects.
55
28
 
56
29
  ## Coverage expectations
57
30
 
58
- - Cover: the interactive/client boundary (event handlers, form
59
- submission, a Server Action's success and validation-failure paths, a
60
- Nuxt composable's loading/error/data states), not just the happy-path
61
- render.
62
- - Do not chase coverage on generated framework files (`layout.tsx` that
63
- only renders `{children}`, an empty `error.vue`) — spend test budget on
64
- logic the project actually wrote.
31
+ - Cover the interactive/client boundary (event handlers, form submission, a Server Action's success and validation-failure paths, a Nuxt composable's loading/error/data states), not only the happy-path render.
32
+ - Skip coverage on generated framework files (a `layout.tsx` that only renders `{children}`, an empty `error.vue`).
@@ -7,76 +7,35 @@ metadata:
7
7
 
8
8
  # PHP / Laravel coding style
9
9
 
10
- Narrows `core-common-rules`' stack-agnostic style rules to modern PHP
11
- (8.2+) and Laravel (11/12/13) idiom. Applies only to `*.php` files —
12
- everything not PHP/Laravel-specific still comes from the common rules
13
- this file `extends`.
10
+ Narrows `core-common-rules`' style rules to modern PHP (8.2+) and Laravel (11/12/13); follows PSR-12 and PSR-4. Applies only to `*.php` files.
14
11
 
15
12
  ## Naming and structure
16
13
 
17
- - Classes, interfaces, enums, and traits are `StudlyCase`; methods and
18
- properties are `camelCase`; constants and enum cases are
19
- `SCREAMING_SNAKE_CASE` unless the enum case is meant to read as a label.
20
- - Follow Laravel's default directory conventions
21
- (`app/Models`, `app/Http/Controllers`, `app/Http/Requests`,
22
- `app/Providers`, `app/Jobs`, `database/migrations`) rather than
23
- inventing a parallel structure for the same kind of class.
24
- - A controller method stays thin: validate (via a Form Request), delegate
25
- to a model/action/service, return a response — push business rules into
26
- a model method, an action class, or a service, not the controller.
27
- - Type-hint every parameter, property, and return value that can be
28
- typed; PHP 8.2+ intersection types and `never`/`static` return types are
29
- fair game where they genuinely describe the contract.
14
+ - Constants and enum cases are `SCREAMING_SNAKE_CASE` unless the enum case is meant to read as a label.
15
+ - Follow Laravel's default directory conventions (`app/Models`, `app/Http/Controllers`, `app/Http/Requests`, `app/Providers`, `app/Jobs`, `database/migrations`); do not invent a parallel structure.
16
+ - Keep a controller method thin: validate (Form Request), delegate to a model/action/service, return a response.
17
+ - Type-hint every parameter, property and return value that can be typed, including intersection types and `never`/`static` where they describe the contract.
30
18
 
31
19
  ## PHP 8.2+ language features
32
20
 
33
- - `readonly` properties for value objects and anything constructed once
34
- and never mutated (a DTO, an immutable config value) instead of a
35
- mutable property guarded only by convention.
36
- - Native `enum` (backed by `string`/`int` when the value needs to persist
37
- to a column or API payload) instead of class constants for a fixed set
38
- of related values.
39
- - First-class callable syntax (`$this->method(...)`, `Str::slug(...)`)
40
- instead of a string/array callable (`[$this, 'method']`) or an
41
- unnecessary closure wrapper when passing a method as a callback.
42
- - Constructor property promotion (`public function __construct(private
43
- readonly OrderRepository $orders) {}`) for simple DTOs and services
44
- instead of repeating each property as a separate declaration plus
45
- assignment.
21
+ - Use `readonly` properties for value objects and anything constructed once and never mutated.
22
+ - Use native `enum` (backed by `string`/`int` when persisted to a column or API payload) instead of class constants for a fixed set of values.
23
+ - Use first-class callable syntax (`$this->method(...)`, `Str::slug(...)`) instead of string/array callables or closure wrappers.
24
+ - Use constructor property promotion for simple DTOs and services.
46
25
 
47
26
  ## Eloquent models
48
27
 
49
- - Declare `protected $fillable` (an explicit allowlist) or `protected
50
- $guarded` on every model that is ever mass-assigned; do not leave a
51
- model without either and rely on `Model::unguard()` outside of a
52
- seeder/test context.
53
- - Cast attributes with the model's `casts()` method (or the `$casts`
54
- property on codebases not yet migrated to it) rather than hand-parsing
55
- dates/JSON/enums in accessors.
56
- - Put a relationship's return type on the method
57
- (`: HasMany`, `: BelongsTo`, ...) so IDEs and static analysis can follow
58
- it.
28
+ - Declare `protected $fillable` (allowlist) or `protected $guarded` on every model that is ever mass-assigned; do not rely on `Model::unguard()` outside a seeder/test context.
29
+ - Cast attributes with the `casts()` method (or `$casts` on codebases not yet migrated) rather than hand-parsing in accessors.
30
+ - Put the return type on relationship methods (`: HasMany`, `: BelongsTo`).
59
31
 
60
32
  ## Controllers, routes, and requests
61
33
 
62
- - Route parameters use route-model binding
63
- (`Route::get('/users/{user}', ...)` resolving to a typed `User $user`
64
- parameter) instead of manually calling `User::findOrFail($id)` in every
65
- controller method that already receives the bound model.
66
- - Validate every request that accepts user input through a Form Request
67
- class (`php artisan make:request`) or `$request->validate([...])`, not
68
- by reading raw `$request->all()`/`$request->input()` values straight
69
- into model or database calls.
70
- - Register route-specific middleware with `->middleware(...)` on the
71
- route/group; keep global middleware in `bootstrap/app.php`
72
- (or `app/Http/Kernel.php` on codebases still on that structure) rather
73
- than duplicating a global concern per-route.
34
+ - Use route-model binding (`Route::get('/users/{user}', ...)` with a typed `User $user`) instead of `User::findOrFail($id)`.
35
+ - Validate every request accepting user input through a Form Request (`php artisan make:request`) or `$request->validate([...])`, not raw `$request->all()`/`$request->input()` into model or database calls.
36
+ - Register route-specific middleware with `->middleware(...)`; keep global middleware in `bootstrap/app.php` (or `app/Http/Kernel.php` on older structure).
74
37
 
75
38
  ## Formatting
76
39
 
77
- - Follow PSR-12 spacing/brace conventions; run the project's configured
78
- formatter (`./vendor/bin/pint` is Laravel's default) instead of
79
- hand-formatting around one that is already configured.
80
- - One class per file, filename matching the class name, matching the
81
- namespace to the directory per PSR-4 — do not add a second top-level
82
- class/interface/enum to an existing file.
40
+ - Run the project's configured formatter (`./vendor/bin/pint` is Laravel's default); do not hand-format around it.
41
+ - One class per file; do not add a second top-level class/interface/enum to an existing file.