@ryuenn3123/agentic-senior-core 3.0.50 → 4.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 (83) hide show
  1. package/.agent-context/review-checklists/pr-checklist.md +1 -0
  2. package/.agent-context/rules/api-docs.md +63 -47
  3. package/.agent-context/rules/architecture.md +133 -120
  4. package/.agent-context/rules/database-design.md +36 -18
  5. package/.agent-context/rules/docker-runtime.md +66 -43
  6. package/.agent-context/rules/efficiency-vs-hype.md +38 -17
  7. package/.agent-context/rules/error-handling.md +35 -16
  8. package/.agent-context/rules/event-driven.md +35 -18
  9. package/.agent-context/rules/frontend-architecture.md +103 -76
  10. package/.agent-context/rules/git-workflow.md +81 -197
  11. package/.agent-context/rules/microservices.md +42 -41
  12. package/.agent-context/rules/naming-conv.md +27 -8
  13. package/.agent-context/rules/performance.md +32 -12
  14. package/.agent-context/rules/realtime.md +26 -9
  15. package/.agent-context/rules/security.md +39 -20
  16. package/.agent-context/rules/testing.md +36 -16
  17. package/AGENTS.md +9 -9
  18. package/README.md +10 -1
  19. package/lib/cli/commands/init.mjs +1 -0
  20. package/lib/cli/compiler.mjs +1 -0
  21. package/lib/cli/detector/constants.mjs +135 -0
  22. package/lib/cli/detector/design-evidence/collector.mjs +256 -0
  23. package/lib/cli/detector/design-evidence/constants.mjs +39 -0
  24. package/lib/cli/detector/design-evidence/file-traversal.mjs +83 -0
  25. package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +117 -0
  26. package/lib/cli/detector/design-evidence/summary.mjs +109 -0
  27. package/lib/cli/detector/design-evidence/utility-helpers.mjs +122 -0
  28. package/lib/cli/detector/design-evidence.mjs +25 -610
  29. package/lib/cli/detector/stack-detection.mjs +243 -0
  30. package/lib/cli/detector/ui-signals.mjs +150 -0
  31. package/lib/cli/detector/workspace-scan.mjs +177 -0
  32. package/lib/cli/detector.mjs +20 -688
  33. package/lib/cli/memory-continuity.mjs +1 -0
  34. package/lib/cli/project-scaffolder/design-contract/sections/audits.mjs +96 -0
  35. package/lib/cli/project-scaffolder/design-contract/sections/conceptual-anchor.mjs +116 -0
  36. package/lib/cli/project-scaffolder/design-contract/sections/execution-handoff.mjs +211 -0
  37. package/lib/cli/project-scaffolder/design-contract/seed-signals.mjs +79 -0
  38. package/lib/cli/project-scaffolder/design-contract/signal-vocab.mjs +64 -0
  39. package/lib/cli/project-scaffolder/design-contract/validation/anchor-validators.mjs +222 -0
  40. package/lib/cli/project-scaffolder/design-contract/validation/audit-validators.mjs +117 -0
  41. package/lib/cli/project-scaffolder/design-contract/validation/completeness.mjs +83 -0
  42. package/lib/cli/project-scaffolder/design-contract/validation/execution-validators.mjs +328 -0
  43. package/lib/cli/project-scaffolder/design-contract/validation/helpers.mjs +8 -0
  44. package/lib/cli/project-scaffolder/design-contract/validation/structural-validators.mjs +79 -0
  45. package/lib/cli/project-scaffolder/design-contract/validation/system-validators.mjs +256 -0
  46. package/lib/cli/project-scaffolder/design-contract/validation.mjs +59 -896
  47. package/lib/cli/project-scaffolder/design-contract.mjs +147 -557
  48. package/mcp.json +30 -9
  49. package/package.json +17 -2
  50. package/scripts/audit-cache-layer-contract.mjs +258 -0
  51. package/scripts/audit-caching-scope-hygiene.mjs +263 -0
  52. package/scripts/audit-file-size.mjs +219 -0
  53. package/scripts/audit-reflection-citations.mjs +163 -0
  54. package/scripts/audit-release-bundle.mjs +170 -0
  55. package/scripts/audit-rule-id-uniqueness.mjs +313 -0
  56. package/scripts/benchmark-evidence-bundle.mjs +1 -0
  57. package/scripts/build-release-benchmark-bundle.mjs +204 -0
  58. package/scripts/context-triggered-audit.mjs +1 -0
  59. package/scripts/documentation-boundary-audit.mjs +1 -0
  60. package/scripts/explain-on-demand-audit.mjs +2 -1
  61. package/scripts/frontend-usability-audit.mjs +10 -10
  62. package/scripts/llm-judge/checklist-loader.mjs +45 -0
  63. package/scripts/llm-judge/constants.mjs +66 -0
  64. package/scripts/llm-judge/diff-collection.mjs +74 -0
  65. package/scripts/llm-judge/prompting.mjs +78 -0
  66. package/scripts/llm-judge/providers.mjs +111 -0
  67. package/scripts/llm-judge/verdict.mjs +134 -0
  68. package/scripts/llm-judge.mjs +21 -482
  69. package/scripts/mcp-server/tool-registry.mjs +55 -0
  70. package/scripts/mcp-server/tools.mjs +137 -1
  71. package/scripts/migrate-rule-format/id-prefix-table.mjs +37 -0
  72. package/scripts/migrate-rule-format/parse-legacy.mjs +180 -0
  73. package/scripts/migrate-rule-format/render-new.mjs +169 -0
  74. package/scripts/migrate-rule-format/roundtrip-validate.mjs +89 -0
  75. package/scripts/migrate-rule-format.mjs +192 -0
  76. package/scripts/release-gate/constants.mjs +1 -1
  77. package/scripts/release-gate/static-checks.mjs +1 -1
  78. package/scripts/rules-guardian-audit.mjs +5 -2
  79. package/scripts/single-source-lazy-loading-audit.mjs +2 -1
  80. package/scripts/ui-design-judge/git-input.mjs +3 -0
  81. package/scripts/validate/config.mjs +3 -2
  82. package/scripts/validate/coverage-checks.mjs +1 -1
  83. package/scripts/validate.mjs +93 -1
