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:
- Token efficiency - CLI output is compact compared to raw API JSON responses
- Authentication handled - CLIs manage auth via their own config, no tokens in context
- Claude already knows them - Claude has strong knowledge of common CLI tools and their flags
- 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.