Claude CLI Usage Guide
The Claude CLI is a powerful command-line interface for interacting with Claude. This guide covers basic usage, advanced features, and important considerations when using Claude as an agent.Installation
Basic Usage
Recommended: Use VibeTunnel for Better Visibility
When working within VibeTunnel, usevt claude
instead of claude
directly. This provides better visibility into what Claude is doing:
One-Shot Prompts
Input Methods
File Context
Advanced Features
Timeout Considerations
⏱️ Important: Claude can be slow but thorough. When calling Claude from scripts or other tools, set a timeout of more than 10 minutes:- Analyze large codebases thoroughly
- Consider multiple approaches before responding
- Verify its suggestions are correct
- Generate comprehensive solutions
- Re-read all files that were passed to Claude
- Check related files that Claude might have modified (imports, dependencies, tests)
- Use version control to see what changed:
git status
andgit diff
- Never assume the operation failed completely - partial changes are common
Environment Variables
Output Formatting
Interactive Mode
Important Considerations: Claude as an Agent
⚠️ Critical Understanding: Claude is an intelligent agent that aims to be helpful and thorough. This means:Default Behavior
When you use Claude via CLI, it will:- Analyze the full context of your request
- Make reasonable inferences about what you need
- Perform additional helpful actions beyond the literal request
- Verify and validate its work
- Provide explanations and context
Example of Agent Behavior
Controlling Agent Behavior
If you need Claude to perform ONLY specific actions without additional help:Strict Mode Prompting
Best Practices for Strict Operations
-
Be explicit about constraints:
-
Use precise language:
-
Specify output format:
-
Chain commands for control:
Use Cases
When to Use Claude’s Agent Capabilities
- Code review: Let Claude analyze thoroughly
- Debugging: Benefit from comprehensive analysis
- Learning: Get detailed explanations
- Refactoring: Allow intelligent improvements
When to Constrain Claude
- CI/CD pipelines: Need deterministic behavior
- Automated scripts: Require predictable outputs
- Specific edits: Want surgical precision
- Integration with other tools: Need exact output formats
Examples
Development Workflow
Script Integration
Tips
- Test first: Always test Claude’s behavior before using in automation
- Be explicit: Over-specify when you need exact behavior
- Use version control: Claude might make helpful changes you didn’t expect
- Review outputs: Especially in automated workflows
- Leverage intelligence: Don’t over-constrain when you want smart help
Command Reference
vt claude
with just claude
in all commands above.
Remember: Claude is designed to be a helpful assistant. This is usually what you want, but sometimes you need precise, limited actions. Plan accordingly!