34 Claude Code Usage Tips
I. Command Line Interface (CLI) Tips (7 tips)
- Treat it as CLI : Fundamentally understand that Claude Code is a command line tool with all its basic characteristics.
- Pass command arguments : Use the
-Pparameter to run in command line mode. - Use no-mode : Use the
-Pparameter to run in front-end interface mode. - Connect with other tools : Can connect other command line tools (bash/CLI tools) to the workflow.
- Use piped input : Pipe data into Claude Code using pipes (
|). - Run multiple instances : Can run multiple Claude Code instances simultaneously.
- Let it start itself : Can instruct Claude Code to start a new instance to handle task principles.
II. Image Processing Tips (6 tips)
- Drag and paste : Drag image files directly into the terminal for use.
- macOS screenshot paste : Use shortcut
Shift+Command+Control+4to copy screenshots to clipboard. - Use Control+V to paste : Use
Control+V(instead ofCommand+V) to paste images into the terminal. - Generate code from design mockups : Paste design mockup images and let Claude Code build the interface.
- Establish visual feedback loop : Take screenshots of the current application state and feed them back to Claude Code for iterative modifications.
- Automated generation : Use Puppeteer MCP service to automate the screenshot generation workflow for applications.
III. Integration and External Data Tips (5 tips)
- Act as MCP server/client : Claude Code itself can serve both as an MCP server and as a client connecting to other services.
- Connect to databases : Use Postgres MCP server to connect Claude Code to your database.
- Get latest API documentation : Utilize MCP servers provided by companies like Cloudflare to get real-time updated documentation.
- Scrape link content : Directly paste a URL, and Claude Code will scrape the webpage content as context.
- Get external knowledge : Use URL scraping functionality to obtain knowledge from the external world (like game rules) and apply it to code.
IV. claude.md Configuration File Tips (7 tips)
- Understand its core purpose :
claude.mdis a system prompt file that gets loaded with every request. - Use /init for auto-generation : Run the
/initcommand in the project directory to automatically generate aclaude.mdbased on project structure. - Use # for dynamic updates : In conversations, use the
#symbol to directly add instructions toclaude.md. - Set global configuration : Create
claude.mdin the user home directory~/.claude/to apply to all projects. - Use subdirectory configuration : Add
claude.mdin subdirectories to apply to specific modules. - Regular reloading : Regularly optimize and refine your
claude.mdfile to keep it specific and efficient. - Use prompt optimization tools : Leverage Anthropic's prompt optimization tools to improve
claude.mdcontent.
V. Custom Slash Commands Tips (6 tips)
- Define in specified folder : Create files in the
.claude/slash_commandsfolder to customize your own slash commands. - Create commands for solving GitHub issues : Create a command like
/solve_github_issue. - Create commands for refactoring : Create a
/refactorcommand. - Create commands for code checking : Create a
/lintcommand. - Create commands for PR review : Create a
/review_prcommand. - Pass arguments to commands : Your custom slash commands are prompt templates that can receive command line arguments.
VI. UI and Workflow Tips (3 tips)
- Use Tab completion : Use the
Tabkey to auto-complete file and directory names for more precise context. - Decisively press Esc to interrupt : When you see Claude Code's output deviating from expectations, immediately press the
Esckey to interrupt it. - Use undo to revert : After interrupting, you can ask it to
undothe previous operation.
