My Claude Code Setup

May 4, 2026 · View on GitHub

GitHub stars GitHub forks GitHub issues

May 4, 2026 — CLAUDE.md template updated. The CLAUDE.md template has been modernized with 3 new variants (CLAUDE-template-1.md, CLAUDE-template-2.md, CLAUDE-template-3.md) following official Anthropic best practices — including dual-memory architecture, progressive disclosure, and standalone behavioral rules. Existing users: use CLAUDE-migrate-to-new-template.md as an AI prompt to migrate your current CLAUDE.md to any of the new templates while preserving all your project-specific content. See 2.7 CLAUDE.md Templates for details.

My Claude Code Setup

A comprehensive starter kit for Claude Code projects featuring a memory bank system for context retention, pre-configured hooks, skills, subagents, and MCP server recommendations.

You can also use Claude Code with Z.AI to get higher token usage quotas and get access to Z.AI GLM-4.7 LLM models within Claude Code. Use Z.AI invite code for additional 10% discount which can stack with current 50-60% yearly discounts.

Table of Contents


Quick Start

Get up and running in under 5 minutes:

Prerequisites Checklist:

  • Paid Claude AI account (Pro $20/mo, Max $100/mo, or Max $200/mo)
  • Node.js 18+ installed
  • Git installed
  • macOS: brew install ripgrep fd jq

Installation Options:

Choose the method that works best for you:

Option A: Clone Entire Repository (New Projects)

# 1. Clone this repository as your new project
git clone https://github.com/centminmod/my-claude-code-setup.git my-project
cd my-project

# 2. Remove template README files (create your own project README)
rm README.md README-v2.md README-v3.md README-v4.md

# 3. Reinitialize git for your own project (optional)
rm -rf .git
git init

# 4. Launch Claude Code and initialize
claude
# Then run: /init

Option B: Selective Copy (Existing Projects)

Copy only the files you need into your existing project:

# Core files (recommended)
cp /path/to/my-claude-code-setup/CLAUDE.md your-project/
cp -r /path/to/my-claude-code-setup/.claude your-project/

# Or selectively copy specific components:
cp -r /path/to/my-claude-code-setup/.claude/commands your-project/.claude/
cp -r /path/to/my-claude-code-setup/.claude/skills your-project/.claude/
cp -r /path/to/my-claude-code-setup/.claude/agents your-project/.claude/
cp -r /path/to/my-claude-code-setup/.claude/hooks your-project/.claude/

Option C: Download Specific Files (GitHub)

Browse the repository on GitHub and download individual files:

  • CLAUDE.md - Memory bank main file (uses Template 3 format)
  • CLAUDE-template-1.md - Compact self-contained template
  • CLAUDE-template-2.md - Memory bank system template
  • CLAUDE-template-3.md - Progressive disclosure template
  • CLAUDE-migrate-to-new-template.md - Template migration guide
  • .claude/settings.json - Settings template
  • .claude/rules/core-rules.md - Behavioral rules (required by Template 3)
  • .claude/commands/ - Slash commands you want
  • .claude/skills/ - Skills you want
  • .claude/agents/ - Subagents you want

After copying files, launch Claude Code in your project and run /init.


BEGINNER SECTION


1. Getting Started

1.1 What This Repository Provides

  • Memory Bank System: Structured context files for persistent memory across sessions
  • Pre-configured Settings: Optimized .claude/settings.json with fast tools
  • Custom Hooks: Desktop notifications when Claude Code completes tasks
  • Custom Skills: Specialized agents for documentation lookup
  • Custom Subagents: Task-specific agents for code search, UX design, and more
  • Custom Slash Commands: Security audits, refactoring plans, prompt engineering
  • MCP Server Recommendations: Curated list of useful MCP servers

1.2 Prerequisites

RequirementVersionPurpose
Claude AI AccountPro/MaxRequired for Claude Code access
Node.js18+Runtime environment
GitLatestVersion control
ripgrepLatestFast content search
fdLatestFast file finding
jqLatestJSON processing

Operating System Support:

  • macOS: Fully supported
  • Linux: Fully supported
  • Windows: Supported (PowerShell or CMD)

1.3 Installation Steps

  1. Copy Repository Files

    Copy all files from this GitHub repo to your project directory (where your intended codebase will be).

  2. Modify Template Files

    Edit CLAUDE.md to match your project. The .claude/settings.json file includes Terminal-Notifier for macOS notifications (setup guide). Remove this file if not using macOS.

  3. Initialize Memory Bank

    After launching Claude Code in your project directory, run /init to analyze your codebase and populate memory bank files.

  4. Install Fast Tools (macOS)

    brew install ripgrep fd jq
    

1.4 Optional Enhancements

1.5 Useful Learning Resources


2. Memory Bank System

2.1 What is Memory Bank?

The Memory Bank System is a structured set of markdown files that help Claude Code retain context across multiple chat sessions. Instead of starting fresh each time, Claude Code reads these files to understand your project's patterns, decisions, and current state.

2.2 Core Context Files

