@activatus/code-standards 0.0.0-stage → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +199 -2
  2. package/docs/Guides/_category_.json +4 -0
  3. package/docs/Guides/component-library-workflow.md +182 -0
  4. package/docs/Guides/migrating.md +161 -0
  5. package/docs/Guides/setup.md +158 -0
  6. package/docs/Standards/_category_.json +4 -0
  7. package/docs/Standards/agent-skills.md +125 -0
  8. package/docs/Standards/agent-specs.md +74 -0
  9. package/docs/Standards/direnv.mdx +249 -0
  10. package/docs/Standards/documentation.md +314 -0
  11. package/docs/Standards/editorconfig.md +74 -0
  12. package/docs/Standards/eslint.md +900 -0
  13. package/docs/Standards/human-readable-names.md +274 -0
  14. package/docs/Standards/lint-errors.md +171 -0
  15. package/docs/Standards/prettier.md +106 -0
  16. package/docs/Standards/readable-code.md +570 -0
  17. package/docs/Standards/stylelint.md +193 -0
  18. package/docs/Standards/styling.md +290 -0
  19. package/docs/Standards/tech-stack.md +158 -0
  20. package/docs/Structure/_category_.json +4 -0
  21. package/docs/Structure/api-routes.md +118 -0
  22. package/docs/Structure/component-organization.md +526 -0
  23. package/docs/Structure/folder-structure.md +366 -0
  24. package/docs/Structure/import-organization.md +158 -0
  25. package/docs/Structure/naming-conventions.md +334 -0
  26. package/docs/design-system-components.md +117 -0
  27. package/docs/intro.md +44 -0
  28. package/docs/ontology.md +127 -0
  29. package/docs/templates.mdx +396 -0
  30. package/docs/version-history.md +338 -0
  31. package/package.json +60 -3
  32. package/scripts/renameSymbol.mjs +188 -0
  33. package/static/templates/.editorconfig +25 -0
  34. package/static/templates/.envrc +25 -0
  35. package/static/templates/.nvmrc +1 -0
  36. package/static/templates/AGENTS.md +163 -0
  37. package/static/templates/decision-doc.md +19 -0
  38. package/static/templates/docs/ai/agent-harness.md +17 -0
  39. package/static/templates/docs/ai/agents.md +17 -0
  40. package/static/templates/docs/ai/architecture.md +17 -0
  41. package/static/templates/docs/ai/context.md +17 -0
  42. package/static/templates/docs/ai/model-routing.md +17 -0
  43. package/static/templates/docs/ai/models.md +17 -0
  44. package/static/templates/docs/ai/retrieval.md +17 -0
  45. package/static/templates/docs/ai/tools.md +17 -0
  46. package/static/templates/docs/architecture/authentication.md +17 -0
  47. package/static/templates/docs/architecture/backend.md +17 -0
  48. package/static/templates/docs/architecture/background-jobs.md +17 -0
  49. package/static/templates/docs/architecture/backups.md +17 -0
  50. package/static/templates/docs/architecture/caching.md +17 -0
  51. package/static/templates/docs/architecture/ci-cd.md +17 -0
  52. package/static/templates/docs/architecture/disaster-recovery.md +17 -0
  53. package/static/templates/docs/architecture/environments.md +17 -0
  54. package/static/templates/docs/architecture/frontend.md +17 -0
  55. package/static/templates/docs/architecture/hosting.md +17 -0
  56. package/static/templates/docs/architecture/observability.md +17 -0
  57. package/static/templates/docs/architecture/realtime.md +17 -0
  58. package/static/templates/docs/architecture/search.md +17 -0
  59. package/static/templates/docs/architecture/services.md +17 -0
  60. package/static/templates/docs/architecture/state-management.md +17 -0
  61. package/static/templates/docs/architecture/storage.md +17 -0
  62. package/static/templates/docs/architecture/system.md +17 -0
  63. package/static/templates/docs/business/buying-trigger.md +17 -0
  64. package/static/templates/docs/business/customer-value.md +17 -0
  65. package/static/templates/docs/business/customer.md +17 -0
  66. package/static/templates/docs/business/defensibility.md +17 -0
  67. package/static/templates/docs/business/growth.md +17 -0
  68. package/static/templates/docs/business/pricing.md +17 -0
  69. package/static/templates/docs/business/revenue-model.md +17 -0
  70. package/static/templates/docs/business/unit-economics.md +17 -0
  71. package/static/templates/docs/data/analytics.md +17 -0
  72. package/static/templates/docs/data/audit.md +17 -0
  73. package/static/templates/docs/data/database.md +17 -0
  74. package/static/templates/docs/data/indexing.md +17 -0
  75. package/static/templates/docs/data/migrations.md +17 -0
  76. package/static/templates/docs/data/model.md +17 -0
  77. package/static/templates/docs/data/retention.md +17 -0
  78. package/static/templates/docs/data/schema.md +17 -0
  79. package/static/templates/docs/deployment/approval.md +17 -0
  80. package/static/templates/docs/deployment/live-verification.md +17 -0
  81. package/static/templates/docs/deployment/process.md +17 -0
  82. package/static/templates/docs/deployment/rollback.md +17 -0
  83. package/static/templates/docs/design/design-system.md +17 -0
  84. package/static/templates/docs/design/errors.md +17 -0
  85. package/static/templates/docs/design/feedback.md +17 -0
  86. package/static/templates/docs/design/interactions.md +17 -0
  87. package/static/templates/docs/design/layout.md +17 -0
  88. package/static/templates/docs/design/navigation.md +17 -0
  89. package/static/templates/docs/design/principles.md +17 -0
  90. package/static/templates/docs/design/responsive.md +17 -0
  91. package/static/templates/docs/development/branching.md +17 -0
  92. package/static/templates/docs/development/code-quality.md +17 -0
  93. package/static/templates/docs/development/coding-standards.md +21 -0
  94. package/static/templates/docs/development/commits.md +17 -0
  95. package/static/templates/docs/development/merge-strategy.md +17 -0
  96. package/static/templates/docs/development/process.md +17 -0
  97. package/static/templates/docs/development/pull-requests.md +17 -0
  98. package/static/templates/docs/experience/accessibility.md +17 -0
  99. package/static/templates/docs/experience/aha-moment.md +17 -0
  100. package/static/templates/docs/experience/anti-experience.md +17 -0
  101. package/static/templates/docs/experience/friction.md +17 -0
  102. package/static/templates/docs/experience/outcomes.md +17 -0
  103. package/static/templates/docs/experience/principles.md +17 -0
  104. package/static/templates/docs/experience/retention.md +17 -0
  105. package/static/templates/docs/experience/sharing.md +17 -0
  106. package/static/templates/docs/overview/how-it-works.md +17 -0
  107. package/static/templates/docs/overview/what-is-it.md +17 -0
  108. package/static/templates/docs/overview/writing-docs.md +16 -0
  109. package/static/templates/docs/pitch/alternatives.md +17 -0
  110. package/static/templates/docs/pitch/assumptions.md +17 -0
  111. package/static/templates/docs/pitch/audience.md +17 -0
  112. package/static/templates/docs/pitch/concept.md +17 -0
  113. package/static/templates/docs/pitch/differentiators.md +17 -0
  114. package/static/templates/docs/pitch/outcomes.md +17 -0
  115. package/static/templates/docs/pitch/problem.md +17 -0
  116. package/static/templates/docs/pitch/product-market-fit.md +17 -0
  117. package/static/templates/docs/pitch/success-criteria.md +17 -0
  118. package/static/templates/docs/pitch/validation.md +17 -0
  119. package/static/templates/docs/pitch/value-proposition.md +17 -0
  120. package/static/templates/docs/pitch/vision.md +17 -0
  121. package/static/templates/docs/scope/core.md +17 -0
  122. package/static/templates/docs/scope/exclusions.md +17 -0
  123. package/static/templates/docs/scope/future.md +17 -0
  124. package/static/templates/docs/scope/launch.md +17 -0
  125. package/static/templates/docs/scope/post-launch.md +17 -0
  126. package/static/templates/docs/scope/priorities.md +17 -0
  127. package/static/templates/docs/scope/quality-bar.md +17 -0
  128. package/static/templates/docs/security/audit.md +17 -0
  129. package/static/templates/docs/security/data-access.md +17 -0
  130. package/static/templates/docs/security/logging.md +17 -0
  131. package/static/templates/docs/security/privacy.md +17 -0
  132. package/static/templates/docs/security/secrets.md +17 -0
  133. package/static/templates/docs/security/threat-model.md +17 -0
  134. package/static/templates/docs/testing/end-to-end.md +17 -0
  135. package/static/templates/docs/testing/integration.md +17 -0
  136. package/static/templates/docs/testing/regression.md +17 -0
  137. package/static/templates/docs/testing/security.md +17 -0
  138. package/static/templates/docs/testing/strategy.md +17 -0
  139. package/static/templates/docs/testing/test-data.md +17 -0
  140. package/static/templates/docs/testing/unit.md +17 -0
  141. package/static/templates/docs/uat/checks.md +17 -0
  142. package/static/templates/docs/uat/strategy.md +17 -0
  143. package/static/templates/docs/users/permissions.md +17 -0
  144. package/static/templates/docs/users/roles.md +17 -0
  145. package/static/templates/docs/users/user-types.md +17 -0
  146. package/static/templates/docs/workflows/assignment.md +17 -0
  147. package/static/templates/docs/workflows/bugfix.md +17 -0
  148. package/static/templates/docs/workflows/dependencies.md +17 -0
  149. package/static/templates/docs/workflows/deployment.md +17 -0
  150. package/static/templates/docs/workflows/development.md +17 -0
  151. package/static/templates/docs/workflows/planning.md +17 -0
  152. package/static/templates/docs/workflows/review.md +17 -0
  153. package/static/templates/docs/workflows/uat.md +17 -0
  154. package/static/templates/docsSite/docusaurus.config.mjs +144 -0
  155. package/static/templates/docsSite/gitignore.txt +3 -0
  156. package/static/templates/docsSite/package.json.txt +42 -0
  157. package/static/templates/docsSite/pnpm-workspace.yaml +2 -0
  158. package/static/templates/docsSite/sidebars.mjs +7 -0
  159. package/static/templates/docsSite/src/css/custom.css +7 -0
  160. package/static/templates/docsSite/src/pages/index.tsx +9 -0
  161. package/static/templates/docsSite/static/images/logo.svg +4 -0
  162. package/static/templates/docsSite/tsconfig.json +7 -0
  163. package/static/templates/eslint/base/eslint.config.mjs +104 -0
  164. package/static/templates/eslint/nextjs/eslint.config.mjs +181 -0
  165. package/static/templates/eslint/react/eslint.config.mjs +173 -0
  166. package/static/templates/eslint/typescript/eslint.config.mjs +154 -0
  167. package/static/templates/globals.css +16 -0
  168. package/static/templates/husky/pre-commit +1 -0
  169. package/static/templates/next.config.mjs +21 -0
  170. package/static/templates/prettier.config.mjs +26 -0
  171. package/static/templates/skills/codeReview.md +31 -0
  172. package/static/templates/skills/format.md +18 -0
  173. package/static/templates/skills/lint.md +21 -0
  174. package/static/templates/skills/lintFix.md +24 -0
  175. package/static/templates/skills/securityAudit.md +28 -0
  176. package/static/templates/skills/test.md +24 -0
  177. package/static/templates/skills/typescript.md +28 -0
  178. package/static/templates/skills/updateLayout.md +20 -0
  179. package/static/templates/stylelint/css/stylelint.config.mjs +40 -0
  180. package/static/templates/stylelint/scss/stylelint.config.mjs +13 -0
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: securityAudit
3
+ description: Audit the code for common security problems
4
+ argument-hint: "[path]"
5
+ allowed-tools: Read, Glob, Grep, Bash(pnpm audit:*), Bash(git ls-files:*)
6
+ ---
7
+
8
+ Audit the code for security problems and report them. Do NOT modify any files.
9
+
10
+ 1. Work out the scope: `$ARGUMENTS` if given, otherwise the whole repository.
11
+ 2. Run `pnpm audit` and note every high and critical vulnerability.
12
+ 3. Check the code for each of these:
13
+ - **Secrets** — API keys, tokens or passwords written in code or committed in `.env` files. Use `git ls-files` to check which files are tracked.
14
+ - **Access control** — API routes and server actions that do not check who the user is or what they are allowed to do
15
+ - **Input validation** — request data used without being validated
16
+ - **Injection** — database queries or shell commands built by joining strings
17
+ - **Cross-site scripting** — `dangerouslySetInnerHTML` or unescaped user content
18
+ - **Sensitive data** — personal data or secrets written to logs or returned in error messages
19
+ - **Client exposure** — secrets or server-only code reachable from a client component
20
+ 4. Report the findings in order of severity: **Critical**, **High**, **Medium**, **Low**. For each one give the file and line, what the risk is, and how to fix it.
21
+ 5. Finish by listing what you did NOT check, so a clean report is not mistaken for a full security review.
22
+
23
+ If `pnpm audit` fails, say so and carry on with the code checks.
24
+
25
+ Do NOT audit the source of packages in `node_modules/` or `vendor/` — `pnpm audit` covers dependencies.
26
+ Do NOT print the value of any secret you find. Report the file and line only.
27
+ Do NOT fix anything. Report only.
28
+ Do NOT stage, commit or push.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: test
3
+ description: Run the tests and report failures and missing tests
4
+ argument-hint: "[path]"
5
+ allowed-tools: Read, Glob, Grep, Bash(pnpm test:*)
6
+ ---
7
+
8
+ Run the test suite and report the result. Do NOT modify any files.
9
+
10
+ 1. Read `package.json` and confirm a `test` script exists.
11
+ 2. Run `pnpm test $ARGUMENTS`.
12
+ 3. Report the failures grouped by cause, not by file. Tests that fail for the same reason go under one heading. For each cause give the test names, the file and line, and what was expected against what happened.
13
+ 4. Report separately any test that **never ran** — a file that failed to load, or a skipped test. A test that did not run has not passed.
14
+ 5. Check for missing test files in scope. Every function and component needs a test file beside it:
15
+ - `formatCurrency.ts` needs `formatCurrency.test.ts`
16
+ - `Button.tsx` needs `Button.test.tsx`
17
+ List every function and component file that has no test file. Ignore `index.ts`, `types.ts`, config files and Next.js route files.
18
+ 6. Finish with a one-line total: passed, failed, never ran, and files missing a test.
19
+
20
+ If `package.json` has no `test` script, stop and say so.
21
+
22
+ Do NOT fix failing tests or the code they test. Report only.
23
+ Do NOT report on files in `node_modules/` or `vendor/`.
24
+ Do NOT stage, commit or push.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: typescript
3
+ description: Tighten loose types and remove unsafe assertions
4
+ argument-hint: "[path]"
5
+ allowed-tools: Read, Glob, Grep, Edit, Bash(pnpm typecheck:*), Bash(pnpm lint:*)
6
+ ---
7
+
8
+ Replace loose types with precise ones in the given files.
9
+
10
+ 1. Work out the scope: `$ARGUMENTS` if given. If it is empty, stop and ask which file or folder to work on.
11
+ 2. Find every loose type in scope:
12
+ - `any`, written or implied
13
+ - Non-null assertions (`value!`)
14
+ - Type casts (`value as SomeType`), except `as const`
15
+ 3. Fix each one:
16
+ - Replace `any` with the real type, or with `unknown` narrowed by a check
17
+ - Replace `value!` with a check that the value exists
18
+ - Replace a cast with validation or a properly typed source
19
+ 4. Follow the naming rule for every type you add or rename: the name ends in `Props` (the object parameter of a component or function) or `Type` (everything else).
20
+ 5. Run `pnpm typecheck`, then `pnpm lint`. Fix any errors your changes caused.
21
+ 6. Report each change: the file, what the type was, and what it is now. List anything you could not tighten, and why.
22
+
23
+ If `package.json` has no `typecheck` script, say so and skip that check. Do NOT run `tsc` directly.
24
+
25
+ Do NOT silence an error with `any`, `!`, `as`, `@ts-ignore` or `@ts-expect-error`.
26
+ Do NOT change what the code does. Change types only.
27
+ Do NOT edit files in `node_modules/` or `vendor/`.
28
+ Do NOT stage, commit or push. Leave every change uncommitted.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: updateLayout
3
+ description: Regenerate the repository layout in AGENTS.md
4
+ allowed-tools: Read, Glob, Edit, Bash(tree:*), Bash(ls:*)
5
+ ---
6
+
7
+ Update the "Repository layout" section of `AGENTS.md` so it matches the repository as it is now.
8
+
9
+ 1. Read `AGENTS.md` and find the "Repository layout" section.
10
+ 2. Build a directory tree two levels deep:
11
+ - Run `tree -L 2 -a -I 'node_modules|.git|.next|build|dist|coverage|.DS_Store'`
12
+ - If `tree` is not installed, build the same tree with `ls` and Glob, and say that you used the fallback.
13
+ 3. Replace the code block in the "Repository layout" section with the new tree.
14
+ 4. If `AGENTS.md` has a "Workspace packages" section, update its table from the workspace `package.json` files: package name, path and description.
15
+ 5. Report what changed: the folders that were added and removed.
16
+
17
+ If `AGENTS.md` does not exist, or has no "Repository layout" section, stop and say so.
18
+
19
+ Do NOT edit any other section of `AGENTS.md`, and do NOT edit any other file.
20
+ Do NOT stage, commit or push. Leave the change uncommitted.
@@ -0,0 +1,40 @@
1
+ /** @type {import("stylelint").Config} */
2
+ export default {
3
+ ignoreFiles: ["**/vendor/**"],
4
+ extends: [
5
+ "stylelint-config-standard",
6
+ "stylelint-config-recess-order",
7
+ ],
8
+ rules: {
9
+ "selector-max-id": 0,
10
+ "property-no-vendor-prefix": true,
11
+ "color-function-notation": "modern",
12
+ "import-notation": "string",
13
+ "at-rule-no-unknown": [
14
+ true,
15
+ {
16
+ ignoreAtRules: [
17
+ "theme",
18
+ "utility",
19
+ "variant",
20
+ "custom-variant",
21
+ "source",
22
+ "plugin",
23
+ ],
24
+ },
25
+ ],
26
+ },
27
+ overrides: [
28
+ {
29
+ files: ["**/*.module.css"],
30
+ rules: {
31
+ "color-named": "never",
32
+ "color-no-hex": true,
33
+ "selector-class-pattern": [
34
+ "^[a-z][a-zA-Z0-9]*$",
35
+ { message: "Expected class selector to be camelCase" },
36
+ ],
37
+ },
38
+ },
39
+ ],
40
+ };
@@ -0,0 +1,13 @@
1
+ /** @type {import("stylelint").Config} */
2
+ export default {
3
+ ignoreFiles: ["**/vendor/**"],
4
+ extends: [
5
+ "stylelint-config-standard-scss",
6
+ "stylelint-config-recess-order",
7
+ ],
8
+ rules: {
9
+ "selector-max-id": 0,
10
+ "property-no-vendor-prefix": true,
11
+ "color-function-notation": "modern",
12
+ },
13
+ };