@ryuenn3123/agentic-senior-core 3.0.50 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +3 -1
  2. package/.agent-context/prompts/research-design.md +165 -0
  3. package/.agent-context/review-checklists/pr-checklist.md +1 -0
  4. package/.agent-context/rules/api-docs.md +63 -47
  5. package/.agent-context/rules/architecture.md +133 -120
  6. package/.agent-context/rules/database-design.md +36 -18
  7. package/.agent-context/rules/docker-runtime.md +66 -43
  8. package/.agent-context/rules/efficiency-vs-hype.md +38 -17
  9. package/.agent-context/rules/error-handling.md +35 -16
  10. package/.agent-context/rules/event-driven.md +35 -18
  11. package/.agent-context/rules/frontend-architecture.md +103 -76
  12. package/.agent-context/rules/git-workflow.md +81 -197
  13. package/.agent-context/rules/microservices.md +42 -41
  14. package/.agent-context/rules/naming-conv.md +27 -8
  15. package/.agent-context/rules/performance.md +32 -12
  16. package/.agent-context/rules/realtime.md +26 -9
  17. package/.agent-context/rules/security.md +39 -20
  18. package/.agent-context/rules/testing.md +36 -16
  19. package/AGENTS.md +21 -20
  20. package/README.md +10 -1
  21. package/lib/cli/commands/init.mjs +12 -0
  22. package/lib/cli/commands/upgrade.mjs +11 -0
  23. package/lib/cli/compiler.mjs +1 -0
  24. package/lib/cli/detector/constants.mjs +135 -0
  25. package/lib/cli/detector/design-evidence/collector.mjs +256 -0
  26. package/lib/cli/detector/design-evidence/constants.mjs +39 -0
  27. package/lib/cli/detector/design-evidence/file-traversal.mjs +83 -0
  28. package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +117 -0
  29. package/lib/cli/detector/design-evidence/summary.mjs +109 -0
  30. package/lib/cli/detector/design-evidence/utility-helpers.mjs +122 -0
  31. package/lib/cli/detector/design-evidence.mjs +25 -610
  32. package/lib/cli/detector/stack-detection.mjs +243 -0
  33. package/lib/cli/detector/ui-signals.mjs +150 -0
  34. package/lib/cli/detector/workspace-scan.mjs +177 -0
  35. package/lib/cli/detector.mjs +20 -688
  36. package/lib/cli/memory-continuity.mjs +1 -0
  37. package/lib/cli/project-scaffolder/design-contract/research-dossier-migration.mjs +165 -0
  38. package/lib/cli/project-scaffolder/design-contract/sections/audits.mjs +96 -0
  39. package/lib/cli/project-scaffolder/design-contract/sections/conceptual-anchor.mjs +233 -0
  40. package/lib/cli/project-scaffolder/design-contract/sections/execution-handoff.mjs +211 -0
  41. package/lib/cli/project-scaffolder/design-contract/seed-signals.mjs +79 -0
  42. package/lib/cli/project-scaffolder/design-contract/signal-vocab.mjs +64 -0
  43. package/lib/cli/project-scaffolder/design-contract/validation/anchor-validators.mjs +456 -0
  44. package/lib/cli/project-scaffolder/design-contract/validation/audit-validators.mjs +117 -0
  45. package/lib/cli/project-scaffolder/design-contract/validation/completeness.mjs +83 -0
  46. package/lib/cli/project-scaffolder/design-contract/validation/execution-validators.mjs +328 -0
  47. package/lib/cli/project-scaffolder/design-contract/validation/helpers.mjs +8 -0
  48. package/lib/cli/project-scaffolder/design-contract/validation/research-dossier-validators.mjs +104 -0
  49. package/lib/cli/project-scaffolder/design-contract/validation/structural-validators.mjs +79 -0
  50. package/lib/cli/project-scaffolder/design-contract/validation/system-validators.mjs +256 -0
  51. package/lib/cli/project-scaffolder/design-contract/validation.mjs +61 -896
  52. package/lib/cli/project-scaffolder/design-contract.mjs +151 -556
  53. package/lib/cli/project-scaffolder/prompt-builders.mjs +9 -0
  54. package/mcp.json +30 -9
  55. package/package.json +17 -2
  56. package/scripts/audit-cache-layer-contract.mjs +258 -0
  57. package/scripts/audit-caching-scope-hygiene.mjs +263 -0
  58. package/scripts/audit-file-size.mjs +219 -0
  59. package/scripts/audit-reflection-citations.mjs +163 -0
  60. package/scripts/audit-release-bundle.mjs +170 -0
  61. package/scripts/audit-rule-id-uniqueness.mjs +313 -0
  62. package/scripts/benchmark-evidence-bundle.mjs +1 -0
  63. package/scripts/build-release-benchmark-bundle.mjs +204 -0
  64. package/scripts/context-triggered-audit.mjs +1 -0
  65. package/scripts/documentation-boundary-audit.mjs +1 -0
  66. package/scripts/explain-on-demand-audit.mjs +2 -1
  67. package/scripts/frontend-usability-audit.mjs +10 -10
  68. package/scripts/llm-judge/checklist-loader.mjs +45 -0
  69. package/scripts/llm-judge/constants.mjs +66 -0
  70. package/scripts/llm-judge/diff-collection.mjs +74 -0
  71. package/scripts/llm-judge/prompting.mjs +78 -0
  72. package/scripts/llm-judge/providers.mjs +111 -0
  73. package/scripts/llm-judge/verdict.mjs +134 -0
  74. package/scripts/llm-judge.mjs +21 -482
  75. package/scripts/mcp-server/tool-registry.mjs +55 -0
  76. package/scripts/mcp-server/tools.mjs +137 -1
  77. package/scripts/migrate-rule-format/id-prefix-table.mjs +37 -0
  78. package/scripts/migrate-rule-format/parse-legacy.mjs +180 -0
  79. package/scripts/migrate-rule-format/render-new.mjs +169 -0
  80. package/scripts/migrate-rule-format/roundtrip-validate.mjs +89 -0
  81. package/scripts/migrate-rule-format.mjs +192 -0
  82. package/scripts/release-gate/constants.mjs +1 -1
  83. package/scripts/release-gate/static-checks.mjs +1 -1
  84. package/scripts/rules-guardian-audit.mjs +5 -2
  85. package/scripts/single-source-lazy-loading-audit.mjs +2 -1
  86. package/scripts/ui-design-judge/git-input.mjs +3 -0
  87. package/scripts/validate/config.mjs +27 -2
  88. package/scripts/validate/coverage-checks.mjs +1 -1
  89. package/scripts/validate.mjs +94 -1