@@ -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.
@@ -1,25 +1,42 @@
1
+ ---
2
+ id_prefix: EVT
3
+ domain: event-driven
4
+ priority: medium
5
+ scope: backend
6
+ applies_to:
7
+ - backend
8
+ - fullstack
9
+ keywords:
10
+ - event-driven
11
+ - evt
12
+ - events
13
+ - consumers
14
+ - outbox
15
+ - consistency
16
+ ---
17
+
1
18
  # Event Boundary
2
19
 
3
20
  Do not add event-driven architecture because it sounds modern. Use it only when the product or repo shows a real async boundary.
4
21
 
5
- Use events when:
6
- - multiple independent consumers must react to the same fact
7
- - synchronous coupling would harm reliability, latency, or ownership
8
- - audit history, fan-out, or eventual consistency is a real requirement
9
- - the team can operate retries, monitoring, and failure recovery
22
+ ## EVT-001: Event Boundary and Hard Delivery Rules
10
23
 
11
- Reject events when a direct call, database transaction, or simple module boundary is enough.
24
+ 1. Use events when multiple independent consumers must react to the same fact.
25
+ 2. Use events when synchronous coupling would harm reliability, latency, or ownership.
26
+ 3. Use events when audit history, fan-out, or eventual consistency is a real requirement.
27
+ 4. Use events only when the team can operate retries, monitoring, and failure recovery.
28
+ 5. Reject events when a direct call, database transaction, or simple module boundary is enough.
29
+ 6. Events describe facts that already happened.
30
+ 7. Payloads are versioned, typed, and documented.
31
+ 8. Producers do not know consumer internals.
32
+ 9. Consumers are idempotent.
33
+ 10. Retries are bounded and dead-letter or recovery behavior is defined.
34
+ 11. Transactional publishing uses an outbox or equivalent safety pattern when data consistency matters.
35
+ 12. Dual-write flows that update local state and publish a message must use a transactional outbox or document an equivalent atomicity and replay strategy.
12
36
 
