CLI Command Extensions
CLI Command Extensions
Claude Code allows you to extend the standard CLI interface with custom slash commands. These commands act as specialized entry points for complex workflows, enabling you to automate repetitive tasks—like ticket management, documentation updates, or code reviews—directly from the terminal.
Overview
Custom commands are defined within your repository (typically in the .claude/commands/ directory) and can be triggered by typing / followed by the command name in the Claude Code interface. These extensions often leverage MCP (Model Context Protocol) servers to bridge the gap between your codebase and external tools like Jira, Linear, or GitHub.
Using Custom Commands
To use an extension, simply type the command prefix in your active session:
# Example: Using the ticket integration command
/ticket "Implement the new auth flow described in AUTH-123"
When a command is invoked, Claude:
- Retrieves Context: Accesses relevant local files and MCP server data.
- Executes Logic: Follows the instructions defined in the command's markdown or configuration file.
- Performs Actions: Executes the necessary code changes, API calls, or file manipulations.
Key Extension: Ticket Management (/ticket)
The /ticket command is a primary example of a high-utility extension. It connects Claude Code to your project management software (via .mcp.json) to automate the entire development lifecycle.
Capabilities:
- Context Retrieval: Reads acceptance criteria and descriptions directly from Jira or Linear.
- Implementation: Automatically plans and implements the feature based on the ticket details.
- Verification: Links the generated PR back to the ticket and updates the status (e.g., moving "In Progress" to "In Review").
Configuring New Commands
Extensions are powered by a combination of configuration files and skill definitions. To add a new command, you typically define its behavior in a markdown file within the .claude/commands/ directory.
| Component | Role |
| :--- | :--- |
| Command Definition | A .md file in .claude/commands/ that describes what the command does and the steps Claude should take. |
| MCP Configuration | The .mcp.json file used to provide Claude with the credentials and endpoints needed for external integrations. |
| Skill Mappings | Logic (often in .claude/hooks/) that helps Claude decide which internal skills to activate when a specific command is run. |
Example: Workflow Automation
Beyond ticketing, extensions are frequently used for maintenance and quality gates. Because these commands are version-controlled within your repo, they ensure that every team member has access to the same automated workflows.
# Example: /review command usage
/review "Check the latest changes in /src/components for accessibility compliance"
This triggers the specialized Code Review Agent, which uses the project's specific .claude/skills/testing-patterns and strict mode requirements to evaluate the code before it reaches the human review stage.