@gempack/squad-mcp 0.6.4 → 0.7.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +6 -3
- package/CHANGELOG.md +37 -0
- package/INSTALL.md +15 -0
- package/README.md +32 -0
- package/agents/product-owner.md +9 -0
- package/agents/senior-architect.md +12 -0
- package/agents/senior-dba.md +15 -1
- package/agents/senior-dev-reviewer.md +100 -29
- package/agents/senior-dev-security.md +13 -0
- package/agents/senior-developer.md +15 -0
- package/agents/senior-qa.md +13 -0
- package/agents/tech-lead-consolidator.md +10 -0
- package/agents/tech-lead-planner.md +9 -0
- package/commands/squad-next.md +24 -0
- package/commands/squad-task.md +29 -0
- package/commands/squad-tasks.md +21 -0
- package/dist/config/ownership-matrix.js +4 -20
- package/dist/config/ownership-matrix.js.map +1 -1
- package/dist/config/squad-yaml.js +3 -7
- package/dist/config/squad-yaml.js.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/exec/git.d.ts +1 -1
- package/dist/exec/git.js +0 -0
- package/dist/exec/git.js.map +1 -1
- package/dist/format/pr-review.js +1 -3
- package/dist/format/pr-review.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/learning/format.js +1 -5
- package/dist/learning/format.js.map +1 -1
- package/dist/learning/store.js +89 -16
- package/dist/learning/store.js.map +1 -1
- package/dist/observability/logger.d.ts +2 -2
- package/dist/observability/logger.js +20 -20
- package/dist/observability/logger.js.map +1 -1
- package/dist/prompts/registry.js.map +1 -1
- package/dist/resources/agent-loader.js.map +1 -1
- package/dist/resources/registry.js +28 -28
- package/dist/tasks/select.js.map +1 -1
- package/dist/tasks/store.js +49 -11
- package/dist/tasks/store.js.map +1 -1
- package/dist/tools/_shared/schemas.d.ts +21 -0
- package/dist/tools/_shared/schemas.js +25 -0
- package/dist/tools/_shared/schemas.js.map +1 -0
- package/dist/tools/agents.d.ts +3 -3
- package/dist/tools/agents.js +9 -9
- package/dist/tools/agents.js.map +1 -1
- package/dist/tools/classify-work-type.d.ts +5 -5
- package/dist/tools/classify-work-type.js +0 -0
- package/dist/tools/classify-work-type.js.map +1 -1
- package/dist/tools/compose-advisory-bundle.js +4 -14
- package/dist/tools/compose-advisory-bundle.js.map +1 -1
- package/dist/tools/compose-prd-parse.js.map +1 -1
- package/dist/tools/compose-squad-workflow.js +0 -0
- package/dist/tools/compose-squad-workflow.js.map +1 -1
- package/dist/tools/consolidate.js +1 -3
- package/dist/tools/consolidate.js.map +1 -1
- package/dist/tools/detect-changed-files.d.ts +5 -6
- package/dist/tools/detect-changed-files.js +0 -0
- package/dist/tools/detect-changed-files.js.map +1 -1
- package/dist/tools/list-tasks.js +1 -8
- package/dist/tools/list-tasks.js.map +1 -1
- package/dist/tools/next-task.js +1 -8
- package/dist/tools/next-task.js.map +1 -1
- package/dist/tools/read-learnings.js +2 -4
- package/dist/tools/read-learnings.js.map +1 -1
- package/dist/tools/read-squad-config.js +1 -1
- package/dist/tools/read-squad-config.js.map +1 -1
- package/dist/tools/record-tasks.js.map +1 -1
- package/dist/tools/registry.js +2 -4
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/score-risk.d.ts +3 -3
- package/dist/tools/score-risk.js +15 -15
- package/dist/tools/score-rubric.js.map +1 -1
- package/dist/tools/select-squad.d.ts +5 -5
- package/dist/tools/select-squad.js +0 -0
- package/dist/tools/select-squad.js.map +1 -1
- package/dist/tools/slice-files-for-task.js.map +1 -1
- package/dist/tools/slice-files.d.ts +2 -2
- package/dist/tools/slice-files.js +0 -0
- package/dist/tools/slice-files.js.map +1 -1
- package/dist/tools/update-task-status.js +1 -8
- package/dist/tools/update-task-status.js.map +1 -1
- package/dist/tools/validate-plan-text.d.ts +3 -3
- package/dist/tools/validate-plan-text.js +0 -0
- package/dist/tools/validate-plan-text.js.map +1 -1
- package/dist/util/file-lock.d.ts +10 -0
- package/dist/util/file-lock.js +102 -0
- package/dist/util/file-lock.js.map +1 -0
- package/dist/util/override-allowlist.d.ts +4 -4
- package/dist/util/override-allowlist.js +36 -27
- package/dist/util/override-allowlist.js.map +1 -1
- package/dist/util/path-internal.js +10 -8
- package/dist/util/path-internal.js.map +1 -1
- package/dist/util/path-safety.d.ts +15 -0
- package/dist/util/path-safety.js +47 -13
- package/dist/util/path-safety.js.map +1 -1
- package/package.json +13 -2
- package/shared/Skill-Squad-Dev.md +38 -27
- package/shared/Skill-Squad-Review.md +49 -26
- package/shared/_Severity-and-Ownership.md +6 -6
- package/skills/brainstorm/SKILL.md +31 -20
- package/skills/commit-suggest/SKILL.md +32 -14
- package/tools/_tasks-io.mjs +25 -16
- package/tools/list-tasks.mjs +1 -4
- package/tools/next-task.mjs +4 -13
- package/tools/post-review.mjs +20 -30
- package/tools/record-learning.mjs +8 -11
- package/tools/record-tasks.mjs +2 -9
- package/tools/update-task-status.mjs +2 -9
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"repo": "ggemba/squad-mcp"
|
|
13
13
|
},
|
|
14
14
|
"description": "Squad-dev workflow: deterministic classification, risk scoring, agent selection, advisory orchestration over MCP, native subagents, plus /squad and /squad-review slash commands.",
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.7.0",
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
17
|
"homepage": "https://github.com/ggemba/squad-mcp"
|
|
18
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "squad",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Squad-dev workflow as a Claude Code plugin: classification, risk scoring, agent selection, advisory orchestration. Bundles an MCP server, native subagents, and the /squad and /squad-review slash commands.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -24,14 +24,17 @@
|
|
|
24
24
|
"commands": [
|
|
25
25
|
"./commands/squad.md",
|
|
26
26
|
"./commands/squad-review.md",
|
|
27
|
+
"./commands/squad-tasks.md",
|
|
28
|
+
"./commands/squad-next.md",
|
|
29
|
+
"./commands/squad-task.md",
|
|
27
30
|
"./commands/brainstorm.md",
|
|
28
31
|
"./commands/commit-suggest.md"
|
|
29
32
|
],
|
|
30
33
|
"skills": "./skills/",
|
|
31
34
|
"mcpServers": {
|
|
32
35
|
"squad": {
|
|
33
|
-
"command": "
|
|
34
|
-
"args": ["
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["-y", "@gempack/squad-mcp@0.7.0"]
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,43 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.0] - 2026-05-10
|
|
11
|
+
|
|
12
|
+
Six-phase response to the full-repo `/squad-review`. Verdict was REJECTED with 3 blockers + 20 majors; this release lands all of them.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **`safeString` Zod refine was checking space (0x20), not NUL byte (0x00).** Across 7 tool schemas + `validateArg` in `exec/git.ts`, the refine source had a literal NUL byte embedded that the TypeScript compiler normalises to a space on emit. Every published tarball since this rule landed has rejected every realistic prompt with `must not contain NUL byte`. Replaced with the escape sequence `"\0"` (4 characters) which survives the build. `compose_advisory_bundle` and friends are now usable.
|
|
17
|
+
- **Schema validation was bypassed by every unit test.** Tests called handlers directly instead of going through `dispatchTool`, which is how the bug above slipped through CI. Added round-trip `dispatchTool` tests so any future schema regression fails immediately.
|
|
18
|
+
- **Path traversal via `.squad.yaml`.** `learnings.path` and `tasks.path` were `path.resolve`d against `workspaceRoot` without a containment check — a `.squad.yaml` with `learnings.path: ../../etc/whatever` gave the host LLM an arbitrary-write primitive (CWE-22). New `ensureRelativeInsideRoot` rejects absolute paths and `..` escapes in both the TS store and the `tools/*.mjs` CLIs.
|
|
19
|
+
- **`validateCwd` rejected legitimate git worktrees.** Setting `GIT_CEILING_DIRECTORIES = path.dirname(realCwd)` blocked git from following the `.git` file pointer that worktrees use. Now detects `.git` as a file and skips the ceiling for that case.
|
|
20
|
+
- **JSONL bad line bricked the entire learning store.** `readLearnings` threw on the first malformed line, making every read of `.squad/learnings.jsonl` fail forever after a hand-edit or partial write. Bad lines are now quarantined to `<file>.corrupt-<ts>.jsonl` and reading continues with the valid prefix.
|
|
21
|
+
- **`tools/post-review.mjs` could truncate the PR body.** `proc.stdin.write(body)` did not await backpressure; large bodies on small pipe buffers were silently truncated (`gh` exits 0 with the prefix only). Now respects the `write` return value and waits for `drain` before `end`.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **`/squad-tasks`, `/squad-next`, `/squad-task` slash commands.** Referenced throughout `README` / `INSTALL` / the skill, but missing from `.claude-plugin/plugin.json` — users typing them got `command not found`. Now registered.
|
|
26
|
+
- **Cross-process file lock** (`src/util/file-lock.ts`). `O_EXCL`-based advisory lock with jittered backoff and stale-recovery after 30s. Wraps `recordTasks`, `updateTaskStatus`, `expandTask`, and `appendLearning` so multiple MCP server processes (e.g. two Claude clients open in the same repo) cannot race the read-modify-write cycle.
|
|
27
|
+
- **`.prev` snapshot for `tasks.json`.** Every successful write moves the prior generation to `<file>.prev` before the rename, so a future corruption has one recoverable backup.
|
|
28
|
+
- **JSONL entry truncation.** `appendLearning` truncates oversized `reason` / `finding` so the serialised line stays under `PIPE_BUF` (4096B) and `fs.appendFile` remains atomic w.r.t. concurrent appenders.
|
|
29
|
+
- **Centralised input schemas** (`src/tools/_shared/schemas.ts`). All tools that previously redeclared `safeString` now import `SafeString` from one place. The `*ToolDef` ↔ `*Tool` naming inconsistency across 23 tool files is acknowledged as follow-up.
|
|
30
|
+
- **Coverage threshold + smoke pipeline.** New `vitest.config.ts` with `lines>=80, statements>=80, functions>=75, branches>=70` thresholds on runtime modules. `tests/compose-prd-parse.test.ts` (was 202 LOC with zero tests). `tests/detect-changed-files.integration.test.ts` exercising real `git` against a tmpdir repo. `tests/smoke.mjs` wired into `ci.yml`. New post-publish smoke job in `release.yml` invokes `npx -y @gempack/squad-mcp@<TAG>` over stdio and asserts `tools/list`.
|
|
31
|
+
- **ESLint + Prettier.** `eslint.config.js` (flat config, ESLint 9 + typescript-eslint), `.prettierrc`, `.prettierignore`. Scripts: `lint` (`tsc --noEmit && eslint .`), `typecheck` (pure `tsc`), `format`, `format:check`, `test:coverage`, `smoke`.
|
|
32
|
+
- **README "Your first `/squad` in 60 seconds".** New post-install walkthrough with the expected scorecard shape and pointers to the other slash commands.
|
|
33
|
+
- **`INSTALL.md` troubleshooting entry** for `Failed to reconnect to plugin:squad:squad` pointing at v0.6.5+ and the `npx --version` diagnostic.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- `examples/client-config-{claude-desktop,cursor}.json` now pin `@0.7.0` instead of the floating tag.
|
|
38
|
+
- `release.yml` adds a second job `smoke` that runs after `publish` and validates the published tarball boots over stdio.
|
|
39
|
+
|
|
40
|
+
## [0.6.5] - 2026-05-10
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **Plugin MCP server now runs from npm, not from gitignored `dist/`.** v0.6.4 (and all earlier releases) shipped a plugin manifest pointing at `${CLAUDE_PLUGIN_ROOT}/dist/index.js`. Claude Code's plugin install does a shallow `git clone` and never runs `npm install` / `npm run build`, so `dist/` (gitignored) was missing on disk and the MCP server failed to start with `Failed to reconnect to plugin:squad:squad`. The plugin manifest now uses `command: "npx"` + `args: ["-y", "@gempack/squad-mcp@<version>"]`, pulling the pre-built tarball published with provenance. The plugin still ships agents/commands/skills directly (those are static markdown). Side benefit: plugin and npm install paths now share a single MCP runtime.
|
|
45
|
+
- **`release.yml` version-pin guard** now also verifies the npx pin in `mcpServers.squad.args` matches the git tag — any future bump that forgets this field fails publish.
|
|
46
|
+
|
|
10
47
|
## [0.6.4] - 2026-05-10
|
|
11
48
|
|
|
12
49
|
### Changed
|
package/INSTALL.md
CHANGED
|
@@ -563,6 +563,21 @@ Plugin-author issue (will not affect users on a published release). The `agents`
|
|
|
563
563
|
**Plugin installed but `/squad` does not appear.**
|
|
564
564
|
Restart Claude Code. The slash command registry is populated at startup. If still missing, run `/plugin list` and confirm `squad@gempack` is listed and enabled.
|
|
565
565
|
|
|
566
|
+
**`Failed to reconnect to plugin:squad:squad` after `/plugin install`.**
|
|
567
|
+
You're on a plugin release older than v0.6.5. Pre-0.6.5 manifests pointed the MCP runtime at `${CLAUDE_PLUGIN_ROOT}/dist/index.js`, but Claude Code's plugin install does only a `git clone` — it never runs `npm install` / `npm run build`, so `dist/` (which is gitignored) does not exist on disk and the server has nothing to run. Fix:
|
|
568
|
+
|
|
569
|
+
```text
|
|
570
|
+
/plugin update squad@gempack
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
If `update` says "already up to date" but the version is still pre-0.6.5, the marketplace cache is stale — use the `remove`+`add` cycle from the cache section above. Verify the published npm tarball is healthy from a terminal:
|
|
574
|
+
|
|
575
|
+
```bash
|
|
576
|
+
npx -y @gempack/squad-mcp --version
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
If that succeeds but the plugin still fails, wait 5 minutes for the GitHub raw CDN to invalidate and retry the install.
|
|
580
|
+
|
|
566
581
|
**MCP server shows as failed / disconnected.**
|
|
567
582
|
Check the host's MCP log:
|
|
568
583
|
|
package/README.md
CHANGED
|
@@ -71,6 +71,38 @@ npm run build
|
|
|
71
71
|
node dist/index.js
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
## Your first `/squad` in 60 seconds
|
|
75
|
+
|
|
76
|
+
After install, the plugin is silent until you invoke it. Drop into a repo with at least one staged or recently committed change and run:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/squad add a /health endpoint that returns {"status":"ok"}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
What happens, in order:
|
|
83
|
+
|
|
84
|
+
1. **Classification.** `compose_squad_workflow` looks at your prompt + changed files and prints something like `work_type: Feature, risk: Low, agents: [senior-developer, senior-qa]`.
|
|
85
|
+
2. **Plan.** The skill drafts an implementation plan and sends it to `tech-lead-planner` for review. You see the plan in chat.
|
|
86
|
+
3. **Gate 1.** The skill **stops** and asks you to approve. Reply `approved`, `go`, or equivalent to proceed; anything else cancels.
|
|
87
|
+
4. **Advisory squad.** After approval, every selected agent (architect, dba, dev, qa, security, reviewer — depends on the selection) reviews in **parallel** and emits a findings list + a `Score: NN/100`.
|
|
88
|
+
5. **Consolidation.** `tech-lead-consolidator` produces a verdict (`APPROVED` / `CHANGES_REQUIRED` / `REJECTED`) plus a scorecard like:
|
|
89
|
+
```
|
|
90
|
+
SQUAD RUBRIC — weighted 82 / 100 (threshold 75)
|
|
91
|
+
Application Code ████████████████░░░░ 82 ×18% senior-developer
|
|
92
|
+
Testing & QA ███████████████░░░░░ 78 ×14% senior-qa
|
|
93
|
+
```
|
|
94
|
+
6. **Implementation.** If approved, the skill writes code. **Never** commits or pushes — that's your call.
|
|
95
|
+
|
|
96
|
+
Other commands to try once `/squad` works:
|
|
97
|
+
|
|
98
|
+
- `/squad-review` — same agents, but on an existing diff or PR (no implementation).
|
|
99
|
+
- `/squad-tasks docs/prd.md` — decompose a PRD into atomic tasks with confirmation before they land in `.squad/tasks.json`.
|
|
100
|
+
- `/squad-next` — pick the next ready task; `/squad-task 3` — work on a specific one.
|
|
101
|
+
- `/brainstorm <topic>` — exploratory Q&A, no code.
|
|
102
|
+
- `/commit-suggest` — generate a Conventional Commits message for staged changes.
|
|
103
|
+
|
|
104
|
+
Stuck? Check `INSTALL.md` → Troubleshooting. The most common failures (`Failed to reconnect to plugin:squad:squad`, marketplace cache, SSH key) all have entries.
|
|
105
|
+
|
|
74
106
|
## What it provides
|
|
75
107
|
|
|
76
108
|
### Tools (deterministic, pure functions)
|
package/agents/product-owner.md
CHANGED
|
@@ -9,17 +9,21 @@ model: inherit
|
|
|
9
9
|
> Reference: [Severity and Ownership Matrix](_shared/_Severity-and-Ownership.md)
|
|
10
10
|
|
|
11
11
|
## Role
|
|
12
|
+
|
|
12
13
|
Business representative in technical review. Ensures every implementation delivers real value to the end user and aligns with product goals.
|
|
13
14
|
|
|
14
15
|
## Primary Focus
|
|
16
|
+
|
|
15
17
|
Confirm that what was built solves the correct business problem, in the expected way, with no functional gaps.
|
|
16
18
|
|
|
17
19
|
## Ownership
|
|
20
|
+
|
|
18
21
|
- Business value and requirements fit
|
|
19
22
|
- User experience (messages, flows, journey)
|
|
20
23
|
- Business rules (semantics, not technical implementation)
|
|
21
24
|
|
|
22
25
|
## Boundaries
|
|
26
|
+
|
|
23
27
|
- Do not comment on code quality, performance, or security
|
|
24
28
|
- Do not technically review API contracts (DTOs, status codes) — that is Senior-Developer
|
|
25
29
|
- If an API contract does not make semantic sense for the domain, report as a business gap
|
|
@@ -28,22 +32,26 @@ Confirm that what was built solves the correct business problem, in the expected
|
|
|
28
32
|
## Responsibilities
|
|
29
33
|
|
|
30
34
|
### Requirements Validation
|
|
35
|
+
|
|
31
36
|
- Verify the implementation fully meets acceptance criteria
|
|
32
37
|
- Identify gaps between what was asked and what was delivered
|
|
33
38
|
- Challenge uncovered usage scenarios (happy path and business edge cases)
|
|
34
39
|
- When no user story or explicit criteria exist, record as "context missing" and assess by observable behavior
|
|
35
40
|
|
|
36
41
|
### User Experience
|
|
42
|
+
|
|
37
43
|
- Evaluate error, success, and validation messages aimed at the end user
|
|
38
44
|
- Verify flows make sense from the user's point of view
|
|
39
45
|
- Identify unnecessary friction in the journey
|
|
40
46
|
- When the change has no user surface, record as "no direct UX impact"
|
|
41
47
|
|
|
42
48
|
### Product Impact
|
|
49
|
+
|
|
43
50
|
- Assess whether the change may break or degrade existing functionality
|
|
44
51
|
- Identify side effects on other business flows
|
|
45
52
|
|
|
46
53
|
### Business Rules
|
|
54
|
+
|
|
47
55
|
- Verify business rules are implemented correctly (semantics)
|
|
48
56
|
- Identify implicit rules that should be documented
|
|
49
57
|
- Validate limits, thresholds, and business parameters
|
|
@@ -84,6 +92,7 @@ Objective summary of the evaluation.
|
|
|
84
92
|
```
|
|
85
93
|
|
|
86
94
|
## Guidelines
|
|
95
|
+
|
|
87
96
|
- Focus strictly on value delivered to the business and to the user
|
|
88
97
|
- Be pragmatic: not every gap is a blocker, classify by severity
|
|
89
98
|
- Frame impact in business terms, not technical ones
|
|
@@ -9,12 +9,15 @@ model: inherit
|
|
|
9
9
|
> Reference: [Severity and Ownership Matrix](_shared/_Severity-and-Ownership.md)
|
|
10
10
|
|
|
11
11
|
## Role
|
|
12
|
+
|
|
12
13
|
Guardian of architectural integrity. Evaluates design decisions with a long-term lens and keeps the solution from eroding boundaries.
|
|
13
14
|
|
|
14
15
|
## Primary Focus
|
|
16
|
+
|
|
15
17
|
Prevent incremental architectural decay. Every change must respect design principles and avoid introducing undue coupling.
|
|
16
18
|
|
|
17
19
|
## Ownership
|
|
20
|
+
|
|
18
21
|
- Boundaries between modules and domains (bounded contexts)
|
|
19
22
|
- Coupling and dependency direction
|
|
20
23
|
- DI registrations and lifetimes
|
|
@@ -22,6 +25,7 @@ Prevent incremental architectural decay. Every change must respect design princi
|
|
|
22
25
|
- Architectural patterns (not code-level patterns)
|
|
23
26
|
|
|
24
27
|
## Boundaries
|
|
28
|
+
|
|
25
29
|
- Do not review naming or code smells (Senior-Dev-Reviewer)
|
|
26
30
|
- Do not review retry/timeout/circuit-breaker implementation (Senior-Developer)
|
|
27
31
|
- Do not review data-cache strategy and invalidation (Senior-DBA)
|
|
@@ -30,12 +34,14 @@ Prevent incremental architectural decay. Every change must respect design princi
|
|
|
30
34
|
## Responsibilities
|
|
31
35
|
|
|
32
36
|
### Architectural Integrity
|
|
37
|
+
|
|
33
38
|
- Validate adherence to defined architecture (layers, boundaries, responsibilities)
|
|
34
39
|
- Check SOLID conformance, especially SRP and DIP
|
|
35
40
|
- Identify bounded-context violations and domain leakage
|
|
36
41
|
- Assess whether existing abstractions are being used correctly
|
|
37
42
|
|
|
38
43
|
### Architecture Conformance Audit
|
|
44
|
+
|
|
39
45
|
For every change, explicitly evaluate:
|
|
40
46
|
|
|
41
47
|
1. **Conformance with the existing architecture**: does this change follow the patterns already established in the repository (folder layout, layer separation, dependency direction, naming, transport)? If it diverges, justify or call it out.
|
|
@@ -46,28 +52,33 @@ For every change, explicitly evaluate:
|
|
|
46
52
|
Record the audit outcome in the `Architectural Conformance` table even when everything is healthy, so the verdict is auditable.
|
|
47
53
|
|
|
48
54
|
### Coupling and Cohesion
|
|
55
|
+
|
|
49
56
|
- Detect undue coupling between modules / projects
|
|
50
57
|
- Identify circular dependencies or fragile dependency chains
|
|
51
58
|
- Verify the change respects the dependency rule
|
|
52
59
|
- Confirm shared components sit in the right place
|
|
53
60
|
|
|
54
61
|
### Scalability
|
|
62
|
+
|
|
55
63
|
- Assess whether the solution scales for the expected volume
|
|
56
64
|
- Identify architectural bottlenecks
|
|
57
65
|
- Verify extensibility without modification (open/closed)
|
|
58
66
|
|
|
59
67
|
### DI and Lifetimes
|
|
68
|
+
|
|
60
69
|
- Validate service lifetimes (Singleton, Scoped, Transient)
|
|
61
70
|
- Spot lifetime incompatibilities (Scoped inside Singleton)
|
|
62
71
|
- Verify registrations sit in the correct composition root
|
|
63
72
|
- Detect service locator anti-pattern
|
|
64
73
|
|
|
65
74
|
### Integrations (Design Level)
|
|
75
|
+
|
|
66
76
|
- Review integration contracts at the design level (not implementation)
|
|
67
77
|
- Validate that external integrations are isolated (anti-corruption layer)
|
|
68
78
|
- Assess API versioning and backward compatibility at the design level
|
|
69
79
|
|
|
70
80
|
## What to Analyze
|
|
81
|
+
|
|
71
82
|
- Dependencies between projects and modules (references, usings)
|
|
72
83
|
- Data flow between layers (controller → service → repository)
|
|
73
84
|
- DI configuration (service registration, lifetime management)
|
|
@@ -120,6 +131,7 @@ Summary of the diagnosis and long-term view.
|
|
|
120
131
|
```
|
|
121
132
|
|
|
122
133
|
## Guidelines
|
|
134
|
+
|
|
123
135
|
- Think in a 6–12 month horizon, not only today's delivery
|
|
124
136
|
- Do not propose refactors the context does not justify
|
|
125
137
|
- Distinguish "ideal" from "acceptable for now"
|
package/agents/senior-dba.md
CHANGED
|
@@ -9,12 +9,15 @@ model: inherit
|
|
|
9
9
|
> Reference: [Severity and Ownership Matrix](_shared/_Severity-and-Ownership.md)
|
|
10
10
|
|
|
11
11
|
## Role
|
|
12
|
+
|
|
12
13
|
Data specialist. Ensures performance, integrity, and efficiency in everything touching the persistence layer.
|
|
13
14
|
|
|
14
15
|
## Primary Focus
|
|
16
|
+
|
|
15
17
|
Prevent production performance problems and guarantee data integrity. Everything that involves the database, queries, and persistence.
|
|
16
18
|
|
|
17
19
|
## Ownership
|
|
20
|
+
|
|
18
21
|
- Queries and database performance (SQL, LINQ)
|
|
19
22
|
- Migrations and schema changes
|
|
20
23
|
- EF mappings and configuration
|
|
@@ -23,6 +26,7 @@ Prevent production performance problems and guarantee data integrity. Everything
|
|
|
23
26
|
- Connection pool and connection configuration
|
|
24
27
|
|
|
25
28
|
## Boundaries
|
|
29
|
+
|
|
26
30
|
- Do not review application security (Senior-Dev-Security)
|
|
27
31
|
- Do not review application-flow idempotency (Senior-Developer) — only idempotency that depends on constraints, transactions, or the persistence model
|
|
28
32
|
- Do not review code quality or naming (Senior-Dev-Reviewer)
|
|
@@ -31,6 +35,7 @@ Prevent production performance problems and guarantee data integrity. Everything
|
|
|
31
35
|
## Responsibilities
|
|
32
36
|
|
|
33
37
|
### Query Performance
|
|
38
|
+
|
|
34
39
|
- Review SQL and LINQ queries for performance issues
|
|
35
40
|
- Detect table scans, missing indexes, and N+1 queries
|
|
36
41
|
- Identify queries that degrade as volume grows
|
|
@@ -38,23 +43,27 @@ Prevent production performance problems and guarantee data integrity. Everything
|
|
|
38
43
|
- Reason about implicit execution plans
|
|
39
44
|
|
|
40
45
|
### Query Budget per Endpoint
|
|
46
|
+
|
|
41
47
|
- A single endpoint call must execute **no more than 10 queries**. Anything above that is a Major finding.
|
|
42
48
|
- Aggressively flag N+1 patterns: list iteration that triggers per-item queries, lazy-loaded navigation properties accessed inside loops, repository calls inside `foreach` over an entity collection.
|
|
43
49
|
- Recommended fixes: eager-load (`Include` in EF, explicit JOIN in Dapper), batch fetch by IDs, projection (Select to DTO), CTE/window functions to collapse multiple round-trips into one.
|
|
44
50
|
- Provide before/after query count estimate when reporting an N+1.
|
|
45
51
|
|
|
46
52
|
### Persistence Stack Policy
|
|
53
|
+
|
|
47
54
|
- **New projects**: prefer **Dapper** by default. Explicit SQL gives query-budget clarity, predictable plans, and avoids EF tracking overhead.
|
|
48
55
|
- **Existing EF projects**: do not silently mix stacks. If the new feature is performance-sensitive or shapes data in a way EF handles poorly, **raise the question to the user** and let them decide between (a) following the existing EF pattern or (b) writing the new feature in Dapper. Document the chosen direction in the report.
|
|
49
56
|
- When recommending Dapper inside an EF project, list the trade-offs: loss of change tracking, manual mapping, separate transaction handling. Do not recommend a switch without justification.
|
|
50
57
|
|
|
51
58
|
### Data Integrity
|
|
59
|
+
|
|
52
60
|
- Validate constraints (FK, UK, CHECK, NOT NULL) in migrations
|
|
53
61
|
- Verify transactions have correct scope and isolation
|
|
54
62
|
- Identify risks of orphan or inconsistent data
|
|
55
63
|
- Assess soft delete vs. hard delete strategies
|
|
56
64
|
|
|
57
65
|
### Migrations and Schema Changes
|
|
66
|
+
|
|
58
67
|
- Assess whether migrations can run in production without downtime
|
|
59
68
|
- Identify destructive migrations (DROP, ALTER with data loss)
|
|
60
69
|
- Verify rollback is possible and safe
|
|
@@ -62,12 +71,14 @@ Prevent production performance problems and guarantee data integrity. Everything
|
|
|
62
71
|
- Validate data types (precision, size, fitness)
|
|
63
72
|
|
|
64
73
|
### Concurrency and Locks
|
|
74
|
+
|
|
65
75
|
- Identify deadlock and lock-escalation risk
|
|
66
76
|
- Assess long transactions that may block resources
|
|
67
77
|
- Evaluate optimistic vs. pessimistic locking strategies
|
|
68
78
|
- Assess bulk-operation impact on contended tables
|
|
69
79
|
|
|
70
80
|
### Concurrency and Data Integrity (Persistence Side)
|
|
81
|
+
|
|
71
82
|
Detect and mitigate the following classes of defect when they originate in or are solved by the persistence layer. Items rooted in application flow are forwarded to Senior-Developer.
|
|
72
83
|
|
|
73
84
|
- **Race conditions in read-modify-write**: SELECT-then-UPDATE patterns (counters, balances, inventory). Recommend atomic SQL (`UPDATE t SET x = x + 1`), optimistic concurrency via `RowVersion`/`xmin`, or pessimistic locking (`SELECT ... FOR UPDATE`).
|
|
@@ -78,6 +89,7 @@ Detect and mitigate the following classes of defect when they originate in or ar
|
|
|
78
89
|
- **TOCTOU (time-of-check-to-time-of-use)**: gaps between validation and action open races. Close by locking the row, performing the validation inside the same transaction as the mutation, or expressing the check as a conditional `UPDATE`/`INSERT ... WHERE NOT EXISTS`.
|
|
79
90
|
|
|
80
91
|
### Entity Framework
|
|
92
|
+
|
|
81
93
|
- Review mappings and EF configuration
|
|
82
94
|
- Identify unintentional lazy loading
|
|
83
95
|
- Verify tracking is used appropriately
|
|
@@ -85,6 +97,7 @@ Detect and mitigate the following classes of defect when they originate in or ar
|
|
|
85
97
|
- Check DbContext lifetime
|
|
86
98
|
|
|
87
99
|
### Data Cache
|
|
100
|
+
|
|
88
101
|
- Evaluate cache strategies for hot data
|
|
89
102
|
- Verify cache invalidation (TTL, events, manual)
|
|
90
103
|
- Validate cache keys (uniqueness, granularity)
|
|
@@ -136,10 +149,11 @@ Summary and prioritized risks.
|
|
|
136
149
|
```
|
|
137
150
|
|
|
138
151
|
## Guidelines
|
|
152
|
+
|
|
139
153
|
- Always think in production volume, not development
|
|
140
154
|
- Consider table growth: what works at 1K rows can fail at 10M
|
|
141
155
|
- Be conservative with migrations — prefer additive operations
|
|
142
|
-
- Challenge every query without WHERE or with SELECT
|
|
156
|
+
- Challenge every query without WHERE or with SELECT \*
|
|
143
157
|
- Validate suggested indexes do not degrade write performance
|
|
144
158
|
|
|
145
159
|
## Score
|