Skip to main content

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

When working within VibeTunnel, use vt 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:
Claude may take time to:
  • Analyze large codebases thoroughly
  • Consider multiple approaches before responding
  • Verify its suggestions are correct
  • Generate comprehensive solutions
Note: Claude itself has no built-in timeout mechanism. The calling process must implement timeout handling. ⚠️ Critical: Even if a timeout occurs, Claude may have already modified multiple files before being interrupted. After any Claude invocation (successful or timed out):
  1. Re-read all files that were passed to Claude
  2. Check related files that Claude might have modified (imports, dependencies, tests)
  3. Use version control to see what changed: git status and git diff
  4. 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

  1. Be explicit about constraints:
  2. Use precise language:
  3. Specify output format:
  4. 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

  1. Test first: Always test Claude’s behavior before using in automation
  2. Be explicit: Over-specify when you need exact behavior
  3. Use version control: Claude might make helpful changes you didn’t expect
  4. Review outputs: Especially in automated workflows
  5. Leverage intelligence: Don’t over-constrain when you want smart help

Command Reference

Note: When not using VibeTunnel, replace 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!