Skip to main content

Prime your repo for Claude Code with context-aware knowledge architecture

Project description

Claude Primer

Prime your repo for Claude Code.

Scans your project's DNA and generates the knowledge architecture Claude Code needs to work effectively.

Like a real primer, it prepares the surface so everything after it adheres better: claude-primer grounds Claude Code sessions in real project context from the first command.

Install & Run

Python (PyPI)

# No install needed — run directly:
pipx run claude-primer

# Or with uv:
uvx claude-primer

# Or install globally:
pip install claude-primer
claude-primer

Node.js (npm)

# No install needed — run directly:
npx claude-primer

# Or install globally:
npm install -g claude-primer
claude-primer

Both packages produce identical output. Use whichever runtime you already have.

Usage

claude-primer                       # interactive setup in current directory
claude-primer /path/to/project      # specific directory
claude-primer --dry-run             # preview without writing
claude-primer --force               # overwrite changed files (skip unchanged)
claude-primer --force-all           # overwrite all files unconditionally
claude-primer --yes                 # non-interactive (accept defaults)
claude-primer --plan-json           # output project analysis as JSON
claude-primer --with-readme         # also generate README.md
claude-primer --with-ralph          # generate Ralph integration files
claude-primer --reconfigure         # re-run wizard (ignore saved config)
claude-primer --no-git-check        # skip git safety entirely
claude-primer --from-doc FILE       # bootstrap from PRD/spec document
claude-primer --clean-root          # move aux docs to .claude/docs/
claude-primer --git-mode stash      # auto-stash dirty changes
claude-primer --git-mode skip       # skip git safety

Flags can be combined for full automation:

claude-primer --force --yes         # overwrite changed files, no prompts
claude-primer --force-all --yes     # overwrite ALL files, no prompts
claude-primer --git-mode skip --yes # full automation, no git checks

What It Does

  1. Scans your project — detects language, framework, deploy targets, monorepo structure
  2. Classifies project tier (T1-T4) based on blast radius
  3. Extracts from existing documentation if present
  4. Generates four files with context-aware content:
    • CLAUDE.md — project map, invariants, decision heuristics, verification standards
    • STANDARDS.md — governance rules, code quality gates, naming conventions
    • QUICKSTART.md — essential commands and quick fixes
    • ERRORS_AND_LESSONS.md — mistake catalog with rationalization table
  5. Verifies generated files have correct structure
  6. Saves wizard answers to .claude-setup.rc for future runs

Ralph Integration

The --with-ralph flag creates an integration layer that eliminates duplication between Ralph (an autonomous coding agent) and the Claude Primer knowledge architecture. Instead of maintaining separate context files, Ralph reads directly from the same generated documents, with a thin prompt wrapper and symlinks to keep everything in sync.

Files created by --with-ralph:

  • .ralph/PROMPT.md — Ralph-specific development instructions referencing the knowledge architecture
  • .ralph/AGENT.md — symlink to QUICKSTART.md (single source of truth)
  • .ralph/fix_plan.md — prioritized task list (Ralph-owned, never overwritten without --force)
  • .ralph/hooks/post-loop.sh — post-loop hook that detects changes to knowledge files
  • .ralphrc — stack-aware Ralph project configuration at the project root

Generated Content Highlights

  • Iron Laws — bright-line rules that are never violated
  • Decision Heuristics — 6 concrete rules for autonomous decision-making
  • Stuck Protocol — explicit steps when 3+ approaches fail
  • Red Flags — self-monitoring triggers to prevent common mistakes
  • Rationalization Table — excuse-to-reality mapping to catch bad reasoning
  • HARD-GATE tags — absolute non-negotiable rules
  • Tier-based governance — process weight proportional to blast radius
  • Defense-in-Depth debugging — 4-layer validation after bug fixes
  • Git worktree guidance — parallel development patterns (for git repos)
  • AUTO-MAINTAINED marker — QUICKSTART.md flagged for automatic upkeep
  • Idempotent regeneration--force skips unchanged files

Supported Stacks

Python, Node.js/TypeScript, Rust, Go, Ruby, Java/Kotlin, PHP, .NET, Elixir, Swift, Dart/Flutter, Zig, Scala

Supported Frameworks

Django, Flask, FastAPI, Next.js, React, Vue, Svelte, SvelteKit, Remix, Astro, Express, NestJS, Hono, Axum, Actix, Rocket, Gin, Fiber, Echo, Phoenix, Spring, Laravel, Flutter, and more.

Repository Structure

claude-primer/
├── README.md          # this file
├── LICENSE
├── docs/              # project documentation
├── python/            # PyPI package (claude-primer)
│   ├── claude_primer.py
│   ├── pyproject.toml
│   └── tests/
└── npm/               # npm package (claude-primer)
    ├── index.mjs
    ├── package.json
    └── tests/

Authors

  • Ronaldo Lima
  • Breno Lima

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_primer-1.3.0.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_primer-1.3.0-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file claude_primer-1.3.0.tar.gz.

File metadata

  • Download URL: claude_primer-1.3.0.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for claude_primer-1.3.0.tar.gz
Algorithm Hash digest
SHA256 f5bb045ca3ac0d8af49ab385c4a7247c1afe35e3bc9b4d2e9959377e58c2df8c
MD5 bc6616901b2b3dd678d8f7f57f45a24a
BLAKE2b-256 c7b0bd8454192af68b83fea2b47dcfd95c260197b00b6f869e648333bf478281

See more details on using hashes here.

File details

Details for the file claude_primer-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: claude_primer-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for claude_primer-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c861d33e9cc84d29f79de37cbcb6f89be6dd7db3e729164bd249fa8b6dfbd5ee
MD5 536821d83ff47954fb74bf433f872262
BLAKE2b-256 5b93b325f941a264bbd91943b05a2903681126e1ca4f6af2ffa4efa2699a251a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page