Unit Brief: Claude Code Installer
The Claude Code Installer handles installation of specsmd to Claude Code, including both slash commands (.claude/commands/) and agents (.claude/agents/).
The Claude Code Installer handles installation of specsmd to Claude Code, including both slash commands (.claude/commands/) and agents (.claude/agents/).
The Claude Code Installer handles installation of specsmd to Claude Code, including both slash commands (`.claude/commands/`) and agents (`.claude/agents/`).
---
---
src/lib/installers/
└── ClaudeInstaller.jssrc/flows/aidlc/
└── commands/ ← Serves as both commands and agents
├── master-agent.md
├── inception-agent.md
├── construction-agent.md
└── operations-agent.mdproject-root/
└── .claude/
├── commands/ ← Slash commands
│ ├── specsmd-master-agent.md → /specsmd-master-agent
│ ├── specsmd-inception-agent.md
│ ├── specsmd-construction-agent.md
│ └── specsmd-operations-agent.md
│
└── agents/ ← Agents
├── specsmd-master-agent.md
├── specsmd-inception-agent.md
├── specsmd-construction-agent.md
└── specsmd-operations-agent.md---
Extends `ToolInstaller` and overrides `installCommands()` to also install agents.
| Property | Value | Description | |----------|-------|-------------| | `key` | `'claude'` | Unique identifier for factory lookup | | `name` | `'Claude Code'` | Display name in CLI | | `commandsDir` | `'.claude/commands'` | Where to install command files | | `agentsDir` | `'.claude/agents'` | Where to install agent files | | `detectPath` | `'.claude'` | Directory to check for detection |
Claude Code is detected if `.claude/` directory exists in the project root.
const ToolInstaller = require('./ToolInstaller');
const fs = require('fs-extra');
const path = require('path');
class ClaudeInstaller extends ToolInstaller {
get key() { return 'claude'; }
get name() { return 'Claude Code'; }
get commandsDir() { return '.claude/commands'; }
get agentsDir() { return '.claude/agents'; }
get detectPath() { return '.claude'; }
async installCommands(flowPath, config) {
// Install commands (default behavior)
const installedCommands = await super.installCommands(flowPath, config);
// Install agents (from commands folder)
const installedAgents = await this.installAgents(flowPath, config);
return [...installedCommands, ...installedAgents];
}
async installAgents(flowPath, config) {
await fs.ensureDir(this.agentsDir);
const commandsSourceDir = path.join(flowPath, 'commands');
if (!await fs.pathExists(commandsSourceDir)) return [];
const agentFiles = await fs.readdir(commandsSourceDir);
const installedFiles = [];
for (const agentFile of agentFiles) {
if (agentFile.endsWith('.md')) {
const sourcePath = path.join(commandsSourceDir, agentFile);
const prefix = config?.command?.prefix ? `${config.command.prefix}-` : '';
const targetFileName = `specsmd-${prefix}${agentFile}`;
const targetPath = path.join(this.agentsDir, targetFileName);
await fs.copy(sourcePath, targetPath);
installedFiles.push(targetFileName);
}
}
return installedFiles;
}
}---
| Feature | Commands | Agents | |---------|----------|--------| | Location | `.claude/commands/` | `.claude/agents/` | | Invocation | `/specsmd-master-agent` | Natural language or explicit | | Context | Shared with main conversation | Isolated context window | | Parallelism | Sequential | Up to 10 concurrent | | Source | `commands/` folder | `commands/` folder |
Both commands and agents are sourced from the same `commands/` folder, with the same content installed to both directories.
---