13
- Hard rules:
14
- - events describe facts that already happened
15
- - payloads are versioned, typed, and documented
16
- - producers do not know consumer internals
17
- - consumers are idempotent
18
- - retries are bounded and dead-letter or recovery behavior is defined
19
- - transactional publishing uses an outbox or equivalent safety pattern when data consistency matters
20
- - dual-write flows that update local state and publish a message must use a transactional outbox or document an equivalent atomicity and replay strategy
21
- - distributed transactions and two-phase commit are not the default recovery model; prefer local transactions plus saga, choreography, orchestration, or explicit compensating actions when consistency crosses service boundaries
22
- - message handlers must record processed message identifiers or use another duplicate-detection strategy when the delivery model can retry or redeliver
23
- - event catalogs or docs identify producer, consumers, ownership, and schema evolution rules
37
+ ## EVT-002: Event Recovery and Catalogs
24
38
 
25
- If event tooling is unresolved, the LLM must recommend a current project-fit broker or managed service from official docs before implementation.
39
+ 1. Distributed transactions and two-phase commit are not the default recovery model; prefer local transactions plus saga, choreography, orchestration, or explicit compensating actions when consistency crosses service boundaries.
40
+ 2. Message handlers must record processed message identifiers or use another duplicate-detection strategy when the delivery model can retry or redeliver.
41
+ 3. Event catalogs or docs identify producer, consumers, ownership, and schema evolution rules.
42
+ 4. If event tooling is unresolved, recommend a current project-fit broker or managed service from official docs before implementation.
@@ -1,107 +1,134 @@
1
+ ---
2
+ id_prefix: FE
3
+ domain: frontend-architecture
4
+ priority: high
5
+ scope: ui
6
+ applies_to:
7
+ - frontend
8
+ - fullstack
9
+ keywords:
10
+ - frontend-architecture
11
+ - fe
12
+ - ui
13
+ - design
14
+ - interaction
15
+ - boundaries
16
+ ---
17
+
1
18
  # Frontend Design and Interaction Boundaries
2
19
 
3
20
  Load this rule for UI-facing work. Keep the loaded surface small.
4
21
 
5
- ## Activation
22
+ ## FE-001: Activation
23
+
24
+ 1. Use this rule for UI, UX, page, screen, component, layout, landing, dashboard, form, onboarding, animation, interaction, redesign, visual refresh, responsive fix, hierarchy fix, and frontend deliverables inside fullstack or backend work.
25
+
26
+ ## FE-002: Authority
6
27
 
7
- Use this rule for UI, UX, page, screen, component, layout, landing, dashboard, form, onboarding, animation, interaction, redesign, visual refresh, responsive fix, hierarchy fix, and frontend deliverables inside fullstack or backend work.
28
+ 1. Use current repo evidence, the active brief, and current project docs as valid style context.
29
+ 2. Treat `.agent-context/` as design governance authority.
30
+ 3. Treat `README.md` as public and developer overview, setup, usage, and user-facing context only when design or architecture rules conflict.
31
+ 4. Do not choose final style, framework, palette, typography, layout paradigm, or animation library offline.
32
+ 5. Research current official docs before adding a new UI, animation, scroll, 3D, canvas, charting, icon, styling, or primitive library.
33
+ 6. Dynamic UI Foundation: do not hardcode shadcn/ui, Tailwind-only, native-only, or any component library as the universal answer, and do not avoid them out of guardrail fear when they fit. Tailwind-first is valid when the stack, token model, and team workflow support it; pure Tailwind, vanilla CSS, shadcn/ui, or any kit is not neutral by itself. Modern primitives, motion/canvas/WebGL helpers, charting libraries, and styling tools are valid when product evidence, accessibility, runtime constraints, and official docs support them.
34
+ 7. For fresh projects, prefer official framework scaffolders or setup commands when official docs show they produce the current supported shape. Build files manually only when approved architecture, repo constraints, or learning/prototype scope makes that better.
35
+ 8. Keep design continuity opt-in. Repo evidence outranks memory residue.
8
36
 
