From dstoic
Creates, updates, or optimizes CLAUDE.md files following Anthropic best practices. Use when user requests creating, updating, improving, or optimizing CLAUDE.md files for project context, coding standards, or persistent memory.
npx claudepluginhub digital-stoic-org/agent-skills --plugin dstoicThis skill uses the workspace's default tool permissions.
**CREATE**: New CLAUDE.md file requested
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
CREATE: New CLAUDE.md file requested UPDATE: Modify existing CLAUDE.md (keywords: "update", "add", "modify", "change") OPTIMIZE: Improve token efficiency (keywords: "optimize", "reduce tokens", "improve")
Audit current content:
Apply compression techniques:
Remove anti-patterns:
Validate token efficiency: Aim for maximum signal, minimum tokens
See reference.md for optimization strategies and examples.
Gather context: Ask user for project details if missing:
Organize around WHAT/WHY/HOW:
Determine organization strategy (memory hierarchy):
Main CLAUDE.md (universal, <200 tokens ideal, <500 acceptable):
CLAUDE.md in project root (shared via git).claude/rules/ (modular, 100-300 tokens each):
python.md, javascript.mdfrontend/, backend/CLAUDE.local.md (personal, auto-gitignored):
~/.claude/CLAUDE.md (cross-project personal):
@imports (lazy-loaded reference):
@README, @docs/architecture.md@~/.claude/my-prefs.mdMemory load order (later overrides earlier):
Organization decision tree:
Universal vs Path-Specific Decision:
Keep in main CLAUDE.md:
Extract to .claude/rules/:
*.py, React for *.tsx)frontend/, backend/, infra/)python.md with paths: "**/*.py", bash-scripting.md with paths: "**/*.sh"Key principle: Cohesion and semantic grouping matter more than strict token limits. A well-organized 430-token CLAUDE.md with universal sections (Git 90 + Security 50 + Planning 45 + Style 200 = 385 tokens) is better than fragmenting conceptually related content across multiple files.
H1 = Project Name (required):
# Project Name — used by /switch, /save-context, /load-context for project identification# Praxis, # NanoVC — Control Repo, # GTD-PCM Control PlaneStructure content (token-efficient):
Include sanity marker (optional but recommended):
sanity check: [random-number]
Write file with appropriate sections based on user context
See reference.md § Templates for starter examples and § Modular Rules for .claude/rules/ patterns.
Claude Code enforces hard character limits on instruction files. Content beyond these limits is silently truncated with [truncated] appended — no warning to the user.
| Limit | Value | Source |
|---|---|---|
| Per file | 4,000 chars | MAX_INSTRUCTION_FILE_CHARS |
| Total across all files | 12,000 chars | MAX_TOTAL_INSTRUCTION_CHARS |
Loading order: Files are loaded walking from filesystem root to CWD. Once total budget is exhausted: "Additional instruction content omitted after reaching the prompt budget." — deeper files (closer to CWD) are the ones that get dropped.
Implications:
~/.claude/ → praxis root → repo → subfolder) shares the 12K budgetclaude --dump-system-prompt to verify what actually loadswc -c on each file in the chain to check headroomWhen creating/updating: Always check current chain total. Warn user if any file is >3,500 chars or chain total >10,000 chars.
npm test" not "Test the code"paths: glob patternsSTOP: Before creating new CLAUDE.md, answer YES/NO for each:
If ANY answer is NO: → STOP. Explain why inappropriate. → Recommend alternatives: README.md (docs), environment variables (secrets), direct request (one-time), .claude/rules/ (detailed guidelines) → EXIT immediately.
If ALL answers are YES: → Proceed to "Creating New CLAUDE.md Files" section above.
Keep main CLAUDE.md lean (<200 tokens). Distribute content:
Modular rules (.claude/rules/ - auto-loaded):
.claude/rules/
|- code-style.md
|- security.md
|- frontend/react.md
|- backend/api.md
Imports (lazy-loaded when referenced):
@README
@docs/architecture.md
@~/.claude/my-project-prefs.md
Reference docs (external):
reference/
|- runbooks/building.md
|- standards/conventions.md
Use /memory command during session to view/edit loaded memories.
See reference.md § Content Guidelines for inclusion/exclusion rules and anti-patterns.
See reference.md § Templates, § Modular Rules, and § Import Syntax for detailed examples.