Claude Tips mascot
Claude Tips & Tricks
Claude Code intermediate

Tell Claude Code to Use CLI Tools for External Services

Point Claude Code at gh, aws, gcloud, and other CLI tools instead of APIs. They're the most context-efficient way to interact with services.

When you need Claude Code to interact with external services like GitHub, AWS, or Sentry, tell it to use their CLI tools rather than trying to call APIs directly. CLI tools are the most context-efficient way for Claude to work with external services.

Install the GitHub CLI. Claude knows how to use it:

# Install gh if you haven't already
brew install gh
gh auth login

# Now Claude Code can do things like:
# - Create pull requests
# - Open and manage issues
# - Read PR comments and reviews
# - Check CI status

Example prompts:

Use gh to create a PR from this branch with a summary of changes

Use the aws cli to list all S3 buckets in us-east-1

Check the latest Sentry errors using sentry-cli

Why CLI over API calls:

  1. Token efficiency - CLI output is compact compared to raw API JSON responses
  2. Authentication handled - CLIs manage auth via their own config, no tokens in context
  3. Claude already knows them - Claude has strong knowledge of common CLI tools and their flags
  4. Composable - Claude can pipe CLI output through other tools

Bonus: Run /install-github-app in Claude Code to have Claude automatically review your pull requests on GitHub.

Paste into Claude Code
Check what CLI tools are available on this system (gh, aws, gcloud, etc.) and show me how to use them for common tasks in this project.