9
- ## Authority
37
+ ## FE-003: Required Design Contract
10
38
 
11
- - Use current repo evidence, the active brief, and current project docs as valid style context.
12
- - Treat `.agent-context/` as design governance authority.
13
- - Treat `README.md` as public and developer overview, setup, usage, and user-facing context only when design or architecture rules conflict.
14
- - Do not choose final style, framework, palette, typography, layout paradigm, or animation library offline.
15
- - Research current official docs before adding a new UI, animation, scroll, 3D, canvas, charting, icon, styling, or primitive library.
16
- - Dynamic UI Foundation: do not hardcode shadcn/ui, Tailwind-only, native-only, or any component library as the universal answer, and do not avoid them out of guardrail fear when they fit. Tailwind-first is valid when the stack, token model, and team workflow support it; pure Tailwind, vanilla CSS, shadcn/ui, or any kit is not neutral by itself. Modern primitives, motion/canvas/WebGL helpers, charting libraries, and styling tools are valid when product evidence, accessibility, runtime constraints, and official docs support them.
17
- - For fresh projects, prefer official framework scaffolders or setup commands when official docs show they produce the current supported shape. Build files manually only when approved architecture, repo constraints, or learning/prototype scope makes that better.
18
- - Keep design continuity opt-in. Repo evidence outranks memory residue.
39
+ 1. Before UI code, create or refine `docs/DESIGN.md` and `docs/design-intent.json`.
40
+ 2. The contract must record `motionPaletteDecision`, `designFlexibilityPolicy`, `conceptualAnchor`, `derivedTokenLogic`, `aiSafeUiAudit`, `designExecutionPolicy`, `designExecutionHandoff`, `reviewRubric`, `contextHygiene`, `libraryResearchStatus`, and `libraryDecisions[]`.
19
41
 
20
- ## Required Design Contract
42
+ ## FE-004: Anti-Generic UI Gate
21
43
 
22
- Before UI code, create or refine `docs/DESIGN.md` and `docs/design-intent.json`. The contract must record `motionPaletteDecision`, `designFlexibilityPolicy`, `conceptualAnchor`, `derivedTokenLogic`, `aiSafeUiAudit`, `designExecutionPolicy`, `designExecutionHandoff`, `reviewRubric`, `contextHygiene`, `libraryResearchStatus`, and `libraryDecisions[]`.
44
+ 1. Do not ship interchangeable dashboard chrome, balanced card grids, centered marketing shells, generic component-kit surfaces, generic abstract logos, or nonfunctional background decoration unless the product earns them.
45
+ 2. For new screens or broad redesigns, make at least three at-a-glance product-specific signals visible. Signals may be data treatment, iconography, state language, motion behavior, spatial structure, typography, material logic, or color behavior.
46
+ 3. Use the rename test: if the UI can be renamed to another product category without changing composition, palette, iconography, and motion language, revise before implementation is considered complete.
47
+ 4. Use the old-design regression test for broad redesigns: if the UI reads as the previous design with fewer details, removed animation, simplified sections, or a new palette on the same composition, revise before implementation is considered complete.
23
48
 
24
- ## Anti-Generic UI Gate
49
+ ## FE-005: Dynamic Anchor Gate
25
50
 
