@jamie-tam/forge 6.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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/agents/architect.md +92 -0
  4. package/agents/builder.md +122 -0
  5. package/agents/code-reviewer.md +107 -0
  6. package/agents/concept-designer.md +207 -0
  7. package/agents/craft-reviewer.md +132 -0
  8. package/agents/critic.md +130 -0
  9. package/agents/doc-writer.md +85 -0
  10. package/agents/dreamer.md +129 -0
  11. package/agents/e2e-runner.md +89 -0
  12. package/agents/gotcha-hunter.md +127 -0
  13. package/agents/prototype-builder.md +193 -0
  14. package/agents/prototype-codifier.md +204 -0
  15. package/agents/prototype-reviewer.md +163 -0
  16. package/agents/security-reviewer.md +108 -0
  17. package/agents/spec-reviewer.md +94 -0
  18. package/agents/tracer.md +98 -0
  19. package/agents/wireframer.md +109 -0
  20. package/commands/abort.md +25 -0
  21. package/commands/bugfix.md +151 -0
  22. package/commands/evolve.md +118 -0
  23. package/commands/feature.md +236 -0
  24. package/commands/forge.md +100 -0
  25. package/commands/greenfield.md +185 -0
  26. package/commands/hotfix.md +98 -0
  27. package/commands/refactor.md +147 -0
  28. package/commands/resume.md +25 -0
  29. package/commands/setup.md +201 -0
  30. package/commands/status.md +27 -0
  31. package/commands/task-force.md +110 -0
  32. package/commands/validate.md +12 -0
  33. package/dist/__tests__/active-manifest.test.js +272 -0
  34. package/dist/__tests__/copy.test.js +96 -0
  35. package/dist/__tests__/gate-check.test.js +384 -0
  36. package/dist/__tests__/wiki.test.js +472 -0
  37. package/dist/__tests__/work-manifest.test.js +304 -0
  38. package/dist/active-manifest.js +229 -0
  39. package/dist/cli.js +158 -0
  40. package/dist/copy.js +124 -0
  41. package/dist/gate-check.js +326 -0
  42. package/dist/hooks.js +60 -0
  43. package/dist/init.js +140 -0
  44. package/dist/manifest.js +90 -0
  45. package/dist/merge.js +77 -0
  46. package/dist/paths.js +36 -0
  47. package/dist/uninstall.js +216 -0
  48. package/dist/update.js +158 -0
  49. package/dist/verify-manifest.js +65 -0
  50. package/dist/verify.js +98 -0
  51. package/dist/wiki-ui.js +310 -0
  52. package/dist/wiki.js +364 -0
  53. package/dist/work-manifest.js +798 -0
  54. package/hooks/config/gate-requirements.json +79 -0
  55. package/hooks/hooks.json +143 -0
  56. package/hooks/scripts/analyze-telemetry.sh +114 -0
  57. package/hooks/scripts/gate-enforcer.sh +164 -0
  58. package/hooks/scripts/pre-compact.sh +90 -0
  59. package/hooks/scripts/session-start.sh +81 -0
  60. package/hooks/scripts/telemetry.sh +41 -0
  61. package/hooks/scripts/wiki-lint.sh +87 -0
  62. package/hooks/templates/AGENTS.md.template +48 -0
  63. package/hooks/templates/CLAUDE.md.template +45 -0
  64. package/package.json +55 -0
  65. package/protocols/README.md +40 -0
  66. package/protocols/codex.md +151 -0
  67. package/protocols/graphify.md +156 -0
  68. package/references/common/agent-coordination.md +65 -0
  69. package/references/common/coding-standards.md +54 -0
  70. package/references/common/feature-tracking.md +21 -0
  71. package/references/common/io-protocol.md +36 -0
  72. package/references/common/phases.md +57 -0
  73. package/references/common/quality-gates.md +130 -0
  74. package/references/common/skill-authoring.md +154 -0
  75. package/references/common/skill-compliance.md +30 -0
  76. package/references/python/standards.md +44 -0
  77. package/references/react/standards.md +61 -0
  78. package/references/typescript/standards.md +42 -0
  79. package/rules/common/forge-system.md +59 -0
  80. package/rules/common/git-workflow.md +40 -0
  81. package/rules/common/guardrails.md +37 -0
  82. package/rules/common/quality-gates.md +18 -0
  83. package/rules/common/security.md +50 -0
  84. package/rules/common/skill-selection.md +78 -0
  85. package/rules/common/testing.md +58 -0
  86. package/rules/common/verification.md +39 -0
  87. package/skills/build-pr-workflow/SKILL.md +301 -0
  88. package/skills/build-pr-workflow/references/pr-template.md +62 -0
  89. package/skills/build-pr-workflow/references/subagent-merge.md +47 -0
  90. package/skills/build-pr-workflow/references/worktree-setup.md +125 -0
  91. package/skills/build-prototype/SKILL.md +264 -0
  92. package/skills/build-scaffold/SKILL.md +340 -0
  93. package/skills/build-tdd/SKILL.md +89 -0
  94. package/skills/build-wireframe/SKILL.md +110 -0
  95. package/skills/build-wireframe/assets/baseline-template.html +486 -0
  96. package/skills/build-wireframe/references/demo-walkthroughs.md +170 -0
  97. package/skills/build-wireframe/references/gotchas.md +188 -0
  98. package/skills/build-wireframe/references/legend-lines.md +141 -0
  99. package/skills/concept-slides/SKILL.md +192 -0
  100. package/skills/deliver-db-migration/SKILL.md +466 -0
  101. package/skills/deliver-deploy/SKILL.md +407 -0
  102. package/skills/deliver-onboarding/SKILL.md +198 -0
  103. package/skills/deliver-onboarding/references/document-templates.md +393 -0
  104. package/skills/deliver-onboarding/templates/getting-started.md +122 -0
  105. package/skills/discover-codebase-analysis/SKILL.md +448 -0
  106. package/skills/discover-requirements/SKILL.md +418 -0
  107. package/skills/discover-requirements/templates/prd.md +99 -0
  108. package/skills/discover-requirements/templates/technical-spec.md +123 -0
  109. package/skills/discover-requirements/templates/user-stories.md +76 -0
  110. package/skills/harden/SKILL.md +214 -0
  111. package/skills/iterate-prototype/SKILL.md +241 -0
  112. package/skills/plan-architecture/SKILL.md +457 -0
  113. package/skills/plan-architecture/templates/adr-template.md +52 -0
  114. package/skills/plan-architecture/templates/api-contract.md +99 -0
  115. package/skills/plan-architecture/templates/db-schema.md +81 -0
  116. package/skills/plan-architecture/templates/system-design.md +111 -0
  117. package/skills/plan-brainstorm/SKILL.md +433 -0
  118. package/skills/plan-design-system/SKILL.md +279 -0
  119. package/skills/plan-task-decompose/SKILL.md +454 -0
  120. package/skills/quality-code-review/SKILL.md +286 -0
  121. package/skills/quality-security-audit/SKILL.md +292 -0
  122. package/skills/quality-security-audit/references/audit-report-template.md +89 -0
  123. package/skills/quality-security-audit/references/owasp-checks.md +178 -0
  124. package/skills/quality-test-execution/SKILL.md +435 -0
  125. package/skills/quality-test-plan/SKILL.md +297 -0
  126. package/skills/quality-test-plan/references/test-type-guide.md +263 -0
  127. package/skills/quality-test-plan/templates/e2e-test-plan.md +72 -0
  128. package/skills/quality-test-plan/templates/integration-test-plan.md +74 -0
  129. package/skills/quality-test-plan/templates/load-test-plan.md +111 -0
  130. package/skills/quality-test-plan/templates/smoke-test-plan.md +68 -0
  131. package/skills/quality-test-plan/templates/unit-test-plan.md +56 -0
  132. package/skills/quality-uiux/SKILL.md +481 -0
  133. package/skills/support-debug/SKILL.md +464 -0
  134. package/skills/support-dream/SKILL.md +213 -0
  135. package/skills/support-gotcha/SKILL.md +249 -0
  136. package/skills/support-runtime-reachability/SKILL.md +190 -0
  137. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/app.ts +7 -0
  138. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/handlers/cases.ts +7 -0
  139. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/app.ts +8 -0
  140. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/handlers/cases.ts +7 -0
  141. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/App.tsx +5 -0
  142. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/components/RingingBanner.tsx +7 -0
  143. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/hooks/useTwilio.ts +6 -0
  144. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/App.tsx +5 -0
  145. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/components/MyComp.tsx +3 -0
  146. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/App.tsx +3 -0
  147. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/components/Orphan.tsx +3 -0
  148. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/lib/Service.ts +6 -0
  149. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/main.ts +4 -0
  150. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/lib/Lonely.ts +5 -0
  151. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/main.ts +2 -0
  152. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/handler.ts +3 -0
  153. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/main.ts +3 -0
  154. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/handler.ts +3 -0
  155. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/main.ts +2 -0
  156. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/lib.ts +5 -0
  157. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/main.ts +3 -0
  158. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/index.ts +1 -0
  159. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/internal.ts +3 -0
  160. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/main.ts +3 -0
  161. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.test.ts +5 -0
  162. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.ts +3 -0
  163. package/skills/support-runtime-reachability/scripts/__fixtures__/case-13-gated-pending-annotation/src/future.ts +4 -0
  164. package/skills/support-runtime-reachability/scripts/__fixtures__/case-14-untraceable-annotation/src/decorated.ts +4 -0
  165. package/skills/support-runtime-reachability/scripts/__fixtures__/case-15-untraceable-empty/src/lazy.ts +4 -0
  166. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/lib.py +15 -0
  167. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/main.py +5 -0
  168. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/parent.ts +5 -0
  169. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/routes/cases.ts +5 -0
  170. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/lib/foo.ts +3 -0
  171. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/other.ts +8 -0
  172. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/cases.ts +4 -0
  173. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/users.ts +4 -0
  174. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/main.ts +5 -0
  175. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/handlers/cases.ts +3 -0
  176. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/main.ts +4 -0
  177. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/lib.ts +5 -0
  178. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/main.ts +5 -0
  179. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/lib.ts +3 -0
  180. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/main.ts +8 -0
  181. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/lib.ts +3 -0
  182. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/main.ts +7 -0
  183. package/skills/support-runtime-reachability/scripts/check.mjs +638 -0
  184. package/skills/support-runtime-reachability/scripts/check.test.mjs +244 -0
  185. package/skills/support-skill-validator/SKILL.md +194 -0
  186. package/skills/support-skill-validator/references/false-positives.md +59 -0
  187. package/skills/support-skill-validator/references/validation-checks.md +280 -0
  188. package/skills/support-system-guide/SKILL.md +311 -0
  189. package/skills/support-task-force/SKILL.md +265 -0
  190. package/skills/support-task-force/references/dispatch-pattern.md +178 -0
  191. package/skills/support-task-force/references/synthesis-template.md +126 -0
  192. package/skills/support-wiki-bootstrap/SKILL.md +37 -0
  193. package/skills/support-wiki-lint/SKILL.md +196 -0
  194. package/skills/support-wiki-lint/scripts/lint.mjs +488 -0
  195. package/skills/support-wiki-lint/scripts/lint.test.mjs +196 -0
  196. package/templates/README.md +23 -0
  197. package/templates/aiwiki/CLAUDE.md.template +78 -0
  198. package/templates/aiwiki/schemas/architecture.md +118 -0
  199. package/templates/aiwiki/schemas/convention.md +112 -0
  200. package/templates/aiwiki/schemas/decision.md +144 -0
  201. package/templates/aiwiki/schemas/gotcha.md +118 -0
  202. package/templates/aiwiki/schemas/oracle.md +105 -0
  203. package/templates/aiwiki/schemas/session.md +125 -0
  204. package/templates/manifests/bugfix.yaml +41 -0
  205. package/templates/manifests/feature.yaml +69 -0
  206. package/templates/manifests/greenfield.yaml +61 -0
  207. package/templates/manifests/hotfix.yaml +45 -0
  208. package/templates/manifests/refactor.yaml +44 -0
  209. package/templates/manifests/v5/SCHEMA.md +327 -0
  210. package/templates/manifests/v5/feature.yaml +77 -0
  211. package/templates/manifests/v6/SCHEMA.md +199 -0
  212. package/templates/wiki-html/dream-detail.html +378 -0
  213. package/templates/wiki-html/dreams-list.html +155 -0
