Skip to content

Commit b4eb09f

Browse files
committed
Strengthen vertical-slice and quality rules
1 parent 2a5d34a commit b4eb09f

File tree

3 files changed

+46
-12
lines changed

3 files changed

+46
-12
lines changed

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ The goal of MCAF:
2525
MCAF has three core elements:
2626

2727
- **Context** — code, docs, `AGENTS.md`, and skills live with the repo.
28-
- **Verification** — tests and analyzers are the decision makers, not opinions.
29-
- **Instructions** — root and local `AGENTS.md` files define how agents work here.
28+
- **Verification**integration tests and quality gates are the decision makers, not opinions.
29+
- **Instructions** — root and local `AGENTS.md` files define how agents work here and learn over time.
3030

3131
These concepts define the framework (the "what" and "why").
3232
`TUTORIAL.md` is the bootstrap procedure (the "how").
@@ -113,15 +113,18 @@ The public skill catalog lives on the Skills page:
113113

114114
Platform-specific bundles can stay small and still be explicit.
115115
`.NET` skills are maintained outside this repository in the [Managed Code Skills catalog](https://skills.managed-code.com/).
116-
Install the `.NET` skills you need from that catalog, then document the exact `dotnet build`, `dotnet test`, `dotnet format`, `analyze`, and coverage commands in the consuming repo’s `AGENTS.md`.
117-
For `.NET` code changes, the task is not done when tests are green if the repo also configured formatters, analyzers, coverage, architecture tests, or security gates.
116+
Install the `.NET` skills you need from that catalog, then document the exact `dotnet build`, `dotnet test`, `dotnet format`, `analyze`, `complexity`, coverage, and other quality-gate commands in the consuming repo’s `AGENTS.md`.
117+
For `.NET` code changes, the task is not done when tests are green if the repo also configured formatters, analyzers, complexity checks, coverage, architecture tests, or security gates.
118118
Agents should run the repo-defined post-change quality pass before completion, and any external `.NET` helper should still include a `Bootstrap When Missing` section so agents can detect, install, verify, and first-run the tool without guessing.
119119

120120
### 2.5 Context Rules
121121

122122
- All durable engineering context lives in the repository.
123123
- The project has a current `docs/Architecture.md`.
124124
- Humans and agents start from the architecture map, not repo-wide scanning.
125+
- Vertical-slice architecture is mandatory by default.
126+
- Each feature lives in its own folder tree with the code, tests, contracts, docs, and other dependencies needed for that slice.
127+
- Feature slices stay as isolated as possible so task context stays narrow and the right files are easy to find.
125128
- `docs/Architecture.md` contains Mermaid diagrams for system/module boundaries, interfaces/contracts, and key types for the active area.
126129
- Feature docs under `docs/Features/` contain at least one Mermaid diagram for the main flow.
127130
- ADRs under `docs/ADR/` contain at least one Mermaid diagram for the decision and affected boundaries.
@@ -145,19 +148,23 @@ MCAF expects layered verification:
145148
The goal is not “one test per feature.”
146149
The goal is enough automated evidence to trust the change.
147150

151+
Integration tests are the backbone because they prove that a slice works through real boundaries, not just isolated units.
152+
148153
### 3.2 Verification Rules
149154

150155
- Prefer TDD for new behaviour and bug fixes: start with a failing test, make it pass, then refactor.
151156
- New or changed behaviour is proven by new or updated automated tests.
152157
- Tests prove user-visible or caller-visible flows, not just isolated implementation detail.
153158
- Tests cover positive, negative, edge, and unexpected flows when the behaviour can fail in different ways.
154159
- Integration/API/UI coverage is preferred when the behaviour crosses boundaries.
160+
- Integration tests are the default primary proof for behaviour that spans more than one component inside a feature slice.
155161
- Internal and external systems are exercised through real containers, test instances, or sandbox environments in primary suites.
156162
- Mocks, fakes, stubs, and service doubles are forbidden in verification flows.
157163
- Changed production code should reach at least 80% line coverage and 70% branch coverage where supported; critical flows and public contracts should reach 90% line coverage.
158164
- Coverage must not regress below the pre-change baseline without an explicit exception, and coverage numbers do not replace scenario coverage.
159165
- Static analysis is part of done, not a cleanup task.
160166
- Failing tests or analyzers block completion.
167+
- Run every repo-defined quality gate that is available for the stack and change scope: formatters, linters, analyzers, complexity checks, architecture tests, security scans, mutation checks, coverage, and any other configured verification tools.
161168
- The task is not done until the full relevant test suite is green, not only the newly added or changed tests.
162169

163170
### 3.3 Verification Artifacts
@@ -210,13 +217,14 @@ Agents follow this order:
210217

211218
Root `AGENTS.md` stays current with:
212219

213-
- commands (`build`, `test`, `format`, `analyze`, `coverage` if used)
220+
- commands (`build`, `test`, `format`, `analyze`, `complexity`, `coverage`, and other quality gates if used)
214221
- global skills and when to use them
215222
- self-learning rules
216223
- non-trivial task workflow rules, including root-level `<slug>.brainstorm.md` and `<slug>.plan.md` usage
217224
- testing discipline
218225
- done criteria for tests, coverage, and quality gates
219226
- design and maintainability rules
227+
- vertical-slice architecture rules and allowed exceptions
220228
- exception policy
221229
- topology for local `AGENTS.md` files
222230

@@ -254,13 +262,18 @@ Stable corrections, preferences, and recurring mistakes should become:
254262
- skill updates
255263

256264
If the same mistake happens twice, the framework expects the rule to be made durable.
265+
Self-learning is a cornerstone of the framework, not an optional habit.
257266

258267
### 4.6 Hard Rules for Instructions
259268

260269
- Every MCAF repo has a root `AGENTS.md`.
261270
- Multi-project solutions use local `AGENTS.md` files at project roots.
262271
- Agents read root and local `AGENTS.md` before editing code.
263-
- Non-trivial tasks start with a root-level `<slug>.brainstorm.md`, then move into a root-level `<slug>.plan.md`.
272+
- Vertical-slice architecture is mandatory unless an ADR or local exception rule says otherwise.
273+
- Each feature must live in its own isolated folder tree with its local code, tests, and supporting artifacts kept together.
274+
- Agents must prefer the smallest relevant feature slice over repo-wide scanning.
275+
- Only non-trivial tasks start with a root-level `<slug>.brainstorm.md`, then move into a root-level `<slug>.plan.md`.
276+
- Simple, short, or obvious tasks should skip the brainstorm and go straight to execution.
264277
- Brainstorms capture thinking, options, trade-offs, and the chosen direction before implementation starts.
265278
- Plans include ordered implementation steps, explicit test steps, testing methodology, and final validation commands.
266279
- Skills are preferred over improvised workflow when a skill matches the task.
@@ -274,6 +287,8 @@ MCAF coding rules exist to keep systems changeable and testable.
274287

275288
- SOLID is mandatory.
276289
- SRP and cohesion are mandatory.
290+
- Vertical-slice architecture is mandatory at feature level.
291+
- Organize code so each feature owns its folder, subfolders, tests, and nearby dependencies as an isolated slice.
277292
- Prefer composition over inheritance unless inheritance is explicitly justified.
278293
- Boundaries must support realistic tests through public interfaces.
279294
- Hidden global state and side effects are design smells.
@@ -362,6 +377,7 @@ The brainstorm records:
362377
- the recommended direction that will become the plan
363378

364379
Brainstorm first, think through the task, then convert the chosen direction into a working plan.
380+
Do not create a brainstorm for simple, short, or obvious work where the path is already clear.
365381

366382
### 7.3 Plan
367383

@@ -397,7 +413,8 @@ Run verification in layers:
397413
2. related suite
398414
3. broader required regressions and the full relevant suite
399415
4. analyzers, formatters, and any configured architecture, security, mutation, or other quality gates
400-
5. coverage comparison against the pre-change baseline
416+
5. complexity checks and any other configured code-quality tools
417+
6. coverage comparison against the pre-change baseline
401418

402419
### 7.6 Update Durable Context and Close the Task
403420

@@ -444,5 +461,7 @@ Adoption is complete when:
444461
- multi-project boundaries have local `AGENTS.md`
445462
- commands and docs reflect the real repo
446463
- non-trivial work is guided by root-level `<slug>.brainstorm.md`, `<slug>.plan.md`, and the Ralph Loop
464+
- simple work skips brainstorm overhead and goes straight to execution
465+
- vertical-slice architecture, integration tests, and self-learning are treated as core framework pillars
447466
- tool-specific skills document real bootstrap and install steps when the tool is missing
448467
- tests and analyzers are the real gates

TUTORIAL.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ For `.NET` repositories, keep these repo-native artifacts explicit in `AGENTS.md
114114
- `Directory.Build.props` or project files for bulk analyzer and runner settings
115115
- target `TFM` and explicit `LangVersion` only when the repo intentionally differs from the SDK default
116116
- whether the solution uses `VSTest` or `Microsoft.Testing.Platform`
117-
- the non-trivial task flow: `<slug>.brainstorm.md` first, then `<slug>.plan.md`, then implementation and validation
117+
- the decision rule for `brainstorm`: use `<slug>.brainstorm.md` only for non-trivial tasks, then `<slug>.plan.md`, then implementation and validation
118+
- vertical-slice architecture rules so each feature stays in its own isolated folder tree
119+
- self-learning rules so repeated corrections become durable repo guidance
118120

119121
The intended `.NET` flow stays the same even though the bundle is external:
120122

121123
- install the required skills from the external catalog
122124
- use the skills that fit the repo workflow and test framework
123-
- after code changes, run the repo-defined quality pass: format, build, analyze, tests, coverage, and any configured extra gates
125+
- after code changes, run the repo-defined quality pass: format, build, analyze, tests, complexity, coverage, and any configured extra gates
124126

125127
### 4.1 Current Skill Catalog (Generated)
126128

@@ -236,6 +238,8 @@ Use a prompt like this:
236238
Analyze this solution and customize the root AGENTS.md.
237239
If this is a multi-project solution, create project-local AGENTS.md files in each project root.
238240
Then identify which MCAF skills apply to each project and document them in the local AGENTS files.
239-
For non-trivial tasks, require a root-level <slug>.brainstorm.md before <slug>.plan.md.
241+
For non-trivial tasks, require a root-level <slug>.brainstorm.md before <slug>.plan.md, but skip brainstorm for simple or obvious tasks.
242+
Make vertical-slice architecture mandatory so each feature stays in its own isolated folder tree with nearby tests and dependencies.
243+
Treat integration tests, self-learning, and full quality-gate execution as non-negotiable repo rules.
240244
Finally, update docs/Architecture.md so agents can scope work without repo-wide scanning.
241245
```

docs/templates/AGENTS.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ If the stack is `.NET`, document skill-management rules explicitly:
112112
- Keep exactly one framework skill: `mcaf-dotnet-xunit` or `mcaf-dotnet-tunit` or `mcaf-dotnet-mstest`.
113113
- Add tool-specific `.NET` skills only when the repository actually uses those tools in CI or local verification.
114114
- Keep only `mcaf-*` skills in agent skill directories.
115-
- When upgrading skills, recheck `build`, `test`, `format`, `analyze`, and `coverage` commands against the repo toolchain.
115+
- When upgrading skills, recheck `build`, `test`, `format`, `analyze`, `complexity`, and `coverage` commands against the repo toolchain.
116116

117117
## Rules to Follow (Mandatory)
118118

@@ -122,6 +122,7 @@ If the stack is `.NET`, document skill-management rules explicitly:
122122
- `test`: `...`
123123
- `format`: `...`
124124
- `analyze`: `...` (delete if not used)
125+
- `complexity`: `...` (delete if not used)
125126
- `coverage`: `...` (delete if not used)
126127

127128
If the stack is `.NET`, also document:
@@ -160,6 +161,9 @@ Local `AGENTS.md` files may tighten these values, but they must not loosen them
160161
- Start from `docs/Architecture.md` and the nearest local `AGENTS.md`.
161162
- Treat `docs/Architecture.md` as the architecture map for every non-trivial task.
162163
- If the overview is missing, stale, or diagram-free, update it before implementation.
164+
- Use vertical slices as the default architecture rule.
165+
- Keep each feature in its own folder tree with its code, tests, contracts, docs, and supporting artifacts together.
166+
- Prefer the smallest relevant feature slice over repo-wide scanning so context stays narrow.
163167
- Define scope before coding:
164168
- in scope
165169
- out of scope
@@ -169,7 +173,9 @@ Local `AGENTS.md` files may tighten these values, but they must not loosen them
169173
- current state
170174
- required change
171175
- constraints and risks
176+
- Before starting a brainstorm, decide whether the task is actually non-trivial.
172177
- For non-trivial work, create a root-level `<slug>.brainstorm.md` file before making code or doc changes.
178+
- For simple, short, or obvious work, skip the brainstorm and go directly to execution.
173179
- Use `<slug>.brainstorm.md` to capture the problem framing, options, trade-offs, risks, open questions, and the recommended direction.
174180
- Think through the task in the brainstorm before committing to implementation details.
175181
- After the brainstorm direction is chosen, create a root-level `<slug>.plan.md` file.
@@ -208,6 +214,7 @@ Local `AGENTS.md` files may tighten these values, but they must not loosen them
208214
- broader required regressions
209215
- If `build` is separate from `test`, run `build` before `test`.
210216
- After tests pass, run `format`, then the final required verification commands.
217+
- Run every repo-defined quality gate that is available for the stack and change scope, including analyzers, linters, complexity checks, coverage, architecture checks, security checks, and any other configured tools.
211218
- The task is complete only when every planned checklist item is done and all relevant tests are green.
212219
- Summarize the change, risks, and verification before marking the task complete.
213220

@@ -242,6 +249,7 @@ Local `AGENTS.md` files may tighten these values, but they must not loosen them
242249
- Tests should be as realistic as possible and exercise the system through real flows, contracts, and dependencies.
243250
- Tests must cover positive flows, negative flows, edge cases, and unexpected paths from multiple relevant angles when the behaviour can fail in different ways.
244251
- Prefer integration/API/UI tests over isolated unit tests when behaviour crosses boundaries.
252+
- Integration tests are the default primary proof for feature-slice behaviour that spans multiple components.
245253
- Do not use mocks, fakes, stubs, or service doubles in verification.
246254
- Exercise internal and external dependencies through real containers, test instances, or sandbox environments that match the real contract.
247255
- Flaky tests are failures. Fix the cause.
@@ -251,14 +259,16 @@ Local `AGENTS.md` files may tighten these values, but they must not loosen them
251259
- Coverage is for finding gaps, not gaming a number. Coverage numbers do not replace scenario coverage or user-flow verification.
252260
- The task is not done until the full relevant test suite is green, not only the newly added tests.
253261
- If the stack is `.NET`, document the active framework and runner model explicitly so agents do not mix VSTest and Microsoft.Testing.Platform assumptions.
254-
- If the stack is `.NET`, after changing production code run the repo-defined quality pass: format, build, analyze, focused tests, broader tests, coverage, and any configured extra gates such as architecture, security, or mutation checks.
262+
- If the stack is `.NET`, after changing production code run the repo-defined quality pass: format, build, analyze, focused tests, broader tests, complexity, coverage, and any configured extra gates such as architecture, security, or mutation checks.
255263

256264
### Code and Design
257265

258266
- Everything in this solution MUST follow SOLID principles by default.
259267
- Every class, object, module, and service MUST have a clear single responsibility and explicit boundaries.
260268
- SOLID is mandatory.
261269
- SRP and strong cohesion are mandatory for files, types, and functions.
270+
- Vertical-slice architecture is mandatory unless a local rule or ADR documents an exception.
271+
- Each feature MUST live in its own isolated folder tree with all slice-local dependencies kept together.
262272
- Prefer composition over inheritance unless inheritance is explicitly justified.
263273
- Large files, types, functions, and deep nesting are design smells. Split them or document a justified exception under `exception_policy`.
264274
- Hardcoded values are forbidden.
@@ -274,6 +284,7 @@ Local `AGENTS.md` files may tighten these values, but they must not loosen them
274284
- Never weaken a test or analyzer without explicit justification.
275285
- Never introduce mocks, fakes, stubs, or service doubles to hide real behaviour in tests or local flows.
276286
- Never introduce a non-SOLID design unless the exception is explicitly documented under `exception_policy`.
287+
- Never spread one feature across unrelated folders when a vertical slice can keep it isolated.
277288
- Never force-push to `main`.
278289
- Never approve or merge on behalf of a human maintainer.
279290

0 commit comments

Comments
 (0)