26
- Do not ship interchangeable dashboard chrome, balanced card grids, centered marketing shells, generic component-kit surfaces, generic abstract logos, or nonfunctional background decoration unless the product earns them.
51
+ 1. If the user gives no current-task visual research or reference, do not count old UI, existing design docs, or scaffold seeds as research.
52
+ 2. Choose one high-variance non-software conceptual anchor before UI code.
53
+ 3. Internally reject the safest dashboard, portal, card-grid, admin-shell, or minimalist-web-app mental model.
54
+ 4. Do not let the fallback anchor become a generic place metaphor. Avoid room, darkroom, counting room, control room, war room, studio, lab, cockpit, and command center unless the product actually depends on that place model; prefer product-specific artifacts, workflows, custody chains, instruments, data behaviors, material systems, editorial systems, service rituals, or interaction mechanisms over "where the UI lives".
55
+ 5. Record one real-world anchor reference, one signature motion behavior, and one typographic decision with role contrast.
56
+ 6. Derive typography, spacing, morphology, motion, and responsive recomposition from that anchor.
57
+ 7. Translate the anchor into workflow, hierarchy, density, typography, state behavior, and interaction before using literal artifacts. Do not turn anchor artifacts into required chrome, wallpaper, decorative props, or component-kit theme objects without a named product function.
58
+ 8. Reject anchors described only by generic quality words such as modern, clean, premium, expressive, minimal, or bold.
27
59
 
28
- For new screens or broad redesigns, make at least three at-a-glance product-specific signals visible. Signals may be data treatment, iconography, state language, motion behavior, spatial structure, typography, material logic, or color behavior.
60
+ ## FE-006: Motion, Palette, and 3D
29
61
 
30
- Use the rename test: if the UI can be renamed to another product category without changing composition, palette, iconography, and motion language, revise before implementation is considered complete.
62
+ 1. Product categories are heuristics, not style presets.
63
+ 2. Choose motion density from task, content density, brand intent, device budget, performance, and accessibility.
64
+ 3. Map states before coding: default, hover, focus-visible, active, disabled, loading, empty, error, success, transition.
65
+ 4. Distinguish motion (visual continuity between states) from interaction design (state machines, focus transfer on route/modal/error transitions, optimistic updates where safe, skeleton shapes that match real content, `aria-live` for status, keyboard paths, scroll-driven progressive disclosure). Record at least one interaction-design decision per major flow alongside motion choices.
66
+ 5. Prefer visually exploratory, product-derived palettes while preserving WCAG contrast and status clarity.
67
+ 6. Do not default to dark slate, cream/beige/tan, purple-blue gradients, monochrome palettes, cyber-neon terminals, or uniform card surfaces without product evidence.
68
+ 7. Treat motion, 3D, WebGL, canvas, scroll choreography, and animation libraries as first-class options.
31
69
 
32
- Use the old-design regression test for broad redesigns: if the UI reads as the previous design with fewer details, removed animation, simplified sections, or a new palette on the same composition, revise before implementation is considered complete.
70
+ ## FE-007: Zero-Based Redesign
33
71
 
34
- Background lines, grids, scanlines, noise, glows, blobs, abstract logos, calibration marks, and decorative geometry are invalid as wallpaper. Do not use grid or line backgrounds as first-output filler. Use them only for a named product function such as alignment, crop guidance, map/route orientation, timeline reading, measurement, status, or motion continuity.
72
+ 1. If the user asks for a redesign from zero, treat existing UI as behavioral/content evidence only.
73
+ 2. Discard prior palette, typography, hero composition, navigation placement, component morphology, motion signature, and image framing unless the user requests continuity.
74
+ 3. Rewrite or materially update both design docs before coding.
75
+ 4. Change primary composition, content hierarchy, interaction model, and responsive information architecture.
76
+ 5. Reject palette swaps, dark-mode flips, and restyled heroes.
77
+ 6. Reject implementations that remove animation, media, depth, or interaction density merely to reduce complexity when the request calls for a more distinctive experience.
35
78
 
36
- Measurement, calibration, crop, map, route, and inspection marks are task-bound overlays or control affordances. They must not become the page background, hero backdrop, or default visual texture. When a conceptual anchor and a forbidden visual motif conflict, the forbidden motif wins; translate the anchor into layout, hierarchy, density, typography, state behavior, materials, and interaction instead of literal decorative texture.
79
+ ## FE-008: Responsive Mutation
37
80
 