@@ -0,0 +1,42 @@
1
+ # TypeScript Standards
2
+
3
+ Extends common coding standards with TypeScript-specific rules.
4
+
5
+ ## Compiler Configuration
6
+
7
+ - `strict: true` always — no exceptions
8
+ - `noUncheckedIndexedAccess: true`, `exactOptionalProperties: true`
9
+
10
+ ## Type Safety
11
+
12
+ - No `any` — use `unknown` and narrow
13
+ - `interface` for object shapes, `type` for unions/intersections/computed
14
+ - Discriminated unions over type guards: `{ ok: true; data: T } | { ok: false; error: E }`
15
+
16
+ ## Runtime Validation
17
+
18
+ - Zod (or similar) at system boundaries: API bodies, env vars, config
19
+ - Parse external data into typed structures — never trust raw input
20
+
21
+ ## Module Organization
22
+
23
+ - Barrel exports (`index.ts`) for public APIs; internals not exported
24
+ - One responsibility per file, co-locate tests
25
+
26
+ ## Modern TypeScript
27
+
28
+ - `as const` for literal types, `satisfies` for type-safe inference
29
+ - Template literal types for string patterns
30
+ - `Map`/`Set` over plain objects for dynamic keys
31
+
32
+ ## Error Handling
33
+
34
+ - Typed Result types over try/catch where possible
35
+ - Catch at boundaries, not every function
36
+ - Never catch and ignore — handle, transform, or re-throw
37
+
38
+ ## Naming
39
+
40
+ - Interfaces/Types: PascalCase (no `I` prefix)
41
+ - Enums: PascalCase members
42
+ - Constants: UPPER_SNAKE_CASE for true constants
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: Forge system structure — skills (prefix-grouped), commands (orchestrate skills), .forge/ directory layout, context recovery. Auto-loaded every session so agents know the system they're operating in.
3
+ ---
4
+
5
+ # Forge System
6
+
7
+ This project uses **forge** as its development workflow. Every session should follow it.
8
+
9
+ ## Skills (prefix-grouped)
10
+
11
+ | Prefix | Purpose | Examples |
12
+ |--------|---------|---------|
13
+ | `discover-` | Understand inputs and codebase | requirements, codebase-analysis |
14
+ | `plan-` | Design before building | brainstorm, architecture, task-decompose, design-system |
15
+ | `build-` | Write code and manage git | scaffold, tdd, pr-workflow, wireframe, prototype |
16
+ | `quality-` | Review, test, audit | code-review, test-plan, test-execution, security-audit, uiux |
17
+ | `deliver-` | Ship and migrate | deploy, db-migration, onboarding |
18
+ | `support-` | Maintain and learn | system-guide, debug, gotcha, skill-validator |
19
+
20
+ v6 also adds phase skills: concept-slides, build-wireframe, build-prototype, iterate-prototype, harden.
21
+
22
+ ## Commands (orchestrate skills)
23
+
24
+ | Command | When to use |
25
+ |---------|------------|
26
+ | `/forge` | One-screen discovery — installed capabilities, active work, suggested next |
27
+ | `/setup` | Detect stack, install matching language rules, and fill the project profile |
28
+ | `/feature` | Full feature development |
29
+ | `/greenfield` | New project from zero |
30
+ | `/bugfix` | Fix a bug |
31
+ | `/refactor` | Improve existing code |
32
+ | `/hotfix` | Emergency production fix |
33
+ | `/evolve` | Improve the forge system itself |
34
+ | `/validate` | Check skill consistency |
35
+
36
+ ## .forge/ Directory
37
+
38
+ ```
39
+ .forge/
40
+ work/ # Per-work-item artifacts, one subdir per type
41
+ feature/{name}/ # manifest, requirements, architecture, tasks, test plan/results
42
+ bugfix/{name}/ # manifest, debug notes, regression tests
43
+ refactor/{name}/ # manifest, codebase analysis, tasks, test results
44
+ hotfix/{name}/ # manifest, minimal debug, smoke tests
45
+ greenfield/{name}/ # manifest + full project scaffold artifacts
46
+ state/ # Runtime state (notepad.md, telemetry, dream history)
47
+ ```
48
+
49
+ Project knowledge (ADRs, gotchas) lives under `aiwiki/` — see `aiwiki/decisions/` and `aiwiki/gotchas/`. The `.forge/` directory retains operational state only (manifests, telemetry, dream history).
50
+
51
+ Work items are identified by `{type}/{name}` — names may collide across types.
52
+
53
+ ## Context Recovery
54
+
55
+ If `.forge/state/notepad.md` exists, read it FIRST before doing anything else.
56
+
57
+ ## Rules
58
+
59
+ Rules in `.claude/rules/` are always-on constraints. Common rules apply to all projects. Language-specific rules layer on top.
@@ -0,0 +1,40 @@
1
+ ---
2
+ description: Git commit and PR conventions — Conventional Commits format, bisectable commits, branch naming. Auto-loads into every session including forge subagents (builder, prototype-builder) which lack Skill-tool access.
3
+ ---
4
+
5
+ # Git Workflow
6
+
7
+ ## Conventional Commits
8
+
9
+ Format: `type(scope): description` — lowercase, imperative mood.
10
+
11
+ | Type | When |
12
+ |------|------|
13
+ | `feat` | New feature |
14
+ | `fix` | Bug fix |
15
+ | `refactor` | Restructuring (no behavior change) |
16
+ | `test` | Adding or updating tests |
17
+ | `docs` | Documentation only |
18
+ | `chore` | Build, config, tooling |
19
+
20
+ ## Commit Discipline
21
+
22
+ - One commit per logical change — each must be bisectable
23
+ - Every commit must leave the project in a working state
24
+ - Always create new commits; never amend unless explicitly asked
25
+ - Never commit generated files, build artifacts, or secrets
26
+
27
+ ## Branch Naming
28
+
29
+ `feat/`, `fix/`, `refactor/`, `hotfix/` + kebab-case description.
30
+
31
+ ## Pull Requests
32
+
33
+ - One PR per logical function — atomic, independently mergeable
34
+ - PR description references requirements or issue
35
+ - Squash merges for feature branches
36
+ - Every PR must pass CI before merge
37
+
38
+ ## Secrets
39
+
40
+ See [rules/common/security.md](security.md) for canonical secrets handling.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Safety floor — never run destructive operations (rm -rf, force-push, DROP TABLE, --no-verify) without explicit confirmation. Universal across all phases.
3
+ ---
4
+
5
+ # Guardrails
6
+
7
+ Safety rules that apply to every action. When in doubt, ask.
8
+
9
+ ## Blocked Operations
10
+
11
+ Never execute without explicit user confirmation:
12
+
13
+ - `rm -rf` — Use targeted deletes instead
14
+ - `DROP TABLE`, `DROP DATABASE`, `TRUNCATE`
15
+ - `git push --force` — Suggest `--force-with-lease` and confirm
16
+ - `git reset --hard` — Warn about data loss
17
+ - `--no-verify` on any git command — Hooks exist for a reason
18
+
19
+ ## Require Confirmation Before
20
+
21
+ - Deleting git branches (local or remote)
22
+ - Modifying CI/CD configuration files
23
+ - Running destructive database migrations
24
+ - Overwriting files outside the current project
25
+ - Any operation described as "irreversible"
26
+
27
+ ## Never Commit Secrets
28
+
29
+ See [rules/common/security.md](security.md) for canonical secrets handling.
30
+
31
+ ## Deployment
32
+
33
+ The `deliver-deploy` skill and `/hotfix` command respect all guardrails. Speed does not override the confirmation requirement for irreversible actions.
34
+
35
+ ## When Uncertain
36
+
37
+ Stop and ask the user. A 30-second question is better than a 30-minute rollback.
@@ -0,0 +1,18 @@
1
+ ---
2
+ description: Gate-state names and pass criteria summary — auto-loaded every session for quick recall; references/common/quality-gates.md has the full tables.
3
+ ---
4
+
5
+ # Quality Gates
6
+
7
+ Gates block phase transitions until criteria are met. See [references/common/quality-gates.md](../../references/common/quality-gates.md) for the full gate-set tables, pass criteria, and fail actions.
8
+
9
+ Gate names (per `hooks/config/gate-requirements.json`):
10
+ - code-review-final
11
+ - code-review (per-slice)
12
+ - test-plan
13
+ - test-execution
14
+ - uiux-review
15
+ - runtime-reach (per-slice wiring gate)
16
+ - wiki-lint (per-slice)
17
+
18
+ Security audit is invoked as a skill (`quality-security-audit`) on High/Critical-risk diffs — see `quality-code-review` Risk Classification — rather than a dedicated `phases.*` gate.
@@ -0,0 +1,50 @@
1
+ ---
2
+ description: Security baseline for all code — no hardcoded secrets, parameterized queries, input validation, secure auth, dependency hygiene. Universal across phases.
3
+ ---
4
+
5
+ # Security Standards
6
+
7
+ Security is a constraint, not a feature. These rules apply to all code.
8
+
9
+ ## Secrets Management
10
+
11
+ - ZERO hardcoded secrets: API keys, passwords, tokens, connection strings
12
+ - Use environment variables or a secret manager
13
+ - `.env` files never committed — use `.env.example` with placeholders
14
+ - Rotate any secret that was ever exposed in version control
15
+
16
+ ## Database Security
17
+
18
+ - Parameterized queries for ALL database access — no string concatenation
19
+ - Use an ORM or query builder that parameterizes by default
20
+ - Principle of least privilege for database users
21
+
22
+ ## Input Validation
23
+
24
+ - Validate all user-facing input at the boundary
25
+ - Whitelist valid input rather than blacklisting bad input
26
+ - Validate type, length, range, and format
27
+ - Reject unexpected fields — don't silently ignore them
28
+
29
+ ## Web Security
30
+
31
+ - No `*` CORS in production; CSP, HSTS, X-Content-Type-Options, X-Frame-Options headers required
32
+ - CSRF tokens on all state-changing endpoints; sanitize all HTML output
33
+
34
+ ## Data Protection
35
+
36
+ - Sensitive data (PII, credentials, tokens) never in logs or error messages
37
+ - Never return sensitive data in API error responses
38
+ - Encrypt sensitive data at rest where applicable
39
+
40
+ ## Dependencies
41
+
42
+ - Check for known CVEs before adding any new dependency
43
+ - Pin dependency versions — no floating ranges in production
44
+ - Audit periodically (`npm audit`, `pip-audit`)
45
+
46
+ ## Authentication and Authorization
47
+
48
+ - Use established libraries (don't roll your own auth/crypto)
49
+ - Session tokens: HttpOnly, Secure, SameSite attributes
50
+ - Rate limiting on auth endpoints
@@ -0,0 +1,78 @@
1
+ ---
2
+ description: How to route user intent to the right slash command or skill — detect repo mode (prototype vs production) first, then route.
3
+ ---
4
+
5
+ # Skill Selection
6
+
7
+ When to load a skill — even outside commands. This rule is always active.
8
+
9
+ ## The Rule
10
+
11
+ **Detect repo state first. Then check intent. Load the matching skill before writing code or responding.**
12
+
13
+ ## Step 1: Detect Repo State
14
+
15
+ Before routing on user intent, classify the repo. Two primary modes; signals are checked in order.
16
+
17
+ | Mode | Signals (any of these) | Implications |
18
+ |---|---|---|
19
+ | **Prototype** | Path under `pocs/` or directory name ends in `-prototype`; `package.json` has `"private": true` and no test runner / no CI; `aiwiki/architecture/` is empty or missing; manifest has `phase_plan.prototype: active` and `phase_plan.codify: skipped` | TDD is exempt (per `rules/common/testing.md` phase header). UI work iterates in-place. Gotchas are recorded but production hardening is deferred. |
20
+ | **Production** | `aiwiki/architecture/` has entries (codified); manifest has `phase_plan.codify: active` and `phase_plan.production-build: active`; CI configured + tests pass | Phase-conditional rules (testing, quality-gates, git-workflow) are active. Production code must go through `build-tdd`. |
21
+
22
+ **Mixed mode** (prototype directory inside a production repo, or vice versa) is rare; treat the work item's local context as authoritative — if you're touching files under `pocs/`, you're in prototype mode for that work.
23
+
24
+ When the mode is ambiguous, ask the user once. Do not guess.
25
+
26
+ ## Step 2: Priority Rule
27
+
28
+ When multiple skills match, follow this order:
29
+
30
+ 1. **Diagnose first** — `support-debug` before any fix-skill for bugs
31
+ 2. **Route by mode**:
32
+ - **Prototype mode**: `iterate-prototype` is the default execution skill. No `build-tdd`, no `harden`, no `plan-architecture` unless explicitly invoked.
33
+ - **Production mode**: `harden` produces architecture/ADRs/slice graph at codify; `build-tdd` implements at production-build.
34
+ 3. **Review after build** — `quality-code-review` after production code is written (not for prototype iteration; that uses `prototype-reviewer` via `iterate-prototype`)
35
+ 4. **Plan-* skills are non-prototype fallback only** — `plan-brainstorm`, `plan-architecture`, `plan-task-decompose` are for library / internal-tool / refactor work where prototype/wireframe phases don't apply. Not the default for `/feature` or `/greenfield`.
36
+
37
+ ## Step 3: Direct-Request Routing
38
+
39
+ | User says / situation | Prototype mode loads | Production mode loads | Why |
40
+ |---|---|---|---|
41
+ | Bug, error, unexpected behavior | `iterate-prototype` (capture as feedback item) | `support-debug` → `build-tdd` | Diagnose-then-fix is universal; the fix lives in different skills per mode |
42
+ | "Add X" / "tweak X" / "improve UI" | `iterate-prototype` | `/feature` (full pipeline) or `build-tdd` if mid-flow | Prototype iteration is lightweight; production features need the gated pipeline |
43
+ | "Make this fast" / "refactor this" | `iterate-prototype` (mark as iteration item) | `build-tdd` (refactors need tests proving behavior preserved) | |
44
+ | Before declaring code changes done | `prototype-reviewer` (informal pass) | `quality-code-review` (full multi-stage chain) | Review depth scales with mode |
45
+ | Surprising lesson, workaround, wrong assumption | `support-gotcha` | `support-gotcha` | Mode-independent: writes to `aiwiki/gotchas/` |
46
+ | "How should we approach X?" / design discussion | Existing prototype IS the design exploration — answer inline; no skill | `plan-brainstorm` (non-prototype fallback only) | Prototype-driven flow makes brainstorm redundant |
47
+ | Need API contracts, DB schema, system design | If a prototype exists, use `harden` to codify; otherwise `plan-architecture` (fallback) | `harden` (from prototype) or `plan-architecture` (fallback) | Codify-from-prototype is the default; plan-* is the fallback |
48
+ | New visual direction, design tokens, UI system | `plan-design-system` | `plan-design-system` | Mode-independent design step |
49
+ | Security concerns, pre-deploy audit | Not applicable during prototype phases | `quality-security-audit` | Pre-deploy gate; safety floor rules always active |
50
+ | Database schema changes needed | Not applicable (prototype data is mocked) | `deliver-db-migration` | |
51
+ | Ready to deploy | Not applicable | `deliver-deploy` | |
52
+ | New team member needs onboarding | `deliver-onboarding` (light) | `deliver-onboarding` (full) | Same skill; depth varies by mode |
53
+
54
+ ## Ambiguous Requests
55
+
56
+ Some requests could mean multiple things. Ask before guessing.
57
+
58
+ | Request | Could be... | How to decide |
59
+ |---|---|---|
60
+ | "There's no button for X" | Bug (should exist) OR feature (doesn't exist yet) | Ask: "Should this button already exist, or is this a new feature request?" |
61
+ | "X isn't working right" | Bug (broken) OR feature gap (never built) | Check if the code path exists. If yes → diagnose. If no → mode-routed feature work. |
62
+ | "Can we improve X?" | Refactor OR feature enhancement | Ask: "Is this changing behavior or just restructuring?" Then mode-route. |
63
+ | User in production repo says "let me just tweak something" | Production work OR mistaken-for-prototype | Ask: "Is this a one-off ad-hoc change or a tracked feature?" One-off may still need gates if it touches production-built code. |
64
+
65
+ When genuinely ambiguous, ask — don't guess.
66
+
67
+ ## What This Rule Does NOT Cover
68
+
69
+ - **Command routing under explicit invocation** — if the user types `/feature`, `/bugfix`, etc., the command's own preflight handles state detection and may redirect (see each command's Step 0). This rule covers routing when the user describes intent without naming a command.
70
+ - **Which skill to invoke inside a command** — commands specify `REQUIRED SUB-SKILL` explicitly
71
+ - **Skill invocation correctness** — see `skill-compliance.md` for that
72
+
73
+ ## The Explicit Rule
74
+
75
+ - **In production mode**: any production-code change, no matter how small, requires `build-tdd`. "It's just one line" is not an exception. "It's obvious" is not an exception. The skill exists because shortcuts cause regressions.
76
+ - **In prototype mode**: code changes use `iterate-prototype` (or inline editing for trivial cases). TDD is intentionally exempt per `rules/common/testing.md` phase header — the prototype's verification surface is manual click-through, not test coverage.
77
+
78
+ Mode determines which rule applies. Don't apply production discipline to prototype iteration; don't waive production discipline for "this feels like prototyping" inside a production repo.
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: Test-driven development standards for production code — RED-GREEN-REFACTOR, coverage targets, mocking strategy. Loads conditionally via paths on test files and src/ code.
3
+ paths:
4
+ - "**/*.test.*"
5
+ - "**/*.spec.*"
6
+ - "**/__tests__/**"
7
+ - "**/tests/**"
8
+ - "**/test/**"
9
+ - "src/**/*.ts"
10
+ - "src/**/*.tsx"
11
+ - "src/**/*.js"
12
+ - "src/**/*.jsx"
13
+ - "src/**/*.py"
14
+ ---
15
+
16
+ # Testing Standards
17
+
18
+ Test-driven development is mandatory for production code. Code without tests is incomplete. TDD cycle: RED → GREEN → REFACTOR. See `build-tdd` skill for the full process.
19
+
20
+ ## Coverage Requirements
21
+
22
+ - Minimum: 80% line coverage across the project
23
+ - Critical paths: 100% coverage required (auth, payments, security, data mutations)
24
+ - Coverage is necessary but not sufficient — test quality matters more than numbers
25
+
26
+ ## Test Types Required
27
+
28
+ | Type | Covers | Required |
29
+ |------|--------|----------|
30
+ | Unit | Individual functions, edge cases | Always |
31
+ | Integration | Component interactions, API contracts | Always |
32
+ | E2E | Full user flows via browser/client | For user-facing features |
33
+
34
+ ## Test Quality
35
+
36
+ - Every test must fail first (proves it tests something real)
37
+ - One behavior per test — not multiple assertions testing different things
38
+ - Test edge cases: null/undefined, empty collections, boundary values, error paths
39
+ - Use descriptive test names that explain the behavior being verified
40
+
41
+ ## Mocking Strategy
42
+
43
+ | Test Level | External Services | Internal Dependencies |
44
+ |---|---|---|
45
+ | **Unit** | Mocks OK — isolate the unit | Mocks OK |
46
+ | **Integration** | SHOULD use real if available, mocks require documented justification | Real |
47
+ | **E2E** | MUST use real if confirmed available, BLOCKED if not | Real |
48
+
49
+ Mock-only suites fail the quality gate. Every external dependency needs at least one integration/E2E test against the real service. E2E tests MUST NOT fall back to fake data on timeout — they FAIL.
50
+
51
+ **Exemption:** `/hotfix` uses smoke tests + regression test only (not the full test plan). Full test coverage is deferred to the follow-up ticket. See `quality-gates.md` Hotfix Gate Exemptions and `quality-test-execution` Step 2 note.
52
+
53
+ ## Anti-Patterns
54
+
55
+ - No tests that only verify the mock
56
+ - No skipped tests in CI (fix or delete them)
57
+ - No test code in production builds
58
+ - No flaky tests — fix the root cause or quarantine immediately
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Verify-before-claim discipline — check docs before coding, run tests before claiming done, no "should work" without smoke. Universal anti-hallucination guard.
3
+ ---
4
+
5
+ # Verification
6
+
7
+ This is a universal rule. It applies to every action.
8
+
9
+ ## Verify Before Using
10
+
11
+ When uncertain about ANY API, library behavior, function signature, or pattern:
12
+
13
+ 1. Check documentation via context7 MCP or web search BEFORE writing code
14
+ 2. Do not assume you know the current API — libraries change between versions
15
+ 3. Do not guess parameter names, return types, or default behaviors
16
+
17
+ ## Verify After Implementing
18
+
19
+ Before claiming any task is complete:
20
+
21
+ 1. Execute the verification command (test suite, build, type check)
22
+ 2. Review the output — do not just check the exit code
23
+ 3. Confirm the output actually supports the claim of completion
24
+
25
+ ## Red Flags
26
+
27
+ Stop and verify: "seems fixed", "should work now", "based on my knowledge", claiming completion before running tests.
28
+
29
+ ## No "Should Work"
30
+
31
+ - If you wrote code, run it
32
+ - If you fixed a bug, reproduce the original failure first, then confirm the fix
33
+ - If you changed a config, validate the config loads correctly
34
+
35
+ ## Library and Framework Rules
36
+
37
+ - Check the installed version before referencing API docs
38
+ - Use the docs for THAT version, not the latest
39
+ - If a method doesn't exist at runtime, check the version — don't hack around it