New
Apps 6,307Makers 6,286This week 13
Promote your app−30%
4views in
the last 30 days

claude-kit

CLI that scaffolds and audits token-optimized Claude Code projects — lean CLAUDE.md

Built with Claude/Claude Code

by ugolinolle · Unclaimed · from KHCambodia · added Oct 29, 2026
no ratings0 comments

Make any repo cheap and effective to work on with Claude Code. claude-kit looks at your project and generates the files that make Claude Code cheaper and safer to run there: a lean CLAUDE.md, enforced read exclusions, edit guardrails, context snapshots, subagents and a token-budget status line. Optional extras are ranked code search and MCP server templates. It then audits the setup against token budgets (doctor) and measures how real sessions go (usage).

npx @whoa-studio/claude-kit init          # or: bunx @whoa-studio/claude-kit init

It ships as one npm package, @whoa-studio/claude-kit, for macOS, Linux and Windows: plain JavaScript (~0.5 MB, no dependencies to install) that runs on Node 20+ or Bun. Once installed, the command is claude-kit; the examples below use that short form.

Why

Each Claude Code session pays for everything it loads: memory files, tool definitions, every file it reads, every turn of history. Most of that cost comes from defaults nobody chose:

  • Claude reads build output and lockfiles.
  • CLAUDE.md files grow past their useful size.
  • Edits to the prompt prefix break the prompt cache mid-session.
  • Task state is lost at compaction.
  • Claude edits files that should never be hand-edited.

claude-kit sets each of those defaults on purpose, from what is actually in your repo. Because the files it writes are ordinary Claude Code files, the setup keeps working without claude-kit installed.

Quick start

cd your-project
npx @whoa-studio/claude-kit init                    # interactive: pick a preset
npx @whoa-studio/claude-kit init --preset standard  # or skip the questions
npx @whoa-studio/claude-kit doctor                  # check the result: score + findings

Then commit what it generated (including .claude-kit/manifest.json) and start Claude Code as usual. Nothing else needs to run: the hooks and settings are picked up by Claude Code itself.

Pick a preset by how much you want:

Preset For Adds
minimal (default) Any repo, zero overhead .claudeignore + enforced deny rules, lean CLAUDE.md, edit-guard hook
standard Day-to-day team use + task context & snapshots across compaction, context guard, team memory, docs/, opusplan
full Big repos, heavy users + subagents and the /fix loop, token-budget status line, codebase map, compress-doc skill

Fine-tune with --with / --without, e.g. init --preset standard --with agents --without docs. The features are claudeignore claudemd hooks snapshots memory docs models agents budget compress rag, plus search (the code-search MCP server), which no preset includes because it adds a server to every session.

With Bun

bunx @whoa-studio/claude-kit init  # no install; works even without Node
bun add -d @whoa-studio/claude-kit # per project, then: bun run claude-kit doctor
bun add -g @whoa-studio/claude-kit # global `claude-kit` command; needs Node on PATH

The global claude-kit command is a #!/usr/bin/env node script, the only kind npm can wire up on Windows. On a Bun-only machine, use bunx @whoa-studio/claude-kit instead, or alias it: alias claude-kit="bunx @whoa-studio/claude-kit".

Everyday workflow

When Run Why
Once per repo claude-kit init Generate the setup
After editing .claudeignore or the config claude-kit sync Recompile deny rules and hooks from your edits
After adding a dependency like Django or Prisma claude-kit sync Picks up new migration folders and commands
In CI, on every PR claude-kit doctor --check Catch a bloated CLAUDE.md or a cache-breaking edit before it merges
Every week or two claude-kit usage See what sessions really cost and what broke the cache
Before/after trimming memory files claude-kit context --json > before.json, then --baseline before.json Measure the saving
After upgrading claude-kit npx @whoa-studio/claude-kit@latest upgrade Apply newer templates without losing your edits

