Overview
CLAUDE.md Forge is a Next.js 16 utility that turns any GitHub repository URL — or a plain-text stack description — into a complete Claude Code configuration ZIP in under 30 seconds.
The output contains four files your project drops directly into its root directory. Claude Code automatically reads CLAUDE.md at the start of every session, giving the AI persistent knowledge of your project's conventions, principles, and skills.
AI context file — project rules, principles, and selected skills
6–8 individual skill files auto-selected for your stack
Bash hook for linting and type-checking before every commit
Step-by-step instructions for placing files in your project
Quick Start
Clone, configure, and run locally in four commands:
Before running, create .env.local with your API keys. See Environment Variables.
Environment Variables
Forge Pipeline
Every forge request to POST /api/forge runs through a synchronous five-step pipeline:
In-memory map keyed by IP. 5 forges per IP per day, resetting at midnight UTC. Returns 429 if exceeded.
URL mode: packRepo() fetches manifest files from GitHub. Describe mode: uses the raw text input as context.
detectStack() runs keyword matching over the context string and returns a string[] of detected tags (e.g. ["nextjs","typescript","tailwind"]).
selectSkills() scores all 59 skills against the detected tags. Top 6–8 by score are selected. At least one universal skill is always included.
callClaude() sends the context and selected skill names to the model. The response becomes CLAUDE.md. buildZip() bundles everything with fflate.
GitHub URL Scanning
packRepo() in lib/github.ts extracts context from a GitHub repository without cloning it. It makes three types of requests:
GET /repos/{owner}/{repo}— gets the default branch nameGET /repos/{owner}/{repo}/git/trees/{branch}?recursive=1— gets the full file treeGET raw.githubusercontent.com/...— parallel-fetches manifest file content (no auth needed)
Files matched as manifests (case-insensitive):
Content is concatenated as // path\ncontent\n\n and truncated to 32,000 characters before being passed to stack detection and AI generation.
Stack Detection
detectStack() in lib/detectStack.ts scans the packed context string for keywords and returns a string[] of technology tags.
The describe mode input is scanned with the same function — users can write natural-language descriptions like "Next.js app with Prisma and TypeScript" and detection works correctly.
Skill Scoring Algorithm
selectSkills() in lib/selectSkills.ts scores each of the 59 skills against the detected tag array using this formula:
Skills are then sorted by score descending. The top 6–8 are returned, with at minimum one universal skill always included (even if its score is 0.3 and others score higher).
Skills with score === 0 that are not tagged universal are excluded entirely. This keeps the output focused — a Python project won't get React-specific skills.
CLAUDE.md
The generated CLAUDE.md follows this structure:
Claude Code reads CLAUDE.md at the start of every session. The file should be committed to your repository root — it's part of your project's source truth, not a generated artifact to be regenerated each time.
You can edit CLAUDE.md freely after generating it. Common additions include project-specific conventions, team preferences, and task context.
Skill Files
Each selected skill is saved as a standalone markdown file in skills/:
Skill files are referenced from CLAUDE.md with @skills/filename.md. Claude Code resolves these relative imports automatically, keeping the main context file compact while making each skill individually editable.
File names are derived from skill titles using kebab-case slug conversion.
Pre-commit Hook
The generated hooks/pre-commit.sh is a standard Bash hook that runs on every commit:
To install: cp hooks/pre-commit.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit. The SETUP_GUIDE.md includes these exact steps.
SETUP_GUIDE.md
The SETUP_GUIDE.md is generated alongside the other files and contains step-by-step instructions for the developer:
- Unzip
claude-forge-output.zipin your project root - Commit
CLAUDE.mdand theskills/directory - Install the pre-commit hook
- Open Claude Code — it reads
CLAUDE.mdautomatically - Edit
CLAUDE.mdto add your project-specific conventions
POST /api/forge
The single API endpoint that drives the Forge button.
Request
Response (200)
Error responses
Rate Limits
The Forge API is rate-limited at the edge using an in-memory Map keyed by IP address.
The in-memory store resets on server restart (e.g. every Vercel deployment). For stricter production rate-limiting, replace lib/rateLimit.ts with a Redis- or KV-backed implementation.
Self-Hosting Guide
CLAUDE.md Forge can be deployed to any Node.js hosting environment:
Set the following environment variables in your hosting dashboard:
No database is required. The rate limiter uses an in-memory Map that resets on process restart.
Model Configuration
The model is configured in lib/claude.ts. To swap models, change the model field in the OpenRouter request body:
Any OpenRouter-supported model can be used. Faster / cheaper alternatives:
mistralai/ministral-3b-2512Default — fast, high quality, cheapmistralai/mistral-small-3.1Lightweight, very low costgoogle/gemini-flash-1.5Fast, good instruction followinganthropic/claude-3-5-haikuBest instruction following, higher cost