claude-code-haha-local
```markdown
What this skill does
```markdown --- name: claude-code-haha-local description: Run the leaked Claude Code source locally with any Anthropic-compatible API endpoint triggers: - set up claude code haha locally - run claude code from source - configure custom API endpoint for claude code - use minimax or openrouter with claude code - fix claude code not starting - connect claude code to compatible API - run leaked claude code source - self-host claude code with custom model --- # Claude Code Haha — Local Runnable Claude Code from Leaked Source > Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection. A patched, locally runnable version of the Claude Code source that leaked from Anthropic's npm registry on 2026-03-31. Fixes multiple blocking issues in the original leak so the full Ink TUI works. Supports any Anthropic-compatible API (MiniMax, OpenRouter, etc.). --- ## What It Does - Full Ink TUI interactive interface (identical to official Claude Code) - `--print` headless mode for scripts/CI - MCP server, plugin, and Skills support - Custom API endpoint and model configuration - Fallback Recovery CLI mode if TUI fails --- ## Installation ### 1. Install Bun (required runtime) ```bash # macOS / Linux curl -fsSL https://bun.sh/install | bash # If unzip is missing on minimal Linux apt update && apt install -y unzip # macOS via Homebrew brew install bun # Windows (PowerShell) powershell -c "irm bun.sh/install.ps1 | iex" ``` Verify: ```bash bun --version ``` ### 2. Clone and install dependencies ```bash git clone https://github.com/NanmiCoder/claude-code-haha.git cd claude-code-haha bun install ``` ### 3. Configure environment ```bash cp .env.example .env ``` Edit `.env`: ```env # Authentication — pick ONE ANTHROPIC_API_KEY= # sent as x-api-key header ANTHROPIC_AUTH_TOKEN= # sent as Authorization: Bearer header # Custom endpoint (omit for official Anthropic) ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic # Model names — map all tiers to your provider's model ANTHROPIC_MODEL=MiniMax-M2.7-highspeed ANTHROPIC_DEFAULT_SONNET_MODEL=MiniMax-M2.7-highspeed ANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7-highspeed ANTHROPIC_DEFAULT_OPUS_MODEL=MiniMax-M2.7-highspeed # Timeout in ms (default 600000 = 10 min) API_TIMEOUT_MS=3000000 # Disable telemetry and non-essential network requests DISABLE_TELEMETRY=1 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 ``` --- ## Key Commands ```bash # Full interactive TUI ./bin/claude-haha # Headless single-shot (print mode) ./bin/claude-haha -p "explain this codebase" # Pipe input into headless mode echo "what does main.tsx do?" | ./bin/claude-haha -p # Force fallback Recovery CLI (plain readline) CLAUDE_CODE_FORCE_RECOVERY_CLI=1 ./bin/claude-haha # Help / all options ./bin/claude-haha --help ``` --- ## Supported Environment Variables | Variable | Required | Purpose | |---|---|---| | `ANTHROPIC_API_KEY` | One of two | Sent as `x-api-key` | | `ANTHROPIC_AUTH_TOKEN` | One of two | Sent as `Authorization: Bearer` | | `ANTHROPIC_BASE_URL` | No | Override API endpoint | | `ANTHROPIC_MODEL` | No | Primary model name | | `ANTHROPIC_DEFAULT_SONNET_MODEL` | No | Sonnet-tier model | | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | No | Haiku-tier model | | `ANTHROPIC_DEFAULT_OPUS_MODEL` | No | Opus-tier model | | `API_TIMEOUT_MS` | No | Request timeout (ms) | | `DISABLE_TELEMETRY` | No | Set `1` to disable | | `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | No | Set `1` to suppress extras | | `CLAUDE_CODE_FORCE_RECOVERY_CLI` | No | Set `1` for plain CLI fallback | --- ## Provider Configuration Examples ### Official Anthropic API ```env ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY ANTHROPIC_MODEL=claude-sonnet-4-5 ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-5 ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5 ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-5 ``` ### MiniMax ```env ANTHROPIC_AUTH_TOKEN=$MINIMAX_API_KEY ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic ANTHROPIC_MODEL=MiniMax-M2.7-highspeed ANTHROPIC_DEFAULT_SONNET_MODEL=MiniMax-M2.7-highspeed ANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7-highspeed ANTHROPIC_DEFAULT_OPUS_MODEL=MiniMax-M2.7-highspeed ``` ### OpenRouter ```env ANTHROPIC_AUTH_TOKEN=$OPENROUTER_API_KEY ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1 ANTHROPIC_MODEL=anthropic/claude-sonnet-4-5 ANTHROPIC_DEFAULT_SONNET_MODEL=anthropic/claude-sonnet-4-5 ANTHROPIC_DEFAULT_HAIKU_MODEL=anthropic/claude-haiku-4-5 ANTHROPIC_DEFAULT_OPUS_MODEL=anthropic/claude-opus-4-5 ``` --- ## Project Structure ``` bin/claude-haha # Entry script preload.ts # Bun preload — sets MACRO globals .env.example # Env var template src/ ├── entrypoints/cli.tsx # CLI main entry ├── main.tsx # TUI logic (Commander.js + React/Ink) ├── localRecoveryCli.ts # Fallback Recovery CLI ├── setup.ts # Startup initialization ├── screens/REPL.tsx # Interactive REPL screen ├── ink/ # Ink terminal render engine ├── components/ # UI components ├── tools/ # Agent tools (Bash, Edit, Grep…) ├── commands/ # Slash commands (/commit, /review…) ├── skills/ # Skill system ├── services/ # Services (API, MCP, OAuth…) ├── hooks/ # React hooks └── utils/ # Utilities ``` --- ## Common Patterns ### Run a one-shot code review in CI ```bash #!/bin/bash export ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" export ANTHROPIC_MODEL="claude-sonnet-4-5" export DISABLE_TELEMETRY=1 export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 git diff HEAD~1 | ./bin/claude-haha -p "Review this diff for bugs and security issues" ``` ### Pipe a file for analysis ```bash cat src/main.tsx | ./bin/claude-haha -p "Summarize what this file does" ``` ### Use a longer timeout for large codebases ```bash API_TIMEOUT_MS=600000 ./bin/claude-haha -p "Explain the architecture of this project" ``` ### Force Recovery CLI for low-resource environments ```bash CLAUDE_CODE_FORCE_RECOVERY_CLI=1 ./bin/claude-haha ``` --- ## Troubleshooting ### TUI does not start / shows nothing The original leak routed no-argument launches to recovery CLI. This repo fixes it, but if you see a blank screen: ```bash # Check Bun version (needs recent) bun --version # Try recovery mode to confirm the API connection works CLAUDE_CODE_FORCE_RECOVERY_CLI=1 ./bin/claude-haha ``` ### Enter key does nothing in TUI Caused by missing `modifiers-napi` native package. The repo patches this with a try-catch in the `handleEnter` path. If you still hit it: ```bash bun install # re-run in case native bindings failed ``` ### Startup hangs immediately Missing stub files (`verify` skill `.md`, `ultraplan/prompt.txt`, `filePersistence/types.ts`). These are included in this repo. If missing after a fresh clone: ```bash git status # check for untracked/missing files git checkout . # restore any accidentally deleted stubs ``` ### `--print` mode hangs Usually means `filePersistence/types.ts` or `ultraplan/prompt.txt` stub is absent. Verify: ```bash ls src/filePersistence/types.ts ls src/ultraplan/prompt.txt ``` If missing, create empty stubs: ```bash touch src/filePersistence/types.ts touch src/ultraplan/prompt.txt ``` ### API authentication errors - `ANTHROPIC_API_KEY` → sent as `x-api-key` header (standard Anthropic format) - `ANTHROPIC_AUTH_TOKEN` → sent as `Authorization: Bearer <token>` (some compatible APIs require this) - Set only one; if both are set, check which your provider expects ### Provider rejects model name All four model env vars must be set to names your provider recognizes: ```env ANTHROPIC_MODEL=your-provider-model-name ANTHROPIC_DEFAULT_SONNET_MODEL=your-provider-model-name ANTHROPIC_DEFAULT_HAIKU_MODEL=your-provider-model-name ANTHROPIC_DEFAULT_OPUS_MODEL=your-provider-model-name ``` ### Telemetry / unexpected outbound requests ```env DISABLE_TELEMETRY=1 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.