FilePurpose
CLAUDE.mdMain entry point with project overview and AI guidance
CLAUDE-activeContext.mdCurrent session state, goals, and progress
CLAUDE-patterns.mdEstablished code patterns and conventions
CLAUDE-decisions.mdArchitecture decisions and rationale (ADRs)
CLAUDE-troubleshooting.mdCommon issues and proven solutions
CLAUDE-config-variables.mdConfiguration variables reference
CLAUDE-temp.mdTemporary scratch pad (only read when referenced)

2.3 Token-Free Notes

HTML comments (<!-- -->) in CLAUDE.md are stripped from context at runtime and cost zero tokens. The templates use them for guidance notes and placeholder instructions — you can add your own without impacting Claude's context window. This makes them ideal for maintainer notes, TODOs, and documentation hints that only humans need to see.

2.4 Setting Up Memory Bank

  1. Copy the template files from this repository to your project root
  2. Run /init in Claude Code to analyze your codebase
  3. Claude Code will populate the memory bank files based on your project

2.5 Updating Memory Bank

After completing significant work, ask Claude Code to update the memory bank:

update memory bank

2.6 Memory Bank Example Output

Here's what Claude Code's thinking looks like when updating the memory bank:

> update memory bank

∴ Thinking…

  The user wants me to update the memory bank files. I should update the relevant CLAUDE-*.md files to reflect the v0.1.6 changes and current state. Let me check
   which memory bank files exist and update them.

∴ Thinking…

  I need to continue updating the memory bank files. I'll update:
  1. CLAUDE-patterns.md - Add export path handling pattern (Pattern 22)
  2. CLAUDE-decisions.md - Add ADR-017 for Phoneme API migration and ADR-018 for export path handling
  3. CLAUDE-troubleshooting.md - Add new issues and solutions for v0.1.6

∴ Thinking…

  The memory bank files have been modified but not committed. The v0.1.6 release was already committed and tagged, but the memory bank documentation updates are
  still uncommitted. Let me provide a summary of the completed work and offer to commit these documentation changes.

⏺ Summary: v0.1.6 Release Complete ✅

  Memory Bank Updates Complete:
  - CLAUDE-activeContext.md - v0.1.6 session context
  - CLAUDE-patterns.md - Added patterns 22-24 (Export Path, Format Detection, API Migration)
  - CLAUDE-decisions.md - Added ADR-017 & ADR-018
  - CLAUDE-troubleshooting.md - Added 4 new issue/fix entries

  v0.1.6 Fixes Applied:
  1. Export to absolute paths (e.g., --export /tmp/test.wav)
  2. Format detection from filename extension (prevents .mp3.wav)
  3. Phoneme API migrated to /dev/phonemize
  4. Test scripts updated for --export "" syntax

  Test Results: All 29 tests passing

  The memory bank documentation updates are ready to commit. Would you like me to commit them

2.7 CLAUDE.md Templates

This repo provides 3 modernized CLAUDE.md templates following official Anthropic best practices:

TemplateLinesPhilosophyBest For
CLAUDE-template-1.md~101Compact self-contained + memory resilienceQuick starts, small projects
CLAUDE-template-2.md~153Memory bank headline + dual memoryExisting memory bank users
CLAUDE-template-3.md~105Progressive disclosure nativeTeams, max context efficiency

All templates include dual-memory architecture (git-shared CLAUDE-*.md + machine-local auto memory), progressive disclosure (on-demand reading, not @ auto-loading), and standalone behavioral rules.

Migrating an existing CLAUDE.md? See CLAUDE-migrate-to-new-template.md — paste it as a prompt and Claude Code will migrate your content while preserving all your project-specific information.

Template 3 companion: .claude/rules/core-rules.md provides externalized behavioral rules. Required for Template 3, optional for Templates 1 and 2.


INTERMEDIATE SECTION


3. Extending Claude Code

3.1 Plugin System

Claude Code supports plugins from both official and third-party marketplaces.

Official Anthropic Marketplace

Browse and install plugins from the official marketplace.

# Install a plugin
/plugin install plugin-name@claude-plugins-official

# Update marketplace
/plugin marketplace update claude-plugins-official
PluginDescriptionInstall Command
code-simplifierSimplifies and refines code for clarity, consistency, and maintainability/plugin install code-simplifier
frontend-designCreates distinctive, production-grade frontend interfaces/plugin install frontend-design@claude-code-plugins
feature-devSystematic 7-phase approach to building new features/plugin install feature-dev@claude-code-plugins
ralph-wiggumInteractive self-referential AI loops for iterative development/plugin install ralph-wiggum@claude-code-plugins

Note: Ralph Wiggum may have issues on some systems. See #16398 and #16389. Usage guide: YouTube by Greg Isenberg | GitHub

Third-Party Marketplaces

PluginSourceDescriptionInstall Commands
safety-netcc-marketplaceCatches destructive git/filesystem commands before execution/plugin marketplace add kenryu42/cc-marketplace
/plugin install safety-net@cc-marketplace
glm-plan-usagezai-coding-pluginsQuery Z.AI usage statistics/plugin marketplace add zai/zai-coding-plugins
/plugin install glm-plan-usage@zai-coding-plugins
Cloudflare Skillscloudflare/skillsDevelopment skills for Cloudflare platform (Workers, Agents SDK)/plugin marketplace add cloudflare/skills

3.2 MCP Servers

