azcodr 1.5.2 → 2.1.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/hooks.json +42 -42
- package/.agents/hooks.json.example +42 -42
- package/.agents/mcp_config.json.example +29 -29
- package/.agents/scripts/safety_guard.sh +143 -34
- package/.agents/scripts/verify_completion.sh +90 -27
- package/.agents/skills/agentic-architect/SKILL.md +125 -125
- package/.agents/skills/agentic-architect/references/agents_md_template.md +62 -62
- package/.agents/skills/agentic-architect/references/refinement_workflow.md +32 -32
- package/.agents/skills/agentic-architect/references/skill_architecture_inquiry.md +63 -63
- package/.agents/skills/agentic-architect/references/skill_template.md +56 -56
- package/.agents/skills/agentic-architect/scripts/validate_agentic_configs.sh +402 -402
- package/.agents/skills/clean-code-refactor/SKILL.md +91 -91
- package/.agents/skills/clean-code-refactor/references/clean_code_smells.md +27 -27
- package/.agents/skills/clean-code-refactor/references/design_patterns_ts.md +65 -65
- package/.agents/skills/compliance-audit/SKILL.md +120 -120
- package/.agents/skills/compliance-audit/references/owasp_top10_controls.md +16 -16
- package/.agents/skills/compliance-audit/references/soc2_iso_controls.md +28 -28
- package/.agents/skills/lets-build/SKILL.md +173 -173
- package/.agents/skills/lets-build/references/architecture_interview_matrix.md +115 -115
- package/.agents/skills/lets-build/references/hexagonal_bootstrap_scaffolds.md +160 -160
- package/.agents/skills/lets-build/references/project_readme_template.md +79 -79
- package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +419 -255
- package/.agents/skills/product-analyst/SKILL.md +154 -154
- package/.agents/skills/product-analyst/references/backlog_ordering_techniques.md +107 -107
- package/.agents/skills/product-analyst/references/gherkin_patterns.md +46 -46
- package/.agents/skills/product-analyst/references/invest_checklist.md +38 -38
- package/.agents/skills/product-analyst/references/okr_alignment_guide.md +76 -76
- package/.agents/skills/product-analyst/references/smart_tasks.md +59 -59
- package/.agents/skills/relentless-questioner/SKILL.md +128 -128
- package/.agents/skills/relentless-questioner/references/adaptive_question_trees.md +102 -102
- package/.editorconfig +19 -19
- package/.github/workflows/ci.yml +167 -78
- package/.github/workflows/publish.yml +196 -0
- package/.gitignore +40 -25
- package/AGENTS.md +103 -102
- package/LICENSE +21 -21
- package/README.md +168 -165
- package/bin/azcodr.js +19 -228
- package/docs/knowledge/ubiquitous_language.md +31 -18
- package/docs/rules/agentic_configuration.md +259 -259
- package/docs/rules/api_architecture.md +179 -179
- package/docs/rules/authentication.md +76 -76
- package/docs/rules/authorization.md +75 -75
- package/docs/rules/caching.md +69 -69
- package/docs/rules/clean_code.md +62 -62
- package/docs/rules/cloud_native.md +41 -41
- package/docs/rules/cqrs.md +203 -203
- package/docs/rules/database_design.md +125 -125
- package/docs/rules/database_operations.md +69 -69
- package/docs/rules/design_patterns.md +98 -98
- package/docs/rules/devops_ci_cd.md +76 -76
- package/docs/rules/domain_driven_design.md +122 -122
- package/docs/rules/error_handling.md +54 -52
- package/docs/rules/feature_flags.md +59 -59
- package/docs/rules/frontend_architecture.md +157 -157
- package/docs/rules/multitenancy_architecture.md +98 -98
- package/docs/rules/product_ownership.md +127 -127
- package/docs/rules/project_management.md +49 -49
- package/docs/rules/relentless_questioning.md +52 -52
- package/docs/rules/requirements_engineering.md +98 -98
- package/docs/rules/security_compliance.md +53 -53
- package/docs/rules/server_driven_ui.md +88 -88
- package/docs/rules/test_driven_development.md +185 -185
- package/docs/rules/transactional_email.md +27 -27
- package/docs/rules/type_safety.md +65 -65
- package/docs/rules/ui_ux_architecture.md +150 -150
- package/docs/rules/workflow_state_machines.md +117 -117
- package/lib/cli-parse.d.ts +32 -0
- package/lib/cli-parse.d.ts.map +1 -0
- package/lib/cli-parse.js +55 -0
- package/lib/cli-parse.js.map +1 -0
- package/lib/cli-target.d.ts +66 -0
- package/lib/cli-target.d.ts.map +1 -0
- package/lib/cli-target.js +102 -0
- package/lib/cli-target.js.map +1 -0
- package/lib/cli.d.ts +40 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +166 -0
- package/lib/cli.js.map +1 -0
- package/lib/errors.d.ts +39 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +26 -0
- package/lib/errors.js.map +1 -0
- package/lib/git.d.ts +15 -0
- package/lib/git.d.ts.map +1 -0
- package/lib/git.js +32 -0
- package/lib/git.js.map +1 -0
- package/lib/guards.d.ts +35 -0
- package/lib/guards.d.ts.map +1 -0
- package/lib/guards.js +95 -0
- package/lib/guards.js.map +1 -0
- package/lib/index.d.ts +6 -134
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +4 -5
- package/lib/index.js.map +1 -0
- package/lib/links.d.ts +28 -0
- package/lib/links.d.ts.map +1 -0
- package/lib/links.js +129 -0
- package/lib/links.js.map +1 -0
- package/lib/permissions.d.ts +9 -0
- package/lib/permissions.d.ts.map +1 -0
- package/lib/permissions.js +44 -0
- package/lib/permissions.js.map +1 -0
- package/lib/repo.d.ts +20 -0
- package/lib/repo.d.ts.map +1 -0
- package/lib/repo.js +92 -0
- package/lib/repo.js.map +1 -0
- package/lib/scaffold.d.ts +80 -0
- package/lib/scaffold.d.ts.map +1 -0
- package/lib/scaffold.js +201 -448
- package/lib/scaffold.js.map +1 -0
- package/memory.md +135 -36
- package/package.json +75 -62
- package/scripts/test_coverage.js +66 -38
- package/scripts/validate/adr.js +155 -0
- package/scripts/validate/io.js +82 -0
- package/scripts/validate/links.js +166 -0
- package/scripts/validate/parity.js +122 -0
- package/scripts/validate/root.js +183 -0
- package/scripts/validate/rules.js +42 -0
- package/scripts/validate/skills.js +94 -0
- package/scripts/validate/text.js +27 -0
- package/scripts/validate-cli.js +12 -0
- package/scripts/validate.js +158 -258
- package/src/cli-parse.ts +77 -0
- package/src/cli-target.ts +167 -0
- package/src/cli.ts +240 -0
- package/src/errors.ts +35 -0
- package/src/git.ts +34 -0
- package/src/guards.ts +101 -0
- package/src/index.ts +39 -0
- package/src/links.ts +139 -0
- package/src/permissions.ts +42 -0
- package/src/repo.ts +94 -0
- package/src/scaffold.ts +273 -0
- package/.github/copilot-instructions.md +0 -1
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
# Living Ubiquitous Language Glossary Template
|
|
2
|
-
|
|
3
|
-
> **Source of Truth:** Authoritative terminology dictionary binding domain concepts, business definitions, and exact code identifiers. Customize this glossary per project.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Canonical Domain Vocabulary Matrix
|
|
8
|
-
|
|
9
|
-
| Canonical Term | Business Definition | Bounded Context | Forbidden Synonyms | Code & Database Identifiers |
|
|
10
|
-
|---|---|---|---|---|
|
|
11
|
-
| *(No domain terms defined yet)* | *Define business meaning during Phase 1 Domain Discovery.* | *e.g. Core Domain* | *Synonyms strictly forbidden across code & UI.* | *Exact type, class, or table name.* |
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
# Living Ubiquitous Language Glossary Template
|
|
2
|
+
|
|
3
|
+
> **Source of Truth:** Authoritative terminology dictionary binding domain concepts, business definitions, and exact code identifiers. Customize this glossary per project.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Canonical Domain Vocabulary Matrix
|
|
8
|
+
|
|
9
|
+
| Canonical Term | Business Definition | Bounded Context | Forbidden Synonyms | Code & Database Identifiers |
|
|
10
|
+
|---|---|---|---|---|
|
|
11
|
+
| *(No domain terms defined yet)* | *Define business meaning during Phase 1 Domain Discovery.* | *e.g. Core Domain* | *Synonyms strictly forbidden across code & UI.* | *Exact type, class, or table name.* |
|
|
12
|
+
|
|
13
|
+
<!--
|
|
14
|
+
azcodr:glossary-waived
|
|
15
|
+
|
|
16
|
+
This repository is the TEMPLATE, not a product domain. Its glossary ships
|
|
17
|
+
downstream as an empty matrix on purpose: commit 8b5e0ae purged pre-filled
|
|
18
|
+
vocabulary precisely because template vocabulary bleeds into scaffolded
|
|
19
|
+
projects and becomes their false starting authority.
|
|
20
|
+
|
|
21
|
+
Downstream projects must NOT copy this waiver. The validator only honours it
|
|
22
|
+
for a scaffolded project that has defined no ADRs of its own, so removing the
|
|
23
|
+
waiver marker is what re-arms the check.
|
|
24
|
+
-->
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Linguistic Invariants & Rules
|
|
29
|
+
1. **The Single Name Rule:** Every domain concept has exactly one authoritative name. Synonyms are strictly forbidden across code, schemas, and UI.
|
|
30
|
+
2. **Contextual Boundaries:** If a word has multiple meanings across business departments, isolate the terms within dedicated Bounded Contexts.
|
|
31
|
+
3. **Continuous Updating:** When domain experts establish or rename a term, update this glossary immediately, record an ADR in `memory.md`, and refactor all occurrences.
|
|
@@ -1,259 +1,259 @@
|
|
|
1
|
-
# Agentic Configuration, Governance & Harness Standards
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce progressive disclosure across agent entrypoints, strict skill front matter standards, workspace sovereignty, continuous learning via the direct rule ingestion loop, and immutable Architectural Decision Records (ADRs).
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. The Root AGENTS.md Standard
|
|
8
|
-
|
|
9
|
-
Root configuration files (`AGENTS.md`) are injected into the agent context on **every single prompt**. To prevent context pollution and token degradation:
|
|
10
|
-
|
|
11
|
-
### Required Contents (Keep under 100–120 lines)
|
|
12
|
-
- **Identity & Mission:** 1–2 sentences defining workspace purpose and core domain.
|
|
13
|
-
- **Runtime Environment:** Declared package manager, runtime version, and non-standard scripts.
|
|
14
|
-
- **Core Operating Framework:** Foundational principles (Rule Zero, Zero-Assumption, Relentless Questioning, 5-stage lifecycle, action boundaries).
|
|
15
|
-
- **Open-Source Mandate:** Strict requirement to standardize on 100% open-source packages and tools.
|
|
16
|
-
- **High-Level Layout:** High-level architectural boundaries only (packages, apps).
|
|
17
|
-
- **Progressive Disclosure Table:** Clean index linking to specialized domain rules in `docs/rules/*.md`.
|
|
18
|
-
|
|
19
|
-
### Explicit Prohibitions (What NOT to Include)
|
|
20
|
-
- **No Developer Onboarding / Getting Started Guides:** Do not include steps for cloning, environment setup, or basic onboarding meant for human engineers.
|
|
21
|
-
- **No Granular File Trees:** Never enumerate individual file paths that change frequently (causes rapid documentation rot).
|
|
22
|
-
- **No Monolithic Domain Tutorials:** Never embed full CSS conventions, database migration steps, API specs, or PR delivery checklists directly in the root file.
|
|
23
|
-
- **No Preemptive Speculation:** Never add rules for errors the AI has not actually made. Ground rules in verified project mistakes or requirements.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## 2. Monorepo & Nested AGENTS.md Files
|
|
28
|
-
|
|
29
|
-
- In multi-package workspaces or monorepos (e.g. `apps/backend/`, `apps/frontend/`), place package-specific instructions in a nested `AGENTS.md` within that package folder.
|
|
30
|
-
- The root `AGENTS.md` remains high-level; the nested `AGENTS.md` provides scoped context only when the agent operates within that subdirectory.
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 3. Harness Parity & Symlinks
|
|
35
|
-
|
|
36
|
-
Different AI agents and IDE harnesses look for different configuration filenames:
|
|
37
|
-
- Standard: `AGENTS.md`
|
|
38
|
-
- Lowercase: `agents.md`
|
|
39
|
-
- Anthropic Claude Code: `CLAUDE.md`
|
|
40
|
-
- Google Antigravity & Gemini CLI: `GEMINI.md`
|
|
41
|
-
- Cursor: `.cursorrules`
|
|
42
|
-
- Windsurf: `.windsurfrules`
|
|
43
|
-
- GitHub Copilot: `.github/copilot-instructions.md`
|
|
44
|
-
|
|
45
|
-
**Standard:** Maintain identical configuration across all harnesses by establishing filesystem symbolic links:
|
|
46
|
-
```bash
|
|
47
|
-
ln -sf AGENTS.md agents.md
|
|
48
|
-
ln -sf AGENTS.md CLAUDE.md
|
|
49
|
-
ln -sf AGENTS.md GEMINI.md
|
|
50
|
-
ln -sf AGENTS.md .cursorrules
|
|
51
|
-
ln -sf AGENTS.md .windsurfrules
|
|
52
|
-
mkdir -p .github && ln -sf ../AGENTS.md .github/copilot-instructions.md
|
|
53
|
-
```
|
|
54
|
-
Never duplicate content into separate files.
|
|
55
|
-
|
|
56
|
-
### Context Budget & Token Economy Directives
|
|
57
|
-
To prevent LLM context exhaustion, attention dilution, and model degradation:
|
|
58
|
-
- **Per-File Rule Size Cap (24 KB / 24,000 bytes):** Every rule file in `docs/rules/` must strictly stay under 24,000 bytes. Files exceeding this ceiling risk truncation across agent runtimes.
|
|
59
|
-
- **Aggregate Rules Token Budget (20,000 tokens):** Continuous and directory-scoped rules share an aggregate budget. Over-budget rules are demoted to file-pointer references. Always use concise, actionable directives rather than prose tutorials.
|
|
60
|
-
- **Progressive Offloading:** Offload deep specifications, schemas, or large lookup matrices to dedicated reference files loaded on demand.
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## 4. Skills Architecture (`.agents/skills/<skill-name>/`)
|
|
65
|
-
|
|
66
|
-
Skills provide on-demand capabilities for **specialized, complex, or multi-step workflows** that should not pollute the global context.
|
|
67
|
-
|
|
68
|
-
### Front Matter Specification (`SKILL.md`)
|
|
69
|
-
```yaml
|
|
70
|
-
---
|
|
71
|
-
name: <skill-name>
|
|
72
|
-
description: <Imperative trigger description under 1024 characters. MUST start with 'Use when...'>
|
|
73
|
-
---
|
|
74
|
-
```
|
|
75
|
-
- **Description Requirements:**
|
|
76
|
-
- Focus strictly on **user intent**, not just technology descriptions.
|
|
77
|
-
- Explicitly state when to use: `Use when the user wants to...`
|
|
78
|
-
- Explicitly state when NOT to use: `Do not use for...`
|
|
79
|
-
- Never write generic summaries like `"A library for managing state"`.
|
|
80
|
-
|
|
81
|
-
### Body Guidelines
|
|
82
|
-
- Keep under **500 lines**.
|
|
83
|
-
- Ground instructions in real codebase experience, not generic documentation the LLM already knows.
|
|
84
|
-
- **Mandatory "Gotchas & What NOT to Do" section:** Explicitly list known AI anti-patterns and pitfalls.
|
|
85
|
-
- Include structured response templates and self-validation checklists for deterministic output.
|
|
86
|
-
|
|
87
|
-
### Progressive Disclosure Subdirectories
|
|
88
|
-
Adhere strictly to the standard agent skills folder taxonomy:
|
|
89
|
-
- `scripts/`: Deterministic executable scripts (bash, node, python) for tasks where LLMs produce non-deterministic drift.
|
|
90
|
-
- `references/`: Detailed sub-domain markdown manuals loaded on demand by the skill.
|
|
91
|
-
- `resources/`: Static templates, lookup tables, JSON schemas, or mock artifacts.
|
|
92
|
-
- `examples/`: Reference implementations and concrete code patterns.
|
|
93
|
-
|
|
94
|
-
### Deterministic Lifecycle Hooks (`.agents/hooks.json`)
|
|
95
|
-
To enforce non-negotiable safety guardrails and automated verification without stochastic agent failure:
|
|
96
|
-
- **`PreToolUse`**: Intercept destructive or dangerous CLI commands (`rm -rf`, DROP DATABASE, git push --force) and force explicit confirmation (`decision: ask`).
|
|
97
|
-
- **`PostToolUse`**: Automatically trigger fast linters (`npm run lint`), formatters, or unit test verification after tool runs.
|
|
98
|
-
- **`Stop`**: Intercept premature agent termination when background tasks are running or tests remain failing (`decision: continue`).
|
|
99
|
-
|
|
100
|
-
### Model Context Protocol (MCP) Integration (`.agents/mcp_config.json`)
|
|
101
|
-
When external tool capabilities are required (database introspectors, cloud telemetry, documentation search):
|
|
102
|
-
- Standardize on vendor-neutral **Model Context Protocol (MCP)** specifications.
|
|
103
|
-
- Declare local or containerized MCP tool servers in `.agents/mcp_config.json`.
|
|
104
|
-
- Treat MCP tools as secondary adapter driving ports, keeping domain logic decoupled from proprietary platform APIs.
|
|
105
|
-
|
|
106
|
-
### Explicit Prohibition: The "Library-as-a-Skill" Anti-Pattern
|
|
107
|
-
Never author or dynamically generate skills for commodity open-source packages or libraries (e.g. `react`, `tanstack`, `shadcn`, `zustand`, `testing-library`, `vitest`):
|
|
108
|
-
- **Prompt Bloat & Re-Explanation Tax:** Skill descriptions are continuously loaded into the agent's `<skills>` context. Proliferating skills for every library in a stack floods the prompt with thousands of redundant tokens and degrades model reasoning.
|
|
109
|
-
- **Parametric Redundancy:** Frontier LLMs already possess extensive parametric knowledge of open-source library APIs. Re-explaining basic imports and function signatures in a skill wastes context and creates documentation rot.
|
|
110
|
-
- **Trigger Collision & Agent Paralysis:** When a prompt touches UI, form validation, and data fetching, having 5 library skills triggers semantic collision, causing the agent to waste execution turns resolving which sub-skill to run.
|
|
111
|
-
- **The 4-Layer Resolution Standard:** Always resolve library stack knowledge through the **4-Layer Resolution Model**:
|
|
112
|
-
1. *Layer 1 (Manifest Ground Truth):* Read `package.json`, `components.json`, or `tsconfig.json`.
|
|
113
|
-
2. *Layer 2 (Stack Contract in `AGENTS.md`):* 3–5 line declaration in project entrypoint stamped by `/lets-build`.
|
|
114
|
-
3. *Layer 3 (Universal Domain Rules):* Enforce architectural invariants (`frontend_architecture.md`, `test_driven_development.md`) rather than library syntax.
|
|
115
|
-
4. *Layer 4 (Tool & CLI Execution):* Direct execution of official CLIs (`npx shadcn@latest add ...`) or local component inspection.
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## 5. The Architectural Atomicity Mandate for Rules & Skills
|
|
120
|
-
|
|
121
|
-
Every rule, skill, workflow, and configuration component must adhere to the **Single Responsibility Principle (SRP)**: indivisible, self-contained, orthogonal, and composable.
|
|
122
|
-
|
|
123
|
-
### Rule Atomicity
|
|
124
|
-
- **One Domain Per Rule:** Each rule file in `docs/rules/` must govern exactly one architectural or engineering subdomain.
|
|
125
|
-
- **Completeness Without Stubs:** A rule must never be a shallow stub or placeholder; it must codify production-grade invariants, anti-patterns, and concrete code patterns.
|
|
126
|
-
- **Zero Cross-Leakage:** Rules must be mutually orthogonal—never duplicate or contradict directives across files.
|
|
127
|
-
|
|
128
|
-
### Skill Atomicity
|
|
129
|
-
- **One Capability Per Skill:** Each skill in `.agents/skills/` must encapsulate one discrete, multi-step workflow.
|
|
130
|
-
- **Bounded Negative Triggers:** Must define both what it does (`Use when...`) and explicitly what it does not do (`Do not use for...`).
|
|
131
|
-
- **Encapsulated Artifacts:** Scripts, assets, and reference docs must live within the skill's isolated directory tree.
|
|
132
|
-
- **Idempotent Execution:** Re-executing a skill against the same inputs must produce identical, deterministic results.
|
|
133
|
-
|
|
134
|
-
### Many-to-Many Skill Composability Models
|
|
135
|
-
Coding tasks and agentic skills exhibit an explicit **Many-to-Many ($M:N$) Relationship**:
|
|
136
|
-
1. **Multiple Skills per Coding Task:** Implementing a complex domain feature frequently requires composing several orthogonal skills:
|
|
137
|
-
- `relentless-questioner` (resolves ambiguous invariants and failure edge cases).
|
|
138
|
-
- `product-analyst` (decomposes into INVEST user stories and executable Gherkin criteria).
|
|
139
|
-
- `compliance-audit` (verifies OWASP, SOC 2, and data isolation controls).
|
|
140
|
-
- `clean-code-refactor` (applies GoF patterns, CQS, SLAP, and eliminates code smells during the TDD inner loop).
|
|
141
|
-
2. **Single Skill in Multiple Scenarios:** An atomic skill functions as a reusable capability across completely different business problems (e.g. `clean-code-refactor` applies equally to financial ledgers, order lifecycle state machines, and authentication middleware).
|
|
142
|
-
|
|
143
|
-
#### The 3 Composition Patterns:
|
|
144
|
-
- **Pattern 1: Sequential Pipeline Chaining (Workflow Composition):** Skill $A$ produces a structured artifact (e.g. Feature Alignment Spec) that serves as the direct input contract for Skill $B$ (e.g. Gherkin test suite generation).
|
|
145
|
-
- **Pattern 2: Dynamic Skill Stacking (Contextual Composition):** An agent activates multiple orthogonal skills simultaneously in its execution context, adhering to Progressive Disclosure without polluting global prompts.
|
|
146
|
-
- **Pattern 3: Multi-Agent Subagent Delegation (Division of Labor):** A coordinator agent delegates isolated sub-tasks to specialized subagents equipped with specific skills, synthesizing their outputs into a single atomic change.
|
|
147
|
-
|
|
148
|
-
#### Invariants for Valid Skill Composition:
|
|
149
|
-
- **Standardized Output Contracts:** Skills must emit predictable, structured markdown or JSON envelopes (e.g. FAS, Gherkin blocks, ADR templates).
|
|
150
|
-
- **Zero Cross-Contamination:** No skill may write code or modify files outside its declared functional boundary.
|
|
151
|
-
- **Pure Function Semantics:** Analysis skills must remain read-only and side-effect free.
|
|
152
|
-
|
|
153
|
-
## 6. The Mandatory YAGNI Gate Triad (Rules & Skills)
|
|
154
|
-
|
|
155
|
-
LLM coding agents have a natural statistical bias toward **Instruction Creep** and **Eager Pattern Application**: when provided with a rule explaining an advanced pattern, agents reflexively apply it everywhere, causing severe architectural bloat.
|
|
156
|
-
|
|
157
|
-
To prevent premature abstraction, every architectural pattern rule and skill must enforce the **YAGNI Gate Triad**:
|
|
158
|
-
|
|
159
|
-
1. **The Simple Baseline (Day 1 Default):**
|
|
160
|
-
- The zero-overhead, default implementation that solves the immediate requirement without indirection (e.g. single database model before CQRS, relational indexes before Redis, standard React components before Server-Driven UI).
|
|
161
|
-
2. **The Anti-Triggers (Strictly Forbidden Scenarios):**
|
|
162
|
-
- Explicit, negative conditions where applying the pattern or skill is forbidden as premature over-engineering (e.g. no caching for low-throughput queries, no state machines for 2-state boolean flags, no skills for routine typo fixes).
|
|
163
|
-
3. **The Empirical Tipping Point (Graduation Threshold):**
|
|
164
|
-
- Measurable, verified criteria that MUST be breached before graduating to the pattern (e.g. p99 latency > 200ms after indexing, 3+ non-linear lifecycle states with transition guards, untrusted third-party user scripts).
|
|
165
|
-
|
|
166
|
-
### Foundational Leverage vs. Speculative Over-Engineering
|
|
167
|
-
A common misunderstanding is that YAGNI forbids using external libraries. **This is completely false**:
|
|
168
|
-
- **YAGNI Attacks:** Speculative custom code, home-grown frameworks, custom wheel reinvention, and premature multi-tier distributed architectures.
|
|
169
|
-
- **YAGNI Mandates:** Adopting battle-tested, open-source building blocks (`shadcn/ui`, `Tailwind CSS`, `Zod`, `TanStack Query`, `Lombok`) to solve concrete, present requirements with the minimum amount of custom code (preventing Not-Invented-Here / NIH syndrome).
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## 7. The Relentless Skill Architecture Inquiry
|
|
174
|
-
|
|
175
|
-
Never architect or modify a skill based on assumptions. Before authoring any `SKILL.md`, run the **7 Core Skill Inquiry Branches**:
|
|
176
|
-
|
|
177
|
-
```mermaid
|
|
178
|
-
flowchart TD
|
|
179
|
-
Req["New Skill / Rule Request"] --> B1["Branch 1: Placement<br/>AGENTS.md, Rule, or Skill?"]
|
|
180
|
-
B1 --> B2["Branch 2: Trigger Boundaries<br/>Exact 'Use when...' & 'Do NOT use for...'?"]
|
|
181
|
-
B2 --> B3["Branch 3: Domain Ground Truth<br/>Generic textbook tutorials purged?"]
|
|
182
|
-
B3 --> B4["Branch 4: Gotchas & Anti-Patterns<br/>What AI mistakes MUST be forbidden?"]
|
|
183
|
-
B4 --> B5["Branch 5: Determinism vs LLM<br/>Deterministic steps scripted in scripts/?"]
|
|
184
|
-
B5 --> B6["Branch 6: Progressive Bloat<br/>SKILL.md < 500 lines with sub-docs in references/?"]
|
|
185
|
-
B6 --> B7["Branch 7: Verification Loop<br/>Output templates & self-checklists present?"]
|
|
186
|
-
B7 --> Ready["Ready to Author / Update Skill"]
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### The 7 Core Inquiry Branches
|
|
190
|
-
|
|
191
|
-
| # | Inquiry Branch | What to Interrogate | If Unanswered |
|
|
192
|
-
|---|---|---|---|
|
|
193
|
-
| **1** | **Placement & Scope** | Does this apply to all prompts (Root `AGENTS.md`), one package (Nested `AGENTS.md`), a continuous coding domain (`docs/rules/`), or an on-demand task (`.agents/skills/`)? | Stop and categorize correctly. Never bloat root configs. |
|
|
194
|
-
| **2** | **Trigger Intent** | What explicit user intent wakes this skill? What are the negative conditions? | Interrogate the user on exact workflow boundaries. |
|
|
195
|
-
| **3** | **Domain Truth** | Is this grounded in this project's architecture, or generic fluff the LLM already knows? | Purge generic definitions (e.g. "What is a PDF/REST API"). |
|
|
196
|
-
| **4** | **Gotchas & Anti-Patterns** | What exact mistakes has the AI repeatedly made in this task? | Formulate 3–5 explicit negative "DO NOT" rules. |
|
|
197
|
-
| **5** | **Determinism** | Are there brittle CLI sequences that need a bash/Node script instead of stochastic LLM generation? | Create helper scripts in `scripts/`. |
|
|
198
|
-
| **6** | **Progressive Bloat** | Does `SKILL.md` exceed 500 lines? | Extract sub-topic guides into `references/`. |
|
|
199
|
-
| **7** | **Verification Loop** | How will the agent and user prove the skill succeeded? | Provide structured response templates & validation checklists. |
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
## 8. The Continuous Refinement Loop
|
|
204
|
-
|
|
205
|
-
When an AI produces suboptimal code or documentation:
|
|
206
|
-
1. Preserve the original AI output draft.
|
|
207
|
-
2. Make manual corrections to produce the desired gold-standard output.
|
|
208
|
-
3. Diff the original draft against the corrected version to identify specific gaps.
|
|
209
|
-
4. Update the relevant skill's "What NOT to do" or guideline section to prevent repeating that mistake.
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## 9. Workspace Sovereignty & Zero Global Interference
|
|
214
|
-
|
|
215
|
-
Enforce strict workspace containment within the workspace root (`./`):
|
|
216
|
-
- **Ground Truth Boundary**: Only files, dependencies, configuration files (`package.json`, `tsconfig.json`, `docker-compose.yml`), and verified command executions within the local workspace (`./`) constitute project truth.
|
|
217
|
-
- **Zero Global Contamination**: Never import, execute, or assume tools, environment variables, or conventions from global system directories (e.g. `~/.config`, `/tmp`, `~/.gemini/antigravity-cli`, or parent directories) unless explicitly defined within local workspace configuration.
|
|
218
|
-
- **Sibling Project Isolation**: Strictly ignore external or legacy projects. Do not read from or write to directories outside the local repository (`./`).
|
|
219
|
-
- **Subagent Context Sandboxing**: When spawning subagents or executing commands, ensure working directories are anchored strictly to `./`.
|
|
220
|
-
|
|
221
|
-
---
|
|
222
|
-
|
|
223
|
-
## 10. Continuous Learning & The Direct Rule Ingestion Loop
|
|
224
|
-
|
|
225
|
-
Whenever an error, test failure, build friction, or architectural anti-pattern occurs during development, immediately execute the 4-step loop:
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
1. Capture Defect ──► 2. Root Cause Analysis ──► 3. Synthesize Invariant ──► 4. Update Rule / Skill
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
1. **Capture Defect**: Record the failure symptoms, stack trace, and failing test case.
|
|
232
|
-
2. **Root Cause Analysis**: Identify the fundamental architectural or operational gap (not just the surface symptom).
|
|
233
|
-
3. **Synthesize Invariant**: Formulate a concrete, positive architectural invariant and code example showing the correct implementation.
|
|
234
|
-
4. **Update Rule / Skill**:
|
|
235
|
-
- Update the governing domain rule in `docs/rules/<domain>.md` or specialized skill in `.agents/skills/` directly.
|
|
236
|
-
- If the lesson introduces an architectural trade-off or paradigm shift, record a lightweight ADR in [`memory.md`](../../memory.md).
|
|
237
|
-
- Run verification (`npm test && npm run validate`) to ensure 100% integrity.
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
## 11. Architectural Decision Records (ADR) Standards
|
|
242
|
-
|
|
243
|
-
Significant architectural, technical stack, or invariant decisions must be captured in [`memory.md`](../../memory.md):
|
|
244
|
-
|
|
245
|
-
### Required ADR Envelope:
|
|
246
|
-
```markdown
|
|
247
|
-
#### ADR-XXX: <Imperative Action-Oriented Title>
|
|
248
|
-
- **Date:** YYYY-MM-DD | **Status:** PROPOSED | ACCEPTED | SUPERSEDED | DEPRECATED
|
|
249
|
-
- **Context:** The specific operational or technical problem, constraint, or trade-off requiring a decision.
|
|
250
|
-
- **Decision:** Concrete, unambiguous architecture choice and positive invariants.
|
|
251
|
-
- **Consequences:** Direct benefits and deliberate operational trade-offs accepted.
|
|
252
|
-
- **Enforced In:** Links to specific rule files in `docs/rules/` or code paths.
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Numbering & Immutability:
|
|
256
|
-
- ADR numbers are monotonically increasing (`ADR-001`, `ADR-002`, ...).
|
|
257
|
-
- ADR entries are **immutable history**. Never edit past accepted ADRs to represent new decisions; author a new ADR that explicitly supersedes the former.
|
|
258
|
-
- **Fresh Project Baseline (ADR Clean Slate):** When starting or bootstrapping a new project from this starter template, the memory ledger in [`memory.md`](../../memory.md) must be a clean slate with zero prior decisions recorded. The initial technical foundation derived during `/lets-build` must always be recorded as **`ADR-001`**. Template development history from `azcodr` must never bleed into downstream project memory ledgers.
|
|
259
|
-
|
|
1
|
+
# Agentic Configuration, Governance & Harness Standards
|
|
2
|
+
|
|
3
|
+
> **Core Mandate:** Enforce progressive disclosure across agent entrypoints, strict skill front matter standards, workspace sovereignty, continuous learning via the direct rule ingestion loop, and immutable Architectural Decision Records (ADRs).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. The Root AGENTS.md Standard
|
|
8
|
+
|
|
9
|
+
Root configuration files (`AGENTS.md`) are injected into the agent context on **every single prompt**. To prevent context pollution and token degradation:
|
|
10
|
+
|
|
11
|
+
### Required Contents (Keep under 100–120 lines)
|
|
12
|
+
- **Identity & Mission:** 1–2 sentences defining workspace purpose and core domain.
|
|
13
|
+
- **Runtime Environment:** Declared package manager, runtime version, and non-standard scripts.
|
|
14
|
+
- **Core Operating Framework:** Foundational principles (Rule Zero, Zero-Assumption, Relentless Questioning, 5-stage lifecycle, action boundaries).
|
|
15
|
+
- **Open-Source Mandate:** Strict requirement to standardize on 100% open-source packages and tools.
|
|
16
|
+
- **High-Level Layout:** High-level architectural boundaries only (packages, apps).
|
|
17
|
+
- **Progressive Disclosure Table:** Clean index linking to specialized domain rules in `docs/rules/*.md`.
|
|
18
|
+
|
|
19
|
+
### Explicit Prohibitions (What NOT to Include)
|
|
20
|
+
- **No Developer Onboarding / Getting Started Guides:** Do not include steps for cloning, environment setup, or basic onboarding meant for human engineers.
|
|
21
|
+
- **No Granular File Trees:** Never enumerate individual file paths that change frequently (causes rapid documentation rot).
|
|
22
|
+
- **No Monolithic Domain Tutorials:** Never embed full CSS conventions, database migration steps, API specs, or PR delivery checklists directly in the root file.
|
|
23
|
+
- **No Preemptive Speculation:** Never add rules for errors the AI has not actually made. Ground rules in verified project mistakes or requirements.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2. Monorepo & Nested AGENTS.md Files
|
|
28
|
+
|
|
29
|
+
- In multi-package workspaces or monorepos (e.g. `apps/backend/`, `apps/frontend/`), place package-specific instructions in a nested `AGENTS.md` within that package folder.
|
|
30
|
+
- The root `AGENTS.md` remains high-level; the nested `AGENTS.md` provides scoped context only when the agent operates within that subdirectory.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 3. Harness Parity & Symlinks
|
|
35
|
+
|
|
36
|
+
Different AI agents and IDE harnesses look for different configuration filenames:
|
|
37
|
+
- Standard: `AGENTS.md`
|
|
38
|
+
- Lowercase: `agents.md`
|
|
39
|
+
- Anthropic Claude Code: `CLAUDE.md`
|
|
40
|
+
- Google Antigravity & Gemini CLI: `GEMINI.md`
|
|
41
|
+
- Cursor: `.cursorrules`
|
|
42
|
+
- Windsurf: `.windsurfrules`
|
|
43
|
+
- GitHub Copilot: `.github/copilot-instructions.md`
|
|
44
|
+
|
|
45
|
+
**Standard:** Maintain identical configuration across all harnesses by establishing filesystem symbolic links:
|
|
46
|
+
```bash
|
|
47
|
+
ln -sf AGENTS.md agents.md
|
|
48
|
+
ln -sf AGENTS.md CLAUDE.md
|
|
49
|
+
ln -sf AGENTS.md GEMINI.md
|
|
50
|
+
ln -sf AGENTS.md .cursorrules
|
|
51
|
+
ln -sf AGENTS.md .windsurfrules
|
|
52
|
+
mkdir -p .github && ln -sf ../AGENTS.md .github/copilot-instructions.md
|
|
53
|
+
```
|
|
54
|
+
Never duplicate content into separate files.
|
|
55
|
+
|
|
56
|
+
### Context Budget & Token Economy Directives
|
|
57
|
+
To prevent LLM context exhaustion, attention dilution, and model degradation:
|
|
58
|
+
- **Per-File Rule Size Cap (24 KB / 24,000 bytes):** Every rule file in `docs/rules/` must strictly stay under 24,000 bytes. Files exceeding this ceiling risk truncation across agent runtimes.
|
|
59
|
+
- **Aggregate Rules Token Budget (20,000 tokens):** Continuous and directory-scoped rules share an aggregate budget. Over-budget rules are demoted to file-pointer references. Always use concise, actionable directives rather than prose tutorials.
|
|
60
|
+
- **Progressive Offloading:** Offload deep specifications, schemas, or large lookup matrices to dedicated reference files loaded on demand.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 4. Skills Architecture (`.agents/skills/<skill-name>/`)
|
|
65
|
+
|
|
66
|
+
Skills provide on-demand capabilities for **specialized, complex, or multi-step workflows** that should not pollute the global context.
|
|
67
|
+
|
|
68
|
+
### Front Matter Specification (`SKILL.md`)
|
|
69
|
+
```yaml
|
|
70
|
+
---
|
|
71
|
+
name: <skill-name>
|
|
72
|
+
description: <Imperative trigger description under 1024 characters. MUST start with 'Use when...'>
|
|
73
|
+
---
|
|
74
|
+
```
|
|
75
|
+
- **Description Requirements:**
|
|
76
|
+
- Focus strictly on **user intent**, not just technology descriptions.
|
|
77
|
+
- Explicitly state when to use: `Use when the user wants to...`
|
|
78
|
+
- Explicitly state when NOT to use: `Do not use for...`
|
|
79
|
+
- Never write generic summaries like `"A library for managing state"`.
|
|
80
|
+
|
|
81
|
+
### Body Guidelines
|
|
82
|
+
- Keep under **500 lines**.
|
|
83
|
+
- Ground instructions in real codebase experience, not generic documentation the LLM already knows.
|
|
84
|
+
- **Mandatory "Gotchas & What NOT to Do" section:** Explicitly list known AI anti-patterns and pitfalls.
|
|
85
|
+
- Include structured response templates and self-validation checklists for deterministic output.
|
|
86
|
+
|
|
87
|
+
### Progressive Disclosure Subdirectories
|
|
88
|
+
Adhere strictly to the standard agent skills folder taxonomy:
|
|
89
|
+
- `scripts/`: Deterministic executable scripts (bash, node, python) for tasks where LLMs produce non-deterministic drift.
|
|
90
|
+
- `references/`: Detailed sub-domain markdown manuals loaded on demand by the skill.
|
|
91
|
+
- `resources/`: Static templates, lookup tables, JSON schemas, or mock artifacts.
|
|
92
|
+
- `examples/`: Reference implementations and concrete code patterns.
|
|
93
|
+
|
|
94
|
+
### Deterministic Lifecycle Hooks (`.agents/hooks.json`)
|
|
95
|
+
To enforce non-negotiable safety guardrails and automated verification without stochastic agent failure:
|
|
96
|
+
- **`PreToolUse`**: Intercept destructive or dangerous CLI commands (`rm -rf`, DROP DATABASE, git push --force) and force explicit confirmation (`decision: ask`).
|
|
97
|
+
- **`PostToolUse`**: Automatically trigger fast linters (`npm run lint`), formatters, or unit test verification after tool runs.
|
|
98
|
+
- **`Stop`**: Intercept premature agent termination when background tasks are running or tests remain failing (`decision: continue`).
|
|
99
|
+
|
|
100
|
+
### Model Context Protocol (MCP) Integration (`.agents/mcp_config.json`)
|
|
101
|
+
When external tool capabilities are required (database introspectors, cloud telemetry, documentation search):
|
|
102
|
+
- Standardize on vendor-neutral **Model Context Protocol (MCP)** specifications.
|
|
103
|
+
- Declare local or containerized MCP tool servers in `.agents/mcp_config.json`.
|
|
104
|
+
- Treat MCP tools as secondary adapter driving ports, keeping domain logic decoupled from proprietary platform APIs.
|
|
105
|
+
|
|
106
|
+
### Explicit Prohibition: The "Library-as-a-Skill" Anti-Pattern
|
|
107
|
+
Never author or dynamically generate skills for commodity open-source packages or libraries (e.g. `react`, `tanstack`, `shadcn`, `zustand`, `testing-library`, `vitest`):
|
|
108
|
+
- **Prompt Bloat & Re-Explanation Tax:** Skill descriptions are continuously loaded into the agent's `<skills>` context. Proliferating skills for every library in a stack floods the prompt with thousands of redundant tokens and degrades model reasoning.
|
|
109
|
+
- **Parametric Redundancy:** Frontier LLMs already possess extensive parametric knowledge of open-source library APIs. Re-explaining basic imports and function signatures in a skill wastes context and creates documentation rot.
|
|
110
|
+
- **Trigger Collision & Agent Paralysis:** When a prompt touches UI, form validation, and data fetching, having 5 library skills triggers semantic collision, causing the agent to waste execution turns resolving which sub-skill to run.
|
|
111
|
+
- **The 4-Layer Resolution Standard:** Always resolve library stack knowledge through the **4-Layer Resolution Model**:
|
|
112
|
+
1. *Layer 1 (Manifest Ground Truth):* Read `package.json`, `components.json`, or `tsconfig.json`.
|
|
113
|
+
2. *Layer 2 (Stack Contract in `AGENTS.md`):* 3–5 line declaration in project entrypoint stamped by `/lets-build`.
|
|
114
|
+
3. *Layer 3 (Universal Domain Rules):* Enforce architectural invariants (`frontend_architecture.md`, `test_driven_development.md`) rather than library syntax.
|
|
115
|
+
4. *Layer 4 (Tool & CLI Execution):* Direct execution of official CLIs (`npx shadcn@latest add ...`) or local component inspection.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 5. The Architectural Atomicity Mandate for Rules & Skills
|
|
120
|
+
|
|
121
|
+
Every rule, skill, workflow, and configuration component must adhere to the **Single Responsibility Principle (SRP)**: indivisible, self-contained, orthogonal, and composable.
|
|
122
|
+
|
|
123
|
+
### Rule Atomicity
|
|
124
|
+
- **One Domain Per Rule:** Each rule file in `docs/rules/` must govern exactly one architectural or engineering subdomain.
|
|
125
|
+
- **Completeness Without Stubs:** A rule must never be a shallow stub or placeholder; it must codify production-grade invariants, anti-patterns, and concrete code patterns.
|
|
126
|
+
- **Zero Cross-Leakage:** Rules must be mutually orthogonal—never duplicate or contradict directives across files.
|
|
127
|
+
|
|
128
|
+
### Skill Atomicity
|
|
129
|
+
- **One Capability Per Skill:** Each skill in `.agents/skills/` must encapsulate one discrete, multi-step workflow.
|
|
130
|
+
- **Bounded Negative Triggers:** Must define both what it does (`Use when...`) and explicitly what it does not do (`Do not use for...`).
|
|
131
|
+
- **Encapsulated Artifacts:** Scripts, assets, and reference docs must live within the skill's isolated directory tree.
|
|
132
|
+
- **Idempotent Execution:** Re-executing a skill against the same inputs must produce identical, deterministic results.
|
|
133
|
+
|
|
134
|
+
### Many-to-Many Skill Composability Models
|
|
135
|
+
Coding tasks and agentic skills exhibit an explicit **Many-to-Many ($M:N$) Relationship**:
|
|
136
|
+
1. **Multiple Skills per Coding Task:** Implementing a complex domain feature frequently requires composing several orthogonal skills:
|
|
137
|
+
- `relentless-questioner` (resolves ambiguous invariants and failure edge cases).
|
|
138
|
+
- `product-analyst` (decomposes into INVEST user stories and executable Gherkin criteria).
|
|
139
|
+
- `compliance-audit` (verifies OWASP, SOC 2, and data isolation controls).
|
|
140
|
+
- `clean-code-refactor` (applies GoF patterns, CQS, SLAP, and eliminates code smells during the TDD inner loop).
|
|
141
|
+
2. **Single Skill in Multiple Scenarios:** An atomic skill functions as a reusable capability across completely different business problems (e.g. `clean-code-refactor` applies equally to financial ledgers, order lifecycle state machines, and authentication middleware).
|
|
142
|
+
|
|
143
|
+
#### The 3 Composition Patterns:
|
|
144
|
+
- **Pattern 1: Sequential Pipeline Chaining (Workflow Composition):** Skill $A$ produces a structured artifact (e.g. Feature Alignment Spec) that serves as the direct input contract for Skill $B$ (e.g. Gherkin test suite generation).
|
|
145
|
+
- **Pattern 2: Dynamic Skill Stacking (Contextual Composition):** An agent activates multiple orthogonal skills simultaneously in its execution context, adhering to Progressive Disclosure without polluting global prompts.
|
|
146
|
+
- **Pattern 3: Multi-Agent Subagent Delegation (Division of Labor):** A coordinator agent delegates isolated sub-tasks to specialized subagents equipped with specific skills, synthesizing their outputs into a single atomic change.
|
|
147
|
+
|
|
148
|
+
#### Invariants for Valid Skill Composition:
|
|
149
|
+
- **Standardized Output Contracts:** Skills must emit predictable, structured markdown or JSON envelopes (e.g. FAS, Gherkin blocks, ADR templates).
|
|
150
|
+
- **Zero Cross-Contamination:** No skill may write code or modify files outside its declared functional boundary.
|
|
151
|
+
- **Pure Function Semantics:** Analysis skills must remain read-only and side-effect free.
|
|
152
|
+
|
|
153
|
+
## 6. The Mandatory YAGNI Gate Triad (Rules & Skills)
|
|
154
|
+
|
|
155
|
+
LLM coding agents have a natural statistical bias toward **Instruction Creep** and **Eager Pattern Application**: when provided with a rule explaining an advanced pattern, agents reflexively apply it everywhere, causing severe architectural bloat.
|
|
156
|
+
|
|
157
|
+
To prevent premature abstraction, every architectural pattern rule and skill must enforce the **YAGNI Gate Triad**:
|
|
158
|
+
|
|
159
|
+
1. **The Simple Baseline (Day 1 Default):**
|
|
160
|
+
- The zero-overhead, default implementation that solves the immediate requirement without indirection (e.g. single database model before CQRS, relational indexes before Redis, standard React components before Server-Driven UI).
|
|
161
|
+
2. **The Anti-Triggers (Strictly Forbidden Scenarios):**
|
|
162
|
+
- Explicit, negative conditions where applying the pattern or skill is forbidden as premature over-engineering (e.g. no caching for low-throughput queries, no state machines for 2-state boolean flags, no skills for routine typo fixes).
|
|
163
|
+
3. **The Empirical Tipping Point (Graduation Threshold):**
|
|
164
|
+
- Measurable, verified criteria that MUST be breached before graduating to the pattern (e.g. p99 latency > 200ms after indexing, 3+ non-linear lifecycle states with transition guards, untrusted third-party user scripts).
|
|
165
|
+
|
|
166
|
+
### Foundational Leverage vs. Speculative Over-Engineering
|
|
167
|
+
A common misunderstanding is that YAGNI forbids using external libraries. **This is completely false**:
|
|
168
|
+
- **YAGNI Attacks:** Speculative custom code, home-grown frameworks, custom wheel reinvention, and premature multi-tier distributed architectures.
|
|
169
|
+
- **YAGNI Mandates:** Adopting battle-tested, open-source building blocks (`shadcn/ui`, `Tailwind CSS`, `Zod`, `TanStack Query`, `Lombok`) to solve concrete, present requirements with the minimum amount of custom code (preventing Not-Invented-Here / NIH syndrome).
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 7. The Relentless Skill Architecture Inquiry
|
|
174
|
+
|
|
175
|
+
Never architect or modify a skill based on assumptions. Before authoring any `SKILL.md`, run the **7 Core Skill Inquiry Branches**:
|
|
176
|
+
|
|
177
|
+
```mermaid
|
|
178
|
+
flowchart TD
|
|
179
|
+
Req["New Skill / Rule Request"] --> B1["Branch 1: Placement<br/>AGENTS.md, Rule, or Skill?"]
|
|
180
|
+
B1 --> B2["Branch 2: Trigger Boundaries<br/>Exact 'Use when...' & 'Do NOT use for...'?"]
|
|
181
|
+
B2 --> B3["Branch 3: Domain Ground Truth<br/>Generic textbook tutorials purged?"]
|
|
182
|
+
B3 --> B4["Branch 4: Gotchas & Anti-Patterns<br/>What AI mistakes MUST be forbidden?"]
|
|
183
|
+
B4 --> B5["Branch 5: Determinism vs LLM<br/>Deterministic steps scripted in scripts/?"]
|
|
184
|
+
B5 --> B6["Branch 6: Progressive Bloat<br/>SKILL.md < 500 lines with sub-docs in references/?"]
|
|
185
|
+
B6 --> B7["Branch 7: Verification Loop<br/>Output templates & self-checklists present?"]
|
|
186
|
+
B7 --> Ready["Ready to Author / Update Skill"]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### The 7 Core Inquiry Branches
|
|
190
|
+
|
|
191
|
+
| # | Inquiry Branch | What to Interrogate | If Unanswered |
|
|
192
|
+
|---|---|---|---|
|
|
193
|
+
| **1** | **Placement & Scope** | Does this apply to all prompts (Root `AGENTS.md`), one package (Nested `AGENTS.md`), a continuous coding domain (`docs/rules/`), or an on-demand task (`.agents/skills/`)? | Stop and categorize correctly. Never bloat root configs. |
|
|
194
|
+
| **2** | **Trigger Intent** | What explicit user intent wakes this skill? What are the negative conditions? | Interrogate the user on exact workflow boundaries. |
|
|
195
|
+
| **3** | **Domain Truth** | Is this grounded in this project's architecture, or generic fluff the LLM already knows? | Purge generic definitions (e.g. "What is a PDF/REST API"). |
|
|
196
|
+
| **4** | **Gotchas & Anti-Patterns** | What exact mistakes has the AI repeatedly made in this task? | Formulate 3–5 explicit negative "DO NOT" rules. |
|
|
197
|
+
| **5** | **Determinism** | Are there brittle CLI sequences that need a bash/Node script instead of stochastic LLM generation? | Create helper scripts in `scripts/`. |
|
|
198
|
+
| **6** | **Progressive Bloat** | Does `SKILL.md` exceed 500 lines? | Extract sub-topic guides into `references/`. |
|
|
199
|
+
| **7** | **Verification Loop** | How will the agent and user prove the skill succeeded? | Provide structured response templates & validation checklists. |
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 8. The Continuous Refinement Loop
|
|
204
|
+
|
|
205
|
+
When an AI produces suboptimal code or documentation:
|
|
206
|
+
1. Preserve the original AI output draft.
|
|
207
|
+
2. Make manual corrections to produce the desired gold-standard output.
|
|
208
|
+
3. Diff the original draft against the corrected version to identify specific gaps.
|
|
209
|
+
4. Update the relevant skill's "What NOT to do" or guideline section to prevent repeating that mistake.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 9. Workspace Sovereignty & Zero Global Interference
|
|
214
|
+
|
|
215
|
+
Enforce strict workspace containment within the workspace root (`./`):
|
|
216
|
+
- **Ground Truth Boundary**: Only files, dependencies, configuration files (`package.json`, `tsconfig.json`, `docker-compose.yml`), and verified command executions within the local workspace (`./`) constitute project truth.
|
|
217
|
+
- **Zero Global Contamination**: Never import, execute, or assume tools, environment variables, or conventions from global system directories (e.g. `~/.config`, `/tmp`, `~/.gemini/antigravity-cli`, or parent directories) unless explicitly defined within local workspace configuration.
|
|
218
|
+
- **Sibling Project Isolation**: Strictly ignore external or legacy projects. Do not read from or write to directories outside the local repository (`./`).
|
|
219
|
+
- **Subagent Context Sandboxing**: When spawning subagents or executing commands, ensure working directories are anchored strictly to `./`.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 10. Continuous Learning & The Direct Rule Ingestion Loop
|
|
224
|
+
|
|
225
|
+
Whenever an error, test failure, build friction, or architectural anti-pattern occurs during development, immediately execute the 4-step loop:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
1. Capture Defect ──► 2. Root Cause Analysis ──► 3. Synthesize Invariant ──► 4. Update Rule / Skill
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
1. **Capture Defect**: Record the failure symptoms, stack trace, and failing test case.
|
|
232
|
+
2. **Root Cause Analysis**: Identify the fundamental architectural or operational gap (not just the surface symptom).
|
|
233
|
+
3. **Synthesize Invariant**: Formulate a concrete, positive architectural invariant and code example showing the correct implementation.
|
|
234
|
+
4. **Update Rule / Skill**:
|
|
235
|
+
- Update the governing domain rule in `docs/rules/<domain>.md` or specialized skill in `.agents/skills/` directly.
|
|
236
|
+
- If the lesson introduces an architectural trade-off or paradigm shift, record a lightweight ADR in [`memory.md`](../../memory.md).
|
|
237
|
+
- Run verification (`npm test && npm run validate`) to ensure 100% integrity.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 11. Architectural Decision Records (ADR) Standards
|
|
242
|
+
|
|
243
|
+
Significant architectural, technical stack, or invariant decisions must be captured in [`memory.md`](../../memory.md):
|
|
244
|
+
|
|
245
|
+
### Required ADR Envelope:
|
|
246
|
+
```markdown
|
|
247
|
+
#### ADR-XXX: <Imperative Action-Oriented Title>
|
|
248
|
+
- **Date:** YYYY-MM-DD | **Status:** PROPOSED | ACCEPTED | SUPERSEDED | DEPRECATED
|
|
249
|
+
- **Context:** The specific operational or technical problem, constraint, or trade-off requiring a decision.
|
|
250
|
+
- **Decision:** Concrete, unambiguous architecture choice and positive invariants.
|
|
251
|
+
- **Consequences:** Direct benefits and deliberate operational trade-offs accepted.
|
|
252
|
+
- **Enforced In:** Links to specific rule files in `docs/rules/` or code paths.
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Numbering & Immutability:
|
|
256
|
+
- ADR numbers are monotonically increasing (`ADR-001`, `ADR-002`, ...).
|
|
257
|
+
- ADR entries are **immutable history**. Never edit past accepted ADRs to represent new decisions; author a new ADR that explicitly supersedes the former.
|
|
258
|
+
- **Fresh Project Baseline (ADR Clean Slate):** When starting or bootstrapping a new project from this starter template, the memory ledger in [`memory.md`](../../memory.md) must be a clean slate with zero prior decisions recorded. The initial technical foundation derived during `/lets-build` must always be recorded as **`ADR-001`**. Template development history from `azcodr` must never bleed into downstream project memory ledgers.
|
|
259
|
+
|