azcodr 1.3.0 → 1.5.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 (72) hide show
  1. package/.agents/hooks.json.example +42 -0
  2. package/.agents/mcp_config.json.example +24 -0
  3. package/.agents/scripts/safety_guard.sh +16 -0
  4. package/.agents/scripts/verify_completion.sh +13 -0
  5. package/.agents/skills/agentic-architect/SKILL.md +15 -8
  6. package/.agents/skills/agentic-architect/references/agents_md_template.md +6 -3
  7. package/.agents/skills/agentic-architect/references/skill_architecture_inquiry.md +1 -1
  8. package/.agents/skills/agentic-architect/references/skill_template.md +2 -1
  9. package/.agents/skills/agentic-architect/scripts/validate_agentic_configs.sh +189 -6
  10. package/.agents/skills/clean-code-refactor/SKILL.md +6 -6
  11. package/.agents/skills/compliance-audit/SKILL.md +1 -1
  12. package/.agents/skills/lets-build/SKILL.md +22 -7
  13. package/.agents/skills/lets-build/references/architecture_interview_matrix.md +8 -2
  14. package/.agents/skills/lets-build/references/hexagonal_bootstrap_scaffolds.md +53 -6
  15. package/.agents/skills/lets-build/references/project_readme_template.md +4 -4
  16. package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +181 -36
  17. package/.agents/skills/product-analyst/SKILL.md +13 -2
  18. package/.agents/skills/relentless-questioner/SKILL.md +13 -5
  19. package/.agents/skills/relentless-questioner/references/adaptive_question_trees.md +18 -0
  20. package/.gitignore +2 -0
  21. package/AGENTS.md +25 -40
  22. package/README.md +27 -40
  23. package/bin/azcodr.js +9 -4
  24. package/docs/rules/agentic_configuration.md +123 -32
  25. package/docs/rules/api_architecture.md +179 -0
  26. package/docs/rules/caching.md +30 -13
  27. package/docs/rules/cloud_native.md +10 -12
  28. package/docs/rules/cqrs.md +203 -0
  29. package/docs/rules/database_design.md +125 -0
  30. package/docs/rules/database_operations.md +56 -14
  31. package/docs/rules/design_patterns.md +18 -11
  32. package/docs/rules/devops_ci_cd.md +76 -0
  33. package/docs/rules/domain_driven_design.md +17 -13
  34. package/docs/rules/feature_flags.md +21 -4
  35. package/docs/rules/frontend_architecture.md +157 -0
  36. package/docs/rules/multitenancy_architecture.md +98 -0
  37. package/docs/rules/product_ownership.md +22 -27
  38. package/docs/rules/relentless_questioning.md +4 -0
  39. package/docs/rules/requirements_engineering.md +16 -14
  40. package/docs/rules/security_compliance.md +53 -0
  41. package/docs/rules/server_driven_ui.md +20 -3
  42. package/docs/rules/test_driven_development.md +119 -62
  43. package/docs/rules/type_safety.md +65 -0
  44. package/docs/rules/ui_ux_architecture.md +33 -30
  45. package/docs/rules/workflow_state_machines.md +20 -3
  46. package/lib/scaffold.js +117 -5
  47. package/memory.md +12 -131
  48. package/package.json +2 -2
  49. package/docs/rules/accessibility.md +0 -31
  50. package/docs/rules/advanced_api_patterns.md +0 -104
  51. package/docs/rules/api_versioning.md +0 -113
  52. package/docs/rules/application_security.md +0 -23
  53. package/docs/rules/architecture_decision_records.md +0 -42
  54. package/docs/rules/compliance.md +0 -25
  55. package/docs/rules/container_infrastructure.md +0 -32
  56. package/docs/rules/continuous_deployment.md +0 -24
  57. package/docs/rules/continuous_integration.md +0 -20
  58. package/docs/rules/continuous_learning.md +0 -29
  59. package/docs/rules/database_integrity.md +0 -80
  60. package/docs/rules/database_migrations.md +0 -41
  61. package/docs/rules/database_performance.md +0 -44
  62. package/docs/rules/database_transactions.md +0 -81
  63. package/docs/rules/devsecops.md +0 -33
  64. package/docs/rules/multitenancy_isolation.md +0 -88
  65. package/docs/rules/react.md +0 -78
  66. package/docs/rules/rest_api_conventions.md +0 -46
  67. package/docs/rules/tenant_dynamic_schemas.md +0 -88
  68. package/docs/rules/tenant_pluggable_logic.md +0 -59
  69. package/docs/rules/test_isolation.md +0 -26
  70. package/docs/rules/typescript.md +0 -55
  71. package/docs/rules/ui_navigation.md +0 -20
  72. package/docs/rules/workspace_isolation.md +0 -25
