# Claude Code setup

> Out of the box Claude Code re-learns your project every session and writes code against APIs as they existed in training. Five pieces of configuration fix that permanently. Each one is a file, most are free, and the whole setup runs on a $20/mo plan.

Source: https://aistack.sh/stack/claude-code-setup
Category: Code · Agent setup
Level: Intermediate
Last verified by a human: 2026-09-04

## The tools

### Claude Code — The agent

- Pricing: Bundled with Claude Pro $20/mo · Max $100-200/mo · API metered
- Site: https://claude.com/code
- Why this one: Everything below is Claude Code configuration, not a separate product. The whole setup is files in your repo and your home directory.
- Swap in instead: Codex, Cursor
- More: https://aistack.sh/tool/claude-code

### Context7 — Live documentation

- Pricing: Free
- Site: https://context7.com
- Why this one: Fixes the most common failure: writing code against an API as it existed in the training data. One MCP server, free, and it removes a whole class of confident wrong answers.
- More: https://aistack.sh/tool/context7

### Supabase MCP — Database access

- Pricing: Free
- Site: https://supabase.com/docs/guides/getting-started/mcp
- Why this one: The agent reads your real schema instead of inferring it from your types. Migrations stop being a copy-paste round trip through a dashboard.
- More: https://aistack.sh/tool/supabase-mcp

### CodeRabbit — Review

- Pricing: Free for OSS · $30/mo per dev Essentials ($24 billed annually) · $60/mo Team · $90/mo Advanced
- Site: https://coderabbit.link/aistacksh
- Why this one: The agent that wrote the code is the wrong reviewer. This reads the pull request cold, on GitHub, with no memory of the reasoning that produced it.
- More: https://aistack.sh/tool/coderabbit

## Monthly cost

### $20/mo — Solo, open source (small)

- Claude Code: $20
- Context7: $0
- Supabase MCP: $0
- CodeRabbit: $0 OSS

### $50/mo — Solo, private repos (medium)

- Claude Code: $20
- Context7: $0
- Supabase MCP: $0
- CodeRabbit: $30

### $390/mo — Heavy agent use, 3 devs (heavy)

- Claude Code: $300 Max ×3
- Context7: $0
- Supabase MCP: $0
- CodeRabbit: $90

## Workflow

### 1. CLAUDE.md, the file that stops repeated corrections (Claude Code)

Claude Code reads CLAUDE.md at the start of every session. Anything you find yourself saying twice belongs in it. Project file is ./CLAUDE.md, personal preferences that follow you across every repo go in ~/.claude/CLAUDE.md, and ./CLAUDE.local.md is for machine-specific notes you do not want committed. It supports @imports up to four levels deep, so a repo that already documents itself in AGENTS.md can point at it rather than duplicating.

**Prompt: A CLAUDE.md worth having**

```
# {{project name}}

@AGENTS.md

## Things that bite

- The middleware file is proxy.ts, not middleware.ts.
- Content lives under content/, not lib/. lib/*.ts are thin loaders.
- Before writing code against any library, look up its current docs with
  Context7. This applies even to libraries you know well: the API may have
  changed since training. Do not skip it because the change looks like a
  one-liner.

## Commands

- npm run build runs the content index and logo manifest first.
- Never run the dev server in the background without checking the port.
```

### 2. MCP servers, so it stops guessing (Context7)

MCP servers give the agent access to things outside your codebase. Scope decides who gets them: --scope local is the default and applies only to you in this project, --scope user follows you into every project, and --scope project writes .mcp.json at the repo root so your team inherits it on clone. For stdio servers the -- separator is mandatory, otherwise the flags are read as arguments to the server.

**Prompt: Add the three worth having**

