Skip to content

heyong4725/claude-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Professional Setup

A portable, reproducible Claude Code configuration for professional Rust development with GitHub integration.

Quick Install

git clone https://github.com/YOUR_USERNAME/claude-setup.git
cd claude-setup
./install.sh

What's Included

Core Philosophy

Based on best practices from:

  • Karpathy Method - Think before coding, simplicity first, surgical changes
  • Boris Cherny (Claude Code creator) - Plan mode, verification loops, slash commands
  • everything-claude-code - Agents, rules, skills architecture
  • rust-skills - Meta-cognition framework for Rust development

Directory Structure

~/.claude/
├── CLAUDE.md              # Global instructions (Karpathy + workflow)
├── settings.json          # Permissions, hooks, model config
├── mcp.json               # GitHub MCP integration
├── rules/                 # Always-follow guidelines
│   ├── security.md        # No secrets, input validation
│   ├── coding-style.md    # Immutability, small files
│   ├── git-workflow.md    # Conventional commits, PR process
│   ├── testing.md         # TDD, 80% coverage target
│   └── agents.md          # When to delegate to subagents
├── agents/                # Subagents for delegation
│   ├── planner.md         # Complex features, multi-step work
│   ├── architect.md       # System design decisions
│   ├── code-reviewer.md   # Post-implementation review
│   ├── security-reviewer.md # Security audit
│   └── tdd-guide.md       # Test-driven development
├── commands/              # Slash commands
│   ├── plan.md            # /plan - Implementation planning
│   ├── review.md          # /review - Code review
│   ├── tdd.md             # /tdd - TDD workflow
│   ├── commit.md          # /commit - Formatted commits
│   ├── pr.md              # /pr - Create GitHub PR
│   ├── pr-review.md       # /pr-review - Review PRs
│   └── (rust-skills cmds) # /audit, /crate-info, etc.
├── hooks/
│   └── auto-format.sh     # Auto-format Rust on Write/Edit
└── skills/                # 39 Rust skills from rust-skills
    ├── m01-ownership/     # Ownership/borrow/lifetime
    ├── m02-resource/      # Smart pointers, RAII
    ├── m03-mutability/    # Interior mutability
    ├── m04-zero-cost/     # Generics, traits
    ├── m05-type-driven/   # Type state patterns
    ├── m06-error-handling/# Result, Option, anyhow
    ├── m07-concurrency/   # Async, threads, channels
    ├── domain-*/          # Web, CLI, embedded, etc.
    └── ...

~/src/.project-templates/
├── makepad/               # Makepad UI framework
│   ├── setup.sh
│   └── CLAUDE.md
├── dora/                  # Dora-rs dataflow
│   ├── setup.sh
│   └── CLAUDE.md
├── pre-commit-hook.sh     # Git pre-commit for Rust
└── CLAUDE.md.template     # Generic project template

Core Principles (CLAUDE.md)

1. Think Before Coding

  • Surface assumptions BEFORE coding
  • Ask clarifying questions rather than guessing
  • Present multiple interpretations when ambiguous

2. Simplicity First

  • Implement ONLY what was requested
  • Minimum code that solves the problem
  • No unnecessary abstractions or error handling

3. Surgical Changes

  • Modify ONLY what's necessary
  • Match existing code style exactly
  • Clean up only your own mess

4. Goal-Driven Execution

  • Define verifiable success criteria BEFORE implementation
  • Loop until goals are confirmed met

Workflow

1. Plan Mode (Shift+Tab x2) → iterate on plan
2. /plan <feature>          → detailed implementation plan
3. /tdd <feature>           → test-driven development
4. /review                  → review before commit
5. /commit                  → well-formatted commit
6. /pr                      → create GitHub PR

Commands Reference

Command Purpose
/plan Create implementation plan
/tdd Test-driven development cycle
/review Review code changes
/commit Create formatted commit
/pr Create GitHub Pull Request
/pr-review <n> Review PR #n
/rust-review Rust-specific code review
/audit Security audit
/crate-info <name> Get crate information
/unsafe-check Check unsafe code

Cargo Plugins

Installed by setup script:

  • cargo-audit - Security vulnerability scanner
  • cargo-deny - Dependency policy enforcement
  • cargo-watch - Auto-rebuild on change
  • cargo-expand - Macro expansion viewer

Project Setup

New Rust Project

cargo new my-project && cd my-project
cp ~/src/.project-templates/CLAUDE.md.template CLAUDE.md
cp ~/src/.project-templates/pre-commit-hook.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
# Edit CLAUDE.md with project specifics

Makepad Project

~/src/.project-templates/makepad/setup.sh /path/to/project

Dora-rs Project

~/src/.project-templates/dora/setup.sh /path/to/project

GitHub Integration

MCP integration enables Claude to:

  • Create/review Pull Requests
  • Manage issues
  • Query repository data

Setup:

gh auth login
export GITHUB_TOKEN=$(gh auth token)  # Add to ~/.bashrc or ~/.zshrc

Permissions

Pre-approved commands (no confirmation needed):

  • All git commands
  • All cargo commands
  • All gh (GitHub CLI) commands
  • make, ls, which

Customization

Add Project-Specific Rules

Edit project's .claude/CLAUDE.md:

## Mistakes Log
- Don't use unwrap() in this codebase, use expect() with message
- Always use tracing instead of println! for logging

Add Custom Commands

Create .claude/commands/my-command.md:

# My Command
Description of what this command does.
$ARGUMENTS

Updating

cd ~/src/claude-setup
git pull
./install.sh  # Re-run installer

Requirements

  • Rust (rustup)
  • GitHub CLI (gh)
  • Claude Code CLI v2.1+

License

MIT

About

Claude Code professional setup for Rust development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages