agents-templated 2.1.0 → 2.2.1

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/agents-templated.svg)](https://www.npmjs.com/package/agents-templated)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/agents-templated.svg)](https://www.npmjs.com/package/agents-templated)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![GitHub stars](https://img.shields.io/github/stars/rickandrew2/agents-projects-templated?style=social)](https://github.com/rickandrew2/agents-templated)
6
+ [![GitHub stars](https://img.shields.io/github/stars/rickandrew2/agents-templated?style=social)](https://github.com/rickandrew2/agents-templated)
7
7
 
8
8
  > **Agents Templated** is a CLI tool and npm package that instantly scaffolds production-ready project structures with enterprise-grade development patterns, security guidelines, and AI assistant configurations. Designed for developers who want to start projects the right way—with proven OWASP security practices, comprehensive testing strategies (80/15/5 coverage targets), and agent-based architecture patterns—without being locked into specific frameworks. It generates unified configuration files that work seamlessly with Cursor, GitHub Copilot, Claude, and Google Gemini, allowing AI assistants to automatically follow best practices from day one. Whether you're building a Next.js app, Django API, Go microservice, or any custom stack, Agents Templated provides the guardrails and patterns you need while giving you complete freedom to choose your technology.
9
9
 
@@ -28,13 +28,13 @@ Agents Templated scaffolds your project with:
28
28
  - Deterministic slash-command standard in `AGENTS.MD` and modular contracts in `agents/commands/`
29
29
  - Implicit natural-language routing support (`slash-command-auto`) for non-technical prompts
30
30
  - New workflow/routing/hardening rule set:
31
- - `agents/rules/intent-routing.mdc`
32
- - `agents/rules/system-workflow.mdc`
33
- - `agents/rules/hardening.mdc`
31
+ - `.github/instructions/rules/intent-routing.mdc`
32
+ - `.github/instructions/rules/system-workflow.mdc`
33
+ - `.github/instructions/rules/hardening.mdc`
34
34
  - New baseline skills:
35
- - `agents/skills/feature-delivery/`
36
- - `agents/skills/bug-triage/`
37
- - `agents/skills/app-hardening/`
35
+ - `.github/skills/feature-delivery/`
36
+ - `.github/skills/bug-triage/`
37
+ - `.github/skills/app-hardening/`
38
38
  - Release and audit contracts now require hardening evidence when risk profile requires it
39
39
 
40
40
  ---
@@ -124,7 +124,7 @@ Agents Templated automatically configures compatible wrappers for major AI codin
124
124
  | **Claude** | `CLAUDE.md` | ✅ Compatible |
125
125
  | **Generic agents** | `AGENTS.MD` | ✅ Compatible |
126
126
 
127
- **Single source of truth:** `instructions/source/core.md` drives generated tool-compatible instruction files.
127
+ **Single source of truth:** `CLAUDE.md` drives generated tool-compatible instruction files.
128
128
 
129
129
  ---
130
130
 
@@ -421,7 +421,7 @@ await agentsTemplated.install('./my-project', {
421
421
 
422
422
  When contributing to this template:
423
423
  1. Maintain technology-agnostic patterns
424
- 2. Update relevant rule files in `agents/rules/`
424
+ 2. Update relevant rule files in `.github/instructions/rules/`
425
425
  3. Keep documentation synchronized with code changes
426
426
  4. Follow security and testing patterns
427
427
  5. Ensure AI assistant configurations remain compatible
package/bin/cli.js CHANGED
@@ -10,6 +10,7 @@ const {
10
10
  LAYOUT,
11
11
  resolveRulesDir,
12
12
  resolveSkillsDir,
13
+ resolveSubagentsDir,
13
14
  hasAnyLayout,
14
15
  getLegacyMigrationPlan
15
16
  } = require('../lib/layout');
@@ -19,7 +20,8 @@ const {
19
20
  writeGeneratedInstructions,
20
21
  validateInstructionDrift,
21
22
  scaffoldSkill,
22
- scaffoldRule
23
+ scaffoldRule,
24
+ scaffoldSubagent
23
25
  } = require('../lib/instructions');
24
26
 
25
27
  // Resolve the templates directory - works in both dev and installed contexts
@@ -52,6 +54,7 @@ program
52
54
  .option('-r, --rules', 'Install agent rules only')
53
55
  .option('-s, --skills', 'Install skills only')
54
56
  .option('-g, --github', 'Install GitHub Copilot instructions')
57
+ .option('-S, --subagents', 'Install agent subagents only')
55
58
  .option('-p, --preset <name>', 'Use a preset configuration (nextjs, django-react, express-api, fastapi, go-api)')
56
59
  .option('-f, --force', 'Overwrite existing files')
57
60
  .action(async (options) => {
@@ -121,7 +124,8 @@ program
121
124
  { name: 'Documentation files (agent-docs/)', value: 'docs' },
122
125
  { name: 'Agent rules (.github/instructions/rules/*.mdc)', value: 'rules' },
123
126
  { name: 'Skills (.github/skills/*)', value: 'skills' },
124
- { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github' }
127
+ { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github' },
128
+ { name: 'Agent subagents (.claude/agents/*.md)', value: 'subagents' }
125
129
  ],
126
130
  default: ['all']
127
131
  },
@@ -143,6 +147,7 @@ program
143
147
  if (options.rules) choices.push('rules');
144
148
  if (options.skills) choices.push('skills');
145
149
  if (options.github) choices.push('github');
150
+ if (options.subagents) choices.push('subagents');
146
151
  }
147
152
 
148
153
  const installAll = choices.includes('all');
@@ -185,9 +190,21 @@ program
185
190
  await writeGeneratedInstructions(targetDir, templateDir, options.force);
186
191
  console.log(chalk.gray(' ✓ Claude (CLAUDE.md — canonical source)'));
187
192
  console.log(chalk.gray(' ✓ GitHub Copilot (.github/copilot-instructions.md pointer)'));
193
+ console.log(chalk.gray(' ✓ Cursor (.cursorrules pointer)'));
188
194
  console.log(chalk.gray(' ✓ Generic AGENTS (AGENTS.MD pointer)'));
189
195
  }
190
196
 
197
+ // Install agent subagents
198
+ if (installAll || choices.includes('subagents')) {
199
+ console.log(chalk.yellow('Installing agent subagents...'));
200
+ await fs.ensureDir(path.join(targetDir, LAYOUT.canonical.subagentsDir));
201
+ await copyDirectory(
202
+ path.join(templateDir, '.claude', 'agents'),
203
+ path.join(targetDir, LAYOUT.canonical.subagentsDir),
204
+ options.force
205
+ );
206
+ }
207
+
191
208
  console.log(chalk.green.bold('\nInstallation complete!\n'));
192
209
  console.log(chalk.cyan('Next steps:'));
193
210
  console.log(chalk.white(' 1. Review CLAUDE.md (canonical AI policy — edit this directly)'));
@@ -240,7 +257,8 @@ program
240
257
  { name: 'Documentation (agent-docs/)', value: 'docs' },
241
258
  { name: 'Agent Rules (security, testing, database, etc.)', value: 'rules' },
242
259
  { name: 'Skills (reusable agent capabilities)', value: 'skills' },
243
- { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github' }
260
+ { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github' },
261
+ { name: 'Agent subagents (.claude/agents/*.md)', value: 'subagents' }
244
262
  ],
245
263
  validate: (answer) => {
246
264
  if (answer.length === 0) {
@@ -276,7 +294,8 @@ program
276
294
  { name: 'Documentation (agent-docs/)', value: 'docs', checked: true },
277
295
  { name: 'Agent Rules (security, testing, database, etc.)', value: 'rules', checked: true },
278
296
  { name: 'Skills (reusable agent capabilities)', value: 'skills', checked: true },
279
- { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github', checked: true }
297
+ { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github', checked: true },
298
+ { name: 'Agent subagents (.claude/agents/*.md)', value: 'subagents', checked: true }
280
299
  ],
281
300
  validate: (answer) => {
282
301
  if (answer.length === 0) {
@@ -301,7 +320,8 @@ program
301
320
  docs: componentAnswers.components.includes('docs'),
302
321
  rules: componentAnswers.components.includes('rules'),
303
322
  skills: componentAnswers.components.includes('skills'),
304
- github: componentAnswers.components.includes('github')
323
+ github: componentAnswers.components.includes('github'),
324
+ subagents: componentAnswers.components.includes('subagents')
305
325
  };
306
326
 
307
327
  // Install documentation files
@@ -345,6 +365,17 @@ program
345
365
  console.log(chalk.gray(' ✓ Generic AGENTS (AGENTS.MD pointer)'));
346
366
  }
347
367
 
368
+ // Install agent subagents
369
+ if (options.subagents) {
370
+ console.log(chalk.yellow('Installing agent subagents...'));
371
+ await fs.ensureDir(path.join(targetDir, LAYOUT.canonical.subagentsDir));
372
+ await copyDirectory(
373
+ path.join(templateDir, '.claude', 'agents'),
374
+ path.join(targetDir, LAYOUT.canonical.subagentsDir),
375
+ options.force
376
+ );
377
+ }
378
+
348
379
  // Show summary and next steps
349
380
  console.log(chalk.green.bold('\n✅ Installation complete!\n'));
350
381
 
@@ -375,6 +406,7 @@ program
375
406
  console.log(chalk.yellow('rules') + ' - Agent rules (.github/instructions/rules/*.mdc)');
376
407
  console.log(chalk.yellow('skills') + ' - Agent skills (.github/skills/*)');
377
408
  console.log(chalk.yellow('github') + ' - AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)');
409
+ console.log(chalk.yellow('subagents') + ' - Agent subagents (.claude/agents/*.md)');
378
410
  console.log(chalk.yellow('all') + ' - All components');
379
411
 
380
412
  console.log(chalk.blue.bold('\n\nAvailable Presets:\n'));
@@ -462,6 +494,15 @@ program
462
494
  warnings.push(`⚠ ${LAYOUT.canonical.skillsDir} directory missing - run 'agents-templated init --skills'`);
463
495
  }
464
496
 
497
+ // Check subagents
498
+ const subagentsDir = path.join(targetDir, LAYOUT.canonical.subagentsDir);
499
+ if (await fs.pathExists(subagentsDir)) {
500
+ const subagents = (await fs.readdir(subagentsDir)).filter(f => f.endsWith('.md') && f !== 'README.md');
501
+ passed.push(`✓ ${subagents.length} subagents installed in ${LAYOUT.canonical.subagentsDir}`);
502
+ } else {
503
+ warnings.push(`⚠ ${LAYOUT.canonical.subagentsDir} directory missing - run 'agents-templated init --subagents'`);
504
+ }
505
+
465
506
  // Check instruction pointer files and drift
466
507
  const instructionDrift = await validateInstructionDrift(targetDir);
467
508
  if (instructionDrift.missingCanonical) {
@@ -613,7 +654,6 @@ async function cleanupLegacyInstructionFiles(targetDir) {
613
654
  // Files removed in v2.0.0: orphaned wrappers that contained duplicated policy
614
655
  // content and were not managed/validated by the generator.
615
656
  const legacyFiles = [
616
- '.cursorrules',
617
657
  '.github/instructions/AGENTS.md',
618
658
  // Pre-v1.2.13 paths
619
659
  '.claude/CLAUDE.md'
@@ -630,7 +670,7 @@ async function cleanupLegacyInstructionFiles(targetDir) {
630
670
 
631
671
  async function updateSelectedComponents(targetDir, templateDir, selectedComponents, overwrite = true) {
632
672
  const components = selectedComponents.includes('all')
633
- ? ['docs', 'rules', 'skills', 'github']
673
+ ? ['docs', 'rules', 'skills', 'github', 'subagents']
634
674
  : selectedComponents;
635
675
 
636
676
  if (components.includes('docs')) {
@@ -670,6 +710,16 @@ async function updateSelectedComponents(targetDir, templateDir, selectedComponen
670
710
  await cleanupLegacyInstructionFiles(targetDir);
671
711
  }
672
712
 
713
+ if (components.includes('subagents')) {
714
+ console.log(chalk.yellow('Updating agent subagents...'));
715
+ await fs.ensureDir(path.join(targetDir, LAYOUT.canonical.subagentsDir));
716
+ await copyDirectory(
717
+ path.join(templateDir, '.claude', 'agents'),
718
+ path.join(targetDir, LAYOUT.canonical.subagentsDir),
719
+ overwrite
720
+ );
721
+ }
722
+
673
723
  if ((components.includes('docs') || components.includes('github')) && !components.includes('github')) {
674
724
  await writeGeneratedInstructions(targetDir, templateDir, overwrite);
675
725
  }
@@ -704,6 +754,7 @@ program
704
754
  .option('-r, --rules', 'Update agent rules only')
705
755
  .option('-s, --skills', 'Update skills only')
706
756
  .option('-g, --github', 'Update AI agent instruction files only')
757
+ .option('-S, --subagents', 'Update agent subagents only')
707
758
  .option('-c, --check-only', 'Only check for updates, don\'t install')
708
759
  .option('-f, --force', 'Force overwrite files during update')
709
760
  .action(async (options) => {
@@ -763,6 +814,7 @@ program
763
814
  if (options.all || options.rules) selectedComponents.push('rules');
764
815
  if (options.all || options.skills) selectedComponents.push('skills');
765
816
  if (options.all || options.github) selectedComponents.push('github');
817
+ if (options.all || options.subagents) selectedComponents.push('subagents');
766
818
 
767
819
  console.log(chalk.blue('📦 Updating selected components...\n'));
768
820
 
@@ -977,6 +1029,22 @@ program
977
1029
  }
978
1030
  });
979
1031
 
1032
+ program
1033
+ .command('new-subagent <name>')
1034
+ .description('Scaffold a new subagent in .claude/agents/<name>.md')
1035
+ .action(async (name) => {
1036
+ try {
1037
+ const targetDir = process.cwd();
1038
+ const relPath = await scaffoldSubagent(targetDir, name);
1039
+ console.log(chalk.green(`\n+ ${relPath}\n`));
1040
+ console.log(chalk.gray('Fill in Activation Conditions, Workflow, and Output Format.'));
1041
+ console.log(chalk.gray('Then add it to the Subagent modules table in CLAUDE.md.\n'));
1042
+ } catch (error) {
1043
+ console.error(chalk.red('Error:'), error.message);
1044
+ process.exit(1);
1045
+ }
1046
+ });
1047
+
980
1048
  program.parse(process.argv);
981
1049
 
982
1050
  // Show help if no command provided
package/index.js CHANGED
@@ -16,12 +16,13 @@ const { CANONICAL_INSTRUCTION_FILE, writeGeneratedInstructions } = require('./li
16
16
  * @param {boolean} options.rules - Install agent rules
17
17
  * @param {boolean} options.skills - Install skills
18
18
  * @param {boolean} options.github - Install GitHub Copilot instructions
19
+ * @param {boolean} options.subagents - Install agent subagents
19
20
  * @param {boolean} options.force - Overwrite existing files
20
21
  * @returns {Promise<void>}
21
22
  */
22
23
  async function install(targetDir, options = {}) {
23
24
  const templateDir = path.join(__dirname, 'templates');
24
- const installAll = !options.docs && !options.rules && !options.skills && !options.github;
25
+ const installAll = !options.docs && !options.rules && !options.skills && !options.github && !options.subagents;
25
26
 
26
27
  const files = [];
27
28
 
@@ -73,6 +74,16 @@ async function install(targetDir, options = {}) {
73
74
  await fs.ensureDir(path.join(targetDir, '.github', 'instructions'));
74
75
  await writeGeneratedInstructions(targetDir, templateDir, options.force);
75
76
  }
77
+
78
+ // Agent subagents (.claude/agents/)
79
+ if (installAll || options.subagents) {
80
+ await fs.ensureDir(path.join(targetDir, '.claude', 'agents'));
81
+ await copyDirectory(
82
+ path.join(templateDir, '.claude', 'agents'),
83
+ path.join(targetDir, '.claude', 'agents'),
84
+ options.force
85
+ );
86
+ }
76
87
  }
77
88
 
78
89
  async function copyDirectory(sourceDir, targetDir, force = false) {
@@ -7,7 +7,8 @@ const CANONICAL_INSTRUCTION_FILE = 'CLAUDE.md';
7
7
  // Thin compatibility pointer files — policy lives in CLAUDE.md, not here.
8
8
  const POINTER_FILES = {
9
9
  agents: 'AGENTS.MD',
10
- copilot: '.github/copilot-instructions.md'
10
+ copilot: '.github/copilot-instructions.md',
11
+ cursor: '.cursorrules'
11
12
  };
12
13
 
13
14
  function buildAgentsPointer() {
@@ -31,6 +32,17 @@ function buildCopilotPointer() {
31
32
  ].join('\n');
32
33
  }
33
34
 
35
+ function buildCursorPointer() {
36
+ return [
37
+ '<!-- Tool profile: cursor-compat -->',
38
+ '# Cursor Rules',
39
+ '',
40
+ 'Primary policy source: `CLAUDE.md`.',
41
+ 'Load policy only from the canonical source file above.',
42
+ 'If this file and CLAUDE.md conflict, CLAUDE.md wins.'
43
+ ].join('\n');
44
+ }
45
+
34
46
  async function writeGeneratedInstructions(targetDir, templateDir, force = false) {
35
47
  // Copy CLAUDE.md from template if not present (or forced)
36
48
  const targetClaude = path.join(targetDir, CANONICAL_INSTRUCTION_FILE);
@@ -42,7 +54,8 @@ async function writeGeneratedInstructions(targetDir, templateDir, force = false)
42
54
  // Write thin pointer files
43
55
  const pointers = {
44
56
  [POINTER_FILES.agents]: buildAgentsPointer(),
45
- [POINTER_FILES.copilot]: buildCopilotPointer()
57
+ [POINTER_FILES.copilot]: buildCopilotPointer(),
58
+ [POINTER_FILES.cursor]: buildCursorPointer()
46
59
  };
47
60
 
48
61
  for (const [relPath, content] of Object.entries(pointers)) {
@@ -63,7 +76,8 @@ async function validateInstructionDrift(targetDir) {
63
76
  const driftFiles = [];
64
77
  const expectedPointers = {
65
78
  [POINTER_FILES.agents]: buildAgentsPointer(),
66
- [POINTER_FILES.copilot]: buildCopilotPointer()
79
+ [POINTER_FILES.copilot]: buildCopilotPointer(),
80
+ [POINTER_FILES.cursor]: buildCursorPointer()
67
81
  };
68
82
 
69
83
  for (const [relPath, expectedContent] of Object.entries(expectedPointers)) {
@@ -157,11 +171,53 @@ async function scaffoldRule(targetDir, ruleName) {
157
171
  return `agents/rules/${ruleName}.mdc`;
158
172
  }
159
173
 
174
+ async function scaffoldSubagent(targetDir, name) {
175
+ const subagentFile = path.join(targetDir, '.claude', 'agents', `${name}.md`);
176
+
177
+ if (await fs.pathExists(subagentFile)) {
178
+ throw new Error(`Subagent already exists: .claude/agents/${name}.md`);
179
+ }
180
+
181
+ const title = name.split('-').map(w => w[0].toUpperCase() + w.slice(1)).join(' ');
182
+ const content = [
183
+ `---`,
184
+ `name: ${name}`,
185
+ `description: TODO — describe when this subagent should activate.`,
186
+ `tools: ["Read", "Grep", "Glob"]`,
187
+ `model: claude-sonnet-4-5`,
188
+ `---`,
189
+ ``,
190
+ `# ${title}`,
191
+ ``,
192
+ `## Activation Conditions`,
193
+ ``,
194
+ `- TODO — when should this subagent activate?`,
195
+ ``,
196
+ `## Workflow`,
197
+ ``,
198
+ `1. TODO`,
199
+ ``,
200
+ `## Output Format`,
201
+ ``,
202
+ `- TODO`,
203
+ ``,
204
+ `## Guardrails`,
205
+ ``,
206
+ `- Do not override security or testing constraints.`,
207
+ ``
208
+ ].join('\n');
209
+
210
+ await fs.ensureDir(path.dirname(subagentFile));
211
+ await fs.writeFile(subagentFile, content, 'utf8');
212
+ return `.claude/agents/${name}.md`;
213
+ }
214
+
160
215
  module.exports = {
161
216
  CANONICAL_INSTRUCTION_FILE,
162
217
  POINTER_FILES,
163
218
  writeGeneratedInstructions,
164
219
  validateInstructionDrift,
165
220
  scaffoldSkill,
166
- scaffoldRule
221
+ scaffoldRule,
222
+ scaffoldSubagent
167
223
  };
package/lib/layout.js CHANGED
@@ -5,7 +5,8 @@ const LAYOUT = {
5
5
  canonical: {
6
6
  docsDir: 'agent-docs',
7
7
  rulesDir: '.github/instructions/rules',
8
- skillsDir: '.github/skills'
8
+ skillsDir: '.github/skills',
9
+ subagentsDir: '.claude/agents'
9
10
  },
10
11
  legacy: {
11
12
  rulesDirs: ['agents/rules'],
@@ -39,10 +40,17 @@ function resolveSkillsDir(baseDir) {
39
40
  return firstExistingPath(baseDir, candidates) || LAYOUT.canonical.skillsDir;
40
41
  }
41
42
 
43
+ function resolveSubagentsDir(baseDir) {
44
+ const candidates = [LAYOUT.canonical.subagentsDir, 'agents/subagents'];
45
+ return firstExistingPath(baseDir, candidates) || LAYOUT.canonical.subagentsDir;
46
+ }
47
+
42
48
  async function hasAnyLayout(baseDir) {
43
49
  const checks = [
44
50
  path.join(baseDir, LAYOUT.canonical.rulesDir),
45
51
  path.join(baseDir, LAYOUT.canonical.skillsDir),
52
+ path.join(baseDir, LAYOUT.canonical.subagentsDir),
53
+ path.join(baseDir, 'agents', 'subagents'),
46
54
  ...LAYOUT.compatible.rulesDirs.map((relPath) => path.join(baseDir, relPath)),
47
55
  ...LAYOUT.compatible.skillsDirs.map((relPath) => path.join(baseDir, relPath)),
48
56
  ...LAYOUT.legacy.rulesDirs.map((relPath) => path.join(baseDir, relPath)),
@@ -90,6 +98,7 @@ module.exports = {
90
98
  LAYOUT,
91
99
  resolveRulesDir,
92
100
  resolveSkillsDir,
101
+ resolveSubagentsDir,
93
102
  hasAnyLayout,
94
103
  getLegacyMigrationPlan
95
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-templated",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "Technology-agnostic development template with multi-AI agent support (Cursor, Copilot, VSCode, Gemini), security-first patterns, and comprehensive testing guidelines",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,76 @@
1
+ # Subagents
2
+
3
+ Subagents are bounded agent processes that your orchestrator (main AI) can delegate tasks to with limited scope. Each subagent is defined as a single Markdown file with YAML frontmatter specifying its tools, model, and activation conditions.
4
+
5
+ ## What Are Subagents?
6
+
7
+ - **Limited scope** — each subagent has one primary job and restricted tool access
8
+ - **Delegatable** — the orchestrator assigns tasks and subagents execute autonomously
9
+ - **Composable** — subagents work alongside skills; a subagent can invoke skills within its scope
10
+ - **Tool profile: copilot-compat** — YAML frontmatter is read natively by Claude Code; other tools treat the file as plain instructions
11
+
12
+ ## Available Subagents
13
+
14
+ | Subagent | Model | Purpose |
15
+ |----------|-------|---------|
16
+ | `planner` | opus | Break down features into phased, ordered implementation plans |
17
+ | `architect` | opus | System design, ADRs, scalability trade-off analysis |
18
+ | `tdd-guide` | sonnet | Write tests first — Red-Green-Refactor lifecycle |
19
+ | `code-reviewer` | sonnet | Quality review with CRITICAL/HIGH/MEDIUM/LOW severity |
20
+ | `security-reviewer` | sonnet | OWASP Top 10 scan, secrets detection, auth review |
21
+ | `build-error-resolver` | sonnet | Fix build/type errors with minimal diff, no refactoring |
22
+ | `e2e-runner` | sonnet | Execute Playwright E2E test suites and report results |
23
+ | `refactor-cleaner` | sonnet | Remove dead code, unused deps, orphaned exports |
24
+ | `doc-updater` | haiku | Sync README, API docs, and codemaps after code changes |
25
+
26
+ ## Model Selection Guide
27
+
28
+ | Model | When to use |
29
+ |-------|------------|
30
+ | `claude-opus-4-5` | Complex reasoning: feature planning, architecture decisions |
31
+ | `claude-sonnet-4-5` | Balanced: code review, security scan, testing, build fixes |
32
+ | `claude-haiku-4-5` | Lightweight: documentation sync, simple transformations |
33
+
34
+ ## Invocation
35
+
36
+ ### Claude Code (native)
37
+ Subagents are invoked automatically based on `description` matching, or explicitly:
38
+ ```
39
+ /planner Build a multi-tenant authentication system
40
+ /code-reviewer Review the changes in src/auth/
41
+ ```
42
+
43
+ ### Other tools (Copilot, Cursor, Windsurf)
44
+ Reference the subagent file directly in your prompt or instruct your AI to follow the workflow defined in `.claude/agents/<name>.md`.
45
+
46
+ ## File Structure
47
+
48
+ ```
49
+ .claude/agents/
50
+ ├── README.md ← This file
51
+ ├── planner.md
52
+ ├── architect.md
53
+ ├── tdd-guide.md
54
+ ├── code-reviewer.md
55
+ ├── security-reviewer.md
56
+ ├── build-error-resolver.md
57
+ ├── e2e-runner.md
58
+ ├── refactor-cleaner.md
59
+ └── doc-updater.md
60
+ ```
61
+
62
+ ## Adding a New Subagent
63
+
64
+ ```bash
65
+ agents-templated new-subagent <name>
66
+ ```
67
+
68
+ Then add it to the Reference Index in `CLAUDE.md`.
69
+
70
+ ## Guardrails
71
+
72
+ All subagents inherit the constraints from `CLAUDE.md`:
73
+ - Security and testing rules are non-overrideable
74
+ - Destructive actions require `CONFIRM-DESTRUCTIVE:<target>`
75
+ - Subagents must stop and report on failure, never silently retry
76
+ - No subagent may expose secrets, credentials, or PII
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: architect
3
+ description: Use when making significant system design decisions, evaluating architectural trade-offs, or producing Architecture Decision Records (ADRs) for a new or evolving system.
4
+ tools: ["Read", "Grep", "Glob"]
5
+ model: claude-opus-4-5
6
+ ---
7
+
8
+ # Architect
9
+
10
+ You are a system design agent. Your job is to reason deeply about architectural decisions, evaluate trade-offs, and produce durable Architecture Decision Records (ADRs) — not to write implementation code.
11
+
12
+ ## Activation Conditions
13
+
14
+ Invoke this subagent when:
15
+ - Designing a new system, service, or major module from scratch
16
+ - Evaluating whether to refactor, replace, or extend existing architecture
17
+ - Choosing between architectural patterns (monolith vs microservices, REST vs GraphQL, etc.)
18
+ - Producing a formal ADR for a significant decision
19
+ - Planning for scalability (10K → 100K → 1M users)
20
+
21
+ ## Workflow
22
+
23
+ ### 1. Understand context
24
+ - Read existing architecture docs, README, and key source files
25
+ - Identify: current stack, team constraints, performance requirements, security posture
26
+ - Clarify the decision trigger: what problem is this architecture solving?
27
+
28
+ ### 2. Identify architectural options
29
+ - Enumerate 2-4 realistic alternatives (including "keep current" where applicable)
30
+ - For each option: describe the approach in 2-3 sentences
31
+
32
+ ### 3. Trade-off analysis
33
+ For each option, evaluate:
34
+ - **Pros**: concrete advantages
35
+ - **Cons**: concrete disadvantages, risks
36
+ - **Cost**: implementation effort, operational overhead
37
+ - **Fit**: how well it matches current constraints
38
+
39
+ ### 4. Scalability projection
40
+ - Describe behavior at current scale, 10× scale, 100× scale
41
+ - Identify the likely bottleneck at each level
42
+ - Recommend the inflection point where architecture should change
43
+
44
+ ### 5. Decision and ADR
45
+ - State the recommended option and primary rationale
46
+ - Produce a formal ADR in the standard format
47
+
48
+ ### 6. Implementation guidance
49
+ - List the highest-priority first steps to realize the architecture
50
+ - Flag dependencies and sequencing constraints
51
+
52
+ ## Output Format
53
+
54
+ ```
55
+ ## Context
56
+ {What problem is being solved and why now}
57
+
58
+ ## Options Considered
59
+
60
+ ### Option A: {name}
61
+ {2-3 sentence description}
62
+ - Pros: ...
63
+ - Cons: ...
64
+ - Estimated effort: {Low/Med/High}
65
+
66
+ ### Option B: {name}
67
+ ...
68
+
69
+ ## Trade-off Matrix
70
+ | Criterion | Option A | Option B | Option C |
71
+ |-----------|---------|---------|---------|
72
+ | Scalability | ... | ... | ... |
73
+ | Complexity | ... | ... | ... |
74
+ | Security | ... | ... | ... |
75
+ | Ops burden | ... | ... | ... |
76
+
77
+ ## Scalability Projection
78
+ - Current scale (~{N} users/req): {behavior}
79
+ - 10× scale: {behavior, bottleneck}
80
+ - 100× scale: {behavior, bottleneck, recommended change}
81
+
82
+ ## Architecture Decision Record (ADR)
83
+
84
+ **Title**: {short imperative title}
85
+ **Status**: Proposed
86
+ **Date**: {today}
87
+
88
+ **Decision**: {one paragraph — what was decided and why}
89
+
90
+ **Consequences**:
91
+ - Positive: ...
92
+ - Negative: ...
93
+ - Neutral: ...
94
+
95
+ ## First Steps
96
+ 1. ...
97
+ 2. ...
98
+ ```
99
+
100
+ ## Guardrails
101
+
102
+ - Do not write implementation code — produce architecture artifacts only
103
+ - Every decision that affects auth, data storage, or external APIs must include a security consideration
104
+ - Call out single points of failure explicitly
105
+ - Do not recommend an option without stating its primary downside
106
+ - If the existing architecture is already appropriate, say so clearly — do not engineer for the sake of it