@@ -1,39 +1,54 @@
1
+ ---
2
+ id_prefix: ARCH
3
+ domain: architecture
4
+ priority: critical
5
+ scope: all-tasks
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - architecture
12
+ - arch
13
+ - separation
14
+ - concerns
15
+ - structure
16
+ - universal
17
+ ---
18
+
1
19
  # Architecture - Separation of Concerns and Structure
2
20
 
3
21
  > If a service imports transport concerns or raw persistence concerns directly, the architecture is already drifting.
4
22
 
5
- ## Universal Backend Principles (Mandatory)
6
-
7
- These principles are mandatory for backend and shared core modules.
8
-
9
- - No clever hacks.
10
- - No premature abstraction.
11
- - Readability over brevity.
12
- - Keep transport, application, domain, and infrastructure concerns separated.
13
- - Favor explicit module boundaries over hidden cross-layer shortcuts.
14
- - Health endpoints distinguish liveness (the process is alive), readiness (the process can serve traffic), and startup (initialization complete) where the runtime supports it. A `200 OK` that does not check critical dependencies is not a readiness signal.
15
-
16
- ## Complexity Budget (Mandatory)
17
-
18
- Prefer the smallest clear implementation that fully preserves behavior, safety, and maintainability.
19
-
20
- - If two implementations are equivalent in behavior and quality, choose the one with fewer moving parts.
21
- - Remove code that does not carry behavior, safety, clarity, maintainability, or test value.
22
- - Prefer direct logic over extra wrappers, layers, classes, config, or state when the abstraction does not reduce real complexity.
23
- - Keep validation, error handling, fallback paths, accessibility, tests, security boundaries, and observability when they protect real behavior.
24
- - Run a final simplification pass before completion.
25
- - Run a domain-fit pass on public contracts before completion: if endpoint names, payload fields, error codes, table names, or event types could be renamed to another domain without changing shape, the contract is too generic; revise to express the actual domain verbs and invariants. This is the backend equivalent of the design rename test.
26
- - Do not optimize for line count alone.
27
- - Do not replace clear code with clever, dense, or surprising code.
28
- - Do not remove safeguards just because the happy path works.
29
-
30
- ## Universal SOP Baseline (Mandatory)
31
-
32
- The `.agent-context/rules/` directory is the default guidance source for implementation and review.
33
-
34
- - Backend and frontend mindset checks are both required when a task spans API and UI boundaries.
35
- - Security and testing are non-negotiable baseline requirements.
36
- - Hard block before coding:
23
+ ## ARCH-001: Universal Backend Principles (Mandatory)
24
+
25
+ 1. These principles are mandatory for backend and shared core modules.
26
+ 2. No clever hacks.
27
+ 3. No premature abstraction.
28
+ 4. Readability over brevity.
29
+ 5. Keep transport, application, domain, and infrastructure concerns separated.
30
+ 6. Favor explicit module boundaries over hidden cross-layer shortcuts.
31
+ 7. Health endpoints distinguish liveness (the process is alive), readiness (the process can serve traffic), and startup (initialization complete) where the runtime supports it. A `200 OK` that does not check critical dependencies is not a readiness signal.
32
+
33
+ ## ARCH-002: Complexity Budget (Mandatory)
34
+
35
+ 1. Prefer the smallest clear implementation that fully preserves behavior, safety, and maintainability.
36
+ 2. If two implementations are equivalent in behavior and quality, choose the one with fewer moving parts.
37
+ 3. Remove code that does not carry behavior, safety, clarity, maintainability, or test value.
38
+ 4. Prefer direct logic over extra wrappers, layers, classes, config, or state when the abstraction does not reduce real complexity.
39
+ 5. Keep validation, error handling, fallback paths, accessibility, tests, security boundaries, and observability when they protect real behavior.
40
+ 6. Run a final simplification pass before completion.
41
+ 7. Run a domain-fit pass on public contracts before completion: if endpoint names, payload fields, error codes, table names, or event types could be renamed to another domain without changing shape, the contract is too generic; revise to express the actual domain verbs and invariants. This is the backend equivalent of the design rename test (see [REF:FE-004]).
42
+ 8. Do not optimize for line count alone.
43
+ 9. Do not replace clear code with clever, dense, or surprising code.
44
+ 10. Do not remove safeguards just because the happy path works.
45
+
46
+ ## ARCH-003: Universal SOP Baseline (Mandatory)
47
+
48
+ 1. The `.agent-context/rules/` directory is the default guidance source for implementation and review.
49
+ 2. Backend and frontend mindset checks are both required when a task spans API and UI boundaries.
50
+ 3. Security and testing are non-negotiable baseline requirements.
51
+ 4. Hard block before coding:
37
52
  - Root `README.md` must exist for every fresh or existing project and read as a public and developer entrypoint, not an internal agent note.
38
53
  - `docs/doc-index.md` must exist whenever `docs/` exists. It is a compact read-routing map, not a replacement for project docs.
39
54
  - `docs/project-brief.md` must exist.
@@ -42,91 +57,89 @@ The `.agent-context/rules/` directory is the default guidance source for impleme
42
57
  - If the project uses persistent data, `docs/database-schema.md` must exist.
43
58
  - If the project exposes API or web application flows, `docs/api-contract.md` must exist.