MCP (Model Context Protocol) servers extend Claude Code's capabilities by connecting to external tools and documentation.

ServerPurposeTransportToken CostInstall Command
Context7Documentation lookup for any librarySSELowSee below
Cloudflare DocsCloudflare documentationSSELowSee below
Usage MetricsClaude Code usage and cost trackingstdioLowSee below
Gemini CLIAccess to Gemini modelsstdioVariableSee below
NotionNotion workspace integrationstdioVariableSee below
Chrome DevToolsBrowser automation & debuggingstdio~17K tokensSee below

Installation Commands

Context7 MCP (with API key):

claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY" -s user

Cloudflare Documentation MCP:

claude mcp add --transport sse cf-docs https://docs.mcp.cloudflare.com/sse -s user

Usage Metrics MCP:

claude mcp add --transport stdio metrics -s user -- uv run --directory /path/to/your/mcp-server metrics-server

Gemini CLI MCP:

claude mcp add gemini-cli /path/to/.venv/bin/python /path/to/mcp_server.py -s user -e GEMINI_API_KEY='YOUR_KEY' -e OPENROUTER_API_KEY='YOUR_KEY'

Notion MCP:

claude mcp add-json notionApi '{"type":"stdio","command":"npx","args":["-y","@notionhq/notion-mcp-server"],"env":{"OPENAPI_MCP_HEADERS":"{\"Authorization\": \"Bearer ntn_API_KEY\", \"Notion-Version\": \"2022-06-28\"}"}}' -s user

Chrome DevTools MCP (high token cost - use on-demand):

Due to the ~17K token overhead across 26 tools, install only when needed via --mcp-config:

claude --mcp-config .claude/mcp/chrome-devtools.json

Create .claude/mcp/chrome-devtools.json:

{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": ["-y", "chrome-devtools-mcp@latest"]
    }
  }
}

Verify MCP Servers

claude mcp list
# Output:
# context7: https://mcp.context7.com/sse (SSE) - ✓ Connected
# cf-docs: https://docs.mcp.cloudflare.com/sse (SSE) - ✓ Connected
# metrics: uv run --directory /path/to/mcp-server metrics-server - ✓ Connected

Usage Metrics Example

The get_current_cost MCP tool returns today's total USD cost:

{
  "metric": "Total Cost Today",
  "value": 27.149809833783127,
  "formatted": "\$27.1498",
  "unit": "currencyUSD"
}

4. Development Workflows

4.1 Git Worktrees for Parallel Sessions

Git worktrees allow you to run parallel Claude Code sessions with complete code isolation. Each worktree has its own working directory while sharing Git history.

Benefits:

  • Run multiple AI coding sessions in parallel
  • Each worktree has independent file state
  • Changes in one worktree won't affect others
  • Ideal for experimental features or YOLO mode

Official Documentation: Run parallel Claude Code sessions with git worktrees

macOS / Linux Shell Functions

Add to ~/.bashrc, ~/.zshrc, or ~/.bash_aliases:

# Codex CLI worktree launcher
cx() {
    local branch_name
    if [ -z "\$1" ]; then
        branch_name="worktree-$(date +%Y%m%d-%H%M%S)"
    else
        branch_name="\$1"
    fi
    git worktree add "../$branch_name" -b "$branch_name" && \
    cd "../$branch_name" || return 1
    codex -m gpt-5-codex --config model_reasoning_effort='xhigh'
}

# Claude Code worktree launcher
clx() {
    local branch_name
    if [ -z "\$1" ]; then
        branch_name="worktree-$(date +%Y%m%d-%H%M%S)"
    else
        branch_name="\$1"
    fi
    git worktree add "../$branch_name" -b "$branch_name" && \
    cd "../$branch_name" || return 1
    claude --model opusplan --permission-mode plan
}

After adding, reload: source ~/.bashrc or source ~/.zshrc

Windows PowerShell Functions

Add to your PowerShell profile (notepad $PROFILE):

# Codex CLI worktree launcher
function cx {
    param([string]$BranchName)
    if (-not $BranchName) {
        $BranchName = "worktree-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
    }
    git worktree add "../$BranchName" -b $BranchName
    if ($LASTEXITCODE -eq 0) {
        Set-Location "../$BranchName"
        codex -m gpt-5-codex --config model_reasoning_effort='xhigh'
    }
}

# Claude Code worktree launcher
function clx {
    param([string]$BranchName)
    if (-not $BranchName) {
        $BranchName = "worktree-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
    }
    git worktree add "../$BranchName" -b $BranchName
    if ($LASTEXITCODE -eq 0) {
        Set-Location "../$BranchName"
        claude --model opusplan --permission-mode plan
    }
}

Reload: . $PROFILE

Windows CMD Batch Files

Create in a directory in your PATH (e.g., C:\Users\YourName\bin\):

cx.bat - Codex CLI launcher:

@echo off
setlocal enabledelayedexpansion
if "%~1"=="" (
    for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set datetime=%%I
    set branch_name=worktree-!datetime:~0,8!-!datetime:~8,6!
) else (
    set branch_name=%~1
)
git worktree add "../%branch_name%" -b "%branch_name%"
if %errorlevel% equ 0 (
    cd "../%branch_name%"
    codex -m gpt-5-codex --config model_reasoning_effort='xhigh'
)
endlocal

clx.bat - Claude Code launcher:

@echo off
setlocal enabledelayedexpansion
if "%~1"=="" (
    for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set datetime=%%I
    set branch_name=worktree-!datetime:~0,8!-!datetime:~8,6!
) else (
    set branch_name=%~1
)
git worktree add "../%branch_name%" -b "%branch_name%"
if %errorlevel% equ 0 (
    cd "../%branch_name%"
    claude --model opusplan --permission-mode plan
)
endlocal

Usage

# Create worktree with custom name
clx feature-auth
cx bugfix-123

# Create worktree with auto-generated timestamp name
clx
cx

Worktree Management

# List all worktrees
git worktree list

# Remove a worktree when done
git worktree remove ../worktree-name

# Clean up stale worktree references
git worktree prune

Environment Setup

Each new worktree needs its own development environment:

  • JavaScript/Node.js: Run npm install or yarn
  • Python: Create virtual environment or run pip install -r requirements.txt
  • Other languages: Follow your project's standard setup process

The .worktreeinclude File

When Claude Code creates a worktree, files ignored via .gitignore aren't automatically available. The .worktreeinclude file specifies which ignored files should be copied.

How It Works:

  • Uses .gitignore-style patterns
  • Only files matched by both .worktreeinclude AND .gitignore are copied

Create .worktreeinclude in your repository root:

# Environment files
.env
.env.local
.env.*

# Claude Code local settings
**/.claude/settings.local.json

Common Use Cases:

  • .env files with API keys and secrets
  • .env.local for local development overrides
  • .claude/settings.local.json for personal Claude Code settings

Claude Desktop Worktree Location

When using Claude Code via the Claude Desktop app:

  • Default location: ~/.claude-worktrees
  • Configurable through Claude Desktop app settings
  • Repository must be Git initialized for worktree sessions

Official Documentation: Claude Code on Desktop

Local Ignores Without .gitignore

Use .git/info/exclude to ignore files locally without modifying shared .gitignore:

# Edit the local exclude file
nano .git/info/exclude

Add patterns:

# Local IDE settings
.idea/
*.swp

# Personal scripts
my-local-scripts/
FileScopeCommitted to Git
.gitignoreShared with teamYes
.git/info/excludeLocal onlyNo
~/.config/git/ignoreGlobal (all repos)No

4.2 Status Lines

Configure custom status lines in ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statuslines/statusline.sh",
    "padding": 0
  }
}

Example Status Line Script

Create ~/.claude/statuslines/statusline.sh:

#!/bin/bash
# Read JSON input from stdin
input=$(cat)

# Extract model and workspace values
MODEL_DISPLAY=$(echo "$input" | jq -r '.model.display_name')
CURRENT_DIR=$(echo "$input" | jq -r '.workspace.current_dir')

# Extract context window metrics
INPUT_TOKENS=$(echo "$input" | jq -r '.context_window.total_input_tokens')
OUTPUT_TOKENS=$(echo "$input" | jq -r '.context_window.total_output_tokens')
CONTEXT_SIZE=$(echo "$input" | jq -r '.context_window.context_window_size')

# Extract cost metrics
COST_USD=$(echo "$input" | jq -r '.cost.total_cost_usd')
LINES_ADDED=$(echo "$input" | jq -r '.cost.total_lines_added')
LINES_REMOVED=$(echo "$input" | jq -r '.cost.total_lines_removed')

# Extract percentage metrics
USED_PERCENTAGE=$(echo "$input" | jq -r '.context_window.used_percentage')
REMAINING_PERCENTAGE=$(echo "$input" | jq -r '.context_window.remaining_percentage')

# Format tokens as Xk
format_tokens() {
    local num="\$1"
    if [ "$num" -ge 1000 ]; then
        echo "$((num / 1000))k"
    else
        echo "$num"
    fi
}

# Generate progress bar for context usage
generate_progress_bar() {
    local percentage=\$1
    local bar_width=20
    local filled=$(awk "BEGIN {printf \"%.0f\", ($percentage / 100) * $bar_width}")
    local empty=$((bar_width - filled))
    local bar=""
    for ((i=0; i<filled; i++)); do bar+="█"; done
    for ((i=0; i<empty; i++)); do bar+="░"; done
    echo "$bar"
}

# Calculate total
TOTAL_TOKENS=$((INPUT_TOKENS + OUTPUT_TOKENS))

# Generate progress bar
PROGRESS_BAR=$(generate_progress_bar "$USED_PERCENTAGE")