38
- Production UI must read as ship-ready: no visible testing, demo, sample, placeholder, lorem, TODO, coming soon, or scaffold labels unless they are intentional product states. User-facing workflows need an operable UI path; terminal-only core flows are valid only for CLI, developer-tool, or runbook products.
81
+ 1. Responsive quality is not scale-only.
82
+ 2. Mobile must prioritize the first decisive action.
83
+ 3. Tablet must regroup surfaces instead of shrinking desktop.
84
+ 4. Desktop may expose more context but must not become interchangeable admin chrome (see [REF:FE-004]).
85
+ 5. At least one major surface must change position, grouping, priority, or disclosure strategy between mobile and desktop.
86
+ 6. Prefer container queries, dynamic viewport units, support-checked selectors, subgrid, popover, or disclosure primitives when they simplify recomposition and fallbacks are clear.
39
87
 
40
- ## Dynamic Anchor Gate
88
+ ## FE-009: Accessibility
41
89
 
42
- If the user gives no current-task visual research or reference:
43
- - Do not count old UI, existing design docs, or scaffold seeds as research.
44
- - Choose one high-variance non-software conceptual anchor before UI code.
45
- - Internally reject the safest dashboard, portal, card-grid, admin-shell, or minimalist-web-app mental model.
46
- - Do not let the fallback anchor become a generic place metaphor. Avoid room, darkroom, counting room, control room, war room, studio, lab, cockpit, and command center unless the product actually depends on that place model; prefer product-specific artifacts, workflows, custody chains, instruments, data behaviors, material systems, editorial systems, service rituals, or interaction mechanisms over "where the UI lives".
47
- - Record one real-world anchor reference, one signature motion behavior, and one typographic decision with role contrast.
48
- - Derive typography, spacing, morphology, motion, and responsive recomposition from that anchor.
49
- - Translate the anchor into workflow, hierarchy, density, typography, state behavior, and interaction before using literal artifacts. Do not turn anchor artifacts into required chrome, wallpaper, decorative props, or component-kit theme objects without a named product function.
50
- - Reject anchors described only by generic quality words such as modern, clean, premium, expressive, minimal, or bold.
90
+ 1. WCAG 2.2 AA is the hard floor.
91
+ 2. APCA is advisory perceptual tuning only.
92
+ 3. Hard checks include focus visibility, focus appearance, target size, keyboard access, accessible authentication, color-only meaning, and dynamic status/state access.
93
+ 4. Fix accessibility issues without flattening the UI into generic safe chrome unless no expressive safe option remains (see [REF:FE-004]).
51
94
 
52
- ## Motion, Palette, and 3D
95
+ ## FE-010: CSS Production Hardening
53
96
 