44
59
  - For UI scope, `docs/DESIGN.md` and `docs/design-intent.json` must exist.
45
- - Required docs coverage must include a public and developer README entrypoint, feature plan, architecture rationale, public contracts, data model when relevant, UI/design when relevant, security assumptions, testing strategy, delivery flow, and next validation actions.
46
- - If required project context docs are missing, stop implementation and bootstrap docs before writing application code.
47
- - Bootstrap flow: analyze the real repo plus the latest user prompt before authoring those docs.
48
- - Bootstrap docs must be adaptive and project-specific. Do not create generic placeholder templates.
49
- - When context is incomplete, separate confirmed facts from assumptions, add an `Assumptions to Validate` section, and end with the next validation action.
50
- - Keep docs current with project changes. Update README and the matching docs whenever setup, runtime, architecture, public contracts, data shape, UI scope, deployment, or validation flow changes.
51
- - Control docs file count. Keep the baseline compact, then add topic files only when a subject is stable, too long for README/core docs, or belongs to a distinct workflow such as hardware setup, deployment, testing validation, operations, or troubleshooting.
52
-
53
- ## Documentation Read Routing and Conditional Specs
54
-
55
- Use `README.md` for human orientation, then use `docs/doc-index.md` to choose the smallest relevant read set. Do not broad-read every Markdown file in `docs/` by default.
56
-
57
- - Read `docs/project-brief.md`, `docs/architecture-decision-record.md`, and `docs/flow-overview.md` for broad planning, new features, or architecture changes.
58
- - Read `docs/api-contract.md` only when API, CLI, firmware endpoint, web flow, event, or library contract behavior is in scope.
59
- - Read `docs/database-schema.md` only when persistence, migrations, data shape, or query behavior is in scope.
60
- - Read `docs/DESIGN.md` and `docs/design-intent.json` only for UI, UX, frontend, layout, component, or visual work.
61
- - Add `docs/prd.md` only when there is product-roadmap, user-story, metrics, product-owner, or feature-flag ownership that would otherwise bloat the project brief.
62
- - Add `docs/srs.md` only for contractual, regulated, multi-stakeholder, or acceptance-criteria-heavy projects. Do not create both PRD and SRS unless those owners and purposes are distinct.
63
- - Add `docs/technical-design.md` only for non-trivial architecture decisions, major refactors, cross-cutting behavior, or system interactions that outgrow the ADR and flow overview.
64
- - Keep ERD inside `docs/database-schema.md` for small and medium schemas. Add a separate ERD file only when relationship complexity makes the schema doc hard to scan.
65
-
66
- ## Rules as Guardian (Cross-Session Consistency)
67
-
68
- - Session handoff must include active architecture contract summary.
69
- - Contract summary must include explicit user constraints, runtime/architecture decision status, active project docs, and the core patterns currently evidenced by the repo.
70
- - Detect drift before changing runtime choices, topology, public contracts, or core patterns.
71
- - Direction changes require explicit user confirmation before applying changes.
72
- - When confirmation is provided, record the rationale in session notes or PR context.
73
-
74
- ## Invisible State Management with Explain-on-Demand
75
-
76
- - Default responses must avoid unnecessary state-file internals.
77
- - State internals are exposed only on explicit user request.
78
- - Diagnostic mode explains relevant state decisions when needed.
79
- - Keep default explanations concise and outcome-first.
80
-
81
- ## Single Source of Truth and Lazy Rule Loading
82
-
83
- - Canonical rule source is AGENTS.md.
84
- - Native adapter entry files stay thin and must import the canonical source.
85
- - Load global domain rules lazily based on touched scope.
86
- - Do not create or load stack-specific governance adapters as the baseline.
87
- - Runtime or framework evidence can clarify implementation details, but it must not replace the global architecture, security, data, API, error, event, and testing boundaries.
88
- - Keep rule-loading output deterministic for init and release validation.
89
-
90
- ## Architecture Decision Boundary
91
-
92
- Do not force a default architecture label before the repo, delivery model, and boundary evidence are clear.
93
-
94
- Do not split into distributed services without evidence. Do not keep everything in one process by habit either.
95
-
96
- Service separation only makes sense when multiple signals are true, such as:
97
-
98
- - frequent deploy conflicts across domains
99
- - clear scale mismatch between domains
100
- - separate team ownership causing repeated coupling pain
101
- - hard fault-isolation requirements
102
- - already-stable contracts and data boundaries
103
-
104
- ## Layer Boundaries (Mandatory)
105
-
106
- - Transport or controller layer: parse input, validate shape, enforce auth at the edge, return protocol responses. No business policy, no raw SQL, no external workflow orchestration.
107
- - Application or service layer: business rules, orchestration, transactions, and use-case flow. No request or response objects, no UI formatting, no raw transport dependencies.
108
- - Domain layer: pure business invariants, calculations, value objects, and policies. No framework, network, database, or file-system coupling.
109
- - Infrastructure or repository layer: database, queue, cache, file system, and external API adapters. No business policy hidden in queries or adapters.
110
-
111
- ## Dependency Direction
112
-
113
- - Dependencies flow inward: transport to application to domain.
114
- - Infrastructure depends inward through interfaces or well-defined ports.
115
- - Domain must not depend on infrastructure.
116
- - Application must not depend on transport details.
117
-
118
- ## Project Structure and File Size Discipline
119
-
120
- - Group code by feature or domain, not by one giant technical folder per type.
121
- - Backend feature modules use `src/modules/<feature>/...` when the repo has no stronger existing convention.
122
- - Frontend feature modules use `src/features/<feature>/...` when the repo has no stronger existing convention.
123
- - Cross-cutting utilities belong in explicit shared locations, not scattered feature internals.
124
- - Files above roughly 1000 lines are a refactor trigger, not a success signal.
125
- - Preserve one clear public entrypoint per module when helpful, but move implementation into smaller focused files.
126
- - Keep code compact because the design is understood, not because safeguards were removed.
127
-
128
- ## Module Communication
129
-
130
- - Import through a module's public API instead of reaching into internal files.
131
- - Keep contracts explicit at boundaries between modules.
132
- - If a new developer cannot find the full flow of a feature in one clear area, the structure is too diffuse.
60
+ 5. Required docs coverage must include a public and developer README entrypoint, feature plan, architecture rationale, public contracts, data model when relevant, UI/design when relevant, security assumptions, testing strategy, delivery flow, and next validation actions.
61
+ 6. If required project context docs are missing, stop implementation and bootstrap docs before writing application code.
62
+ 7. Bootstrap flow: analyze the real repo plus the latest user prompt before authoring those docs.
63
+ 8. Bootstrap docs must be adaptive and project-specific. Do not create generic placeholder templates.
64
+ 9. When context is incomplete, separate confirmed facts from assumptions, add an `Assumptions to Validate` section, and end with the next validation action.
65
+ 10. Keep docs current with project changes. Update README and the matching docs whenever setup, runtime, architecture, public contracts, data shape, UI scope, deployment, or validation flow changes.
66
+ 11. Control docs file count. Keep the baseline compact, then add topic files only when a subject is stable, too long for README/core docs, or belongs to a distinct workflow such as hardware setup, deployment, testing validation, operations, or troubleshooting.
67
+
68
+ ## ARCH-004: Documentation Read Routing and Conditional Specs
69
+
70
+ 1. Use `README.md` for human orientation, then use `docs/doc-index.md` to choose the smallest relevant read set.
71
+ 2. Do not broad-read every Markdown file in `docs/` by default.
72
+ 3. Read `docs/project-brief.md`, `docs/architecture-decision-record.md`, and `docs/flow-overview.md` for broad planning, new features, or architecture changes.
73
+ 4. Read `docs/api-contract.md` only when API, CLI, firmware endpoint, web flow, event, or library contract behavior is in scope.
74
+ 5. Read `docs/database-schema.md` only when persistence, migrations, data shape, or query behavior is in scope.
75
+ 6. Read `docs/DESIGN.md` and `docs/design-intent.json` only for UI, UX, frontend, layout, component, or visual work.
76
+ 7. Add `docs/prd.md` only when there is product-roadmap, user-story, metrics, product-owner, or feature-flag ownership that would otherwise bloat the project brief.
77
+ 8. Add `docs/srs.md` only for contractual, regulated, multi-stakeholder, or acceptance-criteria-heavy projects. Do not create both PRD and SRS unless those owners and purposes are distinct.
78
+ 9. Add `docs/technical-design.md` only for non-trivial architecture decisions, major refactors, cross-cutting behavior, or system interactions that outgrow the ADR and flow overview.
79
+ 10. Keep ERD inside `docs/database-schema.md` for small and medium schemas. Add a separate ERD file only when relationship complexity makes the schema doc hard to scan.
80
+
81
+ ## ARCH-005: Rules as Guardian (Cross-Session Consistency)
82
+
83
+ 1. Session handoff must include active architecture contract summary.
84
+ 2. Contract summary must include explicit user constraints, runtime/architecture decision status, active project docs, and the core patterns currently evidenced by the repo.
85
+ 3. Detect drift before changing runtime choices, topology, public contracts, or core patterns.
86
+ 4. Direction changes require explicit user confirmation before applying changes.
87
+ 5. When confirmation is provided, record the rationale in session notes or PR context.
88
+
89
+ ## ARCH-006: Invisible State Management with Explain-on-Demand
90
+
91
+ 1. Default responses must avoid unnecessary state-file internals.
92
+ 2. State internals are exposed only on explicit user request.
93
+ 3. Diagnostic mode explains relevant state decisions when needed.
94
+ 4. Keep default explanations concise and outcome-first.
95
+
96
+ ## ARCH-007: Single Source of Truth and Lazy Rule Loading
97
+
98
+ 1. Canonical rule source is AGENTS.md.
99
+ 2. Native adapter entry files stay thin and must import the canonical source.
100
+ 3. Load global domain rules lazily based on touched scope.
101
+ 4. Do not create or load stack-specific governance adapters as the baseline.
102
+ 5. Runtime or framework evidence can clarify implementation details, but it must not replace the global architecture, security, data, API, error, event, and testing boundaries.
103
+ 6. Keep rule-loading output deterministic for init and release validation.
104
+
105
+ ## ARCH-008: Architecture Decision Boundary
106
+
107
+ 1. Do not force a default architecture label before the repo, delivery model, and boundary evidence are clear.
108
+ 2. Do not split into distributed services without evidence.
109
+ 3. Do not keep everything in one process by habit either.
110
+ 4. Service separation only makes sense when multiple signals are true, such as:
111
+ 5. frequent deploy conflicts across domains
112
+ 6. clear scale mismatch between domains
113
+ 7. separate team ownership causing repeated coupling pain
114
+ 8. hard fault-isolation requirements
115
+ 9. already-stable contracts and data boundaries
116
+
117
+ ## ARCH-009: Layer Boundaries (Mandatory)
118
+
119
+ 1. Transport or controller layer: parse input, validate shape, enforce auth at the edge, return protocol responses. No business policy, no raw SQL, no external workflow orchestration.
120
+ 2. Application or service layer: business rules, orchestration, transactions, and use-case flow. No request or response objects, no UI formatting, no raw transport dependencies.
121
+ 3. Domain layer: pure business invariants, calculations, value objects, and policies. No framework, network, database, or file-system coupling.
122
+ 4. Infrastructure or repository layer: database, queue, cache, file system, and external API adapters. No business policy hidden in queries or adapters.
123
+
124
+ ## ARCH-010: Dependency Direction
125
+
126
+ 1. Dependencies flow inward: transport to application to domain.
127
+ 2. Infrastructure depends inward through interfaces or well-defined ports.
128
+ 3. Domain must not depend on infrastructure.
129
+ 4. Application must not depend on transport details.
130
+
131
+ ## ARCH-011: Project Structure and File Size Discipline
132
+
133
+ 1. Group code by feature or domain, not by one giant technical folder per type.
134
+ 2. Backend feature modules use `src/modules/<feature>/...` when the repo has no stronger existing convention.
135
+ 3. Frontend feature modules use `src/features/<feature>/...` when the repo has no stronger existing convention.
136
+ 4. Cross-cutting utilities belong in explicit shared locations, not scattered feature internals.
137
+ 5. Files above roughly 1000 lines are a refactor trigger, not a success signal.
138
+ 6. Preserve one clear public entrypoint per module when helpful, but move implementation into smaller focused files.
139
+ 7. Keep code compact because the design is understood, not because safeguards were removed.
140
+
141
+ ## ARCH-012: Module Communication
142
+
143
+ 1. Import through a module's public API instead of reaching into internal files.
144
+ 2. Keep contracts explicit at boundaries between modules.
145
+ 3. If a new developer cannot find the full flow of a feature in one clear area, the structure is too diffuse.
@@ -1,24 +1,42 @@
1
+ ---
2
+ id_prefix: DATA
3
+ domain: database-design
4
+ priority: high
5
+ scope: data
6
+ applies_to:
7
+ - backend
8
+ - fullstack
9
+ keywords:
10
+ - database-design
11
+ - data
12
+ - design
13
+ - boundary
14
+ - reject
15
+ - these
16
+ ---
17
+
1
18
  # Data Design Boundary