# Show git branch if in a git repo
GIT_BRANCH=""
if git -C "$CURRENT_DIR" rev-parse --git-dir > /dev/null 2>&1; then
    BRANCH=$(git -C "$CURRENT_DIR" branch --show-current 2>/dev/null)
    if [ -n "$BRANCH" ]; then
        # Worktree detection
        GIT_DIR=$(git -C "$CURRENT_DIR" rev-parse --git-dir 2>/dev/null)
        WORKTREE=""
        if [[ "$GIT_DIR" == *".git/worktrees/"* ]] || [[ -f "$GIT_DIR/gitdir" ]]; then
            WORKTREE=" 🌳"
        fi
        # Ahead/behind detection
        AHEAD_BEHIND=""
        UPSTREAM=$(git -C "$CURRENT_DIR" rev-parse --abbrev-ref '@{u}' 2>/dev/null)
        if [ -n "$UPSTREAM" ]; then
            AHEAD=$(git -C "$CURRENT_DIR" rev-list --count '@{u}..HEAD' 2>/dev/null || echo 0)
            BEHIND=$(git -C "$CURRENT_DIR" rev-list --count 'HEAD..@{u}' 2>/dev/null || echo 0)
            if [ "$AHEAD" -gt 0 ] && [ "$BEHIND" -gt 0 ]; then
                AHEAD_BEHIND=" ↕${AHEAD}/${BEHIND}"
            elif [ "$AHEAD" -gt 0 ]; then
                AHEAD_BEHIND=" ↑${AHEAD}"
            elif [ "$BEHIND" -gt 0 ]; then
                AHEAD_BEHIND=" ↓${BEHIND}"
            fi
        fi
        GIT_BRANCH=" | 🌿 $BRANCH${WORKTREE}${AHEAD_BEHIND}"
    fi
fi

echo "[$MODEL_DISPLAY] 📁 ${CURRENT_DIR##*/}${GIT_BRANCH}
Context: [$PROGRESS_BAR] ${USED_PERCENTAGE}%
Cost: \$${COST_USD} | +${LINES_ADDED} -${LINES_REMOVED} lines"

4.3 IDE Integration


ADVANCED SECTION


5. Customization

5.1 Custom Subagents

Subagents are specialized tools that handle complex, multi-step tasks autonomously with their own context window and custom prompts. Learn more in the official documentation.

Included Subagents

AgentLocationPurpose
memory-bank-synchronizer.claude/agents/Synchronizes memory bank documentation with codebase state
code-searcher.claude/agents/Efficient codebase navigation with optional Chain of Draft mode
get-current-datetime.claude/agents/Accurate Brisbane timezone (GMT+10) values
ux-design-expert.claude/agents/Comprehensive UX/UI design guidance with Tailwind CSS & Highcharts
zai-cli.claude/agents/CLI wrapper for z.ai GLM 4.7 model (used by consult-zai skill)
codex-cli.claude/agents/CLI wrapper for OpenAI Codex GPT-5.2 (used by consult-codex skill)

memory-bank-synchronizer

Proactively maintains consistency between CLAUDE-*.md files and source code:

  • Pattern documentation synchronization
  • Architecture decision updates
  • Technical specification alignment
  • Implementation status tracking

code-searcher

Efficiently searches the codebase with two modes:

  • Standard mode: Full detailed analysis
  • CoD mode: ~80% fewer tokens with ultra-concise responses
# Standard: "Find the payment processing code"
# CoD: "Find the payment processing code using CoD"

get-current-datetime

Returns accurate Brisbane, Australia (GMT+10) timestamps:

  • Supports multiple formats (default, filename, readable, ISO)
  • Eliminates timezone confusion

ux-design-expert

Comprehensive UX/UI guidance:

  • UX flow optimization
  • Premium UI design with Tailwind CSS
  • Data visualization with Highcharts
  • Accessibility compliance

zai-cli

CLI wrapper for z.ai GLM 4.7 model:

  • Executes z.ai CLI with JSON output
  • Used internally by consult-zai skill
  • Returns raw output for skill to process

codex-cli

CLI wrapper for OpenAI Codex GPT-5.2:

  • Executes Codex CLI in readonly mode
  • Used internally by consult-codex skill
  • Returns raw output for skill to process

5.2 Custom Skills

Skills provide specialized capabilities. See Agent Skills documentation.

Included Skills

SkillPurposeInvocation
claude-code-guide (built-in)Natively built-in subagent for Claude Code CLI features, hooks, MCP servers, settings, Agent SDK, and API usageAutomatic when working on Claude Code features
consult-zaiDual-AI consultation comparing z.ai GLM 4.7 and code-searcher/consult-zai "question" or via Skill tool
consult-codexDual-AI consultation comparing Codex GPT-5.2 and code-searcher/consult-codex "question" or via Skill tool
ai-image-creatorGenerate PNG images using AI (multiple models including Gemini, FLUX.2, Riverflow, SeedDream, GPT-5, GPT-5.4 Image 2 via OpenRouter/Cloudflare AI Gateway). Supports transparent backgrounds (-t), reference image editing (-r), image analysis and description (--analyze), per-project cost tracking (--costs), prompt enhancement patterns, and composite banner generation for multi-size logo banners via ImageMagick. Requires setup/ai-image-creator or via Skill tool
session-metricsParse Claude Code JSONL logs into per-turn token/cost/cache breakdowns with multi-format export (text/JSON/CSV/MD/HTML). Includes 5-hour session blocks with 7/14/30-day counters for weekly-cap tracking, weekly roll-up with percentage deltas, session duration + burn rate, hour-of-day bars, weekday × hour punchcard, and pluggable chart libraries via --chart-lib {highcharts,uplot,chartjs,none} (Highcharts default, uPlot/Chart.js MIT alternatives, all vendored + SHA-256 verified). Instance-wide dashboard (--all-projects, v1.14.0+) rolls up every project under ~/.claude/projects/ into one dated export folder with per-project HTML drilldowns and a daily-cost timeline. Zero network at runtime, stdlib-only Python.Auto-triggers on cost/usage questions or uv run python .claude/skills/session-metrics/scripts/session-metrics.py — also installable via /plugin marketplace add centminmod/claude-plugins + /plugin install session-metrics@centminmod

