tech/claude-code

CLAUDE CODE

Claude Code setup and patterns.

production Claude Code CLI, claude.ai/code
improves: tech

Claude Code

Claude Code is the primary build environment for all 2nth.ai work. Every client project should have a properly configured Claude Code environment.

Project Structure

project/
├── CLAUDE.md                   # Project context — loaded automatically
├── .claude/
│   ├── settings.json           # Tool permissions, MCP servers
│   └── settings.local.json     # Local overrides (gitignore this)
└── memory/                     # Persistent memory (if enabled)
    └── MEMORY.md

CLAUDE.md Principles

A good CLAUDE.md contains:

A CLAUDE.md does NOT contain:

.claude/settings.json Pattern

{
  "permissions": {
    "allow": [
      "Bash(wrangler:*)",
      "Bash(npm:*)",
      "Bash(npx:*)"
    ],
    "deny": [
      "Bash(rm -rf:*)"
    ]
  }
}

Injecting 2nth Skills

# Install skill into current project
npx skills add biz/erp/sage-x3

# This places the SKILL.md where Claude Code finds it
# and resolves the requires: chain automatically

Token Economy Integration

Claude Code sessions should be routed through 2nth AI Gateway for token metering:

export ANTHROPIC_BASE_URL=https://gateway.ai.cloudflare.com/v1/{account}/{gateway}/anthropic

This enables per-client, per-project token tracking without changing any code.

Common Gotchas