2
19
 
3
20
  Use the data store, ORM, migration tool, and query style already chosen by the project. If unresolved, the LLM must recommend a current fit from requirements, repo evidence, and official docs before implementation.
4
21
 
5
- Reject these bad habits:
6
- - schema changes without a migration, rollback or recovery note, and data-safety plan
7
- - duplicated facts or derived values without a sync strategy and rationale
8
- - unbounded reads or missing pagination on growable datasets
9
- - missing indexes or access-path planning for frequent filters, joins, lookups, search, or ordering
10
- - raw query construction that bypasses safe parameterization
11
- - destructive data changes without backup, migration, or deployment sequencing notes
22
+ ## DATA-001: Reject these bad habits
23
+
24
+ 1. schema changes without a migration, rollback or recovery note, and data-safety plan
25
+ 2. duplicated facts or derived values without a sync strategy and rationale
26
+ 3. unbounded reads or missing pagination on growable datasets
27
+ 4. missing indexes or access-path planning for frequent filters, joins, lookups, search, or ordering
28
+ 5. raw query construction that bypasses safe parameterization
29
+ 6. destructive data changes without backup, migration, or deployment sequencing notes
12
30
 
13
- Backend data access rules:
14
- - Relational reads must avoid N+1 query patterns. Use eager loading, joins, batching, or explicit query-shape rationale based on the project's ORM or database driver.
15
- - List endpoints and exports must paginate, limit, stream, or otherwise bound growable datasets by default.
16
- - Use cursor pagination for large or frequently changing datasets when the project contract allows it; offset pagination is acceptable for small, stable, explicitly bounded collections.
17
- - Define maximum page size, payload size, and export limits so list responses cannot exhaust memory or connection pools.
18
- - Mutations that write more than one table, aggregate, queue, or external consistency boundary must run inside a transaction or document the compensating recovery path.
19
- - Repository and data-access layers own persistence mechanics. They must not hide business policy that belongs in application or domain logic.
20
- - Index design follows read patterns, not column lists. Prefer composite indexes with selectivity-correct column order (equality before range), partial indexes for soft-delete or status-filtered tables, and covering indexes when a hot read can be satisfied without a heap fetch. Record the read pattern that justifies each non-trivial index.
21
- - Record explicit decisions for delete semantics (hard delete, soft delete, append-only audit), tenant isolation (none, row-level with `tenant_id` plus row-level security, schema-per-tenant), and normalize-vs-denormalize trade-off for read-heavy or sparse data. Default to the simplest fit, but make the choice explicit in data docs rather than letting it become a side effect of the first migration.
22
- - Cross-domain persistence must respect ownership boundaries. Independent services must not share database tables as an integration contract; modular monoliths may share one database only when module ownership and access paths stay explicit.
31
+ ## DATA-002: Backend data access rules
23
32
 