5.3 Custom Slash Commands

/anthropic Commands

CommandPurpose
/apply-thinking-toApplies Anthropic's extended thinking patterns to enhance prompts
/convert-to-todowrite-tasklist-promptConverts prompts to TodoWrite tasklist methods (60-70% speed improvement)
/update-memory-bankUpdates CLAUDE.md and memory bank files

/ccusage Commands

CommandPurpose
/ccusage-dailyGenerates comprehensive usage cost analysis with daily breakdowns

/cleanup Commands

CommandPurpose
/cleanup-contextMemory bank optimization (15-25% token reduction)

/documentation Commands

CommandPurpose
/create-readme-sectionGenerates README sections with professional formatting
/create-release-noteCreates dual release notes (customer-facing + technical)

/security Commands

CommandPurpose
/security-auditComprehensive security audit using OWASP guidelines
/check-best-practicesAnalyzes code against language-specific best practices
/secure-promptsDetects prompt injection attacks and malicious instructions

Example test prompts at .claude/commands/security/test-examples/

/architecture Commands

CommandPurpose
/explain-architecture-patternIdentifies and explains architectural patterns

/promptengineering Commands

CommandPurpose
/convert-to-test-driven-promptTransforms requests into TDD-style prompts
/batch-operations-promptOptimizes prompts for parallel processing

/refactor Commands

CommandPurpose
/refactor-codeCreates detailed refactoring plans with risk assessment

5.4 Hooks System

Hooks run custom commands before or after tool execution.

Included Hooks

The STOP hook uses Terminal-Notifier for macOS desktop notifications when Claude Code completes a response. Setup: Terminal-Notifier


6. Alternative Providers

6.1 Using Z.AI with Claude Code

Z.AI's GLM Coding Plan provides cost-effective access to high-performance language models optimized for coding.

10% Discount: Use invite code WWB8IFLROM

Overview

  • Performance: 55+ tokens/second for real-time interaction
  • Features: Vision Understanding, Web Search, Web Reader MCP servers
  • Multimodal: GLM-4.7 with state-of-the-art reasoning capabilities

Pricing & Plans

PlanPrompts/5hrsApprox. Monthly Costvs Claude
Lite~120~$33× Claude Pro quota
Pro~600Higher3× Claude Max 5x quota
Max~2,400Higher3× Claude Max 20x quota

Each prompt allows 15–20 model calls, yielding billions of tokens monthly at ~1% of standard API pricing.

Privacy & Data Handling

  • Data Location: Singapore
  • Privacy Guarantee: Z.AI does not store any content you provide or generate
  • See Privacy Policy

Prerequisites

Setup Instructions

Option 1: Automated Setup (macOS/Linux only)

curl -O "https://cdn.bigmodel.cn/install/claude_code_zai_env.sh" && bash ./claude_code_zai_env.sh

Option 2: Manual Configuration

Edit ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your-zai-api-key",
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "API_TIMEOUT_MS": "3000000"
  }
}

Shell Function Launchers

The easiest way to use Z.AI without affecting your existing Claude Code setup.

macOS / Linux (Bash/Zsh)

Add to ~/.bashrc, ~/.zshrc, or ~/.bash_aliases:

# Z.AI + Claude Code launcher
zai() {
    export ANTHROPIC_AUTH_TOKEN="your-zai-api-key"
    export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
    export API_TIMEOUT_MS="3000000"
    claude "$@"
}

Reload: source ~/.bashrc or source ~/.zshrc

Windows PowerShell

Add to PowerShell profile (notepad $PROFILE):

# Z.AI + Claude Code launcher
function zai {
    $env:ANTHROPIC_AUTH_TOKEN = "your-zai-api-key"
    $env:ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic"
    $env:API_TIMEOUT_MS = "3000000"
    claude $args
}

Reload: . $PROFILE

Windows CMD Batch

Create zai.bat in a directory in your PATH:

@echo off
set ANTHROPIC_AUTH_TOKEN=your-zai-api-key
set ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
set API_TIMEOUT_MS=3000000
claude %*

Model Mapping

GLM Coding Plan maps Claude model names to GLM models:

Claude ModelGLM Model
OpusGLM-4.7
SonnetGLM-4.7
HaikuGLM-4.5-Air

Customizing Model Mappings (optional):

In ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your-zai-api-key",
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "API_TIMEOUT_MS": "3000000",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "GLM-4.7",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "GLM-4.5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "GLM-4.5-Air"
  }
}

Or in shell function:

