Claude Code Cheatsheet + Dev Sandbox is my reference for working with Claude in a development environment. It documents my setup, including commonly used commands, MCP configuration, hooks, skills, and subagents. The post also describes how I configure a local development sandbox in Docker to safely run and test integrations. It focuses on practical configuration details and repeatable workflows. The content serves as a personal but reusable guide for everyday development work.
Built-In Commands
# some from https://x.com/adocomplete/status/2006802341228655083 - you can check there quick videos # mandatory on startup /statusline add model, git branch, context usage, and session usage /init /sandbox # all time used Shift + Tab --> edit/plan modes # often used /usage # shell command !cd /workspace/project/ # rewind after incorrect changes (can rollback to different checkpoints in history) ESC + ESC Ctrl + S --> stash prompt, run another, then bring stashed back Ctrl + R --> reverse history of prompts # updating Claude memory with # # Use record instead getters and setters or Lombok # context check - what occupies it /context # background tasks # --> Background tasks require a git repository. Initialize git or run from a git repository. & # include files @ # names sessions - actually I find it very cool, and strange I didn't know it earlier 😍 /rename api-migration # words for better results at the expense of greater token consumption think, think hard, ultrathink # skip permissions check IN SANDBOX (called by X post author YOLO mode 😂) claude --dangerously-skip-permissions # exporting conversation (similar thing I do with Obsidian MCP as summary right now) /export current-task # rarely used by me right now but kind useful claude --continue / claude --resume claude -p "list current dirrectory and sort by date of modification" /stats
Custom Commands
cd .claude/commands
nano my-command.md # and put your prompt there
Hooks
Hooks can be to settings e.g. ~/.claude/settings.json and can run commands on some stage of AI work progress. Simple example on task completion:
{
"hooks": {
"Stop": [
{
"matcher": "bash ~/.claude/scripts/task-done.sh",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/scripts/task-done.sh"
}
]
}
]
}
}
# ~/.claude/scripts/task-done.sh --> say "task completed" on finish
#!/bin/bash
input=$(cat)
session_id=$(echo "$input" | jq -r '.session_id // "unknown"' 2>/dev/null)
# Try to read the task description
if [ -f ~/.claude/hook-data/${session_id}.txt ]; then
task_info=$(cat ~/.claude/hook-data/${session_id}.txt)
say "Task completed: $task_info"
terminal-notifier -title "Claude Code Task Done" -message "$task_info" -sound default 2>/dev/null
rm -f ~/.claude/hook-data/${session_id}.txt
else
say "Task completed"
terminal-notifier -title "Claude Code" -message "Task completed" -sound default 2>/dev/null
fi
exit 0
Skills / Agents
From https://github.com/anthropics/skills/tree/main/skills copy to .claude/skills then in prompt use the skill name (folder name e.g. “use the frontend-design skill”). You can make your own or check dedicated to skills sites – there are plenty of them already.
Subagents you can run as “run X parallel agents on something”, should rather not overlap their competences, but can share. Common usages for apps like SpringBoot + React:
Split into 2 subagents:
1. Create React component UserProfile.tsx with form for editing user data
2. Create Spring Boot REST endpoint PUT /api/users/{id} with validation
Both should use the same User DTO structure.
Use 3 subagents to refactor authentication:
1. Update Spring Security config to use JWT tokens
2. Create new React auth context and hooks
3. Update all affected API calls in frontend services
Split into 2 subagents:
1. Analyze all @RestController classes and generate OpenAPI 3.0 spec
2. Generate TypeScript fetch clients from the spec for React app
Use 3 subagents for testing ProductService:
1. Write JUnit tests for ProductService with MockMvc
2. Create Jest tests for React ProductList component
3. Generate test data seeds for both environments
Split into 3 subagents to add 'status' field to orders:
1. Create Flyway migration V002__add_order_status.sql
2. Update Order entity and OrderRepository in Spring Boot
3. Update Order interface and OrderService in React
Use 2 subagents for form validation:
1. Add @Valid annotations and custom validators to UserDTO in Spring Boot
2. Create Formik validation schema and error display in React UserForm
Split into 3 subagents:
1. Create /api/v2/products endpoints with new response format
2. Update React services to support both v1 and v2
3. Add feature flag to switch between versions
Use 3 subagents to add pagination to product list:
1. Add Pageable support to ProductRepository and ProductController
2. Implement pagination in React with useState and useEffect
3. Add Redis caching for frequently accessed pages
Split into 2 subagents for security:
1. Configure Spring Security with CORS, CSRF protection, and rate limiting
2. Add axios interceptors, token refresh logic, and XSS protection in React
Use 3 subagents for containerization:
1. Create optimized Dockerfile for Spring Boot with multi-stage build
2. Create Dockerfile for React with nginx
3. Write docker-compose.yml to orchestrate both services
Split into 2 subagents:
1. Configure Spring Boot Actuator with custom metrics and Prometheus
2. Add frontend error tracking with Sentry and performance monitoring
We can also setup communication between subagents or chain them:
Create shared types file first, then split into 3 subagents: - Subagent 1: Define User.ts interface - Subagent 2: Use it for backend UserDTO.java - Subagent 3: Use it for React UserProfile.tsx Chain subagents: 1. First: analyze current OrderController 2. Then split into 2: update controller + update React OrderService 3. Finally: one subagent writes integration tests
Git Worktrees
Setup flow:
# In your main repo cd /workspace/project # Create a worktrees directory (optional but organized) mkdir -p .worktrees echo ".worktrees/" >> .gitignore # Ensure you're on main/master git checkout main git pull origin main # Basic syntax git worktree add .worktrees/feature-name -b feature/feature-name git worktree add .worktrees/feature-name2 -b feature/feature-name2 origin/main # another from remote # List all worktrees git worktree list
After that setup you can cd .worktrees/feature-name and run claude there.
Commit / merge flow:
# Inside worktree - Claude Code will work here # All file changes stay isolated to this worktree # Check status anytime git status # Stage changes (Claude Code or manual) git add . # Commit (Claude Code can do this or you manually) git commit -m "feat: descripton" # Push to remote git push origin feature/feature-name # Go back to main repo cd /workspace/project # Option A: Merge locally git checkout main git merge feature/feature-name git push origin main # Option B: Create PR (preferred) # Just push and create PR on GitHub/GitLab cd .worktrees/feature-name git push origin feature/feature-name # Then create PR via web UI # After merge, delete remote branch git push origin --delete feature/feature-name # Delete local branch and worktree git worktree remove .worktrees/feature-name git branch -d feature/feature-name
All of these can be done with script which I will add in Sandbox section.
MCP
MCP servers are defined in ~/.claude.json and access from Claude Code with /mcp. My common use case is to connect to Obsidian and make summaries. More info: https://code.claude.com/docs/en/mcp
claude mcp add --transport http vercel https://mcp.vercel.com Added HTTP MCP server vercel with URL: https://mcp.vercel.com to local config File modified: /home/developer/.claude.json [project: /workspace/spring-test] # next in claude try /mcp to enable it by giving credentials