24
- Docs must record entity ownership, relationships, constraints, data lifecycle, migration risk, and assumptions to validate.
33
+ 1. Relational reads must avoid N+1 query patterns. Use eager loading, joins, batching, or explicit query-shape rationale based on the project's ORM or database driver.
34
+ 2. List endpoints and exports must paginate, limit, stream, or otherwise bound growable datasets by default.
35
+ 3. Use cursor pagination for large or frequently changing datasets when the project contract allows it; offset pagination is acceptable for small, stable, explicitly bounded collections.
36
+ 4. Define maximum page size, payload size, and export limits so list responses cannot exhaust memory or connection pools.
37
+ 5. Mutations that write more than one table, aggregate, queue, or external consistency boundary must run inside a transaction or document the compensating recovery path.
38
+ 6. Repository and data-access layers own persistence mechanics. They must not hide business policy that belongs in application or domain logic.
39
+ 7. Index design follows read patterns, not column lists. Prefer composite indexes with selectivity-correct column order (equality before range), partial indexes for soft-delete or status-filtered tables, and covering indexes when a hot read can be satisfied without a heap fetch. Record the read pattern that justifies each non-trivial index.
40
+ 8. Record explicit decisions for delete semantics (hard delete, soft delete, append-only audit), tenant isolation (none, row-level with `tenant_id` plus row-level security, schema-per-tenant), and normalize-vs-denormalize trade-off for read-heavy or sparse data. Default to the simplest fit, but make the choice explicit in data docs rather than letting it become a side effect of the first migration.
41
+ 9. Cross-domain persistence must respect ownership boundaries. Independent services must not share database tables as an integration contract; modular monoliths may share one database only when module ownership and access paths stay explicit.
42
+ 10. Docs must record entity ownership, relationships, constraints, data lifecycle, migration risk, and assumptions to validate.
@@ -1,47 +1,70 @@
1
+ ---
2
+ id_prefix: DOCK
3
+ domain: docker-runtime
4
+ priority: high
5
+ scope: infra
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - docker-runtime
12
+ - dock
13
+ - docker
14
+ - runtime
15
+ ---
16
+
1
17
  # Docker Runtime Strategy (Dynamic Generation Required)
