Claude Code Advanced Development Guide
A comprehensive learning guide for Claude Code, covering all core concepts from basics to advanced levels, tool usage, development workflows, and best practices.
When to Use This Skill
Use this skill when you need help with:
- Learning Claude Code's core features and tools
- Mastering advanced usage of the REPL environment
- Understanding development workflows and task management
- Integrating external systems using MCP
- Implementing advanced development patterns
- Applying Claude Code best practices
- Resolving common issues and errors
- Performing large file analysis and processing
Quick Reference
Claude Code Core Tools (7)
-
REPL - JavaScript runtime environment
- Full ES6+ support
- Preloaded libraries: D3.js, MathJS, Lodash, Papaparse, SheetJS
- Supports async/await, BigInt, WebAssembly
- File reading:
-
Artifacts - Visual output
- React, Three.js, chart libraries
- HTML/SVG rendering
- Interactive components
-
Web Search - Web search
- US-only availability
- Domain filtering support
-
Web Fetch - Retrieve web content
- HTML to Markdown conversion
- Content extraction and analysis
-
Conversation Search - Conversation search
- Search historical conversations
- Context retrieval
-
Recent Chats - Recent conversations
- Access recent sessions
- Conversation history
-
End Conversation - End conversation
- Cleanup and summary
- Session management
Large File Analysis Workflow
bash
# Phase 1: Quantitative Assessment
wc -l filename.md # Line count
wc -w filename.md # Word count
wc -c filename.md # Character count
# Phase 2: Structural Analysis
grep "^#{1,6} " filename.md # Extract heading hierarchy
grep "```" filename.md # Identify code blocks
grep -c "keyword" filename.md # Keyword frequency
# Phase 3: Content Extraction
Read filename.md offset=0 limit=50 # File start
Read filename.md offset=N limit=100 # Target section
Read filename.md offset=-50 limit=50 # File end
Advanced REPL Usage
javascript
// Data processing
const data = [1, 2, 3, 4, 5];
const sum = data.reduce((a, b) => a + b, 0);
// Use preloaded libraries
// Lodash
_.chunk([1, 2, 3, 4], 2); // [[1,2], [3,4]]
// MathJS
math.sqrt(16); // 4
// D3.js
d3.range(10); // [0,1,2,3,4,5,6,7,8,9]
// Read file
const content = await window.fs.readFile('path/to/file');
// Async operation
const result = await fetch('https://api.example.com/data');
const json = await result.json();
Slash Command System
Built-in Commands:
- - Show help
- - Clear conversation
- - Manage plugins
- - Configure settings
Custom Commands:
Create
.claude/commands/mycommand.md
:
markdown
Instructions to perform specific tasks based on requirements
Development Workflow Patterns
1. File Analysis Workflow
bash
# Explore → Understand → Implement
ls -la # List files
Read file.py # Read content
grep "function" file.py # Search patterns
# Then implement modifications
2. Algorithm Validation Workflow
bash
# Design → Validate → Implement
# 1. Test logic in REPL
# 2. Verify edge cases
# 3. Implement into code
3. Data Exploration Workflow
bash
# Inspect → Analyze → Visualize
# 1. Read data file
# 2. Analyze in REPL
# 3. Visualize with Artifacts
Core Concepts
Tool Permission System
Tools with Auto-Granted Permissions:
- REPL
- Artifacts
- Web Search/Fetch
- Conversation Search
Tools Requiring Authorization:
- Bash (read/write file system)
- Edit (modify files)
- Write (create files)
Project Context
Claude automatically identifies:
- Git repository status
- Programming languages (from file extensions)
- Project structure
- Dependency configurations
Memory System
Conversation Memory:
- Stored in current session
- 200K token window
- Automatic context management
Persistent Memory (Experimental):
- Saved across sessions
- User preference memory
- Project context retention
MCP Integration
What is MCP?
Model Context Protocol - A protocol for connecting Claude to external systems.
MCP Server Configuration
Configuration file:
~/.config/claude/mcp_config.json
json
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["path/to/server.js"],
"env": {
"API_KEY": "your-key"
}
}
}
}
Using MCP Tools
Claude automatically discovers MCP tools and uses them in conversations:
"Use the my-server tool to retrieve data"
Hook System
Hook Types
json
{
"hooks": {
"tool-pre-use": "echo 'About to use tool'",
"tool-post-use": "echo 'Tool used'",
"user-prompt-submit": "echo 'Processing prompt'"
}
}
Common Hook Use Cases
- Automatic code formatting
- Run tests
- Git commit checks
- Logging
- Notification sending
Advanced Patterns
Multi-Agent Collaboration
Use the Task tool to start sub-agents:
"Start a specialized agent to optimize this algorithm"
Sub-agent features:
- Independent context
- Focused on single task
- Returns results to main agent
Intelligent Task Management
Use the TodoWrite tool:
"Create a task list to track this project"
Task statuses:
- - Pending
- - In progress
- - Completed
Code Generation Patterns
Incremental Development:
- Generate basic structure
- Add core functionality
- Implement details
- Test and optimize
Validation-Driven:
- Write test cases
- Implement functionality
- Run tests
- Fix issues
Quality Assurance
Automated Testing
bash
# Run tests
npm test
pytest
# Type checking
mypy script.py
tsc --noEmit
# Code linting
eslint src/
flake8 .
Code Review Pattern
Use sub-agents for review:
"Start a code review agent to check this file"
Review focus areas:
- Code quality
- Security issues
- Performance optimization
- Best practices
Error Recovery
Common Error Patterns
-
Tool Usage Errors
- Check permissions
- Validate syntax
- Confirm paths
-
File Operation Errors
- Verify file exists
- Check read/write permissions
- Validate path correctness
-
API Call Errors
- Check network connection
- Verify API key
- Confirm request format
Incremental Fix Strategy
- Isolate the problem
- Minimize reproduction
- Fix incrementally
- Validate solution
Best Practices
Development Principles
- Clarity First - Clearly define requirements and goals
- Incremental Implementation - Develop in stages
- Continuous Validation - Test frequently
- Appropriate Abstraction - Reasonable modularization
Tool Usage Principles
- Right Tool for the Job - Choose appropriate tools
- Tool Combination - Collaborate with multiple tools
- Least Privilege - Request only necessary permissions
- Error Handling - Gracefully handle failures
Performance Optimization
- Batch Operations - Combine multiple operations
- Incremental Processing - Handle large files
- Cache Results - Avoid redundant calculations
- Async First - Use async/await
Security Considerations
Sandbox Model
Each tool runs in an isolated environment:
- REPL: No file system access
- Bash: Requires explicit authorization
- Web: Only specific domains
Security Best Practices
- Least Privilege - Grant only necessary permissions
- Code Review - Inspect generated code
- Sensitive Data - Do not share keys
- Regular Audits - Check hooks and configurations
Troubleshooting
Tool Unavailable
Symptom: Tool call fails
Solutions:
- Check permission settings
- Validate syntax correctness
- Confirm file paths
- Review error messages
REPL Performance Issues
Symptom: REPL execution is slow
Solutions:
- Reduce data volume
- Use streaming processing
- Optimize algorithms
- Process in batches
MCP Connection Failure
Symptom: MCP server unresponsive
Solutions:
- Check configuration files
- Verify server is running
- Confirm environment variables
- Review server logs
Practical Examples
Example 1: Data Analysis
javascript
// In REPL
const data = await window.fs.readFile('data.csv');
const parsed = Papa.parse(data, { header: true });
const values = parsed.data.map(row => parseFloat(row.value));
const avg = _.mean(values);
const std = math.std(values);
console.log(`Average: ${avg}, Standard Deviation: ${std}`);
Example 2: File Search
bash
# In Bash
grep -r "TODO" src/
find . -name "*.py" -type f
Example 3: Web Data Retrieval
"Use web_fetch to get content from https://api.example.com/data, then analyze the JSON data in REPL"
Reference Files
This skill includes detailed documentation:
- README.md (9,594 lines) - Complete Claude Code Advanced Guide
Covers the following topics:
- In-depth analysis of core tools
- Advanced REPL collaboration patterns
- Detailed development workflows
- Complete MCP integration guide
- Hook system configuration
- Advanced patterns and best practices
- Troubleshooting and security considerations
Use the
command to access reference files for detailed information.
Resources
Notes
This guide combines:
- Official features and announcements
- Patterns observed in practical usage
- Conceptual approaches and best practices
- Third-party tool integrations
Please refer to the latest official documentation when using.
Use this skill to master the powerful features of Claude Code!