Claude Code Tips


Tips

Work with GitHub CLI

Claude knows how to use the GitHub CLI to interact with GitHub for creating issues, opening pull requests, reading comments, and more.

Handling Large Inputs

  • Don’t paste long, large content in Claude Code
  • Do use file-based workflow. Store the input in a file and ask Claude Code to read the file

Turn on macOS Dictation

You can speak to enter the prompts, making it like chatting with a real agent.

Make a Plan Before Implementing

Ask Claude Code to propose a plan and verify the feasibility. You may use prompts like: “propose a few solutions to the XXX issues.”

Give Claude More Context

CLAUDE.md

  • CLAUDE.md is a special file that Claude automatically pulls into context when starting a conversation.
  • This is the ideal place for documenting how to set up or contribute to the project.

Other methods

  • You can use pipe to pass context into Claude Code: cat foo.txt | claude
  • Ask Claude to read files or fetch URLs

Key Bindings

  • Escape: Press Esc to interrupt at any time
  • Double-tap Escape: Jump back to history message
  • Shift+Tab: Toggle between auto-accept mode, plan mode, and normal mode

Use Headless Mode

Claude Code has headless mode for non-interactive environments like CI, pre-commit hooks, build scripts, and automation. Use the -p flag with a prompt to enable headless mode, and --output-format stream-json for streaming JSON output.

Examples:

  • claude -p "<your prompt>" --output-format stream-json --verbose
  • claude -p "<your prompt>" --output-format json | your_command

Useful Commands

  • /init: Generate a CLAUDE.md project summary
  • /vim: Toggle between Vim mode and normal editing mode
  • /clear: Use this command between tasks to reset the context window and keep context focused
  • /memory: Open any memory file in your system editor for additional memory
  • claude commit: Create a Git commit, co-authored by Claude
  • claude -r: Resume the previous conversation

YOU MIGTH ENJOY

  • System design 4 - How to design a rate limiter
  • How I brought my cat to Canada 如何把猫咪带去加拿大
  • System Design 3 - 知乎匿名系统设计