54
- - Product categories are heuristics, not style presets.
55
- - Choose motion density from task, content density, brand intent, device budget, performance, and accessibility.
56
- - Map states before coding: default, hover, focus-visible, active, disabled, loading, empty, error, success, transition.
57
- - Distinguish motion (visual continuity between states) from interaction design (state machines, focus transfer on route/modal/error transitions, optimistic updates where safe, skeleton shapes that match real content, `aria-live` for status, keyboard paths, scroll-driven progressive disclosure). Record at least one interaction-design decision per major flow alongside motion choices.
58
- - Prefer visually exploratory, product-derived palettes while preserving WCAG contrast and status clarity.
59
- - Do not default to dark slate, cream/beige/tan, purple-blue gradients, monochrome palettes, cyber-neon terminals, or uniform card surfaces without product evidence.
60
- - Treat motion, 3D, WebGL, canvas, scroll choreography, and animation libraries as first-class options.
61
- - Omit rich motion or spatial UI only after naming the product-fit reason and the replacement interaction quality.
62
- - For new screens or broad redesigns, research the expressive implementation path instead of defaulting to static native CSS. Use native or already-installed tools only when they can still deliver the chosen ambition, or when a concrete blocker is documented. Do not downshift because adding a package feels inconvenient; downshift only for a concrete product-fit, accessibility, security, compatibility, device, maintenance, or measured performance reason.
63
- - Prefer micro-interactions in 150-300ms, layout transitions in 300-500ms, transform/opacity for high-frequency motion, explicit easing, bounded stagger, and reduced-motion alternatives unless evidence changes the budget.
64
- - Keep reduced-motion, keyboard, loading, performance, mobile, and non-3D fallbacks explicit.
65
- - Use component kits or headless primitives for behavior and accessibility when they fit. Replace library-default visual language with project-specific composition, tokens, motion, state treatment, and morphology.
66
- - Keep design-intent flexible: lock user goals, accessibility, production readiness, forbidden patterns, and approved continuity; keep exact palette primitives, font families, radius/shadow values, component skins, candidate signature moves, and external website inspiration flexible until evidence or approval locks them. Convert references into product-fit rules; do not copy layout, palette, component skin, brand posture, or visual metaphor.
67
- ## Zero-Based Redesign
97
+ 1. Plan overflow, wrapping, truncation, empty, loading, error, and extreme-content behavior before declaring a layout complete.
98
+ 2. Prefer `min()`, `max()`, `clamp()`, stable aspect ratios, container-relative sizing, OKLCH, and tinted neutrals for new tokens when supported; preserve existing design-system tokens.
99
+ 3. Prefer composition primitives that match content meaning: named `grid-template-areas` for editorial regions, subgrid for nested alignment across siblings, container queries for component-level responsiveness independent of viewport, and explicit stacking context (`isolation: isolate`) when overlap or z-depth carries meaning. Do not default to flex column when content has structure that grid expresses better.
100
+ 4. Treat recursive card nesting, uniform radius everywhere, shadow on every surface, arbitrary spacing, gray text on saturated color, and library-default skins as drift signals requiring product rationale.
68
101
 
69
- If the user asks for a redesign from zero:
70
- - Treat existing UI as behavioral/content evidence only.
71
- - Discard prior palette, typography, hero composition, navigation placement, component morphology, motion signature, and image framing unless the user requests continuity.
72
- - Rewrite or materially update both design docs before coding.
73
- - Change primary composition, content hierarchy, interaction model, and responsive information architecture.
74
- - Reject palette swaps, dark-mode flips, and restyled heroes.
75
- - Reject implementations that remove animation, media, depth, or interaction density merely to reduce complexity when the request calls for a more distinctive experience.
102
+ ## FE-011: Implementation Boundaries
76
103
 
77
- ## Responsive Mutation
104
+ 1. Follow the shipped project stack and current repo patterns.
105
+ 2. Do not hardcode Zustand, React Query, smart/dumb component doctrine, or framework-specific architecture as universal design law.
106
+ 3. Keep structure feature-oriented when it improves maintainability.
107
+ 4. Keep component states recognizable across hover, focus, loading, success, empty, and error.
108
+ 5. Do not let repeated surfaces share one visual treatment by habit; repetition needs a product reason.
78
109
 
79
- Responsive quality is not scale-only.
110
+ ## FE-013: Background and Wallpaper Discipline
80
111
 
81
- - Mobile must prioritize the first decisive action.
82
- - Tablet must regroup surfaces instead of shrinking desktop.
83
- - Desktop may expose more context but must not become interchangeable admin chrome.
84
- - At least one major surface must change position, grouping, priority, or disclosure strategy between mobile and desktop.
85
- - Prefer container queries, dynamic viewport units, support-checked selectors, subgrid, popover, or disclosure primitives when they simplify recomposition and fallbacks are clear.
112
+ 1. Background lines, grids, scanlines, noise, glows, blobs, abstract logos, calibration marks, and decorative geometry are invalid as wallpaper.
113
+ 2. Do not use grid or line backgrounds as first-output filler.
114
+ 3. Use them only for a named product function such as alignment, crop guidance, map/route orientation, timeline reading, measurement, status, or motion continuity.
115
+ 4. Measurement, calibration, crop, map, route, and inspection marks are task-bound overlays or control affordances.
116
+ 5. They must not become the page background, hero backdrop, or default visual texture.
117
+ 6. When a conceptual anchor (see [REF:FE-005]) and a forbidden visual motif conflict, the forbidden motif wins; translate the anchor into layout, hierarchy, density, typography, state behavior, materials, and interaction instead of literal decorative texture.
86
118
 