```
# Live docs, everywhere you work
claude mcp add --transport http --scope user context7 https://mcp.context7.com/mcp

# Your database, shared with the team via .mcp.json
claude mcp add --transport http --scope project supabase https://mcp.supabase.com/mcp?project_ref={{your_ref}}

# A stdio server: note the -- before the command
claude mcp add --transport stdio --scope user airtable -- npx -y airtable-mcp-server

claude mcp list
```

### 3. Subagents, for work that would pollute the session (Claude Code)

A subagent runs in its own context and reports back a conclusion. That matters for anything that reads a lot and returns a little: a sweep across forty files ends with one answer in your session instead of forty files of transcript. Definitions live in .claude/agents/, name and description are required, and everything else is optional. The description is what decides when it gets picked automatically, so write it as a trigger rather than a title.

**Prompt: .claude/agents/schema-check.md**

```
---
name: schema-check
description: Use when a change touches database queries or types. Reads the live schema and reports mismatches. Does not edit files.
tools: Read, Grep, Glob
model: haiku
---

Compare the query or type under discussion against the real database schema.

Report only mismatches: a column that does not exist, a nullable column
treated as non-null, a type that has drifted. If everything matches, say so
in one line. Do not suggest refactors and do not edit files.
```

### 4. Hooks, for the things you keep forgetting (Claude Code)

Hooks are shell commands the harness runs on events, configured under a hooks key in settings. They are the right tool for anything that must happen every time regardless of whether the agent remembered: formatting after an edit, a notification when a long run needs input. PostToolUse with a matcher on Write and Edit is the one most people want first.

**Prompt: .claude/settings.json**

```
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
          }
        ]
      }
    ]
  }
}
```

### 5. Skills, for the prompts you keep retyping (Claude Code)

A skill is a markdown file whose body loads only when it is used, which is what makes it cheaper than putting the same instructions in CLAUDE.md. Project skills live in .claude/skills/<name>/SKILL.md and become /<name>. Custom commands in .claude/commands/ still work and produce the same slash command, but skills are the current shape: they support supporting files, path scoping, and being invoked automatically when the description matches.

**Prompt: .claude/skills/ship/SKILL.md**

```
---
name: ship
description: Run the pre-push checks this repo actually requires, in order, and report what failed.
---

Run these in order and stop at the first failure:

1. npx tsc --noEmit
2. npm run lint
3. npm run build

Report the failing output verbatim. Do not fix anything unless asked.
If all three pass, say so and list what changed since the last commit.
```

## What it produced

**This site runs on it**

aistack.sh is built with this setup. Its CLAUDE.md is one line that imports AGENTS.md, so the same file serves both. The Supabase and PostHog MCP servers are in the repo's .mcp.json at project scope, so they arrive on clone. A recent session used the analytics server to find five comparison pages ranking on page one with under 2% click-through, then rewrote their titles in the same sitting: the question and the fix in one place, which is the whole argument for wiring the servers up.

## Pitfalls

- **Writing CLAUDE.md as documentation** — It is not a README. Nobody needs the project history or an architecture overview; the agent can read the code. What belongs there is the things it gets wrong: the file that is not where it looks, the command that needs a flag, the convention that contradicts the framework default. If a line has never prevented a mistake, delete it.
- **Installing servers you never use** — Every connected server spends context on tool definitions before you have typed anything. Three you reach for beat fifteen you installed from a list and forgot. Run claude mcp list monthly and remove what you have not used.
- **Assuming configuration equals behaviour** — An agent will happily write code from memory with a live-docs server sitting right there. If you have not written the rule into CLAUDE.md, assume the server is not being consulted.
- **Giving a database server write access on day one** — Start read-only. An agent that can run migrations unsupervised will eventually run one you did not want, and Postgres has no undo.
- **Letting the author review the work** — Asking the agent that wrote the code to review it produces agreeable answers. The reviewer has to be something that did not see the reasoning: a separate subagent at minimum, a separate product like CodeRabbit on the pull request ideally.

---

Curated by omar on aistack.sh. Last updated 2026-09-04.