Inside a session, Claude itself follows the habits written into CLAUDE.md:

  • plan first for multi-file changes
  • keep .claude/context/task_context.md current
  • delegate searches to the explorer agent, or call search_code when code search is on
  • skim big files with claude-kit compress --outline

You can start the /fix <symptom> loop yourself for any bug (full preset).

What gets generated

minimal

File Purpose
.claudeignore Paths Claude shouldn't read: build output, caches, lockfiles, secrets, plus your .gitignore.
.claude/settings.json permissions.deny Read(...) rules compiled from .claudeignore (Claude Code doesn't read .claudeignore itself), plus the hook registration.
CLAUDE.md Short skeleton: stack, commands, workflow habits, guardrails. Filled in from your manifests.
.claude/hooks/pre-edit.cjs PreToolUse hook enforcing the guardrails: protected paths, committed migrations, opt-in content rules.
.claude-kit/manifest.json What claude-kit generated, so re-runs never clobber your edits. Commit it.

standard adds

File Purpose
.claude/context/task_context.md Current task state Claude keeps up to date; re-injected after compaction by a SessionStart hook.
.claude/hooks/context-snapshot.cjs Saves each compaction summary to .claude/context/snapshots/ (git-ignored, last 10 kept).
.claude/hooks/context-guard.cjs UserPromptSubmit hook. At 60% of the context window (or CLAUDE_KIT_COMPACT_AT tokens) it asks Claude to update task_context.md; at 80% it asks again and suggests /compact. Each level fires once. Every 10 prompts it also asks Claude to log new decisions in conversation_memory.md.
.claude/context/conversation_memory.md Team-shared decisions and lessons. Claude reads it on demand; it is never @imported, so it can't break caching.
docs/ architecture.md (pre-filled from the repo layout), api-contracts.md, data-models.md, debugging.md. Created once; after that they're yours.
"model": "opusplan" Opus in Plan Mode, Sonnet for execution. The cheatsheet sits in a CLAUDE.md HTML comment, which costs no tokens.

full adds

File Purpose
.claude/agents/ explorer (Haiku, read-only search), debugger (root cause without editing), reviewer, test-writer. Only their descriptions cost main-context tokens.
.claude/skills/fix/ /fix <symptom> runs the loop find → diagnose (debugger) → implement → test, retrying with the failures at most twice before asking you, then a reviewer pass. It uses search_code for the find step when search is on.
.claude/statusline/token-budget.cjs Status line showing context %, prompt-cache hit ratio and cost, with an optional CLAUDE_KIT_BUDGET_USD limit. It also gives the context guard the exact window size.
docs/INDEX.md Only for repos over ~200K tokens: a regenerated map of areas and largest files.
CLAUDE.md pointer to claude-kit compress So Claude outlines big files instead of reading them whole.
.claude/skills/compress-doc/ Skill for long documents: outline first, then --extract, and --summarize only after asking you, because it sends the file to the API. Only its description loads until Claude uses it.

--with search adds

File Purpose
.mcp.json entry code-search Runs npx @whoa-studio/claude-kit@<version> serve search (or bunx). The pinned version moves with upgrade.
"enabledMcpjsonServers" in settings Pre-approves the server, so the team isn't asked on first use.
CLAUDE.md "Code search" section Tells Claude to call search_code before grepping, and related_files before changing a file.
.claude-kit/index/ Built on first use, updated incrementally, git-ignored and listed in .claudeignore.

Supported stacks: Node/Bun (npm, pnpm, yarn, bun), Python (uv, poetry, pipenv, pip), Go and Rust, including their monorepo setups. Other stacks can be added through stack packs.

Guardrails

Claude Code runs the generated pre-edit.cjs before every Edit, Write, MultiEdit and NotebookEdit. When an edit is blocked, the hook exits with code 2 and tells Claude why, so Claude changes the right thing instead of retrying. The hook fails open on input it doesn't understand, and it never blocks paths outside the project.

1. Protected paths (always on). Lockfiles, build output, node_modules/, .venv/, .git/ and .env* are blocked; .env.example is allowed. Each stack pack adds its own patterns.

2. Committed migrations (on when detected). Database migrations that other environments have already run are history. claude-kit finds them by dependency or by their folder on disk, so packages inside a monorepo are covered too:

Tool Protected Claude is told to run
Django **/migrations/*.py python manage.py makemigrations
Alembic / Flask-Migrate **/alembic/versions/, **/migrations/versions/ alembic revision --autogenerate
Prisma **/prisma/migrations/ prisma migrate dev --name …
Drizzle the folder holding meta/_journal.json drizzle-kit generate
Knex, Sequelize **/migrations/ knex migrate:make / sequelize-cli migration:generate
Diesel, SQLx **/migrations/ diesel migration generate / sqlx migrate add
goose, golang-migrate **/migrations/ goose create / migrate create
Rails, Flyway db/migrate/, **/db/migration/ bin/rails generate migration / a new V<n>__ file

Only files git already tracks are blocked, so Claude can still write and fix a new migration before you commit it. Without git, any existing migration file counts as committed. To turn this off, set "guardrails": { "migrations": false }.

3. Content rules (opt in). These check the code an edit adds. Only new matches count: an edit that leaves an existing console.log in place still passes.

Built-in id Blocks Skips
no-console-log console.log( in JS/TS tests, scripts/, *.config.*
no-debugger debugger statements
no-focused-tests it.only( / test.only( / describe.only(
no-print print( in Python tests, conftest.py, scripts/
no-breakpoint breakpoint(), pdb.set_trace()
no-raw-db db.query( / db.exec( / db.execute( / db.raw( repositories/, *repository.*, tests, migrations
py-return-annotations a Python def without -> tests
requires-test a new exported JS/TS function or class with no test file tests, *.d.ts, index.*
requires-test-py a new public top-level Python function or class with no test file tests, __init__.py
requires-test-go a new exported Go function with no _test.go file
{
  "guardrails": {
    "content": [
      "no-console-log",
      { "extends": "no-print", "exclude": ["cli/", "tests/"] },
      {
        "id": "no-any",
        "files": ["src/**/*.ts"],
        "exclude": ["*.d.ts"],
        "pattern": ":\\s*any\\b",
        "reason": "use unknown and narrow it"
      }
    ]
  }
}

The requires-test rules don't forbid code. They block the edit until a matching test file exists, and the message lists the paths they looked for, so Claude writes the test first. Editing a function that's already exported isn't "new". requires-test looks for {dir}/{name}.test.{ext}, {dir}/{name}.spec.{ext}, {dir}/__tests__/{name}.test.{ext}, tests/{path}.test.{ext}, tests/{subpath}.test.{ext} and test/{subpath}.test.{ext}, where {subpath} is the path without a leading src/, lib/ or app/. To use your own layout, add "tests": [...] to a rule, for example { "extends": "requires-test", "tests": ["spec/{subpath}.spec.{ext}"] }.

files and exclude use gitignore syntax. pattern is a JavaScript regular expression matched with the gm flags. Run claude-kit sync after changing rules: they are compiled into the hook, and CLAUDE.md lists the active ones.

Commands

claude-kit init [--preset minimal|standard|full] [--with f] [--without f]
claude-kit sync        # re-apply the recorded setup, e.g. after editing .claudeignore or the config
claude-kit doctor      # audit an existing setup: score + prioritized findings
claude-kit doctor --fix
claude-kit doctor --probe-mcp             # also start stdio MCP servers and measure their tool definitions
claude-kit context     # tokens a cold session loads from the repo and ~/.claude
claude-kit context --json > before.json   # …later: claude-kit context --baseline before.json
claude-kit context --exact                # real counts via the Anthropic token-counting API (sends file text)
claude-kit usage [--days 30] [--session id] [--limit 10]   # what past sessions cost, from local transcripts
claude-kit upgrade     # re-apply this version's templates; `npx @whoa-studio/claude-kit@lates

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#cli · #scaffolding · #claude-code