87
- ## Accessibility
119
+ ## FE-014: Production Content Policy
88
120
 
89
- - WCAG 2.2 AA is the hard floor.
90
- - APCA is advisory perceptual tuning only.
91
- - Hard checks include focus visibility, focus appearance, target size, keyboard access, accessible authentication, color-only meaning, and dynamic status/state access.
92
- - Fix accessibility issues without flattening the UI into generic safe chrome unless no expressive safe option remains.
121
+ 1. Production UI must read as ship-ready: no visible testing, demo, sample, placeholder, lorem, TODO, coming soon, or scaffold labels unless they are intentional product states.
122
+ 2. User-facing workflows need an operable UI path; terminal-only core flows are valid only for CLI, developer-tool, or runbook products.
93
123
 
94
- ## CSS Production Hardening
124
+ ## FE-015: Motion Implementation Budget
95
125
 
96
- - Plan overflow, wrapping, truncation, empty, loading, error, and extreme-content behavior before declaring a layout complete.
97
- - Prefer `min()`, `max()`, `clamp()`, stable aspect ratios, container-relative sizing, OKLCH, and tinted neutrals for new tokens when supported; preserve existing design-system tokens.
98
- - Prefer composition primitives that match content meaning: named `grid-template-areas` for editorial regions, subgrid for nested alignment across siblings, container queries for component-level responsiveness independent of viewport, and explicit stacking context (`isolation: isolate`) when overlap or z-depth carries meaning. Do not default to flex column when content has structure that grid expresses better.
99
- - Treat recursive card nesting, uniform radius everywhere, shadow on every surface, arbitrary spacing, gray text on saturated color, and library-default skins as drift signals requiring product rationale.
126
+ 1. Omit rich motion or spatial UI only after naming the product-fit reason and the replacement interaction quality.
127
+ 2. For new screens or broad redesigns, research the expressive implementation path instead of defaulting to static native CSS. Use native or already-installed tools only when they can still deliver the chosen ambition, or when a concrete blocker is documented. Do not downshift because adding a package feels inconvenient; downshift only for a concrete product-fit, accessibility, security, compatibility, device, maintenance, or measured performance reason.
128
+ 3. Prefer micro-interactions in 150-300ms, layout transitions in 300-500ms, transform/opacity for high-frequency motion, explicit easing, bounded stagger, and reduced-motion alternatives unless evidence changes the budget.
129
+ 4. Keep reduced-motion, keyboard, loading, performance, mobile, and non-3D fallbacks explicit.
100
130
 
101
- ## Implementation Boundaries
131
+ ## FE-016: Library and Design-Intent Discipline
102
132
 
103
- - Follow the shipped project stack and current repo patterns.
104
- - Do not hardcode Zustand, React Query, smart/dumb component doctrine, or framework-specific architecture as universal design law.
105
- - Keep structure feature-oriented when it improves maintainability.
106
- - Keep component states recognizable across hover, focus, loading, success, empty, and error.
107
- - Do not let repeated surfaces share one visual treatment by habit; repetition needs a product reason.
133
+ 1. Use component kits or headless primitives for behavior and accessibility when they fit. Replace library-default visual language with project-specific composition, tokens, motion, state treatment, and morphology.
134
+ 2. Keep design-intent flexible: lock user goals, accessibility, production readiness, forbidden patterns, and approved continuity; keep exact palette primitives, font families, radius/shadow values, component skins, candidate signature moves, and external website inspiration flexible until evidence or approval locks them. Convert references into product-fit rules; do not copy layout, palette, component skin, brand posture, or visual metaphor.