@@ -0,0 +1,42 @@
1
+ {
2
+ "safety-guard": {
3
+ "enabled": false,
4
+ "PreToolUse": [
5
+ {
6
+ "matcher": "run_command",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "./.agents/scripts/safety_guard.sh",
11
+ "timeout": 15
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ },
17
+ "post-tool-lint": {
18
+ "enabled": false,
19
+ "PostToolUse": [
20
+ {
21
+ "matcher": "run_command",
22
+ "hooks": [
23
+ {
24
+ "type": "command",
25
+ "command": "npm run lint",
26
+ "timeout": 30
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ },
32
+ "stop-verifier": {
33
+ "enabled": false,
34
+ "Stop": [
35
+ {
36
+ "type": "command",
37
+ "command": "./.agents/scripts/verify_completion.sh",
38
+ "timeout": 15
39
+ }
40
+ ]
41
+ }
42
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "mcpServers": {
3
+ "sqlite": {
4
+ "command": "npx",
5
+ "args": [
6
+ "-y",
7
+ "@modelcontextprotocol/server-sqlite",
8
+ "--db-path",
9
+ "./data/app.db"
10
+ ]
11
+ },
12
+ "filesystem": {
13
+ "command": "npx",
14
+ "args": [
15
+ "-y",
16
+ "@modelcontextprotocol/server-filesystem",
17
+ "./docs"
18
+ ]
19
+ },
20
+ "remote-service": {
21
+ "serverUrl": "https://mcp.example.com/sse"
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ # ==============================================================================
3
+ # safety_guard.sh
4
+ # Example PreToolUse hook for agent commands
5
+ # ==============================================================================
6
+ set -euo pipefail
7
+
8
+ COMMAND="${1:-}"
9
+
10
+ # Reject destructive system commands targeting root or home
11
+ if [[ "${COMMAND}" =~ (rm[[:space:]]+-[rf]{1,2}[[:space:]]+(/|\$HOME|~)) ]]; then
12
+ echo "🚨 Safety Guard: Destructive command rejected: ${COMMAND}" >&2
13
+ exit 1
14
+ fi
15
+
16
+ exit 0
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ # ==============================================================================
3
+ # verify_completion.sh
4
+ # Example Stop hook ensuring tests and validation pass before agent exit
5
+ # ==============================================================================
6
+ set -euo pipefail
7
+
8
+ # Run project validation script if configured in package.json
9
+ if [[ -f "package.json" ]] && grep -q '"validate"' "package.json"; then
10
+ npm run validate
11
+ fi
12
+
13
+ exit 0
@@ -23,11 +23,11 @@ description: Use when creating, modularizing, auditing, or updating agentic conf
23
23
  ### Step 1: Relentless Skill Architecture Inquiry (Question Everything)
24
24
  Before writing a single line of a skill or rule, execute the **7 Core Inquiry Branches**:
25
25
  1. **Placement & Scope:** Does this belong in root `AGENTS.md` (all prompts), nested `AGENTS.md` (one package), a continuous rule in `docs/rules/`, or an on-demand skill in `.agents/skills/`?
26
- 2. **Trigger Boundaries:** What is the exact user intent? What is the explicit imperative trigger (`Use when...`) and the anti-triggers (`Do NOT use for...`)?
26
+ 2. **Trigger Boundaries & YAGNI Gate:** What is the explicit imperative trigger (`Use when...`), the anti-triggers (`Do NOT use for...`), and the empirical tipping points that justify unlocking this capability?
27
27
  3. **Domain Ground Truth:** Have all generic textbook tutorials been purged? Is this grounded in verified codebase evidence?
28
28
  4. **Gotchas & Anti-Patterns:** What exact mistakes has the AI repeatedly made in this domain that must be forbidden?
29
29
  5. **Determinism vs. LLM:** Can brittle tasks be converted into deterministic scripts under `scripts/`?
30
- 6. **Progressive Bloat:** Is `SKILL.md` strictly under 500 lines, offloading deep manuals to `references/` and templates to `assets/`?
30
+ 6. **Progressive Bloat:** Is `SKILL.md` strictly under 500 lines, offloading deep manuals to `references/` and templates to `resources/`?
31
31
  7. **Verification & Proof:** What structured response template and self-validation checklist will prove success?
32
32
  *Rule:* If any branch is unanswered or ambiguous, **STOP and ask the user** (or inspect workspace files). Never fill gaps with assumptions.
33
33
 
@@ -43,8 +43,8 @@ Inspect current agent files and measure their token and line footprint:
43
43
  Extract continuous technical requirements into dedicated markdown files under `docs/rules/`:
44
44
  - `docs/rules/clean_code.md` (Clean Code, Pragmatic Programmer, CQS, SLAP)
45
45
  - `docs/rules/cloud_native.md` (12-Factor 2026, OpenTelemetry, API-first)
46
- - `docs/rules/compliance.md` (SOC 2 Type II, ISO 27001, GDPR)
47
- - `docs/rules/continuous_integration.md` (Shift-left pipelines, trunk-based CI)
46
+ - `docs/rules/security_compliance.md` (SOC 2 Type II, ISO 27001, GDPR)
47
+ - `docs/rules/devops_ci_cd.md` (Shift-left pipelines, trunk-based CI, OCI distroless)
48
48
  - `docs/rules/requirements_engineering.md` (INVEST user stories, Gherkin criteria)
49
49
 
50
50
  ### Step 4: Streamline Root AGENTS.md
@@ -65,15 +65,19 @@ When a task is complex, multi-step, or specialized, encapsulate it into `.agents
65
65
  - Include a mandatory **"Gotchas & What NOT to Do"** section.
66
66
  - Provide structured output templates.
67
67
  3. **Progressive Subdirectories:**
68
- - `references/`: Reference docs loaded only on demand.
68
+ - `references/`: Reference manuals loaded only on demand.
69
69
  - `scripts/`: Deterministic code (bash/node) to prevent stochastic AI divergence.
70
- - `assets/`: Static templates, lookup tables, and schemas.
70
+ - `resources/`: Static templates, lookup tables, and schemas.
71
+ - `examples/`: Reference implementations and code patterns.
71
72
 
72
73
  ### Step 6: Enforce Harness Parity via Symlinks
73
- Prevent divergence between Claude Code, standard AGENTS.md, and legacy tooling:
74
+ Prevent divergence across Claude Code, Google Antigravity, Cursor, Windsurf, and standard AGENTS.md:
74
75
  ```bash
75
76
  ln -sf AGENTS.md CLAUDE.md
76
77
  ln -sf AGENTS.md agents.md
78
+ ln -sf AGENTS.md GEMINI.md
79
+ ln -sf AGENTS.md .cursorrules
80
+ ln -sf AGENTS.md .windsurfrules
77
81
  ```
78
82
 
79
83
  ### Step 7: Apply the Continuous Refinement Loop
@@ -87,6 +91,8 @@ ln -sf AGENTS.md agents.md
87
91
  ## 3. Gotchas & What NOT to Do
88
92
 
89
93
  - **DO NOT** guess what a skill should do. Run the Relentless Skill Architecture Inquiry first.
94
+ - **DO NOT** author architectural rules or skills without a YAGNI Gate (Simple Baseline, Anti-Triggers, Empirical Tipping Point).
95
+ - **DO NOT** confuse battle-tested open-source libraries (shadcn, Tailwind, Zod, Lombok) with speculative custom over-engineering.
90
96
  - **DO NOT** let root `AGENTS.md` exceed 120–150 lines. Every extra token degrades LLM attention.
91
97
  - **DO NOT** write passive skill descriptions like `"Tanstack query documentation"`. Use `"Use when implementing Tanstack Query caches..."`.
92
98
  - **DO NOT** include human "Getting Started" guides. Agents already have the workspace open.
@@ -100,13 +106,14 @@ ln -sf AGENTS.md agents.md
100
106
 
101
107
  Before finalizing any agent configuration update, verify:
102
108
  - [ ] Relentless Skill Architecture Inquiry completed for all 7 branches.
109
+ - [ ] Architectural pattern rules and skills enforce the YAGNI Gate Triad (Baseline, Anti-Triggers, Tipping Point).
103
110
  - [ ] Root `AGENTS.md` is under 120 lines and loads within minimal tokens.
104
111
  - [ ] Specialized domain instructions are decoupled into `docs/rules/`.
105
112
  - [ ] Progressive disclosure table in `AGENTS.md` contains valid, clickable markdown links.
106
113
  - [ ] All skills have front matter with `name` and imperative `description` starting with `Use when...`.
107
114
  - [ ] All skills are under 500 lines or offload sub-content to `references/`.
108
115
  - [ ] Every skill contains a "Gotchas & What NOT to Do" section.
109
- - [ ] Symlinks (`CLAUDE.md`, `agents.md`) resolve to `AGENTS.md`.
116
+ - [ ] Symlinks (`CLAUDE.md`, `agents.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`) resolve to `AGENTS.md`.
110
117
 
111
118
  ---
112
119
 
@@ -45,15 +45,18 @@ Read these specialized rule files on demand when performing relevant tasks:
45
45
  | Domain | Rule Reference File | When to Consult |
46
46
  |---|---|---|
47
47
  | **Testing** | [docs/rules/test_driven_development.md](../../../../docs/rules/test_driven_development.md) | Writing acceptance/unit tests, coverage checks. |
48
- | **Multi-Tenancy** | [docs/rules/multitenancy_isolation.md](../../../../docs/rules/multitenancy_isolation.md) | Tenant context resolution, PostgreSQL RLS. |
49
- | **Database** | [docs/rules/database_transactions.md](../../../../docs/rules/database_transactions.md) | ACID transactions, outbox pattern, atomicity. |
48
+ | **Multi-Tenancy** | [docs/rules/multitenancy_architecture.md](../../../../docs/rules/multitenancy_architecture.md) | Tenant context resolution, PostgreSQL RLS. |
49
+ | **Database** | [docs/rules/database_design.md](../../../../docs/rules/database_design.md) | Relational integrity, ACID transactions, outbox pattern. |
50
50
 
51
51
  ---
52
52
 
53
53
  ## 4. Harness Parity
54
- Keep `AGENTS.md`, `CLAUDE.md`, and `agents.md` in sync via filesystem symlinks:
54
+ Keep `AGENTS.md`, `CLAUDE.md`, `agents.md`, `GEMINI.md`, `.cursorrules`, and `.windsurfrules` in sync via filesystem symlinks:
55
55
  ```bash
56
56
  ln -sf AGENTS.md CLAUDE.md
57
57
  ln -sf AGENTS.md agents.md
58
+ ln -sf AGENTS.md GEMINI.md
59
+ ln -sf AGENTS.md .cursorrules
60
+ ln -sf AGENTS.md .windsurfrules
58
61
  ```
59
62
  ```
@@ -41,7 +41,7 @@
41
41
  [Branch 6: Progressive Disclosure (< 500 Lines)]
42
42
  ├─ Is SKILL.md under 500 lines?
43
43
  ├─ Are deep manuals offloaded to references/?
44
- └─ Are static schemas or templates offloaded to assets/?
44
+ └─ Are static schemas or templates offloaded to resources/?
45
45
  │
46
46
  ▼
47
47
  [Branch 7: Verification & Feedback Loop]
@@ -51,5 +51,6 @@ Provide consistent formatting for results:
51
51
  ## 5. Subdirectories & Progressive Resources
52
52
  - Deep reference documentation: `references/`
53
53
  - Deterministic helper scripts: `scripts/`
54
- - Static schemas or mock assets: `assets/`
54
+ - Static schemas, templates, or mock data: `resources/`
55
+ - Reference implementations and patterns: `examples/`
55
56
  ```
@@ -6,7 +6,21 @@
6
6
 
7
7
  set -euo pipefail
8
8
 
9
- WORKSPACE_ROOT="${1:-$(pwd)}"
9
+ WORKSPACE_ROOT=""
10
+ FIX_MODE=false
11
+
12
+ for arg in "$@"; do
13
+ if [[ "${arg}" == "--fix" ]]; then
14
+ FIX_MODE=true
15
+ elif [[ -z "${WORKSPACE_ROOT}" ]]; then
16
+ WORKSPACE_ROOT="${arg}"
17
+ fi
18
+ done
19
+
20
+ if [[ -z "${WORKSPACE_ROOT}" ]]; then
21
+ WORKSPACE_ROOT="$(pwd)"
22
+ fi
23
+
10
24
  ERRORS=0
11
25
  WARNINGS=0
12
26
 
@@ -36,16 +50,29 @@ else
36
50
  fi
37
51
  fi
38
52
 
53
+ # Helper to check if symlink target resolves to AGENTS.md
54
+ is_valid_agents_target() {
55
+ local target="$1"
56
+ [[ "${target}" == "AGENTS.md" || "${target}" == "./AGENTS.md" || "${target}" == "${WORKSPACE_ROOT}/AGENTS.md" ]]
57
+ }
58
+
59
+ is_valid_text_pointer() {
60
+ local file="$1"
61
+ local content
62
+ content=$(< "${file}")
63
+ [[ "${content}" == "AGENTS.md" || "${content}" == "./AGENTS.md" || "${content}" == "${WORKSPACE_ROOT}/AGENTS.md" ]]
64
+ }
65
+
39
66
  # Check CLAUDE.md symlink
40
67
  CLAUDE_FILE="${WORKSPACE_ROOT}/CLAUDE.md"
41
68
  if [[ -L "${CLAUDE_FILE}" ]]; then
42
69
  TARGET=$(readlink "${CLAUDE_FILE}")
43
- if [[ "${TARGET}" == "AGENTS.md" ]]; then
70
+ if is_valid_agents_target "${TARGET}"; then
44
71
  log_pass "CLAUDE.md is a valid symlink to AGENTS.md."
45
72
  else
46
73
  log_fail "CLAUDE.md points to '${TARGET}' instead of 'AGENTS.md'."
47
74
  fi
48
- elif [[ -f "${CLAUDE_FILE}" ]] && [[ "$(< "${CLAUDE_FILE}")" == "AGENTS.md" ]]; then
75
+ elif [[ -f "${CLAUDE_FILE}" ]] && is_valid_text_pointer "${CLAUDE_FILE}"; then
49
76
  log_pass "CLAUDE.md is a text pointer to AGENTS.md (symlink fallback)."
50
77
  else
51
78
  log_fail "CLAUDE.md is not a symbolic link."
@@ -64,20 +91,99 @@ if [[ "${IS_CASE_INSENSITIVE}" == "true" ]]; then
64
91
  log_pass "agents.md is satisfied natively by AGENTS.md (case-insensitive filesystem)."
65
92
  else
66
93
  if [[ ! -L "${AGENTS_LOWER}" ]] && [[ ! -e "${AGENTS_LOWER}" ]] && [[ -f "${AGENTS_FILE}" ]]; then
67
- ln -sf "AGENTS.md" "${AGENTS_LOWER}"
94
+ if [[ "${FIX_MODE}" == "true" ]]; then
95
+ ln -sf "AGENTS.md" "${AGENTS_LOWER}"
96
+ log_pass "Created agents.md symlink to AGENTS.md (--fix mode)."
97
+ else
98
+ log_fail "agents.md is missing. Run with --fix to automatically repair symlinks."
99
+ fi
68
100
  fi
69
101
  if [[ -L "${AGENTS_LOWER}" ]]; then
70
102
  TARGET=$(readlink "${AGENTS_LOWER}")
71
- if [[ "${TARGET}" == "AGENTS.md" ]]; then
103
+ if is_valid_agents_target "${TARGET}"; then
72
104
  log_pass "agents.md is a valid symlink to AGENTS.md."
73
105
  else
74
106
  log_fail "agents.md points to '${TARGET}' instead of 'AGENTS.md'."
75
107
  fi
108
+ elif [[ -f "${AGENTS_LOWER}" ]] && is_valid_text_pointer "${AGENTS_LOWER}"; then
109
+ log_pass "agents.md is a text pointer to AGENTS.md (symlink fallback)."
110
+ elif [[ ! -e "${AGENTS_LOWER}" ]] && [[ "${FIX_MODE}" == "true" ]]; then
111
+ : # Handled above
76
112
  else
77
113
  log_fail "agents.md is not a symbolic link."
78
114
  fi
79
115
  fi
80
116
 
117
+ # Check GEMINI.md symlink
118
+ GEMINI_FILE="${WORKSPACE_ROOT}/GEMINI.md"
119
+ if [[ -L "${GEMINI_FILE}" ]]; then
120
+ TARGET=$(readlink "${GEMINI_FILE}")
121
+ if is_valid_agents_target "${TARGET}"; then
122
+ log_pass "GEMINI.md is a valid symlink to AGENTS.md."
123
+ else
124
+ log_fail "GEMINI.md points to '${TARGET}' instead of 'AGENTS.md'."
125
+ fi
126
+ elif [[ -f "${GEMINI_FILE}" ]] && is_valid_text_pointer "${GEMINI_FILE}"; then
127
+ log_pass "GEMINI.md is a text pointer to AGENTS.md (symlink fallback)."
128
+ else
129
+ log_fail "GEMINI.md is not a symbolic link."
130
+ fi
131
+
132
+ # Check .cursorrules symlink
133
+ CURSOR_FILE="${WORKSPACE_ROOT}/.cursorrules"
134
+ if [[ -L "${CURSOR_FILE}" ]]; then
135
+ TARGET=$(readlink "${CURSOR_FILE}")
136
+ if is_valid_agents_target "${TARGET}"; then
137
+ log_pass ".cursorrules is a valid symlink to AGENTS.md."
138
+ else
139
+ log_fail ".cursorrules points to '${TARGET}' instead of 'AGENTS.md'."
140
+ fi
141
+ elif [[ -f "${CURSOR_FILE}" ]] && is_valid_text_pointer "${CURSOR_FILE}"; then
142
+ log_pass ".cursorrules is a text pointer to AGENTS.md (symlink fallback)."
143
+ else
144
+ log_fail ".cursorrules is not a symbolic link."
145
+ fi
146
+
147
+ # Check .windsurfrules symlink
148
+ WINDSURF_FILE="${WORKSPACE_ROOT}/.windsurfrules"
149
+ if [[ -L "${WINDSURF_FILE}" ]]; then
150
+ TARGET=$(readlink "${WINDSURF_FILE}")
151
+ if is_valid_agents_target "${TARGET}"; then
152
+ log_pass ".windsurfrules is a valid symlink to AGENTS.md."
153
+ else
154
+ log_fail ".windsurfrules points to '${TARGET}' instead of 'AGENTS.md'."
155
+ fi
156
+ elif [[ -f "${WINDSURF_FILE}" ]] && is_valid_text_pointer "${WINDSURF_FILE}"; then
157
+ log_pass ".windsurfrules is a text pointer to AGENTS.md (symlink fallback)."
158
+ else
159
+ log_fail ".windsurfrules is not a symbolic link."
160
+ fi
161
+
162
+ # Check .github/copilot-instructions.md symlink (if .github directory exists)
163
+ COPILOT_FILE="${WORKSPACE_ROOT}/.github/copilot-instructions.md"
164
+ if [[ -d "${WORKSPACE_ROOT}/.github" ]]; then
165
+ if [[ -L "${COPILOT_FILE}" ]]; then
166
+ TARGET=$(readlink "${COPILOT_FILE}")
167
+ if [[ "${TARGET}" == "../AGENTS.md" || "${TARGET}" == "${WORKSPACE_ROOT}/AGENTS.md" || "${TARGET}" == "AGENTS.md" ]]; then
168
+ log_pass ".github/copilot-instructions.md is a valid symlink to AGENTS.md."
169
+ else
170
+ log_fail ".github/copilot-instructions.md points to '${TARGET}' instead of '../AGENTS.md'."
171
+ fi
172
+ elif [[ -f "${COPILOT_FILE}" ]] && [[ "$(< "${COPILOT_FILE}")" == *"AGENTS.md"* ]]; then
173
+ log_pass ".github/copilot-instructions.md references AGENTS.md (symlink fallback)."
174
+ elif [[ -f "${COPILOT_FILE}" ]]; then
175
+ log_warn ".github/copilot-instructions.md exists but is neither a symlink to ../AGENTS.md nor references AGENTS.md."
176
+ fi
177
+ fi
178
+
179
+ # Check .gitignore exists
180
+ GITIGNORE_FILE="${WORKSPACE_ROOT}/.gitignore"
181
+ if [[ -f "${GITIGNORE_FILE}" ]]; then
182
+ log_pass ".gitignore exists."
183
+ else
184
+ log_fail "Missing .gitignore at ${GITIGNORE_FILE}"
185
+ fi
186
+
81
187
  # 2. Checking Progressive Disclosure Rules (docs/rules)
82
188
  echo ""
83
189
  echo "2. Checking Progressive Disclosure Rules..."
@@ -128,6 +234,11 @@ else
128
234
  log_fail "Skill '${SKILL_NAME}' missing opening front matter delimiter (---)"
129
235
  continue
130
236
  fi
237
+
238
+ # Check closing front matter delimiter
239
+ if ! awk 'NR > 1 && /^---[[:space:]]*$/ { found=1; exit } END { exit !found }' "${SKILL_FILE}"; then
240
+ log_fail "Skill '${SKILL_NAME}' missing closing front matter delimiter (---)"
241
+ fi
131
242
 
132
243
  # Check name field in front matter
133
244
  if ! grep -E "^name:[[:space:]]*${SKILL_NAME}" "${SKILL_FILE}" > /dev/null; then
@@ -143,6 +254,11 @@ else
143
254
  if [[ ! "${DESC}" =~ ^Use[[:space:]]when ]]; then
144
255
  log_warn "Skill '${SKILL_NAME}' description should start with imperative 'Use when...'"
145
256
  fi
257
+
258
+ # Check negative boundary phrasing (Do not use / Do NOT use)
259
+ if ! echo "${DESC}" | grep -qiE "(do not use|do NOT use)"; then
260
+ log_warn "Skill '${SKILL_NAME}' description should specify negative boundaries ('Do not use for...')"
261
+ fi
146
262
 
147
263
  # Check character length (< 1024)
148
264
  CHAR_LEN=${#DESC}
@@ -167,7 +283,74 @@ else
167
283
  log_pass "Validated ${SKILL_COUNT} skills in .agents/skills/."
168
284
  fi
169
285
 
170
- # 4. Summary Output
286
+ # 4. Checking Markdown Internal Links & Cross-References
287
+ echo ""
288
+ echo "4. Checking Markdown Internal Links & Cross-References..."
289
+ LINK_CHECK_RAW=$(node -e '
290
+ const fs = require("fs");
291
+ const path = require("path");
292
+
293
+ const root = process.argv[1];
294
+ const broken = [];
295
+ let totalLinks = 0;
296
+
297
+ function walk(dir) {
298
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
299
+ for (const entry of entries) {
300
+ if (entry.name === ".git" || entry.name === "node_modules") continue;
301
+ const full = path.join(dir, entry.name);
302
+ if (entry.isDirectory()) {
303
+ walk(full);
304
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
305
+ checkFile(full);
306
+ }
307
+ }
308
+ }
309
+
310
+ function checkFile(filePath) {
311
+ const content = fs.readFileSync(filePath, "utf8");
312
+ const dir = path.dirname(filePath);
313
+ const regex = /\[([^\]]+)\]\(([^)]+)\)/g;
314
+ let match;
315
+ while ((match = regex.exec(content)) !== null) {
316
+ const target = match[2].trim();
317
+ if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("mailto:") || target.startsWith("#") || target.startsWith("conversation://") || target.startsWith("file://")) {
318
+ continue;
319
+ }
320
+ const cleanTarget = target.split("#")[0];
321
+ if (!cleanTarget) continue;
322
+ totalLinks++;
323
+ const resolved = path.normalize(path.join(dir, cleanTarget));
324
+ if (!fs.existsSync(resolved)) {
325
+ broken.push(`${path.relative(root, filePath)} -> ${target}`);
326
+ }
327
+ }
328
+ }
329
+
330
+ walk(root);
331
+ if (broken.length > 0) {
332
+ console.log("BROKEN:" + broken.join("|"));
333
+ process.exit(1);
334
+ } else {
335
+ console.log("OK:" + totalLinks);
336
+ process.exit(0);
337
+ }
338
+ ' "${WORKSPACE_ROOT}" 2>&1) || true
339
+
340
+ if [[ "${LINK_CHECK_RAW}" =~ ^OK:([0-9]+) ]]; then
341
+ TOTAL_LINKS="${BASH_REMATCH[1]}"
342
+ log_pass "Validated ${TOTAL_LINKS} internal links across workspace (0 broken links)."
343
+ elif [[ "${LINK_CHECK_RAW}" =~ ^BROKEN:(.*) ]]; then
344
+ BROKEN_LIST="${BASH_REMATCH[1]}"
345
+ IFS='|' read -ra BROKEN_ITEMS <<< "${BROKEN_LIST}"
346
+ for item in "${BROKEN_ITEMS[@]}"; do
347
+ log_fail "Broken markdown link: ${item}"
348
+ done
349
+ else
350
+ log_fail "Markdown link validation failed unexpectedly: ${LINK_CHECK_RAW}"
351
+ fi
352
+
353
+ # 5. Summary Output
171
354
  echo ""
172
355
  echo "--------------------------------------------------------------"
173
356
  if [[ ${ERRORS} -eq 0 ]]; then
@@ -5,7 +5,7 @@ description: Use when refactoring existing code to comply with Clean Code, SOLID
5
5
 
6
6
  # Clean Code & Design Patterns Refactoring Skill
7
7
 
8
- > **Core Purpose:** Transform messy, coupled, or rigid code into clean, expressive, and maintainable TypeScript implementations adhering to Robert C. Martin's Clean Code, The Pragmatic Programmer, and modern Gang of Four patterns without altering external behavior.
8
+ > **Core Purpose:** Transform messy, coupled, or rigid code into clean, expressive, and maintainable implementations adhering to Robert C. Martin's Clean Code, The Pragmatic Programmer, and modern Gang of Four patterns without altering external behavior.
9
9
 
10
10
  ---
11
11
 
@@ -27,7 +27,7 @@ description: Use when refactoring existing code to comply with Clean Code, SOLID
27
27
 
28
28
  ### Step 1: Establish the Test Safety Net
29
29
  - Never refactor without passing tests.
30
- - Confirm all existing unit and acceptance tests pass: `npm run test` or `npm run coverage`.
30
+ - Confirm all existing unit and acceptance tests pass: workspace test command (e.g. `npm test`, `cargo test`, `go test ./...`, `pytest`).
31
31
  - If coverage is missing or incomplete, write tests *before* touching production code.
32
32
 
33
33
  ### Step 2: Identify Specific Code Smells
@@ -45,8 +45,8 @@ Target concrete flaws:
45
45
 
46
46
  ### Step 4: Execute Atomic Surgical Edits
47
47
  - Make one micro-refactor at a time (e.g. rename a method, extract a class).
48
- - Maintain existing naming conventions and strict TypeScript types.
49
- - Ensure zero lint or type errors: `npm run lint && npm run typecheck`.
48
+ - Maintain existing naming conventions and idiomatic type safety.
49
+ - Ensure zero lint or type errors: workspace linter and compiler (e.g. `npm run lint && npm run typecheck`, `cargo clippy`, `golangci-lint`, `mypy`).
50
50
 
51
51
  ### Step 5: Verify Continuous Green State
52
52
  - Run tests after every single atomic change: `npm run coverage`.
@@ -81,11 +81,11 @@ Target concrete flaws:
81
81
  3. **Verification Evidence**:
82
82
  - Tests Status: PASS (100.00% statement, branch, and function coverage preserved)
83
83
  - Linter Status: PASS (0 ESLint warnings)
84
- - Typecheck: PASS (0 TypeScript errors)
84
+ - Typecheck / Compiler: PASS (0 errors)
85
85
  ```
86
86
 
87
87
  ---
88
88
 
89
89
  ## 5. Subdirectories & Progressive Resources
90
90
  - [references/clean_code_smells.md](./references/clean_code_smells.md): Catalog of code smells and their refactoring cures.
91
- - [references/design_patterns_ts.md](./references/design_patterns_ts.md): Production TypeScript implementations of Adapter, Strategy, and Result patterns.
91
+ - [references/design_patterns_ts.md](./references/design_patterns_ts.md): Reference implementations of Adapter, Strategy, and Result patterns (illustrated in TypeScript).
@@ -102,7 +102,7 @@ Audit architectural implementation against compliance baselines:
102
102
  ## 3. Compliance Control Evaluation Matrix
103
103
  | Framework | Control ID | Control Description | Status | Evidence / Notes |
104
104
  |---|---|---|---|---|
105
- | **SOC 2** | CC6.1 | Least-privilege RBAC & tenant isolation | PASS | Scoped queries in Prisma |
105
+ | **SOC 2** | CC6.1 | Least-privilege RBAC & tenant isolation | PASS | Scoped database queries / RLS |
106
106
  | **SOC 2** | CC7.2 | Tamper-evident mutation audit logging | PASS | Audit table with actor tracing |
107
107
  | **ISO 27001** | A.10.1 | Cryptographic controls (AES-256, TLS 1.3) | PASS | TLS 1.3 configured, Argon2id auth |
108
108
  | **OWASP** | A01 | Broken Access Control checks | PASS | Server-side guards on all routes |
@@ -13,7 +13,7 @@ description: Use when initializing or bootstrapping a new project from this temp
13
13
 
14
14
  - When the user starts a fresh project by copying this workspace into a new directory.
15
15
  - When the user explicitly invokes `/lets-build` or asks to initialize/scaffold a new application.
16
- - When transforming or re-architecting an existing project to adhere to the 41 atomic domain rules.
16
+ - When transforming or re-architecting an existing project to adhere to the 28 cohesive domain rules.
17
17
  - **Do NOT use for**:
18
18
  - Routine bug fixes or minor edits on an already bootstrapped codebase.
19
19
  - Adding a single endpoint or modifying an existing domain model.
@@ -45,7 +45,7 @@ Do NOT guess or assume any technology or stack choice. Execute the relentless in
45
45
  #### Batch 1: Problem Space & System Topology
46
46
  1. **Domain & Problem Statement:** What real-world problem or capability does this system solve? What data moves, and what transformations occur?
47
47
  2. **System Topology Classification:** Which topology best matches the execution target?
48
- - Topology A: Web SaaS / Cloud Microservices
48
+ - Topology A: Web SaaS / Cloud Applications (Fullstack Web App vs Headless API)
49
49
  - Topology B: Browser Extension (Manifest V3)
50
50
  - Topology C: Game Engine / High-Performance Simulator (Bare metal, GPU)
51
51
  - Topology D: Browser / Canvas Game (HTML5 Canvas / WebGL / WebGPU)
@@ -70,7 +70,10 @@ Do NOT guess or assume any technology or stack choice. Execute the relentless in
70
70
 
71
71
  #### Batch 4: Targeted Invariants (Topology-Scoped, 100% YAGNI)
72
72
  Inquire *only* into the dimensions relevant to the selected topology:
73
- - *If Web SaaS / Backend:* API protocol (REST/gRPC), DB migration engine (Atlas/Flyway), tenancy isolation model, authentication, and OCI distroless containers.
73
+ - *If Web SaaS / Cloud Application:*
74
+ - **Interface Scope:** Headless API service only vs Fullstack Web Application (API + Web Frontend).
75
+ - **If Fullstack Web Application:** Frontend framework & build tool (React + Vite, Vue 3, Svelte 5), styling & accessible headless component primitives (Tailwind CSS, Radix UI / shadcn/ui per [`frontend_architecture.md`](../../../docs/rules/frontend_architecture.md)), client directory structure (`client/` + `src/` backend), and persistent app shell layout per [`ui_ux_architecture.md`](../../../docs/rules/ui_ux_architecture.md).
76
+ - **Backend & Data:** API protocol (REST/OpenAPI 3.1 vs gRPC), DB migration engine (Atlas/Flyway), tenancy isolation model, authentication, and OCI distroless containers.
74
77
  - *If Browser Extension:* MV3 content script isolation (IIFE bundle), `chrome.storage.sync` flow, permissions. (Zero Docker/K8s/OpenAPI!).
75
78
  - *If Game Engine:* Graphics backend (Vulkan/DirectX/wgpu), memory allocators (arena/frame), ECS archetype model. (Zero Docker/SQL!).
76
79
  - *If CLI:* Arg parsing library, POSIX exit codes, streaming I/O, `--json` formatting. (Zero Docker/SQL!).
@@ -79,7 +82,7 @@ Inquire *only* into the dimensions relevant to the selected topology:
79
82
 
80
83
  ### Phase 3: Synthesize (Architecture Blueprint & User Sign-Off)
81
84
  1. Consolidate the user's answers into a formal **Consolidated Architectural Blueprint** (using Section 4 template).
82
- 2. Author an Architectural Decision Record in `memory.md` (e.g. `ADR-006: Target Technology Stack & Scaffolding Baseline`).
85
+ 2. Author the project's foundational Architectural Decision Record in `memory.md`, strictly starting with **`ADR-001: Target Technology Stack & Scaffolding Baseline`**. For a freshly initialized or bootstrapped project, `memory.md` must be a clean slate (zero prior decisions). If `memory.md` contains any legacy template ADRs from `azcodr`, sanitize and reset them so the new project starts from `ADR-001`.
83
86
  3. **STOP AND ASK FOR EXPLICIT CONFIRMATION**: Present the blueprint and ADR to the user. Do NOT write scaffolding code until the user approves the blueprint.
84
87
 
85
88
  ---
@@ -90,14 +93,15 @@ Upon user confirmation:
90
93
  ```bash
91
94
  bash .agents/skills/lets-build/scripts/bootstrap_workspace.sh . <topology> <language>
92
95
  ```
93
- 2. Generate base infrastructure strictly for the selected topology (zero speculative bloat):
94
- - *Backend:* `specs/openapi/v1/openapi.yaml`, `specs/tokens/tokens.json`, `deploy/docker`, `deploy/compose`.
96
+ 2. Generate base infrastructure strictly for the selected topology (zero speculative bloat) using layouts from [references/hexagonal_bootstrap_scaffolds.md](./references/hexagonal_bootstrap_scaffolds.md):
97
+ - *Fullstack Web SaaS:* Backend in `src/`, Web Client in `client/` (`client/src/components/layout`, `client/src/components/ui`, `client/src/pages`, `client/src/hooks`, `client/src/services`), `specs/openapi/v1/openapi.yaml`, `specs/tokens/tokens.json`, `deploy/docker`, `deploy/compose`.
98
+ - *Headless Backend:* `src/domain/`, `src/ports/`, `src/adapters/`, `specs/openapi/v1/openapi.yaml`, `specs/tokens/tokens.json`, `deploy/docker`, `deploy/compose`.
95
99
  - *Extension:* `manifest.json`, `src/background/index.ts`, `src/content/index.ts`, `src/popup/index.html`.
96
100
  - *Game / Engine:* `src/core/`, `src/ecs/`, asset manifest, frame loop entrypoint.
97
101
  - *CLI:* `src/cmd/`, `src/core/`, CLI entrypoint with exit code handling.
98
102
  3. Generate build manifests (`Cargo.toml`, `package.json`, `go.mod`, `pyproject.toml`), linter configurations, and boundary smoke test (`scripts/smoke_test.sh`).
99
103
  4. **Replace Starter README with Project-Specific README**:
100
- Generate a clean, project-specific `README.md` completely replacing meta-template content with the project's actual name, mission, stack highlights, quickstart commands, and directory tree.
104
+ Generate a clean, project-specific `README.md` using [references/project_readme_template.md](./references/project_readme_template.md), completely replacing meta-template content with the project's actual name, mission, stack highlights, quickstart commands, and directory tree.
101
105
 
102
106
  ---
103
107
 
@@ -113,11 +117,14 @@ Upon user confirmation:
113
117
  - **`lets-build` IS NOW COMPLETE.** Do NOT proceed to write domain business entities, repositories, or application features.
114
118
  - Present the bootstrapped technical skeleton to the user.
115
119
  - Instruct the user to invoke `product-analyst` and `relentless-questioner` to initiate the **Domain Discovery & Requirements Engineering Phase** (Ubiquitous Language, Bounded Contexts, Aggregate Boundaries, INVEST User Stories, and Gherkin Acceptance Criteria) before any domain feature code is written.
120
+ - For applications with a user interface (Fullstack Web SaaS, Extensions, Desktop), the handover must explicitly instruct the user and agent to execute the **7-Pillar Design Architecture Triage Gate** ([`ui_ux_architecture.md`](../../../docs/rules/ui_ux_architecture.md)) to define user personas, persistent app shell navigation, and user journeys.
116
121
 
117
122
  ---
118
123
 
119
124
  ## 3. Gotchas & What NOT to Do
120
125
 
126
+ - **MAJOR DONT: NEVER carry over template-internal ADRs from azcodr into a new project.** When scaffolding or bootstrapping a new project, `memory.md` must be a clean slate and start at `ADR-001`. Do NOT number the first architecture decision as ADR-025 or ADR-028 based on azcodr's template development history.
127
+ - **MAJOR DONT: NEVER silently drop the frontend or treat Fullstack Web SaaS as a headless backend API!** If the user selects a Fullstack Web application with a UI, you MUST scaffold both the client (`client/`) and backend (`src/`) baselines, configure build manifests for both, execute the 7-Pillar Design Architecture Triage Gate, and ensure user stories slice vertically across both UI and API layers.
121
128
  - **MAJOR DONT: DO NOT invent, assume, or scaffold application domain entities, business logic, or feature pages during `/lets-build`.** The `lets-build` skill is strictly an infrastructure and technical stack bootstrapper. Fabricating business domain features without dedicated domain analysis and relentless questioning of the user is a fatal architectural defect.
122
129
  - **DO NOT** assume the stack. Never start writing Go, Rust, Python, or TypeScript before asking the user.
123
130
  - **DO NOT** scaffold universal web boilerplate (Docker, Kubernetes, OpenAPI, Postgres migrations) for non-backend projects (Browser Extensions, CLIs, Game Engines, Desktop apps).
@@ -155,3 +162,11 @@ Upon user confirmation:
155
162
  - **Code Health Gates:** 100.00% test coverage gate, zero lint errors
156
163
  - **DevSecOps:** <Semgrep / Trivy / Gitleaks / None>
157
164
  ```
165
+
166
+ ---
167
+
168
+ ## 5. Subdirectories & Progressive Resources
169
+ - [references/architecture_interview_matrix.md](./references/architecture_interview_matrix.md): Exhaustive 5-tier problem-first architecture interview questions and branch logic.
170
+ - [references/hexagonal_bootstrap_scaffolds.md](./references/hexagonal_bootstrap_scaffolds.md): Standardized directory trees and foundational templates across Go, Rust, Python, and TypeScript.
171
+ - [references/project_readme_template.md](./references/project_readme_template.md): Boilerplate template for replacing starter documentation with project-specific README.
172
+ - [scripts/bootstrap_workspace.sh](./scripts/bootstrap_workspace.sh): Topology-aware deterministic workspace initialization script.
@@ -16,7 +16,7 @@
16
16
 
17
17
  ### Dimension 2: System Topology Classification
18
18
  Classify the system into its primary operational topology:
19
- 1. **Topology A — Web SaaS / Cloud Microservices:** Network-facing HTTP/gRPC services with multi-tenant data persistence and web/mobile clients.
19
+ 1. **Topology A — Web SaaS / Cloud Applications:** Network-facing systems with multi-tenant data persistence, ranging from Fullstack Web Applications (API Backend + Web Frontend) to Headless Microservices (API-only).
20
20
  2. **Topology B — Browser Extension:** Client-side sandboxed extension (Chrome/Firefox MV3) orchestrating content scripts, background service workers, and popup UI.
21
21
  3. **Topology C — Game Engine / High-Performance Simulator:** Low-level, frame-budgeted application directly interfacing with GPU APIs (Vulkan, DirectX, Metal) and system memory.
22
22
  4. **Topology D — Browser / Canvas Game:** Sandboxed web game running inside the browser DOM/Canvas via Canvas2D, WebGL, or WebGPU.
@@ -86,7 +86,13 @@ Derive the programming language, runtime, and package manager strictly from the
86
86
 
87
87
  Inquire *only* into the dimensions relevant to the selected topology. **Never ask non-backend projects about databases, containers, or API versioning!**
88
88
 
89
- ### For Web SaaS & Enterprise Backends ONLY:
89
+ ### For Web SaaS & Enterprise Cloud Applications ONLY:
90
+ - **Application Interface Scope:** Headless API service (no UI) vs Fullstack Web Application (API Backend + Web Frontend Client).
91
+ - **Frontend UI Stack (If Fullstack Web Application):**
92
+ - **Framework & Runtime:** React + Vite, Vue 3, Svelte 5, Next.js.
93
+ - **Component Primitives & Styling:** Tailwind CSS + Accessible Headless Primitives (Radix UI / shadcn/ui) per [docs/rules/frontend_architecture.md](../../../../docs/rules/frontend_architecture.md).
94
+ - **Client Structure:** Paired Client (`client/` + `src/` backend) vs Monorepo (`apps/web` + `apps/api`).
95
+ - **Design Triage & App Shell:** Persistent App Shell (collapsible sidebar, global header) vs Dynamic Canvas per [docs/rules/ui_ux_architecture.md](../../../../docs/rules/ui_ux_architecture.md).
90
96
  - **API Protocols:** REST (OpenAPI 3.1) vs gRPC (Protobuf v3 via Buf) vs GraphQL.
91
97
  - **Database Migrations:** Declarative (Atlas) vs Versioned SQL (Flyway, Goose).
92
98
  - **Multi-Tenancy Isolation:** AST Query Interceptor vs Database RLS vs Schema-per-tenant.