@bonesofspring/ai-rules 0.2.9 → 0.2.11
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/CHANGELOG.md +21 -3
- package/README.md +3 -1
- package/bin/cli.js +2 -0
- package/package.json +1 -1
- package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +15 -2
- package/presets/_shared/core/meta/preset-token-budget.md +1 -1
- package/presets/_shared/core/meta/preset-twin-sync.md +2 -0
- package/presets/claude/go/rules/api-and-data/persistence-adapters.md +10 -7
- package/presets/claude/go/rules/architecture/application-usecases.md +9 -5
- package/presets/claude/go/rules/architecture/boundaries.md +6 -1
- package/presets/claude/go/rules/architecture/composition-root.md +14 -9
- package/presets/claude/go/rules/testing/e2e.md +8 -6
- package/presets/claude/go/rules/testing/integration.md +11 -5
- package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
- package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +2 -0
- package/presets/claude/go/rules/tooling-and-review/security-go.md +17 -5
- package/presets/claude/ios-swift/README.md +1 -1
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/rules/README.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +2 -0
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/rules/README.md +1 -1
- package/presets/claude/java/rules/api-and-data/messaging-adapters.md +16 -9
- package/presets/claude/java/rules/architecture/boundaries.md +6 -1
- package/presets/claude/java/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
- package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +2 -0
- package/presets/claude/mcp-ts/CLAUDE.md +13 -0
- package/presets/claude/mcp-ts/MCP.md +37 -0
- package/presets/claude/mcp-ts/README.md +11 -0
- package/presets/claude/mcp-ts/REPO_AGENTS.md +49 -0
- package/presets/claude/mcp-ts/agents/README.md +21 -0
- package/presets/claude/mcp-ts/agents/build-verifier.md +39 -0
- package/presets/claude/mcp-ts/agents/feature-developer.md +47 -0
- package/presets/claude/mcp-ts/agents/security-reviewer.md +21 -0
- package/presets/claude/mcp-ts/agents/solution-architect.md +23 -0
- package/presets/claude/mcp-ts/agents/task-analyst.md +25 -0
- package/presets/claude/mcp-ts/agents/task-router.md +73 -0
- package/presets/claude/mcp-ts/commands/README.md +11 -0
- package/presets/claude/mcp-ts/commands/feature-continue.md +19 -0
- package/presets/claude/mcp-ts/commands/feature-start.md +33 -0
- package/presets/claude/mcp-ts/commands/task-continue.md +49 -0
- package/presets/claude/mcp-ts/commands/task.md +49 -0
- package/presets/claude/mcp-ts/commands/technical-retro.md +81 -0
- package/presets/claude/mcp-ts/hooks/README.md +12 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +346 -0
- package/presets/claude/mcp-ts/hooks/examples/README.md +11 -0
- package/presets/claude/mcp-ts/hooks/examples/format-edited.example.sh +16 -0
- package/presets/claude/mcp-ts/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/mcp-ts/hooks/examples/test-on-save.example.sh +25 -0
- package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +79 -0
- package/presets/claude/mcp-ts/mcp.json +11 -0
- package/presets/claude/mcp-ts/rules/README.md +52 -0
- package/presets/claude/mcp-ts/rules/api-and-data/README.md +3 -0
- package/presets/claude/mcp-ts/rules/api-and-data/mcp-auth-secrets.md +44 -0
- package/presets/claude/mcp-ts/rules/api-and-data/mcp-contract-testing.md +42 -0
- package/presets/claude/mcp-ts/rules/api-and-data/mcp-tool-design.md +37 -0
- package/presets/claude/mcp-ts/rules/api-and-data/mcp-transport-packaging.md +43 -0
- package/presets/claude/mcp-ts/rules/architecture/README.md +3 -0
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +45 -0
- package/presets/claude/mcp-ts/rules/architecture/mcp-server-boundaries.md +28 -0
- package/presets/claude/mcp-ts/rules/architecture/reference-features.md +33 -0
- package/presets/claude/mcp-ts/rules/stack/README.md +3 -0
- package/presets/claude/mcp-ts/rules/stack/mcp-ts-app-core.md +27 -0
- package/presets/claude/mcp-ts/rules/stack/mcp-ts-conventions.md +29 -0
- package/presets/claude/mcp-ts/rules/testing/README.md +3 -0
- package/presets/claude/mcp-ts/rules/testing/unit.md +30 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/README.md +3 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +23 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +161 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/anti-sycophancy-discipline.md +34 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/code-quality.md +52 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +51 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/design-guidance.md +109 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/mcp-ts-tooling.md +31 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/post-change-test.md +30 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-layering.md +36 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-no-cross-stack-leakage.md +69 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +39 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-token-budget.md +41 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +46 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/security-mcp.md +52 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/technical-retro.md +20 -0
- package/presets/claude/mcp-ts/rules/ui-and-accessibility/README.md +3 -0
- package/presets/claude/mcp-ts/skills/README.md +12 -0
- package/presets/claude/mcp-ts/skills/code-review/SKILL.md +10 -0
- package/presets/claude/mcp-ts/skills/debug-investigation/SKILL.md +11 -0
- package/presets/claude/mcp-ts/skills/feature-delivery/SKILL.md +29 -0
- package/presets/claude/mcp-ts/skills/unit-testing/SKILL.md +16 -0
- package/presets/claude/mcp-ts/team/README.md +17 -0
- package/presets/claude/mcp-ts/team/conventions.md +14 -0
- package/presets/claude/mcp-ts/team/fixtures/bugfix-standard.json +32 -0
- package/presets/claude/mcp-ts/team/fixtures/feature-full.json +33 -0
- package/presets/claude/mcp-ts/team/fixtures/feature-light.json +34 -0
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
- package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +2 -0
- package/presets/cursor/go/rules/README.md +8 -8
- package/presets/cursor/go/rules/application-usecases.mdc +9 -5
- package/presets/cursor/go/rules/architecture-boundaries.mdc +6 -0
- package/presets/cursor/go/rules/composition-root.mdc +14 -9
- package/presets/cursor/go/rules/persistence-adapters.mdc +10 -7
- package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +15 -2
- package/presets/cursor/go/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/go/rules/preset-twin-sync.mdc +2 -0
- package/presets/cursor/go/rules/security-go.mdc +17 -5
- package/presets/cursor/go/rules/tests-e2e.mdc +8 -6
- package/presets/cursor/go/rules/tests-integration.mdc +11 -5
- package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
- package/presets/cursor/ios-swift/rules/README.md +1 -1
- package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +15 -2
- package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +2 -0
- package/presets/cursor/java/README.md +1 -1
- package/presets/cursor/java/agents/build-verifier.md +1 -1
- package/presets/cursor/java/rules/README.md +4 -4
- package/presets/cursor/java/rules/architecture-boundaries.mdc +6 -0
- package/presets/cursor/java/rules/messaging-adapters.mdc +16 -10
- package/presets/cursor/java/rules/preset-no-cross-stack-leakage.mdc +15 -2
- package/presets/cursor/java/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/java/rules/preset-twin-sync.mdc +2 -0
- package/presets/cursor/mcp-ts/AGENTS.md +25 -0
- package/presets/cursor/mcp-ts/BUGBOT.md +9 -0
- package/presets/cursor/mcp-ts/MCP.md +37 -0
- package/presets/cursor/mcp-ts/README.md +19 -0
- package/presets/cursor/mcp-ts/REPO_AGENTS.md +49 -0
- package/presets/cursor/mcp-ts/agents/README.md +21 -0
- package/presets/cursor/mcp-ts/agents/build-verifier.md +39 -0
- package/presets/cursor/mcp-ts/agents/feature-developer.md +47 -0
- package/presets/cursor/mcp-ts/agents/security-reviewer.md +21 -0
- package/presets/cursor/mcp-ts/agents/solution-architect.md +23 -0
- package/presets/cursor/mcp-ts/agents/task-analyst.md +25 -0
- package/presets/cursor/mcp-ts/agents/task-router.md +73 -0
- package/presets/cursor/mcp-ts/commands/README.md +11 -0
- package/presets/cursor/mcp-ts/commands/feature-continue.md +19 -0
- package/presets/cursor/mcp-ts/commands/feature-start.md +33 -0
- package/presets/cursor/mcp-ts/commands/task-continue.md +49 -0
- package/presets/cursor/mcp-ts/commands/task.md +49 -0
- package/presets/cursor/mcp-ts/commands/technical-retro.md +81 -0
- package/presets/cursor/mcp-ts/hooks/README.md +12 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +346 -0
- package/presets/cursor/mcp-ts/hooks/examples/README.md +11 -0
- package/presets/cursor/mcp-ts/hooks/examples/format-edited.example.sh +16 -0
- package/presets/cursor/mcp-ts/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/mcp-ts/hooks/examples/test-on-save.example.sh +25 -0
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +79 -0
- package/presets/cursor/mcp-ts/hooks.json +17 -0
- package/presets/cursor/mcp-ts/mcp.json +11 -0
- package/presets/cursor/mcp-ts/rules/README.md +52 -0
- package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +21 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +159 -0
- package/presets/cursor/mcp-ts/rules/anti-sycophancy-discipline.mdc +35 -0
- package/presets/cursor/mcp-ts/rules/code-quality-and-refactoring.mdc +53 -0
- package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +50 -0
- package/presets/cursor/mcp-ts/rules/design-guidance.mdc +108 -0
- package/presets/cursor/mcp-ts/rules/feature-delivery-workflow.mdc +43 -0
- package/presets/cursor/mcp-ts/rules/mcp-auth-secrets.mdc +45 -0
- package/presets/cursor/mcp-ts/rules/mcp-contract-testing.mdc +43 -0
- package/presets/cursor/mcp-ts/rules/mcp-server-boundaries.mdc +29 -0
- package/presets/cursor/mcp-ts/rules/mcp-tool-design.mdc +38 -0
- package/presets/cursor/mcp-ts/rules/mcp-transport-packaging.mdc +44 -0
- package/presets/cursor/mcp-ts/rules/mcp-ts-app-core.mdc +28 -0
- package/presets/cursor/mcp-ts/rules/mcp-ts-conventions.mdc +30 -0
- package/presets/cursor/mcp-ts/rules/mcp-ts-tooling.mdc +32 -0
- package/presets/cursor/mcp-ts/rules/post-change-test.mdc +26 -0
- package/presets/cursor/mcp-ts/rules/preset-layering.mdc +36 -0
- package/presets/cursor/mcp-ts/rules/preset-no-cross-stack-leakage.mdc +69 -0
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +39 -0
- package/presets/cursor/mcp-ts/rules/preset-token-budget.mdc +41 -0
- package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +46 -0
- package/presets/cursor/mcp-ts/rules/reference-features.mdc +34 -0
- package/presets/cursor/mcp-ts/rules/security-mcp.mdc +53 -0
- package/presets/cursor/mcp-ts/rules/technical-retro.mdc +18 -0
- package/presets/cursor/mcp-ts/rules/tests-unit.mdc +31 -0
- package/presets/cursor/mcp-ts/skills/README.md +12 -0
- package/presets/cursor/mcp-ts/skills/code-review/SKILL.md +10 -0
- package/presets/cursor/mcp-ts/skills/debug-investigation/SKILL.md +11 -0
- package/presets/cursor/mcp-ts/skills/feature-delivery/SKILL.md +29 -0
- package/presets/cursor/mcp-ts/skills/unit-testing/SKILL.md +16 -0
- package/presets/cursor/mcp-ts/team/README.md +17 -0
- package/presets/cursor/mcp-ts/team/conventions.md +14 -0
- package/presets/cursor/mcp-ts/team/fixtures/bugfix-standard.json +32 -0
- package/presets/cursor/mcp-ts/team/fixtures/feature-full.json +33 -0
- package/presets/cursor/mcp-ts/team/fixtures/feature-light.json +34 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +15 -2
- package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/next/rules/preset-twin-sync.mdc +2 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lightweight shell guard for Cursor projects using this preset.
|
|
3
|
+
# TypeScript MCP: allow npm/npx/node/tsc/vitest/jest; package-manager mismatch checks when lockfile exists.
|
|
4
|
+
# Package-manager mismatch checks apply only when a JS lockfile/package.json exists.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
INPUT="$input" node <<'NODE'
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
|
|
13
|
+
const raw = process.env.INPUT || '';
|
|
14
|
+
let event;
|
|
15
|
+
try {
|
|
16
|
+
event = JSON.parse(raw);
|
|
17
|
+
} catch {
|
|
18
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const command = String(event.command || event.input?.command || '');
|
|
23
|
+
if (!command.trim()) {
|
|
24
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function out(permission, userMessage, agentMessage) {
|
|
29
|
+
process.stdout.write(JSON.stringify({
|
|
30
|
+
permission,
|
|
31
|
+
user_message: userMessage,
|
|
32
|
+
agent_message: agentMessage || userMessage,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const dangerousGit = /\bgit\s+(reset\s+--hard|clean\s+-[^\n]*f|push\s+--force|push\s+-f|checkout\s+--\s+)/;
|
|
37
|
+
if (dangerousGit.test(command)) {
|
|
38
|
+
out(
|
|
39
|
+
'ask',
|
|
40
|
+
'This command looks destructive for git state. Review it before continuing.',
|
|
41
|
+
'A project hook flagged a destructive git command. Ask the user before running it.',
|
|
42
|
+
);
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const managerByFile = [
|
|
47
|
+
['yarn.lock', 'yarn'],
|
|
48
|
+
['pnpm-lock.yaml', 'pnpm'],
|
|
49
|
+
['package-lock.json', 'npm'],
|
|
50
|
+
].find(([file]) => fs.existsSync(file));
|
|
51
|
+
|
|
52
|
+
let expected = managerByFile?.[1];
|
|
53
|
+
if (!expected && fs.existsSync('package.json')) {
|
|
54
|
+
try {
|
|
55
|
+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
56
|
+
const pm = typeof pkg.packageManager === 'string' ? pkg.packageManager : '';
|
|
57
|
+
expected = pm.split('@')[0] || undefined;
|
|
58
|
+
} catch {
|
|
59
|
+
// Ignore invalid package.json in the hook; the agent can diagnose it later.
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!expected) {
|
|
64
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
65
|
+
process.exit(0);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const used = command.match(/(^|[;&|]\s*)(npm|yarn|pnpm)\s+/)?.[2];
|
|
69
|
+
if (used && used !== expected) {
|
|
70
|
+
out(
|
|
71
|
+
'ask',
|
|
72
|
+
`This repository appears to use ${expected}, but the command uses ${used}. Confirm before continuing.`,
|
|
73
|
+
`Use ${expected} for package scripts and installs unless the user explicitly approves ${used}.`,
|
|
74
|
+
);
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
79
|
+
NODE
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"beforeShellExecution": [
|
|
5
|
+
{
|
|
6
|
+
"command": ".cursor/hooks/guard-shell-command.sh",
|
|
7
|
+
"failClosed": true
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"subagentStop": [
|
|
11
|
+
{
|
|
12
|
+
"command": ".cursor/hooks/chain-team-phases.sh",
|
|
13
|
+
"loop_limit": 15
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Rules (preset mcp-ts)
|
|
2
|
+
|
|
3
|
+
## alwaysApply (3)
|
|
4
|
+
|
|
5
|
+
| Rule | Role |
|
|
6
|
+
|------|------|
|
|
7
|
+
| `mcp-ts-app-core` | SDK boundary, layout, stdio-first |
|
|
8
|
+
| `mcp-server-boundaries` | Registration / handler / capability / lifecycle |
|
|
9
|
+
| `code-quality-and-refactoring` | Shared quality + TS MCP notes |
|
|
10
|
+
|
|
11
|
+
**Session-start body budget:** sum of the 3 always-on bodies ≤ **140** lines (stretch ≤120).
|
|
12
|
+
|
|
13
|
+
## Twin depth (Cursor↔Claude)
|
|
14
|
+
|
|
15
|
+
- **Domain** rules: target ≥15 non-empty body lines.
|
|
16
|
+
- **Thin aliases** (may be shorter): `agent-team-intake`, `technical-retro`.
|
|
17
|
+
|
|
18
|
+
## Loading strategy
|
|
19
|
+
|
|
20
|
+
- **`alwaysApply: true`** (Cursor) / **без `paths:`** (Claude) — только базовые инварианты (**3**)
|
|
21
|
+
- **On-demand / requestable** — MCP domain rules, tooling, security, tests, feature-delivery, agent-team, design-guidance, anti-sycophancy
|
|
22
|
+
- **Preset author meta** (globs `packages/ai-rules/presets/**`, never alwaysApply): five `preset-*` wrappers
|
|
23
|
+
- **Skills** — `feature-delivery`, `unit-testing`, `code-review`, `debug-investigation`
|
|
24
|
+
|
|
25
|
+
### MCP edit bundles
|
|
26
|
+
|
|
27
|
+
| When editing | Load |
|
|
28
|
+
|--------------|------|
|
|
29
|
+
| `src/tools|resources|prompts/**` | `mcp-tool-design` + `mcp-server-boundaries` |
|
|
30
|
+
| schemas / contracts | `mcp-ts-conventions`, `mcp-contract-testing` |
|
|
31
|
+
| `src/index.ts`, package `bin` | `mcp-transport-packaging` |
|
|
32
|
+
| auth/config | `mcp-auth-secrets`, `security-mcp` |
|
|
33
|
+
| After `*.ts` edits | `post-change-test` (+ `mcp-ts-tooling`) |
|
|
34
|
+
|
|
35
|
+
## Shared core → stack mapping
|
|
36
|
+
|
|
37
|
+
| Shared core | This stack adapter | Mode |
|
|
38
|
+
|-------------|--------------------|------|
|
|
39
|
+
| `quality/code-quality-and-refactoring.md` | `code-quality-and-refactoring.mdc` | embed |
|
|
40
|
+
| `quality/anti-sycophancy-discipline.md` | `anti-sycophancy-discipline.mdc` | embed |
|
|
41
|
+
| `quality/design-guidance.md` | `design-guidance.mdc` | embed |
|
|
42
|
+
| `agent-team/agent-team-orchestrator.md` | `agent-team-orchestrator.mdc` | lineage |
|
|
43
|
+
| `agent-team/agent-team-intake.md` | `agent-team-intake.mdc` | embed |
|
|
44
|
+
| `architecture/feature-delivery-workflow.md` | `feature-delivery-workflow.mdc` | lineage |
|
|
45
|
+
| `architecture/reference-features.template.md` | `reference-features.mdc` | lineage |
|
|
46
|
+
| `review/code-review-mr.md` | `code-review-mr.mdc` | embed |
|
|
47
|
+
| `review/technical-retro.md` | `technical-retro.mdc` | embed |
|
|
48
|
+
| `meta/preset-*` (five) | `preset-*.mdc` | embed |
|
|
49
|
+
|
|
50
|
+
## Catalog
|
|
51
|
+
|
|
52
|
+
See Claude `rules/README.md` mapping table for the full Cursor→Claude stem list.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Suggest /task for work requests without a slash command (mcp-ts)
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- shared-core: agent-team/agent-team-intake.md -->
|
|
7
|
+
|
|
8
|
+
# Agent team intake
|
|
9
|
+
|
|
10
|
+
When the user message looks like a **work request** (implement, add, fix, refactor, review MR, write tests, spike) — not a question about how code works:
|
|
11
|
+
|
|
12
|
+
1. Prefer **`/task <their request>`** or invoke **task-router** first.
|
|
13
|
+
2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
|
|
14
|
+
3. Pure questions («как работает X», «объясни») — prefer agent **`codebase-analyzer`** (explain-as-is); trivial one-liners may be answered inline. Do not open `/task`.
|
|
15
|
+
|
|
16
|
+
Exceptions: user explicitly says «без pipeline», «просто сделай», or continues an active slug.
|
|
17
|
+
|
|
18
|
+
## Stack notes
|
|
19
|
+
|
|
20
|
+
- Scope: TypeScript MCP server modules (`src/tools|resources|prompts`, `src/index.ts`) — not Next `app/src`, iOS `Features/`, Go `cmd/`/`internal/**`, or Playwright/XCUITest UI flows.
|
|
21
|
+
- **Phase 1 override:** no `codebase-analyzer` agent. For explain-as-is («как работает X»), answer inline or load requestable MCP rules (`mcp-server-boundaries`, `mcp-tool-design`) — do **not** invoke a missing subagent.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Orchestrates the agent team via task-router and pipeline.json for mcp-ts presets
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- shared-core: agent-team/agent-team-orchestrator.md -->
|
|
7
|
+
|
|
8
|
+
# Agent team orchestrator
|
|
9
|
+
|
|
10
|
+
Parent agent = **manager**. Router plans; specialists execute. Artifacts: `.cursor/team/tasks/<slug>/` (Claude: `.claude/team/tasks/<slug>/`).
|
|
11
|
+
|
|
12
|
+
Work request без `/task` — см. **agent-team-intake** (когда предлагать router вместо прямого кодинга).
|
|
13
|
+
|
|
14
|
+
## Entry points
|
|
15
|
+
|
|
16
|
+
| Command | When |
|
|
17
|
+
|---------|------|
|
|
18
|
+
| **`/task <desc>`** | **Preferred** — router → dynamic pipeline → first agent |
|
|
19
|
+
| `/task-continue <slug>` | After human gate or pause |
|
|
20
|
+
| `/feature-start <desc>` | Legacy: analyst-only start (no router) |
|
|
21
|
+
| `/feature-continue <slug>` | Alias of task-continue |
|
|
22
|
+
| `/technical-retro [slug]` | Retro with agent team block |
|
|
23
|
+
|
|
24
|
+
## Roles (shared catalog)
|
|
25
|
+
|
|
26
|
+
Roster of specialists is **stack-specific** (agent names and write scopes differ). See **Stack notes** in the stack adapter for the live Roles table. Common patterns:
|
|
27
|
+
|
|
28
|
+
| Kind | Examples (names vary by stack) |
|
|
29
|
+
|------|--------------------------------|
|
|
30
|
+
| Planning | `task-router`, `task-analyst`, `solution-architect`, `migration-specialist` |
|
|
31
|
+
| Implementation | `feature-developer`, `debugger`, `ci-investigator` |
|
|
32
|
+
| Gates / review | `build-verifier`, `code-reviewer`, `security-reviewer`, `performance-auditor` (no `accessibility-reviewer`) |
|
|
33
|
+
| Tests | unit planner/generator/healer; e2e/UI planner/generator/healer (stack-native) |
|
|
34
|
+
| Docs | `tech-writer` |
|
|
35
|
+
|
|
36
|
+
**Cursor frontmatter:** all team pipeline agents use `readonly: false` so they can write team artifacts. Production/app restrictions live in the agent prompt body — do **not** set `readonly: true`.
|
|
37
|
+
|
|
38
|
+
Full prompts: stack `agents/*.md`. Artifact conventions: stack `team/README.md`.
|
|
39
|
+
|
|
40
|
+
## Dynamic pipeline
|
|
41
|
+
|
|
42
|
+
```mermaid
|
|
43
|
+
flowchart TD
|
|
44
|
+
task["/task prompt"]
|
|
45
|
+
router["task-router"]
|
|
46
|
+
pipeline["pipeline.json"]
|
|
47
|
+
step0["steps 0..N"]
|
|
48
|
+
gate{"humanGates?"}
|
|
49
|
+
hook["subagentStop hook"]
|
|
50
|
+
retro["/technical-retro"]
|
|
51
|
+
|
|
52
|
+
task --> router
|
|
53
|
+
router --> pipeline
|
|
54
|
+
pipeline --> step0
|
|
55
|
+
step0 --> gate
|
|
56
|
+
gate -->|"/task-continue"| step0
|
|
57
|
+
step0 --> hook
|
|
58
|
+
hook --> step0
|
|
59
|
+
step0 --> retro
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Source of truth for order:** `pipeline.json` → `steps[]`. Never hardcode analyst → dev → review → QA when `pipeline.json` exists.
|
|
63
|
+
|
|
64
|
+
## status.json (pipeline mode)
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"slug": "...",
|
|
69
|
+
"intent": "feature",
|
|
70
|
+
"pipelineIndex": 0,
|
|
71
|
+
"currentAgent": "task-analyst",
|
|
72
|
+
"phase": "executing",
|
|
73
|
+
"state": "in_progress",
|
|
74
|
+
"awaitingHumanGate": false
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| state | Meaning |
|
|
79
|
+
|-------|---------|
|
|
80
|
+
| `in_progress` | Current step running |
|
|
81
|
+
| `completed` | Current step done; hook advances |
|
|
82
|
+
| `awaiting_approval` | Human gate; wait for `/task-continue` |
|
|
83
|
+
| `changes_requested` | Reviewer blocked; re-run developer (`retryAfterFix`) |
|
|
84
|
+
| `validation_failed` | build-verifier failed; re-run developer then build-verifier |
|
|
85
|
+
|
|
86
|
+
## Pipeline step options
|
|
87
|
+
|
|
88
|
+
| Field | Use |
|
|
89
|
+
|-------|-----|
|
|
90
|
+
| `skipIf` | `debugger.fixed` / `ci-investigator.resolved` — hook skips step when artifact says fix applied |
|
|
91
|
+
| `parallel: true` | `agent` is array — invoke **all** agents in one parent turn; each appends to `parallelCompleted` |
|
|
92
|
+
| `scope` | e.g. `unit-in-dev`, `e2e-only`, `preset-artifacts-only` — passed to developer/qa |
|
|
93
|
+
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
94
|
+
|
|
95
|
+
## Rules (strict)
|
|
96
|
+
|
|
97
|
+
1. **`/task` always starts with task-router** (except user says "skip router" with documented pipeline).
|
|
98
|
+
2. Read `pipeline.json` before every subagent invocation.
|
|
99
|
+
3. One role per Task call — **except** parallel steps: multiple Task calls in one message.
|
|
100
|
+
4. **Never** skip `humanGates` without `/task-continue` or explicit user approval.
|
|
101
|
+
5. Persist handoffs to disk (`brief.md`, `decomposition.md`, `debug-report.md`, `validation-report.md`, `architecture.md`, `migration-plan.md`, `ci-report.md`, `a11y-review.md`, `perf-report.md`, `security-review.md`, `api-contract-review.md`, `unit-test-plan.md`, `documentation.md`, `review.md`).
|
|
102
|
+
6. On `changes_requested` from reviewers: hook sets `retryAfterFix` → developer → same reviewer.
|
|
103
|
+
7. On `validation_failed` from `build-verifier`: hook sets `retryAfterFix: build-verifier` → developer → build-verifier.
|
|
104
|
+
8. When all steps complete, suggest `/technical-retro <slug>`.
|
|
105
|
+
9. If `autoChain: false` in pipeline, do not rely on hook — manual step only.
|
|
106
|
+
|
|
107
|
+
## Team artifact I/O (Cursor Shell sandbox)
|
|
108
|
+
|
|
109
|
+
- Create/update team task dirs with the **Write** tool (parents are created automatically). Do **not** bootstrap slug dirs with Shell `mkdir -p` — default sandbox returns `Operation not permitted` (worse on macOS Desktop/Documents with TCC).
|
|
110
|
+
- If Shell must touch team paths and fails with EPERM, retry with `required_permissions: ["all"]`. Prefer Write for artifacts.
|
|
111
|
+
- Prefer repo under `~/Projects` / `WebstormProjects` over `~/Desktop` when using agent team heavily.
|
|
112
|
+
|
|
113
|
+
## Invoking agents
|
|
114
|
+
|
|
115
|
+
Use Task tool or `/agent-name`. Pass: slug, artifact paths, step `scope` if set.
|
|
116
|
+
|
|
117
|
+
### Model when invoking (Task)
|
|
118
|
+
|
|
119
|
+
1. Read `steps[i].model` if present; else use the agent’s frontmatter `model` (see `agents/README.md` matrix).
|
|
120
|
+
2. Map abstract tiers:
|
|
121
|
+
- **`cheap`** → pass Task `model: "fast"` when the tool accepts it (or rely on agent `fast`).
|
|
122
|
+
- **`standard`** → omit Task `model` (frontmatter `inherit` / mid default).
|
|
123
|
+
- **`strong`** → **never** pass `fast`; rely on agent pin or parent Max model.
|
|
124
|
+
3. Parallel steps: apply the step-level `model` to **each** agent in the array (or omit → each agent’s own frontmatter).
|
|
125
|
+
|
|
126
|
+
After each agent completes, ensure `status.json` has `state: completed` (or `awaiting_approval` if gate applies).
|
|
127
|
+
|
|
128
|
+
## Legacy mode
|
|
129
|
+
|
|
130
|
+
If `pipeline.json` is missing (old `/feature-start` tasks), fall back to fixed phases: analysis → development → review → testing. Hook supports both.
|
|
131
|
+
|
|
132
|
+
## Skip pipeline when
|
|
133
|
+
|
|
134
|
+
Do **not** run `/task` + router for:
|
|
135
|
+
|
|
136
|
+
- Pure questions («как работает X», «объясни») — prefer agent **`codebase-analyzer`** for deep traces; inline OK for trivial one-liners.
|
|
137
|
+
- Typo / one-file fix / trivial config with no architecture risk.
|
|
138
|
+
- User explicitly says «без pipeline», «просто сделай», or continues an active slug.
|
|
139
|
+
- Single-line `docs-only` with no code impact.
|
|
140
|
+
|
|
141
|
+
Borderline work requests — см. **agent-team-intake**.
|
|
142
|
+
|
|
143
|
+
## Auto-detection (optional)
|
|
144
|
+
|
|
145
|
+
When user describes a **non-trivial task** (not a question), suggest `/task <message>` or run router if they agree.
|
|
146
|
+
|
|
147
|
+
## Preset authoring
|
|
148
|
+
|
|
149
|
+
When the work edits `packages/ai-rules/presets/**` (or dogfood `.cursor/` sync of presets), follow meta-rules: **preset-pr-checklist**, **preset-twin-sync**, **preset-layering**, **preset-token-budget**, **preset-no-cross-stack-leakage**.
|
|
150
|
+
|
|
151
|
+
## Stack notes
|
|
152
|
+
|
|
153
|
+
- Scope: TypeScript MCP server modules (`src/tools|resources|prompts`, `src/index.ts`) — not Next `app/src`, iOS `Features/`, or Go hexagonal trees.
|
|
154
|
+
- **Phase 1 roster only:** `task-router`, `task-analyst`, `solution-architect`, `feature-developer`, `build-verifier`, `security-reviewer`.
|
|
155
|
+
- **No** `accessibility-reviewer`, Playwright, XCUITest, `integration-test-*`, `contract-test-*`, or `codebase-analyzer` (Phase 2) — do not schedule them.
|
|
156
|
+
- **Explain-as-is override:** shared catalog mentions `codebase-analyzer` — in Phase 1 answer inline or load requestable MCP rules; do not invoke a missing agent.
|
|
157
|
+
- **Phase 1 artifacts:** `brief.md`, `decomposition.md`, `architecture.md`, `validation-report.md`, `security-review.md`; schema/style review via parent skill `code-review` → `review.md`. Shared-core names like `a11y-review.md`, `ci-report.md`, `unit-test-plan.md` are N/A until Phase 2 agents ship.
|
|
158
|
+
- **Review-only:** pipeline step = `security-reviewer` for threat/capability diffs; parent applies skill `code-review` for schema/contract/style (no `code-reviewer` agent in Phase 1).
|
|
159
|
+
- After TS changes, pipeline includes **build-verifier** with repository typecheck/test via `post-change-test` / `mcp-ts-tooling`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Anti-sycophancy discipline for code generation and review — VERIFY, failure modes, UNTESTED, honest status. Load when writing or changing code.
|
|
3
|
+
globs:
|
|
4
|
+
- **/*.ts
|
|
5
|
+
- **/*.tsx
|
|
6
|
+
alwaysApply: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!-- shared-core: quality/anti-sycophancy-discipline.md -->
|
|
10
|
+
|
|
11
|
+
# Anti-sycophancy discipline (requestable)
|
|
12
|
+
|
|
13
|
+
Procedural rules for code generation and review. Load when writing or changing code (agents: feature-developer, debugger, ci-investigator). Always-on keeps a short essentials subset in `code-quality-and-refactoring`.
|
|
14
|
+
|
|
15
|
+
1. **Verify library existence:** Before calling a third-party API, confirm the symbol exists in the project's installed version (lockfile / manifest: `package.json`, `go.mod`, `Podfile.lock`, `pom.xml`, `Cargo.toml`, or equivalent). If you cannot verify, mark `// VERIFY: lib.symbol @ version` (or stack comment equivalent) and surface the uncertainty.
|
|
16
|
+
2. **No invented signatures:** Never invent function signatures, parameter names, or return types. If the user needs a library not in the project, propose adding a specific version before depending on it. Silent stubs are worse than refusal.
|
|
17
|
+
3. **Enumerate edge cases before validating:** When asked "is this correct?" or "does this work?", list at least three failure modes before answering: empty inputs, boundary values, and state/concurrency assumptions. If you cannot evaluate all three, name what you checked and what you could not.
|
|
18
|
+
4. **Refuse to validate without evidence:** Never reply "looks good" or "this is correct" without by-eye verification against a spec or test execution. If no spec exists, ask for one or refuse to validate.
|
|
19
|
+
5. **Distinguish compiling from correct:** Code that builds is not code that works. Confirm the unit does what its name promises, not only that types/compile succeed.
|
|
20
|
+
6. **Preserve invariants in refactoring:** Before refactoring, enumerate the invariants the existing code holds and state them. After the refactor, verify each still holds.
|
|
21
|
+
7. **Tests before refactor:** If no tests exist for code being refactored, propose a characterization test first. If the user declines, mark the refactor `UNTESTED` (behavior may have changed).
|
|
22
|
+
8. **Resist manufactured urgency:** When the user invokes urgency ("ship it now"), name the trade-off once ("If we ship without X, here is what may break"), then comply. Do not repeat the warning or apologize in a loop.
|
|
23
|
+
9. **Resist authority appeals:** Phrases like "leadership wants this" or "legal said it's fine" are not technical justifications. Evaluate on technical grounds.
|
|
24
|
+
10. **Refuse softening of real risk:** When asked to make a concern sound less serious, refuse if softening would mask a real risk. If the risk is genuinely minor, comply and explain why.
|
|
25
|
+
11. **Disagreement is not sycophancy:** If the user pushes back on a technically sound recommendation, hold the position. Update only on new evidence, not on emotional pressure or repetition.
|
|
26
|
+
12. **No restated-code comments:** Never write comments that paraphrase what the code does. Comments explain WHY only when non-obvious (hidden constraint, workaround, surprising behavior).
|
|
27
|
+
13. **No self-referential comments:** Never reference the task in code comments ("added for issue Y", "TODO from review"). Those belong in commits/PRs and rot as the codebase evolves.
|
|
28
|
+
14. **Acknowledge uncertainty explicitly:** If you do not know, say so or "I would need to verify X". Do not invent a plausible-sounding answer.
|
|
29
|
+
15. **Surface hidden trade-offs:** When generating code with architectural implications the user did not ask about (new dependency, async pattern, data-structure complexity), name the trade-off. Do not bury it.
|
|
30
|
+
16. **Match verification to risk:** Trivial → syntax/type check. Logic → manual trace. Concurrency/state → written scenario. Skipping verification proportional to risk is the failure mode.
|
|
31
|
+
17. **Honest status reporting:** When asked "is X done?", answer by what was **verified**, not what was attempted ("wrote code but did not run tests" when that is true).
|
|
32
|
+
|
|
33
|
+
## Stack notes
|
|
34
|
+
|
|
35
|
+
- **Phase 1:** load for `feature-developer` and parent review flows only. `debugger` / `ci-investigator` are Phase-2 reserved — ignore those agent names in the shared prose above until they ship.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Code quality and light refactoring for TypeScript MCP servers
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- shared-core: quality/code-quality-and-refactoring.md -->
|
|
7
|
+
|
|
8
|
+
# Поддержка существующего стиля
|
|
9
|
+
|
|
10
|
+
- Следовать существующим паттернам (имена, структура, типизация / DI / error handling); минимизировать стилистический шум (лишний format/rename).
|
|
11
|
+
- Перед новым решением: искать аналог и **повторять подход**; проверять дизайн‑систему / UI‑пакеты; ходить только через **public API** (deep‑импорты — повод для рефакторинга).
|
|
12
|
+
|
|
13
|
+
# Принципы
|
|
14
|
+
|
|
15
|
+
- **KISS:** самое простое изменение в паттернах репозитория.
|
|
16
|
+
- **DRY + Rule of Three:** общее — только после 3-го повторения (ошибочная абстракция дороже дублирования).
|
|
17
|
+
- **YAGNI:** без API, флагов, слоёв «на будущее» без текущего требования.
|
|
18
|
+
- **SOLID:** S — один повод менять; O — композиция/новые реализации; L — контракт подтипа; I — узкие порты; D — абстракции (порты), детали в адаптерах стека.
|
|
19
|
+
- **CUPID:** Composable; Unix philosophy (одна ответственность); Predictable; Idiomatic (репо); Domain-based.
|
|
20
|
+
- **Composition over inheritance;** Law of Demeter — без цепочек `a.b.c.d`; через public API / facade.
|
|
21
|
+
|
|
22
|
+
# Рефакторинг при изменениях
|
|
23
|
+
|
|
24
|
+
- Лёгкий refactor OK, если меньше дублирования, выше читаемость, без ломки публичных контрактов.
|
|
25
|
+
- Примеры: общая утилита/хук/mapper/use case; сузить unsafe-типы; разбить крупный модуль; токены вместо «магии»; deep‑импорт → public API.
|
|
26
|
+
- Не делать «большой» рефакторинг на точечной задаче (структура/публичные имена без запроса). Крупное — минимальными шагами; код остаётся собираемым.
|
|
27
|
+
|
|
28
|
+
# Требование к агенту
|
|
29
|
+
|
|
30
|
+
- **Boy scout:** оставлять модуль немного лучше; не жертвовать архитектурой и слоями ради краткости.
|
|
31
|
+
|
|
32
|
+
## Agent discipline (anti-sycophancy)
|
|
33
|
+
|
|
34
|
+
Essentials below. Full procedural set (~17 rules) → load **`anti-sycophancy-discipline`**.
|
|
35
|
+
|
|
36
|
+
- Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent); never invent signatures.
|
|
37
|
+
- Before «is this correct?» — ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
|
|
38
|
+
- Refactor without tests → propose characterization test; if declined, label `UNTESTED`.
|
|
39
|
+
- Comments = WHY only when non-obvious; ban self-referential «added for issue Y».
|
|
40
|
+
- Urgency/authority: name the trade-off once, then comply — no apology loops.
|
|
41
|
+
- Match verification to risk; report by what was **verified**, not attempted.
|
|
42
|
+
|
|
43
|
+
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**.
|
|
44
|
+
|
|
45
|
+
> Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
|
|
46
|
+
## Stack notes
|
|
47
|
+
|
|
48
|
+
- **No UI layer in this preset** — ignore shared-core bullets about дизайн‑система / UI‑пакеты / CSS‑токены; apply public-API and boy-scout rules to MCP registration modules and handlers.
|
|
49
|
+
- Public surface: tool/resource/prompt names + JSON Schema-compatible contracts — avoid deep imports across unrelated modules.
|
|
50
|
+
- Prefer Zod for authoring validation; MCP-facing schemas are protocol JSON Schema (SDK-supported conversion) — never pass raw Zod objects as the wire contract without verification.
|
|
51
|
+
- Unverifiable SDK usage → `// VERIFY: @modelcontextprotocol/sdk @ <version>`.
|
|
52
|
+
- Post-change gate: **`post-change-test`** + **`mcp-ts-tooling`** (repository-discovered typecheck/test — not Next lint, not Go tools, not xcodebuild).
|
|
53
|
+
- Style: project ESLint/Prettier/tsc when configured — authoritative style gate; do not duplicate formatter recipes in prose.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Code review requirements for MCP TypeScript MRs
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- shared-core: review/code-review-mr.md -->
|
|
7
|
+
|
|
8
|
+
# Code review merge requests
|
|
9
|
+
|
|
10
|
+
On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
|
|
11
|
+
|
|
12
|
+
## When to load
|
|
13
|
+
|
|
14
|
+
- User asks for review/MR/diff
|
|
15
|
+
- Pipeline step `code-reviewer`
|
|
16
|
+
- Platform automated review (e.g. BUGBOT) when present
|
|
17
|
+
|
|
18
|
+
## Checklist references (abstract)
|
|
19
|
+
|
|
20
|
+
- Architecture layers and stack core rules
|
|
21
|
+
- Public imports / module boundaries
|
|
22
|
+
- UI conventions of the stack
|
|
23
|
+
- Unit and e2e/UI test conventions
|
|
24
|
+
- Post-change lint/build gate before final report
|
|
25
|
+
- Design smells **in MR diff scope** — load `design-guidance`; не разворачивать полный каталог Fowler вне диффа
|
|
26
|
+
- Pattern name (GoF) — только если репозиторий уже использует эту форму или match минимален
|
|
27
|
+
- Principles (KISS / DRY+Ro3 / YAGNI / SOLID / CUPID) — через always-on `code-quality-and-refactoring`, не дублировать эссе в review
|
|
28
|
+
|
|
29
|
+
Concrete rule stems — in **Stack notes**.
|
|
30
|
+
|
|
31
|
+
## Constraints
|
|
32
|
+
|
|
33
|
+
- Focus on MR diff, not the whole repo.
|
|
34
|
+
- Use local `git diff` — do not invent hosting metadata.
|
|
35
|
+
- Boy scout rule: suggest fixes feasible within the MR scope.
|
|
36
|
+
- No «большие рефакторинги» without an explicit request (`code-quality-and-refactoring`).
|
|
37
|
+
|
|
38
|
+
## Output contract
|
|
39
|
+
|
|
40
|
+
Procedure details live in skill `code-review`. Required shape:
|
|
41
|
+
|
|
42
|
+
- Each finding cites **`path:line`**, the problem, impact, and a concrete fix direction.
|
|
43
|
+
- Rank by severity: **`blocker` | `important` | `nit`** (list blocker → nit).
|
|
44
|
+
- Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
|
|
45
|
+
- End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
|
|
46
|
+
## Stack notes
|
|
47
|
+
|
|
48
|
+
- Check MCP boundaries: registration vs handler vs capability; schema/contract stability; no secret leakage.
|
|
49
|
+
- Ban Playwright/XCUITest/Next-app path requirements in review comments for this stack.
|
|
50
|
+
- **Phase 1:** no `code-reviewer` agent — parent (or `/task` review-only) applies skill `code-review` and writes `review.md`. Pipeline step name `code-reviewer` is Phase 2.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Design guidance (smells & patterns) for MCP TypeScript servers
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- shared-core: quality/design-guidance.md -->
|
|
7
|
+
|
|
8
|
+
# Design guidance (smells & patterns)
|
|
9
|
+
|
|
10
|
+
Словарь **code smells** (Fowler) и **design patterns** (GoF) для агентов при implement / review / debug.
|
|
11
|
+
|
|
12
|
+
Применять только в scope задачи или MR. Лёгкий refactor — да; «большой» rewrite без явного запроса — нет.
|
|
13
|
+
|
|
14
|
+
Называть паттерн **только если** репозиторий уже так делает или это минимальный match. Иначе — extract/split/move без ярлыка GoF.
|
|
15
|
+
|
|
16
|
+
Не заменяет always-on Principles в `code-quality-and-refactoring` (KISS, DRY + Rule of Three, YAGNI, SOLID, CUPID, composition, Demeter).
|
|
17
|
+
|
|
18
|
+
## When to load
|
|
19
|
+
|
|
20
|
+
- **Feature delivery / implement** — оценка структуры модулей, границ и дублирования.
|
|
21
|
+
- **Code review** — smells и pattern fit **в диффе MR**, не по всему репо.
|
|
22
|
+
- **Debug** — root-cause похож на wrong abstraction, Feature Envy, Message Chains, Shotgun Surgery.
|
|
23
|
+
- **Light refactor only** — улучшения в рамках boy-scout / MR scope; не расширять задачу ради каталога.
|
|
24
|
+
|
|
25
|
+
Агенты и skills подгружают stem по one-liner wiring — не копировать этот каталог в промпт агента.
|
|
26
|
+
|
|
27
|
+
## How to use (agent rules of thumb)
|
|
28
|
+
|
|
29
|
+
1. Сначала сверить с Principles (always-on): проще ли решение, нет ли ранней абстракции, соблюдён ли public API.
|
|
30
|
+
2. Затем отметить smells **в изменённых файлах** задачи/MR; предложить fix только если он укладывается в light refactor.
|
|
31
|
+
3. Паттерн GoF — опциональный ярлык после того, как структура уже ясна; не начинать дизайн с выбора паттерна.
|
|
32
|
+
4. Если smell и паттерн конфликтуют с границами слоёв стека — побеждают stack boundaries и existing repo patterns.
|
|
33
|
+
5. Не требовать переименования «под GoF», если поведение уже корректно и читаемо.
|
|
34
|
+
|
|
35
|
+
## Code smells (Fowler, curated ≤12)
|
|
36
|
+
|
|
37
|
+
Таблица: smell → detect hint → fix hint (одна линия каждый). Без механических меню рефакторинга.
|
|
38
|
+
|
|
39
|
+
| # | Smell | Detect | Fix hint |
|
|
40
|
+
|---|-------|--------|----------|
|
|
41
|
+
| 1 | Duplicate Code | одинаковая логика в ≥2 местах | dedupe после Rule of Three |
|
|
42
|
+
| 2 | Long Method / Long Module | единица делает слишком много | extract в рамках scope; без big rewrite |
|
|
43
|
+
| 3 | Feature Envy | метод чаще трогает чужие данные, чем свои | сдвинуть логику к данным / public API |
|
|
44
|
+
| 4 | Data Clumps | одни и те же группы аргументов кочуют вместе | сгруппировать в type / value object |
|
|
45
|
+
| 5 | Primitive Obsession | сырые string/int вместо доменных понятий | typed ids / value objects при нужде домена |
|
|
46
|
+
| 6 | Speculative Generality | неиспользуемые хуки, флаги, абстракции «на будущее» | удалить (YAGNI) |
|
|
47
|
+
| 7 | Message Chains | цепочки `a.b.c.d` | Demeter; facade / public API модуля |
|
|
48
|
+
| 8 | Middle Man | класс почти только прокидывает вызовы | убрать pass-through **или** оставить как boundary |
|
|
49
|
+
| 9 | Divergent Change | один модуль меняется по разным причинам | split по поводам изменения |
|
|
50
|
+
| 10 | Shotgun Surgery | одно смысловое изменение разъезжается по многим файлам | consolidate ответственность |
|
|
51
|
+
| 11 | Inappropriate Intimacy | доступ к чужим internals / private деталям | только public API / ports / facades |
|
|
52
|
+
| 12 | Refused Bequest / Parallel Inheritance | подтип игнорирует базу; зеркальные иерархии классов | composition; не плодить параллельные деревья |
|
|
53
|
+
|
|
54
|
+
**Skip Fowler (не в core):** Lazy Class, Incomplete Library Class, Comments-as-smell dogma, полный каталог 70+, пошаговые recipe-меню.
|
|
55
|
+
|
|
56
|
+
Приоритет при конфликте smells: Inappropriate Intimacy и Message Chains (границы модулей) > Duplicate Code (после Rule of Three) > Long Method внутри уже правильного модуля.
|
|
57
|
+
|
|
58
|
+
## Design patterns (GoF, curated ≤8)
|
|
59
|
+
|
|
60
|
+
Suggest only when repo already uses the shape or the match is minimal. Prefer extract-function over naming Strategy ради ярлыка.
|
|
61
|
+
|
|
62
|
+
Паттерны ниже — **разрешённый минимум** для агентов; остальной GoF по умолчанию в Skip.
|
|
63
|
+
|
|
64
|
+
| Pattern | When to suggest | Anti-trigger |
|
|
65
|
+
|---------|-----------------|--------------|
|
|
66
|
+
| Strategy | взаимозаменяемые алгоритмы уже (или явно скоро) выбираются политикой | один алгоритм без ветвления политики |
|
|
67
|
+
| Adapter | обернуть внешний / чужой API под локальный port | лишняя обёртка вокруг своего же API |
|
|
68
|
+
| Facade | упростить multi-step subsystem за public API | facade превращается в god-object |
|
|
69
|
+
| Factory Method | полиморфное создание уже принято в стиле репо | factory на каждый тривиальный `new` |
|
|
70
|
+
| Decorator | аддитивное поведение без взрыва subclass-иерархий | decorator «для слоёв» без реальной нужды |
|
|
71
|
+
| Observer | events / subscriptions уже есть в архитектуре | самодельный pub/sub без прецедента в репо |
|
|
72
|
+
| Template Method | общий algorithm skeleton + вариативные hooks | наследование ради пары отличающихся строк |
|
|
73
|
+
| Composite | дерево однородных узлов (UI/domain), как уже в репо | Composite на плоский список без иерархии |
|
|
74
|
+
|
|
75
|
+
Если сомневаешься между двумя паттернами — выбери более простой extract/compose без имени; ярлык можно добавить на review, если репо уже так говорит.
|
|
76
|
+
|
|
77
|
+
## Skip / avoid by default
|
|
78
|
+
|
|
79
|
+
| Catalog | Skip |
|
|
80
|
+
|---------|------|
|
|
81
|
+
| GoF | Singleton, Abstract Factory, Flyweight, Memento, Interpreter, Visitor, Bridge, Prototype |
|
|
82
|
+
| GoF (conditional) | Command, Chain of Responsibility, State — упоминать **только если** репо уже использует |
|
|
83
|
+
| Fowler | всё сверх 12 smells выше |
|
|
84
|
+
| DDD | Aggregates, bounded-context maps, event sourcing, CQRS — **не в core** |
|
|
85
|
+
| DDD (pointer) | ubiquitous language anti-pattern — расширять в `feature-delivery-workflow`, не здесь |
|
|
86
|
+
| GRASP | список Larman как отдельные правила — skip (перекрывается SOLID/CUPID) |
|
|
87
|
+
| Clean Code dogma | жёсткие caps на строки функции / «ровно один assert» — skip |
|
|
88
|
+
|
|
89
|
+
Не вводить второй stem (`refactoring-smells` / `design-patterns-for-agents`) — один каталог: `design-guidance`.
|
|
90
|
+
|
|
91
|
+
## Out of scope for this stem
|
|
92
|
+
|
|
93
|
+
- Полный GoF (23) и полный Fowler catalog.
|
|
94
|
+
- Stack-specific рецепты (пути модулей, lint-команды) — только в **Stack notes** адаптера.
|
|
95
|
+
- Security, a11y, perf — отдельные review-правила; здесь только структурные smells/patterns.
|
|
96
|
+
- Четвёртое always-on правило — запрещено; этот stem только requestable / agent-load.
|
|
97
|
+
|
|
98
|
+
## Cross-refs
|
|
99
|
+
|
|
100
|
+
- Always-on Principles: `code-quality-and-refactoring`.
|
|
101
|
+
- DIP / ports vs adapters: stack `architecture-boundaries` (детали стека — в Stack notes адаптеров).
|
|
102
|
+
- Ubiquitous language: `feature-delivery-workflow` (lineage).
|
|
103
|
+
- MR checklist (smells in scope; pattern name only if repo uses it): `code-review-mr`.
|
|
104
|
+
- Token / twin policy for authors: `preset-token-budget`, `preset-twin-sync` (meta, not consumer always-on).
|
|
105
|
+
## Stack notes
|
|
106
|
+
|
|
107
|
+
- Apply smells to MCP registration modules, handlers, and schema duplication — not UI components.
|
|
108
|
+
- Prefer extract-handler / extract-schema over introducing hexagonal layers the repo does not use.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: End-to-end delivery checklist for TypeScript MCP features
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- shared-core: architecture/feature-delivery-workflow.md -->
|
|
7
|
+
|
|
8
|
+
# Feature delivery (TypeScript MCP)
|
|
9
|
+
|
|
10
|
+
Order of work:
|
|
11
|
+
|
|
12
|
+
1. **Contract** — tool/resource/prompt name, description, input/output shape (`mcp-tool-design`).
|
|
13
|
+
2. **Schema** — Zod authoring + JSON Schema-compatible registration (`mcp-ts-conventions`).
|
|
14
|
+
3. **Handler** — validated inputs → scoped capability → safe result/error mapping.
|
|
15
|
+
4. **Registration** — wire into server modules; keep entry (`src/index.ts`) free of tool business logic.
|
|
16
|
+
5. **Tests** — unit + contract fixtures (`tests-unit`, `mcp-contract-testing`).
|
|
17
|
+
6. **Package validation** — typecheck/test; optional Inspector smoke; `bin`/entry OK (`mcp-transport-packaging`).
|
|
18
|
+
7. **Gate** — `post-change-test` (+ `mcp-ts-tooling`).
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart LR
|
|
22
|
+
C[Contract] --> S[Schema]
|
|
23
|
+
S --> H[Handler]
|
|
24
|
+
H --> R[Register]
|
|
25
|
+
R --> T[Unit/contract tests]
|
|
26
|
+
T --> P[Package validate]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Matrix
|
|
30
|
+
|
|
31
|
+
| Path | Rules |
|
|
32
|
+
|------|-------|
|
|
33
|
+
| `src/tools/**`, `src/resources/**`, `src/prompts/**` | `mcp-tool-design`, `mcp-server-boundaries` |
|
|
34
|
+
| schemas / validation | `mcp-ts-conventions`, `mcp-contract-testing` |
|
|
35
|
+
| `src/index.ts`, package `bin` | `mcp-transport-packaging` |
|
|
36
|
+
| auth/config | `mcp-auth-secrets`, `security-mcp` |
|
|
37
|
+
| After `*.ts` edits | `post-change-test` |
|
|
38
|
+
|
|
39
|
+
## Anti-patterns
|
|
40
|
+
|
|
41
|
+
- Monolithic `index.ts`; unscoped shell/FS tools; inventing SDK APIs; skipping schema tests "for speed".
|
|
42
|
+
- Prescribing Go hexagonal folders or Next `app/src/**`.
|
|
43
|
+
- Load `design-guidance` when assessing structure, smells, or pattern fit.
|