zai() {
    export ANTHROPIC_AUTH_TOKEN="your-zai-api-key"
    export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
    export API_TIMEOUT_MS="3000000"
    export ANTHROPIC_DEFAULT_OPUS_MODEL="GLM-4.7"
    export ANTHROPIC_DEFAULT_SONNET_MODEL="GLM-4.5"
    export ANTHROPIC_DEFAULT_HAIKU_MODEL="GLM-4.5-Air"
    claude "$@"
}
Windows PowerShell Model Mapping
function zai {
    $env:ANTHROPIC_AUTH_TOKEN = "your-zai-api-key"
    $env:ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic"
    $env:API_TIMEOUT_MS = "3000000"
    $env:ANTHROPIC_DEFAULT_OPUS_MODEL = "GLM-4.7"
    $env:ANTHROPIC_DEFAULT_SONNET_MODEL = "GLM-4.5"
    $env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "GLM-4.5-Air"
    claude $args
}
Windows CMD Model Mapping
@echo off
set ANTHROPIC_AUTH_TOKEN=your-zai-api-key
set ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
set API_TIMEOUT_MS=3000000
set ANTHROPIC_DEFAULT_OPUS_MODEL=GLM-4.7
set ANTHROPIC_DEFAULT_SONNET_MODEL=GLM-4.5
set ANTHROPIC_DEFAULT_HAIKU_MODEL=GLM-4.5-Air
claude %*

Usage

# Launch with Z.AI configuration
zai

# Launch with specific model
zai --model sonnet

# Launch with permission mode
zai --model opus --permission-mode plan

Z.AI + Git Worktree Integration

Combine Z.AI with git worktrees for isolated parallel sessions.

macOS / Linux (Bash/Zsh)

# Z.AI + Claude Code worktree launcher
zaix() {
    local branch_name
    if [ -z "\$1" ]; then
        branch_name="worktree-$(date +%Y%m%d-%H%M%S)"
    else
        branch_name="\$1"
    fi
    git worktree add "../$branch_name" -b "$branch_name" && \
    cd "../$branch_name" || return 1

    export ANTHROPIC_AUTH_TOKEN="your-zai-api-key"
    export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
    export API_TIMEOUT_MS="3000000"
    claude --model sonnet --permission-mode plan
}
Windows PowerShell Z.AI + Worktree
# Z.AI + Claude Code worktree launcher
function zaix {
    param([string]$BranchName)
    if (-not $BranchName) {
        $BranchName = "worktree-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
    }
    git worktree add "../$BranchName" -b $BranchName
    if ($LASTEXITCODE -eq 0) {
        Set-Location "../$BranchName"
        $env:ANTHROPIC_AUTH_TOKEN = "your-zai-api-key"
        $env:ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic"
        $env:API_TIMEOUT_MS = "3000000"
        claude --model sonnet --permission-mode plan
    }
}
Windows CMD Z.AI + Worktree

Create zaix.bat:

@echo off
setlocal enabledelayedexpansion
if "%~1"=="" (
    for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set datetime=%%I
    set branch_name=worktree-!datetime:~0,8!-!datetime:~8,6!
) else (
    set branch_name=%~1
)
git worktree add "../%branch_name%" -b "%branch_name%"
if %errorlevel% equ 0 (
    cd "../%branch_name%"
    set ANTHROPIC_AUTH_TOKEN=your-zai-api-key
    set ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
    set API_TIMEOUT_MS=3000000
    claude --model sonnet --permission-mode plan
)
endlocal

Usage:

# Create worktree with custom name
zaix feature-auth

# Create worktree with auto-generated timestamp name
zaix

6.1.x Claude Code GitHub Actions

Claude Code can be integrated with GitHub Actions to automate AI-powered workflows. With a simple @claude mention in PRs or issues, Claude can analyze code, implement features, fix bugs, and follow project standards defined in CLAUDE.md.

Key capabilities:

  • Respond to @claude mentions in issues and pull requests
  • Create and modify code through pull requests
  • Follow project-specific guidelines from CLAUDE.md
  • Execute slash commands like /review

Reference: Claude Code GitHub Actions Documentation

Z.AI Integration Example

Create .github/workflows/claude.yml:

Click to expand workflow YAML
name: Claude Code

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned]
  pull_request_review:
    types: [submitted]

