Claude Code
Overview
Section titled “Overview”Claude Code is a powerful command-line interface designed specifically for interacting with large language models directly from your terminal. It enables seamless LLM interactions in your daily development workflow.
Key Features
Section titled “Key Features”- Deep code understanding & editing: Claude Code excels at understanding complex codebases, allowing it to assist with code generation, refactoring, and debugging tasks.
- Works where developers already work: Integrates directly into your terminal and IDE, enabling you to leverage LLM capabilities without disrupting your existing workflow.
- Full development workflow support: From writing and testing code to documentation and deployment, Claude Code supports the entire software development lifecycle.
- Configurability & control: Customize prompts, set context windows, and manage conversation history to tailor the experience to your specific needs.
- Multi-platform support: Compatible with various operating systems and development environments.
Use Cases
Section titled “Use Cases”- Code generation and modification
- Debugging and bug fixing
- Automating routine development tasks
- Prototyping new features
- Writing and running tests
- Integrating with existing tools and workflows
- Creating pull requests from issues
- Making cross-file and large scope edits
- Learning and onboarding support
Setup Instructions
Section titled “Setup Instructions”Get Claude Code up and running on your machine with these simple steps.
-
Install Claude Code:
macOS, Linux, WSL:
Terminal window curl -fsSL https://claude.ai/install.sh | bashWindows PowerShell:
Terminal window irm https://claude.ai/install.ps1 | iexWindows CMD:
Terminal window curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdIf you have Homebrew installed:
Terminal window brew install --cask claude-codeIf you have Node.js 18 or newer installed:
Terminal window npm install -g @anthropic-ai/claude-code -
Connect to relaxAI:
Terminal window export ANTHROPIC_API_KEY="rak_apikey" >> ~/.zshrcexport ANTHROPIC_BASE_URL="https://api.relax.ai" >> ~/.zshrcexport API_TIMEOUT_MS="300000" >> ~/.zshrcexport ANTHROPIC_DEFAULT_HAIKU_MODEL="GLM-46" >> ~/.zshrcexport ANTHROPIC_DEFAULT_SONNET_MODEL="GLM-46" >> ~/.zshrcexport ANTHROPIC_DEFAULT_OPUS_MODEL="GLM-46" >> ~/.zshrcexport CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 >> ~/.zshrcexport CLAUDE_CODE_DISABLE_ANALYTICS=1 >> ~/.zshrcexport CLAUDE_CODE_DEFAULT_MODEL="GLM-46" >> ~/.zshrcThen, reload your shell configuration:
Terminal window source ~/.zshrc -
Verify installation:
Terminal window claude-code --version -
Testing the setup:
Change into a directory with code and run:
Terminal window claude --model GLM-46 "Explain the code in this directory"
Common workflows
Section titled “Common workflows”Learn about common workflows with Claude Code. Each task includes clear instructions, example commands, and best practices to help you get the most from Claude Code with relaxAI.
Understand new codebases
Section titled “Understand new codebases”Get a quick codebase overview:
When you join a new project and need to understand its structure quickly, follow these steps:
-
Navigate to the project root directory:
Terminal window cd /path/to/project -
Start Claude Code:
Terminal window claude --model GLM-46 -
Ask for a high-level overview:
Terminal window > give me an overview of this codebase -
Dive deeper into specific components:
Terminal window > explain the main architecture patterns used hereTerminal window > what are the key data models?Terminal window > how is authentication handled?
Find relevant code:
To locate code related to a specific feature or functionality:
-
Ask Claude to find relevant files:
Terminal window > find the files that handle user authentication -
Get context on how components interact:
Terminal window > how do these authentication files work together? -
Understand the execution flow:
Terminal window > trace the login process from front-end to database
Fix bugs efficiently
Section titled “Fix bugs efficiently”When you encounter an error message and need to find and fix its source:
-
Share the error with Claude:
Terminal window > I'm seeing an error when I run npm test -
Ask for fix recommendations:
Terminal window > suggest a few ways to fix the @ts-ignore in user.ts -
Apply the fix:
Terminal window > update user.ts to add the null check you suggested
Refactor code
Section titled “Refactor code”Update old code to use modern patterns and practices:
-
Identify legacy code for refactoring:
Terminal window > find deprecated API usage in our codebase -
Get refactoring recommendations:
Terminal window > suggest how to refactor utils.js to use modern JavaScript features -
Apply the changes safely:
Terminal window > refactor utils.js to use ES2024 features while maintaining the same behavior -
Verify the refactoring:
Terminal window > run tests for the refactored code
Work with tests
Section titled “Work with tests”Add tests for uncovered code:
-
Identify untested code:
Terminal window > find functions in NotificationsService.swift that are not covered by tests -
Generate test scaffolding:
Terminal window > add tests for the notification service -
Add meaningful test cases:
Terminal window > add test cases for edge conditions in the notification service -
Run and verify tests:
Terminal window > run the new tests and fix any failures
Claude can generate tests that follow your project’s existing patterns and conventions. When asking for tests, be specific about what behavior you want to verify. For comprehensive coverage, ask Claude to identify edge cases you might have missed.
Create pull requests
Section titled “Create pull requests”Create well-documented pull requests for your changes:
-
Summarize your changes:
Terminal window > summarize the changes I've made to the authentication module -
Generate a pull request with Claude:
Terminal window > create a pr -
Review and refine:
Terminal window > enhance the PR description with more context about the security improvements -
Add testing details:
Terminal window > add information about how these changes were tested
Handle documentation
Section titled “Handle documentation”Add or update documentation for your code:
-
Identify undocumented code:
Terminal window > find functions without proper JSDoc comments in the auth module -
Generate documentation:
Terminal window > add JSDoc comments to the undocumented functions in auth.js -
Review and enhance:
Terminal window > improve the generated documentation with more context and examples -
Verify documentation:
Terminal window > check if the documentation follows our project standards
Work with images
Section titled “Work with images”Work with images in your codebase and get Claude’s help analyzing image content:
-
Add an image to the conversation using any of these methods:
- Drag and drop an image into the Claude Code window
- Copy an image and paste it into the CLI with ctrl+v
- Provide an image path to Claude: “Analyze this image: /path/to/your/image.png”
-
Ask Claude to analyze the image:
Terminal window > What does this image show?Terminal window > Describe the UI elements in this screenshotTerminal window > Are there any problematic elements in this diagram? -
Use images for context:
Terminal window > Here's a screenshot of the error. What's causing it?Terminal window > This is our current database schema. How should we modify it for the new feature? -
Get code suggestions from visual content:
Terminal window > Generate CSS to match this design mockupTerminal window > What HTML structure would recreate this component?
Reference files and directories
Section titled “Reference files and directories”Use @ to quickly include files or directories without waiting for Claude to read them:
-
Reference a single file:
Terminal window > Explain the logic in @src/utils/auth.jsThis includes the full content of the file in the conversation.
-
Reference a directory:
Terminal window > What's the structure of @src/components?This provides a directory listing with file information.
-
Reference multiple files:
Terminal window > Compare @file1.js and @file2.js
Resume previous conversations
Section titled “Resume previous conversations”Resume a previous session when starting Claude Code:
claude --continue --model GLM-46continues the most recent conversation in the current directoryclaude --resume --model GLM-46opens a conversation picker or resumes by name
From inside an active session, use /resume to switch to a different conversation.
Name your sessions:
-
Name the current session using
/rename:Terminal window > /rename auth-refactor -
Resume by name later from the command line:
Terminal window claude --resume auth-refactor --model GLM-46Or from inside an active session:
Terminal window > /resume auth-refactor
Use Claude as a unix-style utility
Section titled “Use Claude as a unix-style utility”Add Claude to your verification process:
Add Claude to your build script:
{ "scripts": { "lint:claude": "claude --model GLM-46 -p 'you are a linter. please look at the changes vs. main and report any issues related to typos. report the filename and line number on one line, and a description of the issue on the second line. do not return any other text.'" }}Pipe data through Claude:
cat build-error.txt | claude --model GLM-46 -p 'concisely explain the root cause of this build error' > output.txtControl output format:
-
Use text format (default):
Terminal window cat data.txt | claude -p 'summarize this data' --output-format text > summary.txt -
Use JSON format:
Terminal window cat code.py | claude -p 'analyze this code for bugs' --output-format json > analysis.json -
Use streaming JSON format:
Terminal window cat log.txt | claude -p 'parse this log file for errors' --output-format stream-json
Create custom slash commands
Section titled “Create custom slash commands”Create reusable slash commands for your project that all team members can use.
Create project-specific commands:
-
Create a commands directory in your project:
Terminal window mkdir -p .claude/commands -
Create a Markdown file for each command:
Terminal window echo "Analyze the performance of this code and suggest three specific optimizations:" > .claude/commands/optimize.md -
Use your custom command in Claude Code:
> /optimize
Add command arguments with $ARGUMENTS:
-
Create a command file with the $ARGUMENTS placeholder:
Terminal window echo 'Find and fix issue #$ARGUMENTS. Follow these steps: 1. Understand the issue 2. Locate the relevant code 3. Implement a solution 4. Add tests 5. Prepare a PR description' > .claude/commands/fix-issue.md -
Use the command with an issue number:
> /fix-issue 123This replaces $ARGUMENTS with “123” in the prompt.
Create personal slash commands:
-
Create a commands directory in your home folder:
Terminal window mkdir -p ~/.claude/commands -
Create a Markdown file for each command:
Terminal window echo "Review this code for security vulnerabilities, focusing on:" > ~/.claude/commands/security-review.md -
Use your personal custom command:
> /security-review
Best Practices
Section titled “Best Practices”- Be specific in your prompts: Provide clear context and detailed requirements for better results
- Use incremental changes: Make small, testable changes rather than large refactors all at once
- Leverage session naming: Name your sessions with descriptive names early to find them easily later
- Combine with existing tools: Integrate Claude Code into your CI/CD pipeline and shell scripts
- Review generated code: Always review and test code changes before committing
- Use project commands: Share common workflows with your team through
.claude/commands/ - Ask for explanations: Request explanations of changes to understand the reasoning behind suggestions