AGENT0S
HomeLibraryAgentic
FeedbackLearn AI
LIVE
Agent0s · AI Intelligence Library
Share FeedbackUpdated daily · 7am PST
Library/prompt
promptintermediateClaude Code★ Featured

Ultra-Compressed CLAUDE.md System Prompt for Maximum Context Efficiency

A structured CLAUDE.md template using XML-like shorthand notation that communicates your project architecture, conventions, and preferences to Claude Code in under 300 tokens — compared to the typical 800+. Uses abbreviation schemas and tiered priority markers.

AI SETUP PROMPT

Paste into Claude Code — it will scan your project and set everything up

# Set Up: Ultra-Compressed CLAUDE.md System Prompt for Maximum Context Efficiency

## What This Is
A structured CLAUDE.md template using XML-like shorthand notation that communicates your project architecture, conventions, and preferences to Claude Code in under 300 tokens — compared to the typical 800+. Uses abbreviation schemas and tiered priority markers.

Source: https://github.com/anthropics/claude-code/discussions/284

## Before You Start

Scan my workspace and analyze:
- The project language, framework, and directory structure
- Existing agent configuration (check for .claude/, .codex/, CLAUDE.md, settings.json, commands/, skills/ directories)

Then ask me before proceeding:
1. Should this be a slash command (.claude/commands/*.md) or added to CLAUDE.md as persistent context?
2. Any project-specific values I should customize in the prompt?

## What to Implement

This is a **Command Template** — a reusable slash command or system prompt.

- Create the command file based on my answer above (either `.claude/commands/[name].md` or add to `CLAUDE.md`)
- Adapt any placeholder values to my project specifics
- If the command references specific tools or APIs, wire it to what I already have configured

## Additional Context

- Replace verbose CLAUDE.md prose with the compressed schema: use P1/P2/P3 markers for priority, abbrev tech names (TS, PG, RQ for TypeScript, PostgreSQL, React Query), and collapse repeated patterns into single-line rules.
- Add a "FORBIDDEN" block at the top listing anti-patterns Claude should never produce — this is 10x more token-efficient than explaining why not to do each thing.
- Benchmark your current CLAUDE.md by pasting it into the Claude.ai tokenizer, then compare after applying the compressed format — most users see 55–65% reduction.

## Reference Implementation

```
# CLAUDE.md — compressed schema v2
## PROJECT
stack: Next15·TS5·PG16·Drizzle·RQ5·shadcn
arch: app-router·RSC-first·server-actions
deploy: Vercel·edge-functions

## RULES [P1=critical P2=important P3=prefer]
P1: never-client-components-for-data-fetch
P1: drizzle-not-prisma — schema in /db/schema.ts
P2: zod-validation-all-inputs
P2: error-boundaries-all-async
P3: prefer-server-actions-over-api-routes

## FORBIDDEN
- any useState for server-fetchable data
- inline SQL strings
- console.log in production paths
- @ts-ignore without explanation comment
```

## Guidelines

- Adapt everything to my existing project — do not assume a specific stack or directory layout
- Review any fetched code for safety before installing or executing it
- After setup, run a quick verification and show me a summary of exactly what was installed, where, and how to use it
2,685 charactersCompatible with Claude Code & Codex CLI
MANUAL SETUP STEPS
  1. 01Replace verbose CLAUDE.md prose with the compressed schema: use P1/P2/P3 markers for priority, abbrev tech names (TS, PG, RQ for TypeScript, PostgreSQL, React Query), and collapse repeated patterns into single-line rules.
  2. 02Add a "FORBIDDEN" block at the top listing anti-patterns Claude should never produce — this is 10x more token-efficient than explaining why not to do each thing.
  3. 03Benchmark your current CLAUDE.md by pasting it into the Claude.ai tokenizer, then compare after applying the compressed format — most users see 55–65% reduction.

CODE INTELLIGENCE

bash
# CLAUDE.md — compressed schema v2
## PROJECT
stack: Next15·TS5·PG16·Drizzle·RQ5·shadcn
arch: app-router·RSC-first·server-actions
deploy: Vercel·edge-functions

## RULES [P1=critical P2=important P3=prefer]
P1: never-client-components-for-data-fetch
P1: drizzle-not-prisma — schema in /db/schema.ts
P2: zod-validation-all-inputs
P2: error-boundaries-all-async
P3: prefer-server-actions-over-api-routes

## FORBIDDEN
- any useState for server-fetchable data
- inline SQL strings
- console.log in production paths
- @ts-ignore without explanation comment

FIELD OPERATIONS

CLAUDE.md Generator CLI

A CLI tool that introspects your project (package.json, tsconfig, .eslintrc) and auto-generates an optimized CLAUDE.md in compressed format.

Token Budget Dashboard

A VS Code extension that shows a live token count for your CLAUDE.md file and warns when you exceed efficient thresholds.

STRATEGIC APPLICATIONS

  • →Reduce Claude Code API costs by 40-60% on context-heavy enterprise codebases
  • →Standardize AI onboarding across engineering teams by templatizing the compressed format
  • →Speed up Claude Code response latency on large monorepos by shrinking context window usage

TAGS

#claude-code#context#prompting#efficiency#CLAUDE.md
Source: GITHUB · Quality score: 9/10
VIEW SOURCE