azcodr 1.1.0 → 1.2.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.
- package/.agents/skills/lets-build/SKILL.md +71 -78
- package/.agents/skills/lets-build/references/architecture_interview_matrix.md +78 -157
- package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +75 -35
- package/AGENTS.md +12 -10
- package/README.md +3 -8
- package/changes.md +12 -0
- package/docs/rules/api_versioning.md +0 -15
- package/docs/rules/clean_code.md +37 -0
- package/docs/rules/continuous_learning.md +14 -13
- package/docs/rules/database_integrity.md +9 -17
- package/docs/rules/design_patterns.md +1 -0
- package/docs/rules/domain_driven_design.md +31 -21
- package/docs/rules/error_handling.md +14 -1
- package/docs/rules/multitenancy_isolation.md +2 -0
- package/docs/rules/product_ownership.md +0 -18
- package/docs/rules/project_management.md +0 -17
- package/docs/rules/react.md +4 -14
- package/docs/rules/requirements_engineering.md +0 -17
- package/docs/rules/rest_api_conventions.md +0 -16
- package/docs/rules/test_driven_development.md +42 -20
- package/docs/rules/transactional_email.md +11 -4
- package/docs/rules/ui_ux_architecture.md +5 -26
- package/docs/rules/upstream_synchronization.md +0 -15
- package/docs/rules/workflow_state_machines.md +0 -18
- package/memory.md +85 -219
- package/package.json +1 -1
- package/docs/knowledge/dos_and_donts.md +0 -540
- package/docs/knowledge/issue_log.md +0 -25
- package/docs/knowledge/lessons_learned.md +0 -107
|
@@ -1,52 +1,84 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# ==============================================================================
|
|
3
3
|
# bootstrap_workspace.sh
|
|
4
|
-
# Deterministic Scaffolder
|
|
4
|
+
# Topology-Aware Deterministic Scaffolder (Strict YAGNI, Zero Speculative Bloat)
|
|
5
5
|
# ==============================================================================
|
|
6
6
|
|
|
7
7
|
set -euo pipefail
|
|
8
8
|
|
|
9
9
|
WORKSPACE_ROOT="${1:-$(pwd)}"
|
|
10
|
-
|
|
10
|
+
TOPOLOGY="${2:-backend}"
|
|
11
|
+
LANGUAGE="${3:-generic}"
|
|
11
12
|
|
|
12
|
-
echo "🚀 Initializing
|
|
13
|
+
echo "🚀 Initializing Topology-Aware Workspace in: ${WORKSPACE_ROOT}"
|
|
14
|
+
echo "🏗️ Target Topology: ${TOPOLOGY}"
|
|
13
15
|
echo "📦 Target Language Profile: ${LANGUAGE}"
|
|
14
16
|
echo "--------------------------------------------------------------"
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
20
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
21
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
18
|
+
case "${TOPOLOGY}" in
|
|
19
|
+
extension)
|
|
20
|
+
echo "1. Scaffolding Browser Extension Source Tree (src/)..."
|
|
21
|
+
mkdir -p "${WORKSPACE_ROOT}/src/background"
|
|
22
|
+
mkdir -p "${WORKSPACE_ROOT}/src/content"
|
|
23
|
+
mkdir -p "${WORKSPACE_ROOT}/src/popup"
|
|
24
|
+
mkdir -p "${WORKSPACE_ROOT}/src/shared"
|
|
25
|
+
mkdir -p "${WORKSPACE_ROOT}/public"
|
|
26
|
+
|
|
27
|
+
echo "2. Scaffolding Extension Test Suites (tests/)..."
|
|
28
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/unit"
|
|
29
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/e2e"
|
|
30
|
+
;;
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
echo "
|
|
25
|
-
mkdir -p "${WORKSPACE_ROOT}/src/
|
|
26
|
-
mkdir -p "${WORKSPACE_ROOT}/src/
|
|
27
|
-
mkdir -p "${WORKSPACE_ROOT}/src/
|
|
28
|
-
mkdir -p "${WORKSPACE_ROOT}/src/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
32
|
+
game|engine)
|
|
33
|
+
echo "1. Scaffolding Game/Engine Source Tree (src/)..."
|
|
34
|
+
mkdir -p "${WORKSPACE_ROOT}/src/core"
|
|
35
|
+
mkdir -p "${WORKSPACE_ROOT}/src/ecs"
|
|
36
|
+
mkdir -p "${WORKSPACE_ROOT}/src/renderer"
|
|
37
|
+
mkdir -p "${WORKSPACE_ROOT}/src/assets"
|
|
38
|
+
|
|
39
|
+
echo "2. Scaffolding Game/Engine Test Suites (tests/)..."
|
|
40
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/unit"
|
|
41
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/benchmarks"
|
|
42
|
+
;;
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
echo "
|
|
35
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
36
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
37
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
38
|
-
|
|
44
|
+
cli)
|
|
45
|
+
echo "1. Scaffolding CLI Source Tree (src/)..."
|
|
46
|
+
mkdir -p "${WORKSPACE_ROOT}/src/cmd"
|
|
47
|
+
mkdir -p "${WORKSPACE_ROOT}/src/core"
|
|
48
|
+
mkdir -p "${WORKSPACE_ROOT}/src/io"
|
|
49
|
+
|
|
50
|
+
echo "2. Scaffolding CLI Test Suites (tests/)..."
|
|
51
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/unit"
|
|
52
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/integration"
|
|
53
|
+
;;
|
|
39
54
|
|
|
40
|
-
|
|
41
|
-
echo "
|
|
42
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
43
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
44
|
-
mkdir -p "${WORKSPACE_ROOT}/
|
|
55
|
+
backend|web|saas)
|
|
56
|
+
echo "1. Scaffolding Backend / Enterprise Source Tree (src/)..."
|
|
57
|
+
mkdir -p "${WORKSPACE_ROOT}/src/domain/entities"
|
|
58
|
+
mkdir -p "${WORKSPACE_ROOT}/src/domain/value_objects"
|
|
59
|
+
mkdir -p "${WORKSPACE_ROOT}/src/domain/services"
|
|
60
|
+
mkdir -p "${WORKSPACE_ROOT}/src/ports/primary"
|
|
61
|
+
mkdir -p "${WORKSPACE_ROOT}/src/ports/secondary"
|
|
62
|
+
mkdir -p "${WORKSPACE_ROOT}/src/adapters/primary"
|
|
63
|
+
mkdir -p "${WORKSPACE_ROOT}/src/adapters/secondary"
|
|
64
|
+
|
|
65
|
+
echo "2. Scaffolding Specifications (specs/)..."
|
|
66
|
+
mkdir -p "${WORKSPACE_ROOT}/specs/openapi"
|
|
67
|
+
mkdir -p "${WORKSPACE_ROOT}/specs/tokens"
|
|
68
|
+
|
|
69
|
+
echo "3. Scaffolding Backend Test Suites (tests/)..."
|
|
70
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/unit"
|
|
71
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/integration"
|
|
72
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/contracts"
|
|
73
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/acceptance"
|
|
74
|
+
|
|
75
|
+
echo "4. Scaffolding Deployment Infrastructure (deploy/)..."
|
|
76
|
+
mkdir -p "${WORKSPACE_ROOT}/deploy/docker"
|
|
77
|
+
mkdir -p "${WORKSPACE_ROOT}/deploy/compose"
|
|
45
78
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
cat << 'EOF' > "${TOKEN_SPEC}"
|
|
79
|
+
TOKEN_SPEC="${WORKSPACE_ROOT}/specs/tokens/tokens.json"
|
|
80
|
+
if [[ ! -f "${TOKEN_SPEC}" ]]; then
|
|
81
|
+
cat << 'EOF' > "${TOKEN_SPEC}"
|
|
50
82
|
{
|
|
51
83
|
"color": {
|
|
52
84
|
"brand": {
|
|
@@ -62,7 +94,15 @@ if [[ ! -f "${TOKEN_SPEC}" ]]; then
|
|
|
62
94
|
}
|
|
63
95
|
}
|
|
64
96
|
EOF
|
|
65
|
-
fi
|
|
97
|
+
fi
|
|
98
|
+
;;
|
|
99
|
+
|
|
100
|
+
*)
|
|
101
|
+
echo "1. Scaffolding Generic / Library Source Tree (src/)..."
|
|
102
|
+
mkdir -p "${WORKSPACE_ROOT}/src"
|
|
103
|
+
mkdir -p "${WORKSPACE_ROOT}/tests/unit"
|
|
104
|
+
;;
|
|
105
|
+
esac
|
|
66
106
|
|
|
67
107
|
echo "--------------------------------------------------------------"
|
|
68
|
-
echo "✅
|
|
108
|
+
echo "✅ Topology '${TOPOLOGY}' scaffolded with strict YAGNI (0 speculative folders)!"
|
package/AGENTS.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
> **Rule Zero:** Assume nothing. Every action must be grounded in verified evidence from this workspace or direct instructions from the user.
|
|
5
5
|
> **Open-Source Mandate:** Always utilize 100% open-source tools, frameworks, libraries, and packages across all architectural domains.
|
|
6
6
|
> **Atomicity Mandate:** All rules, skills, code units, migrations, and transactions must be strictly atomic (indivisible, self-contained, and composable with full ACID safety).
|
|
7
|
-
> **
|
|
7
|
+
> **Architecture Mandate:** Architecture emerges strictly from problem constraints and execution targets (Problem-First; zero tool/platform bias). Match architectural style to problem topology (Hexagonal for enterprise backends, Platform Scripting for extensions, Data-Oriented Design for game engines, Command Pipeline for CLIs, Game Loop for canvas games). Never force premature abstractions or universal templates.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
2. **Ground Truth Only:** A statement is only true if proven by a workspace file, verified command output, or direct user instruction.
|
|
15
15
|
3. **Unknown Until Verified:** If something is not explicitly written in the workspace or stated by the user, treat it as unknown.
|
|
16
16
|
4. **Strict Open Standards:** Standardize on open-source solutions and open specs (Semgrep, Trivy, Gitleaks, OpenTelemetry, OPA, OCI, Wasm, CloudEvents).
|
|
17
|
-
5. **
|
|
18
|
-
6. **
|
|
19
|
-
7. **
|
|
20
|
-
8. **
|
|
17
|
+
5. **Problem-First & Topology Alignment:** Problem domain and operational constraints (latency budget, GC tolerance, memory, execution environment) strictly dictate the architectural style and toolchain. Never select tools before defining the problem space.
|
|
18
|
+
6. **Evolutionary Architecture & Refactor-Before-Add:** As complexity grows, code must graduate across explicit architectural tipping points. Refactor structure first under existing green tests before implementing new features. Never append code into rotting files.
|
|
19
|
+
7. **True Incremental TDD & Nano-Cycles:** Never dump test suites in batches ("Test-First Waterfall"). Follow Uncle Bob's Three Laws: write one micro-assertion at a time, verify RED failure output, write minimal code to turn GREEN, and refactor under green.
|
|
20
|
+
8. **Systemic Atomicity:** Every skill, rule, database transaction, and refactoring step must be atomic (Single Responsibility, zero side-effects, full rollback).
|
|
21
|
+
9. **Workspace Sovereignty:** Total containment within the local workspace root (`./`). Zero interference from global configs, tools, or sibling projects.
|
|
22
|
+
10. **Continuous Learning:** Ingest all verified defects, lessons, and architectural invariants directly into domain rules and `memory.md`.
|
|
21
23
|
|
|
22
24
|
### The 5 Core Branch Questions
|
|
23
25
|
Before acting on any decision branch, answer:
|
|
@@ -40,10 +42,10 @@ Before acting on any decision branch, answer:
|
|
|
40
42
|
|
|
41
43
|
Progress all tasks systematically through the unified **Agent Cognitive & Agile Domain Lifecycle**, seamlessly interlocking the 5 agent operational disciplines with the 5-phase domain engineering pipeline:
|
|
42
44
|
```
|
|
43
|
-
1. DISCOVER / REQUIREMENTS ──► Read-only inspection; INVEST
|
|
44
|
-
2. INTERROGATE / DOMAIN ──► Relentless questioning; Ubiquitous Language &
|
|
45
|
+
1. DISCOVER / REQUIREMENTS ──► Read-only inspection; Problem Space & operational constraints; INVEST stories & Gherkin.
|
|
46
|
+
2. INTERROGATE / DOMAIN ──► Relentless questioning; Ubiquitous Language, Aggregate invariants & state machines.
|
|
45
47
|
3. PLAN / OUTER TDD ──► Minimal blast radius; failing Outer Acceptance Test (UI/API RED).
|
|
46
|
-
4. EXECUTE / INNER TDD ──►
|
|
48
|
+
4. EXECUTE / INNER TDD ──► Incremental nano-cycles (Uncle Bob's 3 Laws: 1 micro-assertion RED ➔ MINIMAL pass GREEN ➔ REFACTOR).
|
|
47
49
|
5. VERIFY / DoD & PROOF ──► Outer test turns GREEN; boundary smoke tests & 100.00% test coverage.
|
|
48
50
|
```
|
|
49
51
|
---
|
|
@@ -99,7 +101,7 @@ To prevent context bloat and keep prompt overhead minimal, detailed engineering
|
|
|
99
101
|
| **Domain Modeling** | [docs/rules/domain_expertise.md](./docs/rules/domain_expertise.md) | Business capabilities, Aggregate Root invariants, Ubiquitous Language. |
|
|
100
102
|
| **Relentless Questioning** | [docs/rules/relentless_questioning.md](./docs/rules/relentless_questioning.md) | Dynamic context-aware interrogation loops, adaptive decision trees. |
|
|
101
103
|
| **Workspace Isolation** | [docs/rules/workspace_isolation.md](./docs/rules/workspace_isolation.md) | Strict workspace sovereignty, zero global contamination, local ground truth. |
|
|
102
|
-
| **Continuous Learning** | [docs/rules/continuous_learning.md](./docs/rules/continuous_learning.md) |
|
|
104
|
+
| **Continuous Learning** | [docs/rules/continuous_learning.md](./docs/rules/continuous_learning.md) | Direct rule ingestion, root-cause analysis, dynamic invariant updates. |
|
|
103
105
|
| **Upstream Sync** | [docs/rules/upstream_synchronization.md](./docs/rules/upstream_synchronization.md) | Logging generic architecture improvements to changes.md; zero baseline pollution. |
|
|
104
106
|
---
|
|
105
107
|
|
|
@@ -114,5 +116,5 @@ To prevent context bloat and keep prompt overhead minimal, detailed engineering
|
|
|
114
116
|
- [`lets-build`](.agents/skills/lets-build/SKILL.md): Conducting architecture interviews to finalize stack, frameworks, package managers, and bootstrapping projects.
|
|
115
117
|
- [`relentless-questioner`](.agents/skills/relentless-questioner/SKILL.md): Dynamic context-aware interrogation loops before planning and coding.
|
|
116
118
|
- **Relentless Skill Architecture Inquiry:** Never author or update skills on assumptions. Interrogate all 7 inquiry branches (placement, trigger intent, domain truth, gotchas/anti-patterns, determinism, progressive bloat, verification loop) defined in [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) before writing `SKILL.md`.
|
|
117
|
-
- **Workspace Memory & Knowledge Hub:** Consult [`memory.md`](./memory.md) for ADRs, and [`docs/knowledge/`](./docs/knowledge/knowledge_graph.md) for system topologies
|
|
119
|
+
- **Workspace Memory & Knowledge Hub:** Consult [`memory.md`](./memory.md) for ADRs, and [`docs/knowledge/`](./docs/knowledge/knowledge_graph.md) for system topologies and domain glossaries.
|
|
118
120
|
- **Harness Parity & Symlinks:** `AGENTS.md`, `CLAUDE.md`, and `agents.md` must remain identical via filesystem symbolic links to eliminate configuration divergence across different agent harnesses.
|
package/README.md
CHANGED
|
@@ -34,11 +34,8 @@
|
|
|
34
34
|
│ ├── product-analyst/ # INVEST user stories & Gherkin criteria
|
|
35
35
|
│ └── relentless-questioner/ # Context-aware dynamic interrogation loop
|
|
36
36
|
├── docs/
|
|
37
|
-
│ ├── knowledge/ # Institutional knowledge &
|
|
38
|
-
│ │ ├── dos_and_donts.md # Consolidated DO's and DONT's directory
|
|
39
|
-
│ │ ├── issue_log.md # Defect post-mortems & preventing rules
|
|
37
|
+
│ ├── knowledge/ # Institutional knowledge & domain contracts
|
|
40
38
|
│ │ ├── knowledge_graph.md # Visual topologies & fast-lookup matrices
|
|
41
|
-
│ │ ├── lessons_learned.md # Strategic architectural takeaways
|
|
42
39
|
│ │ └── ubiquitous_language.md # Living Ubiquitous Language glossary template
|
|
43
40
|
│ └── rules/ # 47 atomic single-responsibility domain rules
|
|
44
41
|
├── AGENTS.md # Lean root agentic configuration (< 120 lines)
|
|
@@ -177,8 +174,6 @@ Once confirmed, the agent automatically executes:
|
|
|
177
174
|
## 🏛️ Workspace Memory & Knowledge Hub
|
|
178
175
|
|
|
179
176
|
- 🗺️ **[System Knowledge Graph](./docs/knowledge/knowledge_graph.md)**: Visual subsystem topologies and entity-relationship models.
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
- 💡 **[Institutional Lessons Learned](./docs/knowledge/lessons_learned.md)**: Strategic engineering insights.
|
|
183
|
-
- 📜 **[Lightweight ADR Ledger](./memory.md)**: Formal Architectural Decision Records.
|
|
177
|
+
- 📖 **[Living Ubiquitous Language Glossary](./docs/knowledge/ubiquitous_language.md)**: Authoritative domain vocabulary contract.
|
|
178
|
+
- 📜 **[Lightweight ADR Ledger](./memory.md)**: Formal Architectural Decision Records and governing rules.
|
|
184
179
|
- 📝 **[Upstream Changes Ledger](./changes.md)**: Record candidate improvements and generic patterns for the upstream azcodr template.
|
package/changes.md
CHANGED
|
@@ -48,3 +48,15 @@ When an AI agent or engineer discovers a generic architectural improvement, bug
|
|
|
48
48
|
- **Rationale:** Ensure flawless cross-platform and multi-version Node execution across macOS, Windows, and Linux on Node 18, 20, 22, 24.
|
|
49
49
|
- **Description:** Untracked agents.md from Git to prevent cyclic symlink overwrite on case-insensitive filesystems; hardened ensureSymlink with isSameCaseInsensitiveFile check; added cross-version test coverage runner script; updated npm test runner to use native discovery.
|
|
50
50
|
- **Domain Filter Verification:** Verified 100% generic; purged of all project-specific business entities and models.
|
|
51
|
+
|
|
52
|
+
### [2026-09-25] Problem-First Architecture, Evolutionary Tipping Points, and Incremental Nano-Cycle TDD
|
|
53
|
+
- **Category:** Architecture, Rule & Skill
|
|
54
|
+
- **Target File(s):** `AGENTS.md`, `docs/rules/clean_code.md`, `docs/rules/domain_driven_design.md`, `docs/rules/test_driven_development.md`, `.agents/skills/lets-build/SKILL.md`, `.agents/skills/lets-build/references/architecture_interview_matrix.md`, `.agents/skills/lets-build/scripts/bootstrap_workspace.sh`, `memory.md`
|
|
55
|
+
- **Rationale:** Eliminate tool-first bias ("Solution-in-Search-of-a-Problem"), stop accidental complexity (as seen in `force-dark-light` where Chrome extension received Kubernetes and OpenAPI specs), prevent AI-accelerated architectural drift, and halt the "Test-First Waterfall" batch-test anti-pattern.
|
|
56
|
+
- **Description:**
|
|
57
|
+
1. Enforced Problem Space vs Solution Space decoupling with zero tool bias.
|
|
58
|
+
2. Made scaffolding strictly topology-aware (Web SaaS, Browser Extension, Game/Engine, CLI, Library) with zero speculative bloat.
|
|
59
|
+
3. Codified Evolutionary Architecture, the 5 Architectural Tipping Points, and Kent Beck's "Refactor-Before-Add" protocol.
|
|
60
|
+
4. Codified Uncle Bob's Three Laws of TDD, banned batch-test dumps, and introduced the Incremental Nano-Cycle and Ping-Pong Pair Programming protocol.
|
|
61
|
+
- **Domain Filter Verification:** Verified 100% generic; applicable across any language, stack, and project topology.
|
|
62
|
+
|
|
@@ -111,18 +111,3 @@ specs/
|
|
|
111
111
|
│ └── openapi.yaml
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## 5. Invariants, DO's & DONT's
|
|
117
|
-
|
|
118
|
-
### DO's:
|
|
119
|
-
- **DO:** Prefix all public REST endpoints with major version identifiers (`/api/v1/`, `/api/v2/`).
|
|
120
|
-
- **DO:** Bump MAJOR and cut a new `/api/v2/` prefix whenever request or response breaking changes occur.
|
|
121
|
-
- **DO:** Inject RFC 8594 `Sunset` and `Deprecation` headers on all retired endpoints and provide a 90-day grace period.
|
|
122
|
-
- **DO:** Organize specs into versioned folders (`specs/openapi/v1/`, `v2/`) with an interactive Swagger selector.
|
|
123
|
-
|
|
124
|
-
### DONT's:
|
|
125
|
-
- **DONT:** Never expose minor or patch numbers in the URL path (e.g. `/api/v1.2/`).
|
|
126
|
-
- **DONT:** Never introduce breaking schema or status code changes within an existing major version.
|
|
127
|
-
- **DONT:** Never delete an active endpoint without a formal deprecation lifecycle.
|
|
128
|
-
|
package/docs/rules/clean_code.md
CHANGED
|
@@ -23,3 +23,40 @@
|
|
|
23
23
|
- **Orthogonality**: Eliminate coupling between unrelated modules. Changing one component must not cascade unexpected side effects into another.
|
|
24
24
|
- **Broken Windows Theory**: Never leave bad code, failing lint checks, or out-of-date documentation unfixed. Fix defects immediately before entropy normalizes.
|
|
25
25
|
- **Design by Contract (DbC)**: Define explicit preconditions (runtime boundary validation), postconditions (guaranteed response envelopes), and domain invariants.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 3. Evolutionary Architecture & Architectural Tipping Points (Ford, Parsons & Fowler)
|
|
30
|
+
|
|
31
|
+
Architecture is not a static Day 1 monument; it evolves incrementally as complexity grows. AI coding tools naturally take the path of least resistance (local token minimization), repeatedly appending code to simple files until they rot into a Big Ball of Mud. To eliminate **AI-Accelerated Architectural Drift**, the agent must pause and execute an architectural upgrade whenever code hits a **Deterministic Tipping Point**:
|
|
32
|
+
|
|
33
|
+
| Simple Baseline (Day 1) | Tipping Point / Mutation Trigger | Required Architectural Upgrade |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| **Flat Script / Single File** | File exceeds **250 lines**, or coordinates **>2 distinct I/O resources**, or is imported by **>3 distinct callers**. | **Extract Modular Subsystems:** Decouple domain logic from platform I/O; split into dedicated, focused submodules. |
|
|
36
|
+
| **Inline `if/else` or `switch` Cascades** | **Rule of Three:** The 3rd branching variant, payment provider, or protocol format is introduced. | **Strategy Pattern / Registry:** Replace conditional branching with a polymorphic Strategy interface or handler registry; update `memory.md`. |
|
|
37
|
+
| **In-Memory Store / Global State** | State requires **concurrent mutations**, **persistence across process restarts**, or **transactional rollback**. | **Repository Pattern & Persistence Port:** Introduce an explicit storage port contract; swap in-memory mock for a persistent database adapter. |
|
|
38
|
+
| **Direct Platform / Third-Party Calls** | External SDK or platform API is called from **>2 places**, or SDK throws untyped exceptions across boundaries. | **Adapter Pattern (Anti-Corruption Layer):** Wrap external SDK inside an application-owned port interface; mock only the owned interface in tests. |
|
|
39
|
+
| **Monolithic Domain Model** | The same business noun represents divergent lifecycles or definitions across workflows (e.g. `User` in Auth vs `User` in Billing). | **Bounded Context Split:** Separate into isolated domain contexts with explicit DTO / Anti-Corruption translation between them. |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 4. The "Refactor-Before-Add" Protocol (Kent Beck's Rule)
|
|
44
|
+
|
|
45
|
+
> *"Make the change easy (warning: this may be hard), then make the easy change."* — Kent Beck
|
|
46
|
+
|
|
47
|
+
Before writing production code for any new feature or user story, the agent must execute the **Refactor-Before-Add Check**:
|
|
48
|
+
1. **Assess Tipping Points**: Will adding this requirement cause any module, function, or data structure to cross an architectural tipping point?
|
|
49
|
+
2. **Phase A — Structural Refactoring (Under Green)**: If yes, refactor the existing architecture *first* while existing test suites remain 100% green. Zero behavioral changes; purely structural evolution.
|
|
50
|
+
3. **Phase B — ADR Mutation**: When an architectural tipping point is crossed, log a Lightweight Architectural Decision Record in `memory.md` summarizing the new structural boundary and trade-off.
|
|
51
|
+
4. **Phase C — Feature Implementation (Inner TDD)**: Only once the architecture cleanly accommodates the new capability, write the failing micro-test and implement the feature.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 5. Architectural Fitness Functions (Automated Tripwires)
|
|
56
|
+
|
|
57
|
+
Prevent AI-generated code rot using automated fitness functions integrated into linting and continuous verification:
|
|
58
|
+
- **File Length Gates**: Maximum 250–300 lines per file (ESLint `max-lines`).
|
|
59
|
+
- **Function Length Gates**: Maximum 20–30 lines per function (ESLint `max-lines-per-function`).
|
|
60
|
+
- **Dependency Direction Gates**: Enforce unidirectional import rules (e.g. `import/no-restricted-paths`, `dependency-cruiser`, `ArchUnit`) ensuring domain core never imports infrastructure or transport adapters.
|
|
61
|
+
- **Complexity Budgets**: Enforce cyclomatic complexity limits (maximum 10 per function).
|
|
62
|
+
If an AI attempt to add code violates any fitness function, the build fails immediately, blocking completion until the architecture is refactored.
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
# Continuous Learning & Automated Rule Ingestion
|
|
2
2
|
|
|
3
|
-
> **Core Mandate:** Automatically
|
|
3
|
+
> **Core Mandate:** Automatically capture development defects, analyze root causes, and directly update domain rules or skills to permanently prevent recurrence without intermediate bloat.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## 1. The
|
|
7
|
+
## 1. The Direct Rule Ingestion Loop
|
|
8
8
|
|
|
9
|
-
Whenever an error, test failure, build friction, or architectural anti-pattern occurs during development, immediately execute the
|
|
9
|
+
Whenever an error, test failure, build friction, or architectural anti-pattern occurs during development, immediately execute the 4-step loop:
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
1. Capture Defect ──► 2. Root Cause Analysis ──► 3.
|
|
12
|
+
1. Capture Defect ──► 2. Root Cause Analysis ──► 3. Synthesize Invariant ──► 4. Update Rule / Skill
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
1. **Capture Defect**: Record the failure symptoms and
|
|
15
|
+
1. **Capture Defect**: Record the failure symptoms, stack trace, and failing test case.
|
|
16
16
|
2. **Root Cause Analysis**: Identify the fundamental architectural or operational gap (not just the surface symptom).
|
|
17
|
-
3. **
|
|
18
|
-
4. **
|
|
19
|
-
|
|
20
|
-
- If the
|
|
21
|
-
- If it
|
|
22
|
-
- Run
|
|
17
|
+
3. **Synthesize Invariant**: Formulate a concrete, positive architectural invariant and code example showing the correct implementation.
|
|
18
|
+
4. **Update Rule / Skill**:
|
|
19
|
+
- Update the governing domain rule in `docs/rules/<domain>.md` or specialized skill in `.agents/skills/` directly.
|
|
20
|
+
- If the lesson introduces an architectural trade-off or paradigm shift, record a lightweight ADR in [`memory.md`](../../memory.md).
|
|
21
|
+
- If it unlocks a new domain, author a new atomic rule file and index it in [`AGENTS.md`](../../AGENTS.md).
|
|
22
|
+
- Run verification (`npm test && npm run validate`) to ensure 100% integrity.
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
26
|
## 2. Institutional Memory Maintenance
|
|
27
27
|
|
|
28
|
-
- **ADR
|
|
29
|
-
- **Knowledge Graph
|
|
28
|
+
- **Lightweight ADR Ledger**: Major technical decisions and invariant shifts are logged in [`memory.md`](../../memory.md) linking directly to the governing rule or skill.
|
|
29
|
+
- **System Knowledge Graph**: Keep [`docs/knowledge/knowledge_graph.md`](../knowledge/knowledge_graph.md) synchronized with new services, ports, or adapters to avoid repetitive token-expensive codebase discovery in future sessions.
|
|
30
|
+
- **Living Glossary**: Keep [`docs/knowledge/ubiquitous_language.md`](../knowledge/ubiquitous_language.md) updated with canonical domain terminology and forbidden synonyms.
|
|
@@ -69,20 +69,12 @@ Pure financial ledgers (e.g. `PaymentLedgerEntry`, `JournalEntry`) and event out
|
|
|
69
69
|
|
|
70
70
|
---
|
|
71
71
|
|
|
72
|
-
## 6.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- **
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- **DO:** Filter active records with `WHERE deleted_at IS NULL` and pair uniqueness with partial indexes (`WHERE deleted_at IS NULL`).
|
|
82
|
-
|
|
83
|
-
### DONT's:
|
|
84
|
-
- **DONT:** Never create a database table or entity without `createdAt` and `createdBy`.
|
|
85
|
-
- **DONT:** Never omit `updatedBy` or `deletedBy` on mutable tables. Every mutation and deletion must have an accountable actor.
|
|
86
|
-
- **DONT:** Never expose raw string text inputs for foreign key identifiers in the user interface.
|
|
87
|
-
- **DONT:** Never consider a feature complete if it only implements creation or listing without update, transition, or deletion capabilities.
|
|
88
|
-
- **DONT:** Never allow cascading deletes on master entities with dependent transactional history.
|
|
72
|
+
## 6. Semi-Structured Evolution & Cryptographic Audit Trails
|
|
73
|
+
|
|
74
|
+
- **Non-Destructive Schema Evolution via JSON**: For contractual covenants, dynamic conditions, or variable metadata subject to rapid domain iteration, employ semi-structured JSON fields (`termsJson`, `metadataJson`) validated against JSON Schema rather than premature table migrations.
|
|
75
|
+
- **Cryptographic Electronic Signatures & Execution Auditing**: Legal agreements and execution records require defensible evidence beyond a boolean `isSigned` flag. All executed agreements must capture:
|
|
76
|
+
1. Typed signer legal name and designated role.
|
|
77
|
+
2. ISO 8601 UTC execution timestamp.
|
|
78
|
+
3. Authenticated actor ID (`userId`).
|
|
79
|
+
4. Client network IP address and User-Agent string.
|
|
80
|
+
5. Deterministic cryptographic checksum / hash of the executed terms.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
- **Factory Method**: Encapsulate complex collaborator instantiation (e.g. tenant-specific payment gateways or notification dispatchers) behind factory functions.
|
|
11
11
|
- **Facade Pattern**: Expose a unified, simplified interface to complex underlying multi-service subsystems.
|
|
12
12
|
- **Decorator / Middleware**: Compose cross-cutting concerns (observability, authentication, tenant context resolution, rate limiting) via middleware pipelines.
|
|
13
|
+
- **Dependency Injection & Composition Hygiene**: Application factories (`createApp(deps)`) must accept an explicit composite container (`AppDependencies`). Never provide silent default fallback instances inside factories that instantiate disconnected repositories or services when partial dependencies are passed (the Split-Brain Anti-Pattern). Assemble the full dependency graph explicitly at the composition root.
|
|
13
14
|
|
|
14
15
|
---
|
|
15
16
|
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
# Domain-Driven Design (DDD) & Ubiquitous Language
|
|
2
2
|
|
|
3
|
-
> **Core Mandate:**
|
|
3
|
+
> **Core Mandate:** Separate Problem Space from Solution Space, establish unambiguous Ubiquitous Language definitions, isolate Bounded Contexts, guarantee Domain-Code Language Agreement, and protect Aggregate invariants.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## 1.
|
|
7
|
+
## 1. Problem Space vs. Solution Space (Evans & Vernon)
|
|
8
|
+
|
|
9
|
+
Software engineering fails when teams jump directly into the **Solution Space** (choosing languages, frameworks, databases, and microservices) before fully defining the **Problem Space**.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
┌────────────────────────────────────────────────────────────────────────┐
|
|
13
|
+
│ THE PROBLEM SPACE │
|
|
14
|
+
│ Business Problem ➔ Subdomains (Core/Supporting/Generic) ➔ Invariants │
|
|
15
|
+
│ Operational Constraints: Execution target, Latency budget, GC limits │
|
|
16
|
+
└───────────────────────────────────┬────────────────────────────────────┘
|
|
17
|
+
│ Shapes & Dictates
|
|
18
|
+
▼
|
|
19
|
+
┌────────────────────────────────────────────────────────────────────────┐
|
|
20
|
+
│ THE SOLUTION SPACE │
|
|
21
|
+
│ Bounded Contexts ➔ Architectural Style (DOD, Hexagonal, Pipeline) │
|
|
22
|
+
│ Emergent Toolchain: Programming Language, Runtime, Persistence │
|
|
23
|
+
└────────────────────────────────────────────────────────────────────────┘
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- **The Problem Space (The Essence - Fred Brooks):** Concerns *what* problem is being solved, the entities, state transitions, and operational constraints (e.g. 16.6ms frame budget for games, zero-install browser sandbox for extensions, or ACID compliance for banking). **Zero technology, stack, or database choices are permitted in the Problem Space.**
|
|
27
|
+
- **The Solution Space (The Accidents):** Concerns *how* the system is realized. Runtimes, programming languages (C, Rust, TS, Go, Java), and storage engines are **emergent outputs** derived strictly from Problem Space constraints.
|
|
28
|
+
- **The Golden Hammer Anti-Pattern:** Selecting tools (e.g., "Let's use Next.js and PostgreSQL") before mapping problem constraints forces the domain to fit the tool, creating massive accidental complexity.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. Domain-Code Language Agreement
|
|
8
33
|
|
|
9
34
|
The fundamental premise of Domain-Driven Design (Eric Evans) is that **the code is the model, and the model is the code**. Any divergence between the mental model of domain experts and the source code is called **Linguistic Drift**.
|
|
10
35
|
|
|
@@ -16,7 +41,7 @@ The fundamental premise of Domain-Driven Design (Eric Evans) is that **the code
|
|
|
16
41
|
|
|
17
42
|
---
|
|
18
43
|
|
|
19
|
-
##
|
|
44
|
+
## 3. Living Ubiquitous Language Glossary
|
|
20
45
|
|
|
21
46
|
Every project must maintain an authoritative, version-controlled **Living Ubiquitous Language Glossary** at [`docs/knowledge/ubiquitous_language.md`](../knowledge/ubiquitous_language.md).
|
|
22
47
|
|
|
@@ -30,7 +55,7 @@ Each entry must define:
|
|
|
30
55
|
|
|
31
56
|
---
|
|
32
57
|
|
|
33
|
-
##
|
|
58
|
+
## 4. Automated Enforcement & Linters
|
|
34
59
|
|
|
35
60
|
To prevent linguistic drift over time, teams must employ mechanical enforcement:
|
|
36
61
|
|
|
@@ -60,25 +85,10 @@ Acceptance criteria must be written strictly in Ubiquitous Language, serving as
|
|
|
60
85
|
|
|
61
86
|
---
|
|
62
87
|
|
|
63
|
-
##
|
|
88
|
+
## 5. Tactical Patterns & Invariants
|
|
64
89
|
|
|
65
90
|
1. **Entities**: Objects defined by identity that persists across state changes (e.g. `User`, `Order`, `Invoice`).
|
|
66
91
|
2. **Value Objects**: Immutable objects defined strictly by their attributes with no identity (e.g. `Money`, `DateRange`, `EmailAddress`).
|
|
67
92
|
3. **Aggregates & Aggregate Roots**: Clusters of domain objects treated as a single transactional consistency boundary. All mutations must pass through explicit methods on the Aggregate Root.
|
|
68
93
|
4. **Anti-Corruption Layer (ACL)**: When integrating with third-party APIs or legacy systems that use different terminology, translate external payloads into the internal Ubiquitous Language at the boundary adapter before they enter the domain core.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## 5. Invariants (DO's & DONT's)
|
|
73
|
-
|
|
74
|
-
### DO
|
|
75
|
-
- **DO** use identical terminology in domain conversations, PRDs, code, database schemas, and user interfaces.
|
|
76
|
-
- **DO** maintain an authoritative `ubiquitous_language.md` and treat it as a binding architectural contract.
|
|
77
|
-
- **DO** use branded nominal types for IDs to catch cross-entity domain mixups at compile time.
|
|
78
|
-
- **DO** translate foreign data structures at the perimeter using an Anti-Corruption Layer (ACL).
|
|
79
|
-
|
|
80
|
-
### DONT
|
|
81
|
-
- **DONT** use technical jargon (`dto`, `entity_row`, `table_item`) in domain business logic.
|
|
82
|
-
- **DONT** allow competing synonyms for the same concept within the same Bounded Context.
|
|
83
|
-
- **DONT** overload words with dual meanings across technical architecture and business domain.
|
|
84
|
-
- **DONT** rename domain terms in code without updating the living glossary and recording an ADR.
|
|
94
|
+
5. **Cross-Aggregate Coordination in Use Cases**: While an Aggregate Root guards its own internal invariants, business operations frequently span multiple aggregates (e.g. reserving an inventory item for an agreement). Application use cases or orchestrators must coordinate aggregate transitions atomically: asserting resource availability prior to state change, transitioning the constrained entity (e.g. `ALLOCATED`), and restoring state (`AVAILABLE`) upon cancellation, avoiding double-allocation race conditions without coupling aggregates directly.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Error Handling, Request Tracing & Schema Validation
|
|
2
2
|
|
|
3
|
-
> **Core Mandate:** Enforce fail-fast schema validation at startup, structured OpenTelemetry/JSON request tracing,
|
|
3
|
+
> **Core Mandate:** Enforce fail-fast schema validation at startup, structured OpenTelemetry/JSON request tracing, standardized RFC 7807 problem details, and an explicit canonical DomainError hierarchy.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -37,3 +37,16 @@ Enforce a uniform error envelope across all external HTTP/REST endpoints conform
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
- **Production Masking Invariant**: Strictly mask internal database error codes, raw SQL queries, file system paths, and stack traces from external client responses in non-local environments.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 4. Canonical Domain Error Hierarchy & Type-Safe Narrowing
|
|
44
|
+
|
|
45
|
+
- **Canonical DomainError Hierarchy**: Model operational domain failures using an explicit `DomainError` base class with canonical subclasses:
|
|
46
|
+
- `ValidationError` (maps to HTTP 400 / 422)
|
|
47
|
+
- `UnauthorizedError` (maps to HTTP 401)
|
|
48
|
+
- `ForbiddenError` (maps to HTTP 403)
|
|
49
|
+
- `NotFoundError` (maps to HTTP 404)
|
|
50
|
+
- `ConflictError` (maps to HTTP 409)
|
|
51
|
+
- `ExpiredError` (maps to HTTP 410)
|
|
52
|
+
- **Eliminate Untyped Error Monkey-Patching**: Strictly prohibit monkey-patching arbitrary properties onto error objects at catch sites (e.g. `(err as any).statusCode = 404`). Use clean `instanceof` narrowing in HTTP error middleware to map domain errors deterministically to RFC 7807 status codes with full compiler type safety.
|
|
@@ -14,6 +14,8 @@ Resolve tenant identity dynamically in an inbound gateway or middleware pipeline
|
|
|
14
14
|
|
|
15
15
|
*Validation:* If the resolved tenant does not exist or is in `SUSPENDED` status, immediately return **`403 Forbidden`** (`TENANT_SUSPENDED` or `TENANT_INVALID`). Propagate `TenantContext` across service calls using standard W3C Baggage headers or request contexts.
|
|
16
16
|
|
|
17
|
+
- **Fail-Closed Multi-Tenancy Invariant**: Never trust client-supplied tenant headers (`X-Tenant-ID`) without cryptographically verifying that the authenticated session actor actually belongs to the requested tenant organization/workspace. Mismatched tenant headers must immediately fail closed with HTTP 403 `FORBIDDEN_TENANT_ACCESS`.
|
|
18
|
+
|
|
17
19
|
---
|
|
18
20
|
|
|
19
21
|
## 2. Four Universal Data Isolation Models
|
|
@@ -130,21 +130,3 @@ Following Gunther Verheyen's backlog topology, the Product Backlog serves as an
|
|
|
130
130
|
1. **Single & Ordered:** Exactly one backlog exists per product.
|
|
131
131
|
2. **Dynamic Splitting:** As coarse items approach the top of the backlog, they must be split into fine, sprintable INVEST slices.
|
|
132
132
|
3. **Continuous Pruning:** Items may be reordered, added, split, or permanently deleted at any time based on empirical learning. If an item lingers at the bottom of the backlog for months without business justification, remove it.
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## 6. Invariants, DO's & DONT's
|
|
137
|
-
|
|
138
|
-
### DO's:
|
|
139
|
-
- **DO:** Formulate a clear, inspiring Product Goal that guides all backlog prioritization.
|
|
140
|
-
- **DO:** Ground prioritization in quantitative models (RICE, Kano, MoSCoW) rather than executive opinion.
|
|
141
|
-
- **DO:** Measure outcomes (satisfaction gap closure, conversion, retention) instead of pure output (story points, lines of code).
|
|
142
|
-
- **DO:** Explicitly state what will NOT be done (Won't Have this time) to preserve engineering focus.
|
|
143
|
-
- **DO:** Ensure every sprint increment complies 100% with the Definition of Done.
|
|
144
|
-
|
|
145
|
-
### DONT's:
|
|
146
|
-
- **DONT:** Never confuse output (features shipped) with outcome (value realized).
|
|
147
|
-
- **DONT:** Never treat OKRs as a task checklist; Key Results must be measurable outcomes.
|
|
148
|
-
- **DONT:** Never prioritize speculative features when core "Must-be" baseline capabilities are unfulfilled.
|
|
149
|
-
- **DONT:** Never maintain separate, disconnected backlogs for the same product.
|
|
150
|
-
- **DONT:** Never deliver "un-done" work carrying forward technical debt.
|
|
@@ -47,20 +47,3 @@ A user story or task is only marked `DONE` when all of the following verifiable
|
|
|
47
47
|
|
|
48
48
|
- If a blocker or ambiguity arises, immediately transition the task to `BLOCKED`, halt execution, and interrogate the root cause.
|
|
49
49
|
- Never guess or write speculative code to bypass an unresolved requirement.
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## 5. Invariants, DO's & DONT's
|
|
54
|
-
|
|
55
|
-
### DO's:
|
|
56
|
-
- **DO:** Maintain strict WIP = 1 limit. Never work on multiple active tasks concurrently.
|
|
57
|
-
- **DO:** Deliver features in vertical slices (UI ➔ API ➔ Domain ➔ DB) rather than isolated horizontal stubs.
|
|
58
|
-
- **DO:** Apply SMART criteria to developer tasks, time-boxing them to under 4 hours.
|
|
59
|
-
- **DO:** Halt and transition to `BLOCKED` whenever assumptions are required.
|
|
60
|
-
- **DO:** Satisfy all 7 criteria of the Definition of Done before declaring any increment complete.
|
|
61
|
-
|
|
62
|
-
### DONT's:
|
|
63
|
-
- **DONT:** Never mark a task `DONE` with skipped, failing, or unwritten tests.
|
|
64
|
-
- **DONT:** Never bypass the 5-Phase Agile Domain Lifecycle provenance gate.
|
|
65
|
-
- **DONT:** Never create untracked, open-ended developer tasks without measurable completion tests.
|
|
66
|
-
- **DONT:** Never leave unresolved blockers or silent errors in working branches.
|
package/docs/rules/react.md
CHANGED
|
@@ -72,17 +72,7 @@
|
|
|
72
72
|
|
|
73
73
|
---
|
|
74
74
|
|
|
75
|
-
## 5.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- **
|
|
79
|
-
- **DO:** Use `@tanstack/react-query` (`useQuery`, `useMutation`) for all server data fetching, caching, and mutation invalidation.
|
|
80
|
-
- **DO:** Validate all form inputs using formal Zod schemas and `react-hook-form` / `tanstack-form`.
|
|
81
|
-
- **DO:** Display user feedback and errors using accessible ARIA live regions (`role="alert"` for errors, `role="status"` for confirmations) and `<ConfirmDialog>`.
|
|
82
|
-
- **DO:** Synchronize pagination, active tabs, and search filters into URL search parameters.
|
|
83
|
-
|
|
84
|
-
### DONT's:
|
|
85
|
-
- **DONT:** Never use `window.alert()` or `window.confirm()`.
|
|
86
|
-
- **DONT:** Never fetch data in raw `useEffect` hooks with manual `loading` / `error` boolean state.
|
|
87
|
-
- **DONT:** Never manage multi-field forms using raw `useState` and manual imperative string validations.
|
|
88
|
-
- **DONT:** Never use unstyled raw HTML select or dialog elements when `shadcn/ui` components exist.
|
|
75
|
+
## 5. Theme Architecture & Design Token Completeness
|
|
76
|
+
|
|
77
|
+
- **Symmetric Design Tokens**: Ensure foundational CSS variables (`--background`, `--foreground`, `--card`, `--border`, `--popover`) are symmetrically declared across `:root` and `.dark`. Omitted root tokens in `.dark` result in unstyled backgrounds and illegible text when switching themes.
|
|
78
|
+
- **System Preference Detection & Reactive Synchronization**: `ThemeProvider` implementations must listen to `window.matchMedia('(prefers-color-scheme: dark)')` with dynamic event listeners so OS appearance toggles seamlessly propagate in real-time, and synchronize `document.documentElement.style.colorScheme = resolvedTheme` to ensure browser-native elements (scrollbars, input widgets) match the active theme.
|
|
@@ -94,20 +94,3 @@ Scenario: Successful Digital Agreement Execution
|
|
|
94
94
|
- `422 Unprocessable Entity`: Semantic domain invariant violations.
|
|
95
95
|
- `429 Too Many Requests`: Rate limiter token exhaustion.
|
|
96
96
|
- `500 Internal Server Error`: Unhandled upstream infrastructure failures.
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## 5. Invariants, DO's & DONT's
|
|
101
|
-
|
|
102
|
-
### DO's:
|
|
103
|
-
- **DO:** Embody Ron Jeffries' 3 C's (Card, Conversation, Confirmation) for all user-facing stories.
|
|
104
|
-
- **DO:** Slice user stories vertically through all layers (UI ➔ API ➔ Domain ➔ DB).
|
|
105
|
-
- **DO:** Model technical constraints, invariants, and spikes as explicit non-story requirements.
|
|
106
|
-
- **DO:** Write Gherkin scenarios with active voice covering happy and unhappy paths.
|
|
107
|
-
- **DO:** Map edge cases to standard HTTP status codes and RFC 7807 problem details.
|
|
108
|
-
|
|
109
|
-
### DONT's:
|
|
110
|
-
- **DONT:** Never write horizontal technical stories that lack end-user observable value.
|
|
111
|
-
- **DONT:** Never treat user stories as complete formal specification documents.
|
|
112
|
-
- **DONT:** Never omit negative scope (out-of-scope / non-goals) in requirements.
|
|
113
|
-
- **DONT:** Never skip edge cases or map errors to ambiguous status codes.
|