CLI Usage Guide
Relevant source files
The following files were used as context for generating this wiki page:
The claude-code-templates CLI is a tool designed to initialize, manage, and extend Claude Code environments through pre-built templates, specialized agents, and custom slash commands. It facilitates the rapid setup of project-specific configurations (such as CLAUDE.md) and automates repetitive development workflows by installing modular components into local or global directories.
Sources: cli-tool/TESTING.md:1-5, cli-tool/docs_to_claude/BLOG_WRITING_GUIDE.md:144-150
Core Command Architecture
The CLI operates on a component-based installation model where users can select individual modules (agents, commands, or MCP servers) or install entire technology stacks. The system manages three primary locations for these components: project-specific directories for team collaboration, personal directories for global user access, and internal plugin roots.
Sources: cli-tool/docs_to_claude/COMMANDS_GUIDE.md:28-34, cli-tool/components/skills/development/command-development/README.md:57-60
Installation and Initialization
The CLI provides two main paths for usage: an interactive initialization flow and direct flag-based installation for specific components.
The diagram above illustrates the decision logic the CLI uses to determine whether to enter an interactive configuration mode or proceed with direct component injection.
Sources: cli-tool/TESTING.md:86-90, cli-tool/docs_to_claude/BLOG_WRITING_GUIDE.md:144-165
Command Line Interface Options
The CLI supports a variety of flags for fine-grained control over the template installation process. These include language selection, framework targeting, and specific component IDs.
Primary Flags and Options
| Flag | Description | Examples |
|---|---|---|
--agent | Installs specific specialized AI agents | se-technical-writer, command-expert |
--command | Installs specific custom slash commands | optimize, fix-issue, commit |
--mcp | Installs Model Context Protocol (MCP) servers | github, postgres, google-search |
--language | Sets the primary project language | javascript-typescript, python, go, rust |
--framework | Sets the project framework | react, vue, angular, node |
--yes | Skips confirmation prompts | N/A |
--dry-run | Previews changes without writing files | N/A |
Sources: cli-tool/TESTING.md:38-42, cli-tool/docs_to_claude/BLOG_WRITING_GUIDE.md:144-156
Global Agent Management
The CLI also handles "Global Agents" which are accessible across all projects on a user's machine, rather than being restricted to a single .claude/ directory.
| Command | Action |
|---|---|
--create-agent [name] | Creates a new global agent |
--list-agents | Displays all currently installed global agents |
--update-agent [name] | Updates an existing global agent to the latest template version |
--remove-agent [name] | Deletes a global agent |
Sources: cli-tool/docs_to_claude/BLOG_WRITING_GUIDE.md:170-180
Slash Command System
Custom slash commands are a key feature of the CLI, allowing users to define reusable prompts in Markdown files. These commands are mapped from filenames (e.g., fix.md becomes /fix) and can be executed within the Claude Code terminal.
Command Execution Flow
The sequence diagram shows how the CLI parses Markdown files, handles dynamic arguments, and integrates bash outputs before presenting the final prompt to the AI model.
Sources: cli-tool/docs_to_claude/COMMANDS_GUIDE.md:46-52, cli-tool/docs_to_claude/COMMANDS_GUIDE.md:104-120
Scoping and Precedence
Commands can exist in multiple locations. The CLI follows a strict priority order when resolving command names to prevent conflicts:
- Project Commands: Located in
.claude/commands/. These have the highest priority and are shared with the team via version control. - Personal Commands: Located in
~/.claude/commands/. These are private to the user and available across all projects.
Sources: cli-tool/docs_to_claude/COMMANDS_GUIDE.md:28-34
Component Organization
When components are installed via the CLI, they are organized into a standardized directory structure within the target project.
# Example project structure after CLI installation
your-project/
├── .claude/
│ ├── commands/ # Custom slash commands (.md)
│ │ └── optimize.md
│ └── agents/ # Specialized sub-agents (.md)
│ └── technical-writer.md
├── .mcp.json # MCP server configurations
└── CLAUDE.md # Main project guidance file
Sources: cli-tool/docs_to_claude/BLOG_WRITING_GUIDE.md:214-222, cli-tool/components/agents/development-tools/command-expert.md:200-205
Conclusion
The claude-code-templates CLI serves as the bridge between raw template files and a functional, AI-enhanced development environment. By providing both interactive and automated installation paths, it ensures that project-specific standards, specialized agents, and custom slash commands are consistently deployed across teams and personal workflows.
Sources: cli-tool/TESTING.md:112-117, cli-tool/components/skills/development/command-development/README.md:10-20