2
18
 
3
19
  Use this rule when Docker is enabled in project context.
4
20
 
5
- ## 0. Latest Official Docker Guidance First
6
- - Before generating or changing Dockerfiles, Compose files, or container runbooks, verify the latest official Docker documentation first.
7
- - Use official Docker sources such as [Docker Compose Quickstart](https://docs.docker.com/compose/gettingstarted/), [Compose file reference](https://docs.docker.com/reference/compose-file/), and [Dockerfile best practices](https://docs.docker.com/build/building/best-practices/).
8
- - Use current `docker compose` workflows and `compose.yaml`. Do not default to legacy `docker-compose` commands or stale file naming unless backward compatibility is a stated project requirement.
9
- - Do not add the top-level Compose `version` field by default. The current Compose reference treats it as obsolete. Use it only when a compatibility requirement is explicit and documented.
10
- - Use the latest stable compatible Docker base image, package-manager flow, and Compose syntax first. If the latest compatible path fails, step down intentionally and document the exact reason for the fallback.
11
-
12
- ## 1. Dynamic Generation Only
13
- - Do not copy generic Docker templates blindly.
14
- - Generate Docker assets based on actual stack, package manager, and runtime dependencies in the repository.
15
- - Re-evaluate Docker instructions when dependencies, build tools, or runtime assumptions change.
16
- - Use the latest stable compatible dependency line first. If an older dependency or base image must be pinned, explain the runtime or compatibility constraint that forced it.
17
-
18
- ## 2. Separate Development and Production Lanes
19
- - Development lane and production lane are separate concerns.
20
- - Development lane priorities: fast rebuild, hot reload support, debugger-friendly startup, local volume strategy.
21
- - Production lane priorities: minimal image size, reproducible build, non-root runtime, strict startup command.
22
-
23
- ## 3. Selection Means Asset Materialization
24
- - If Docker is selected for development, create or refine `.dockerignore`, development Dockerfile stage(s), `compose.yaml`, and a runbook before claiming the setup is complete.
25
- - If Docker is selected for production, create or refine production Dockerfile stage(s), `compose.prod.yaml` or a documented production Compose override, health checks or startup checks, exposed ports, and a deployment runbook before claiming the setup is complete.
26
- - If Docker is selected for both lanes, keep development and production assets separate enough that hot reload, bind mounts, debug tooling, and production runtime hardening cannot blur into one unsafe path.
27
- - If the user asks to author files without commands, write the assets and documented commands, but do not execute Docker build, Compose, or registry commands.
28
-
29
- ## 4. Security and Supply Chain
30
- - Use minimal trusted base images with explicit versions.
31
- - Use multi-stage builds for production images when possible.
32
- - Avoid baking secrets into image layers.
33
- - Keep runtime image free from build-only tooling.
34
- - Use fresh base-image validation with `docker build --pull` and use `--no-cache` when a clean dependency refresh is required.
35
- - Keep a `.dockerignore` strategy in mind so build contexts stay small and do not leak unnecessary files into the image.
36
-
37
- ## 5. Operational Clarity
38
- - Docker instructions must document expected entrypoint and exposed ports.
39
- - Local development command and production deployment command must be explicit.
40
- - If Docker is not selected for the project, do not force containerization tasks.
41
- - If Compose is used, document which file is the primary entrypoint, which services are dev-only versus production-facing, and why the chosen layout matches the current Docker docs rather than a legacy blog pattern.
42
-
43
- ## 6. Review Requirements
44
- - Verify the generated Docker workflow matches selected runtime environment (Linux/WSL, Windows, macOS).
45
- - Verify development and production instructions are not mixed into one unsafe image path.
46
- - Ensure API and service health checks are compatible with container startup behavior.
47
- - When Docker choices depend on official docs or release behavior, cite the Docker source and verification date in the generated docs or explanation so the next update can refresh them safely.
21
+ ## DOCK-001: Latest Official Docker Guidance First
22
+
23
+ 1. Before generating or changing Dockerfiles, Compose files, or container runbooks, verify the latest official Docker documentation first.
24
+ 2. Use official Docker sources such as [Docker Compose Quickstart](https://docs.docker.com/compose/gettingstarted/), [Compose file reference](https://docs.docker.com/reference/compose-file/), and [Dockerfile best practices](https://docs.docker.com/build/building/best-practices/).
25
+ 3. Use current `docker compose` workflows and `compose.yaml`. Do not default to legacy `docker-compose` commands or stale file naming unless backward compatibility is a stated project requirement.
26
+ 4. Do not add the top-level Compose `version` field by default. The current Compose reference treats it as obsolete. Use it only when a compatibility requirement is explicit and documented.
27
+ 5. Use the latest stable compatible Docker base image, package-manager flow, and Compose syntax first. If the latest compatible path fails, step down intentionally and document the exact reason for the fallback.
28
+
29
+ ## DOCK-002: Dynamic Generation Only
30
+
31
+ 1. Do not copy generic Docker templates blindly.
32
+ 2. Generate Docker assets based on actual stack, package manager, and runtime dependencies in the repository.
33
+ 3. Re-evaluate Docker instructions when dependencies, build tools, or runtime assumptions change.
34
+ 4. Use the latest stable compatible dependency line first. If an older dependency or base image must be pinned, explain the runtime or compatibility constraint that forced it.
35
+
36
+ ## DOCK-003: Separate Development and Production Lanes
37
+
38
+ 1. Development lane and production lane are separate concerns.
39
+ 2. Development lane priorities: fast rebuild, hot reload support, debugger-friendly startup, local volume strategy.
40
+ 3. Production lane priorities: minimal image size, reproducible build, non-root runtime, strict startup command.
41
+
42
+ ## DOCK-004: Selection Means Asset Materialization
43
+
44
+ 1. If Docker is selected for development, create or refine `.dockerignore`, development Dockerfile stage(s), `compose.yaml`, and a runbook before claiming the setup is complete.
45
+ 2. If Docker is selected for production, create or refine production Dockerfile stage(s), `compose.prod.yaml` or a documented production Compose override, health checks or startup checks, exposed ports, and a deployment runbook before claiming the setup is complete.
46
+ 3. If Docker is selected for both lanes, keep development and production assets separate enough that hot reload, bind mounts, debug tooling, and production runtime hardening cannot blur into one unsafe path.
47
+ 4. If the user asks to author files without commands, write the assets and documented commands, but do not execute Docker build, Compose, or registry commands.
48
+
49
+ ## DOCK-005: Security and Supply Chain
50
+
51
+ 1. Use minimal trusted base images with explicit versions.
52
+ 2. Use multi-stage builds for production images when possible.
53
+ 3. Avoid baking secrets into image layers.
54
+ 4. Keep runtime image free from build-only tooling.
55
+ 5. Use fresh base-image validation with `docker build --pull` and use `--no-cache` when a clean dependency refresh is required.
56
+ 6. Keep a `.dockerignore` strategy in mind so build contexts stay small and do not leak unnecessary files into the image.
57
+
58
+ ## DOCK-006: Operational Clarity
59
+
60
+ 1. Docker instructions must document expected entrypoint and exposed ports.
61
+ 2. Local development command and production deployment command must be explicit.
62
+ 3. If Docker is not selected for the project, do not force containerization tasks.
63
+ 4. If Compose is used, document which file is the primary entrypoint, which services are dev-only versus production-facing, and why the chosen layout matches the current Docker docs rather than a legacy blog pattern.
64
+
65
+ ## DOCK-007: Review Requirements
66
+
67
+ 1. Verify the generated Docker workflow matches selected runtime environment (Linux/WSL, Windows, macOS).
68
+ 2. Verify development and production instructions are not mixed into one unsafe image path.
69
+ 3. Ensure API and service health checks are compatible with container startup behavior.
70
+ 4. When Docker choices depend on official docs or release behavior, cite the Docker source and verification date in the generated docs or explanation so the next update can refresh them safely.
@@ -1,24 +1,45 @@
1
- # Dependency and Tooling Boundary
1
+ ---
2
+ id_prefix: DEP
3
+ domain: efficiency-vs-hype
4
+ priority: medium
5
+ scope: all-tasks
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - efficiency-vs-hype
12
+ - dep
13
+ - dependency
14
+ - latest-compatible-first
15
+ ---
2
16
 
3
- ## Latest-Compatible-First Rule
17
+ # Dependency and Tooling Boundary
4
18
 
5
- The LLM may choose modern libraries and tooling when they fit the project. This rule does not prefer "no library", "always add a library", or any fixed dependency set.
19
+ ## DEP-001: Latest-Compatible-First Rule
6
20
 
7
- New dependencies are allowed when they create a better practical tradeoff than custom implementation. The decision should be based on whether the dependency meaningfully improves efficiency, shortens delivery time, improves correctness, reduces maintenance burden, unlocks a stronger user experience, or avoids unnecessary in-house code.
21
+ 1. The LLM may choose modern libraries and tooling when they fit the project.
22
+ 2. This rule does not prefer "no library", "always add a library", or any fixed dependency set.
23
+ 3. New dependencies are allowed when they create a better practical tradeoff than custom implementation.
24
+ 4. The decision should be based on whether the dependency meaningfully improves efficiency, shortens delivery time, improves correctness, reduces maintenance burden, unlocks a stronger user experience, or avoids unnecessary in-house code.
25
+ 5. Do not treat dependency avoidance as an engineering virtue by itself.
26
+ 6. A small, maintained, well-scoped library can be the simpler and safer choice than custom code, especially for accessibility primitives, animation, gestures, data visualization, parsing, protocol handling, security-sensitive helpers, or browser/runtime capabilities with tricky edge cases.
8
27
 
9
- Do not treat dependency avoidance as an engineering virtue by itself. A small, maintained, well-scoped library can be the simpler and safer choice than custom code, especially for accessibility primitives, animation, gestures, data visualization, parsing, protocol handling, security-sensitive helpers, or browser/runtime capabilities with tricky edge cases.
28
+ ## DEP-002: Before adding or recommending a dependency
10
29
 
11
- Before adding or recommending a dependency:
12
- - check current official docs, release notes, and setup guidance when the ecosystem decision matters
13
- - choose the latest stable compatible dependency version unless a project constraint blocks it
14
- - use the official scaffolder or setup command when it creates the current supported project shape
15
- - do not hand-assemble fresh framework projects by habit when the official setup flow gives safer current defaults; document the reason when manual assembly is better
16
- - Only step down to an older dependency version after documenting the exact compatibility, runtime, platform, or ecosystem reason.
17
- - explain why the dependency is a better tradeoff than local implementation for the current task
18
- - avoid packages that are stale, thinly maintained, too heavy for the job, or added only because they are popular
19
- - keep dependency boundaries replaceable when the library would spread through many files
20
- - do not reject a dependency only because it adds a package; reject it only when the project-fit, security, maintenance, compatibility, bundle/runtime, or ownership tradeoff is worse than the alternative
30
+ 1. check current official docs, release notes, and setup guidance when the ecosystem decision matters
31
+ 2. choose the latest stable compatible dependency version unless a project constraint blocks it
32
+ 3. use the official scaffolder or setup command when it creates the current supported project shape
33
+ 4. do not hand-assemble fresh framework projects by habit when the official setup flow gives safer current defaults; document the reason when manual assembly is better
34
+ 5. Only step down to an older dependency version after documenting the exact compatibility, runtime, platform, or ecosystem reason.
35
+ 6. explain why the dependency is a better tradeoff than local implementation for the current task
36
+ 7. avoid packages that are stale, thinly maintained, too heavy for the job, or added only because they are popular
37
+ 8. keep dependency boundaries replaceable when the library would spread through many files
38
+ 9. do not reject a dependency only because it adds a package; reject it only when the project-fit, security, maintenance, compatibility, bundle/runtime, or ownership tradeoff is worse than the alternative
21
39
 
22
- Reject offline dependency decisions, outdated tutorial versions, trend choices, dependency avoidance choices, and performance-fear choices that are not grounded in the current repo, brief, and delivery tradeoffs.
40
+ ## DEP-003: Framework and offline decision boundaries
23
41
 
24
- Reject framework autopilot, not frameworks. Next.js, Vite, Astro, React Router, SvelteKit, Laravel, plain HTML, and other runtimes are candidates, not defaults or forbidden choices. If the user did not constrain the stack, compare at least the strongest fit and one plausible alternative before implementation, then choose the technology that removes bottlenecks for this project.
42
+ 1. Reject offline dependency decisions, outdated tutorial versions, trend choices, dependency avoidance choices, and performance-fear choices that are not grounded in the current repo, brief, and delivery tradeoffs.
43
+ 2. Reject framework autopilot, not frameworks.
44
+ 3. Next.js, Vite, Astro, React Router, SvelteKit, Laravel, plain HTML, and other runtimes are candidates, not defaults or forbidden choices.
45
+ 4. If the user did not constrain the stack, compare at least the strongest fit and one plausible alternative before implementation, then choose the technology that removes bottlenecks for this project.
@@ -1,22 +1,41 @@
1
+ ---
2
+ id_prefix: ERR
3
+ domain: error-handling
4
+ priority: high
5
+ scope: all-tasks
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - error-handling
12
+ - err
13
+ - error
14
+ - handling
15
+ - boundary
16
+ - reject
17
+ ---
18
+
1
19
  # Error Handling Boundary
2
20
 
3
21
  Use the target language and framework's normal error model. Do not invent a custom exception architecture from this repo.
4
22
 
5
- Reject these failure patterns:
6
- - swallowed errors
7
- - generic errors that erase the domain cause
8
- - client-facing leaks of stack traces, secrets, SQL, infrastructure details, or provider internals
9
- - retries without transient-failure evidence, limits, backoff, and a clear final outcome
10
- - logs that say only "something failed" without action, target, actor, or trace context
23
+ ## ERR-001: Reject these failure patterns
24
+
25
+ 1. swallowed errors
26
+ 2. generic errors that erase the domain cause
27
+ 3. client-facing leaks of stack traces, secrets, SQL, infrastructure details, or provider internals
28
+ 4. retries without transient-failure evidence, limits, backoff, and a clear final outcome
29
+ 5. logs that say only "something failed" without action, target, actor, or trace context
11
30
 
12
- Backend API error rules:
13
- - Use the framework's normal centralized error boundary or middleware for HTTP/API responses.
14
- - Do not return raw exception messages, stack traces, SQL, provider payloads, file paths, secrets, or infrastructure details to callers.
15
- - Public API errors must use a stable JSON shape with at least `code` and `message`; include `details` only when the data is safe, documented, and useful to the caller. HTTP APIs may use an RFC 9457 Problem Details-style shape when it fits the project contract.
16
- - Domain and validation errors should keep machine-readable codes so tests, clients, and operators can distinguish expected failures from defects.
17
- - API boundary errors should include a safe correlation or trace identifier when observability exists, while protected logs keep the internal exception, actor, target, and trace context.
18
- - Distributed systems should preserve trace context across ingress and egress using the project's tracing standard, such as W3C Trace Context or OpenTelemetry propagation.
19
- - Prefer structured logging (key/value or JSON) over free-text strings, record at least one business metric per non-trivial operation alongside system metrics, and propagate correlation/trace IDs across async, queue, and worker boundaries.
20
- - Distinguish error reporting from error recovery. For calls to unreliable upstreams, record the recovery strategy: retry with backoff and jitter, circuit-breaker thresholds and reset behavior, fallback path (cached value, default, degraded mode), and partial-failure semantics for batch operations (per-item success/failure rather than all-or-nothing). "Catch and log" is reporting, not recovery.
31
+ ## ERR-002: Backend API error rules
21
32
 
22
- At boundaries, validate early, return safe user-facing errors, and keep machine-readable error context for operators and callers.
33
+ 1. Use the framework's normal centralized error boundary or middleware for HTTP/API responses.
34
+ 2. Do not return raw exception messages, stack traces, SQL, provider payloads, file paths, secrets, or infrastructure details to callers.
35
+ 3. Public API errors must use a stable JSON shape with at least `code` and `message`; include `details` only when the data is safe, documented, and useful to the caller. HTTP APIs may use an RFC 9457 Problem Details-style shape when it fits the project contract.
36
+ 4. Domain and validation errors should keep machine-readable codes so tests, clients, and operators can distinguish expected failures from defects.
37
+ 5. API boundary errors should include a safe correlation or trace identifier when observability exists, while protected logs keep the internal exception, actor, target, and trace context.
38
+ 6. Distributed systems should preserve trace context across ingress and egress using the project's tracing standard, such as W3C Trace Context or OpenTelemetry propagation.
39
+ 7. Prefer structured logging (key/value or JSON) over free-text strings, record at least one business metric per non-trivial operation alongside system metrics, and propagate correlation/trace IDs across async, queue, and worker boundaries.
40
+ 8. Distinguish error reporting from error recovery. For calls to unreliable upstreams, record the recovery strategy: retry with backoff and jitter, circuit-breaker thresholds and reset behavior, fallback path (cached value, default, degraded mode), and partial-failure semantics for batch operations (per-item success/failure rather than all-or-nothing). "Catch and log" is reporting, not recovery.
41
+ 9. At boundaries, validate early, return safe user-facing errors, and keep machine-readable error context for operators and callers.