jobs:
  claude:
    if: |
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
      (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
      issues: write
      id-token: write
      actions: read
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
        with:
          fetch-depth: 1

      - name: Run Claude Code
        id: claude
        uses: anthropics/claude-code-action@v1
        env:
          ANTHROPIC_BASE_URL: https://api.z.ai/api/anthropic
          API_TIMEOUT_MS: 3000000
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          claude_args: |
            --model claude-opus
            --max-turns 100

Workflow Explanation

ComponentPurpose
Event TriggersListens for issue_comment, pull_request_review_comment, issues, and pull_request_review events
Conditional (if)Only runs when @claude is mentioned in the comment/issue body or title
Permissionscontents: write for code changes, pull-requests: write for PRs, issues: write for issue responses, actions: read for CI results
ANTHROPIC_BASE_URLRoutes API calls through Z.AI endpoint for higher quotas
API_TIMEOUT_MSExtended timeout (50 minutes) for complex operations
claude_argsUses claude-opus model with up to 100 turns for complex tasks

Setup Requirements

  1. Add API key as secret: Go to repository Settings → Secrets and variables → Actions → Add ANTHROPIC_API_KEY with your Z.AI API key
  2. Create workflow file: Save the YAML above to .github/workflows/claude.yml
  3. Usage: Mention @claude in any issue or PR comment to trigger the workflow

7. Cost & Rate Management

7.1 Claude Plan Weekly Rate Limits

From August 28, 2025, weekly rate limits apply in addition to monthly 50x 5hr session limits:

PlanSonnet 4 (hrs/week)Opus 4 (hrs/week)
Pro40–80
Max ($100/mo)140–28015–35
Max ($200/mo)240–48024–40

7.2 Cost Tracking

Use the Usage Metrics MCP server to track costs:

claude mcp add --transport stdio metrics -s user -- uv run --directory /path/to/mcp-server metrics-server

Or use the /ccusage-daily slash command for detailed cost analysis.

7.3 Optimization Tips

  • Use Z.AI for higher quotas at lower cost
  • Configure status lines to monitor real-time usage
  • Use git worktrees for parallel sessions without duplicating quota
  • Leverage CoD mode in code-searcher for 80% token reduction

REFERENCE SECTION


8. Configuration Reference

8.1 Settings Scopes

ScopeLocationAffectsShared?
ManagedSystem directoriesAll usersBy IT
User~/.claude/settings.jsonYou (all projects)No
Project.claude/settings.jsonAll collaboratorsYes
Local.claude/settings.local.jsonYou (this project)No

Precedence (highest to lowest):

  1. Enterprise policies
  2. Command line arguments
  3. Local project settings
  4. Shared project settings
  5. User settings

8.2 settings.json Options

KeyDescriptionExample
apiKeyHelperScript to generate auth value/bin/generate_temp_api_key.sh
cleanupPeriodDaysDays to retain chat transcripts (default: 30)20
envEnvironment variables for every session{"FOO": "bar"}
includeCoAuthoredByInclude co-authored-by Claude in commitsfalse
permissionsPermission rules (see below)

Permission Settings

KeyDescriptionExample
allowArray of allowed tool use rules["Bash(git diff:*)"]
denyArray of denied tool use rules["WebFetch", "Bash(curl:*)"]
additionalDirectoriesAdditional working directories["../docs/"]
defaultModeDefault permission mode"acceptEdits"
disableBypassPermissionsModePrevent bypass mode"disable"

8.3 Environment Variables

VariablePurpose
ANTHROPIC_API_KEYAPI key for Claude SDK
ANTHROPIC_AUTH_TOKENCustom auth header value
ANTHROPIC_BASE_URLCustom API endpoint
ANTHROPIC_MODELCustom model name
ANTHROPIC_SMALL_FAST_MODELHaiku-class model for background tasks
BASH_DEFAULT_TIMEOUT_MSDefault bash command timeout
BASH_MAX_TIMEOUT_MSMaximum bash command timeout
BASH_MAX_OUTPUT_LENGTHMax characters before truncation
CLAUDE_CODE_MAX_OUTPUT_TOKENSMax output tokens per request
CLAUDE_CODE_USE_BEDROCKUse Amazon Bedrock
CLAUDE_CODE_USE_VERTEXUse Google Vertex AI
DISABLE_AUTOUPDATERDisable automatic updates
DISABLE_TELEMETRYOpt out of Statsig telemetry
HTTP_PROXY / HTTPS_PROXYProxy server settings
MAX_THINKING_TOKENSForce thinking budget
MCP_TIMEOUTMCP server startup timeout
MCP_TOOL_TIMEOUTMCP tool execution timeout
MAX_MCP_OUTPUT_TOKENSMax MCP response tokens (default: 25000)

8.4 File Locations by OS

FilemacOSLinuxWindows
User settings~/.claude/settings.json~/.claude/settings.json%USERPROFILE%\.claude\settings.json
Project settings.claude/settings.json.claude/settings.json.claude\settings.json
Local settings.claude/settings.local.json.claude/settings.local.json.claude\settings.local.json

8.5 Tools Available to Claude

ToolDescriptionPermission Required
AgentRuns sub-agents for complex tasksNo
BashExecutes shell commandsYes
EditMakes targeted file editsYes
GlobFinds files by patternNo
GrepSearches file contentsNo
LSLists files and directoriesNo
MultiEditMultiple edits atomicallyYes
NotebookEditModifies Jupyter cellsYes
NotebookReadReads Jupyter notebooksNo
ReadReads file contentsNo
TodoReadReads task listNo
TodoWriteCreates/manages task listsNo
WebFetchFetches URL contentYes
WebSearchPerforms web searchesYes
WriteCreates/overwrites filesYes

8.6 Configuration Commands

# List settings
claude config list

# Get a setting
claude config get <key>

# Set a setting
claude config set <key> <value>

# Add to a list setting
claude config add <key> <value>

# Remove from a list setting
claude config remove <key> <value>

# Global configuration
claude config set -g <key> <value>

Global Configuration Options

KeyDescriptionExample
autoUpdatesEnable automatic updates (default: true)false
preferredNotifChannelNotification methoditerm2, terminal_bell, notifications_disabled
themeColor themedark, light, light-daltonized, dark-daltonized
verboseShow full command outputstrue

9. Resources

Official Documentation

YouTube Guides

Other Resources


Star History

Star History Chart


Stats

Alt