Edit claude

From digital-stoic-org/agent-skills · View interactive version

Edit claude is an AI agent skill from the GitHub repository digital-stoic-org/agent-skills. 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.

How to use this skill

Skill file

Instructions for Managing CLAUDE.md Files

Determine Action Type

CREATE: New CLAUDE.md file requested

UPDATE: Modify existing CLAUDE.md (keywords: "update", "add", "modify", "change")

OPTIMIZE: Audit and clean an existing CLAUDE.md chain (keywords: "optimize", "audit", "clean up", "reduce tokens", "improve")

Updating Existing CLAUDE.md Files

Make surgical edits in the relevant section (or a new heading), preserving the file's existing organization. After editing, check the file's line count against the size guidance below, because longer files consume more context and may reduce adherence.

Optimizing CLAUDE.md Files

The goal is that every line earns its place for the current model, not the shortest file. Rules lose value when cut from their reason, so compress wording, never reasons.

  1. Dated-pattern pass: invoke /claude-api prompt-audit scoped to the CLAUDE.md chain (and .claude/rules/), with the current session model as target. It returns a report and a diff covering pressure language, fossils and restated defaults. Call it by skill name only: its bundled file path is versioned per Claude Code release and breaks on upgrade, and a copy here would go stale, so do not copy it either.
  2. CLAUDE.md-specific pass (prompt-audit does not cover these):
  1. Present both diffs and apply only what the user accepts.

See reference.md ยง Optimization Strategies for rewrite examples.

Fit check (CREATE)

CLAUDE.md is loaded into every session, so it only holds content that is persistent, used in most sessions, and non-sensitive. Route what fails that to its better home and say so: secrets to env vars, one-off asks to the conversation, long docs to a README referenced by path, detailed guidelines to .claude/rules/. For mixed requests, write the part that fits and route the rest.

Creating New CLAUDE.md Files

  1. Gather context: Ask user for project details if missing:
  1. Organize around WHAT/WHY/HOW:
  1. Determine organization strategy (memory hierarchy):

Main CLAUDE.md (universal content; aim for the 200-line target below):

.claude/rules/ (modular, one topic per file):

CLAUDE.local.md (personal; add to .gitignore):

~/.claude/CLAUDE.md (cross-project personal):

@imports (organization, not context reduction):

Load order and how files combine: see reference.md ยง Memory Hierarchy and Loading.

  1. File Zones (if project uses ref/wip pattern):

```

## File Zones

```

  1. Organization decision tree:
  1. Universal vs Path-Specific Decision:

Keep in main CLAUDE.md:

Extract to .claude/rules/:

Key principle: Cohesion and semantic grouping matter more than a short file. A main CLAUDE.md whose universal sections (Git, Security, Planning, Style) sit together is better than the same content fragmented across files, provided it stays near the 200-line target.

  1. H1 = Project Name (required):
  1. Structure content:
  1. Write file with appropriate sections based on user context

See reference.md ยง Templates for starter examples and ยง Modular Rules for .claude/rules/ patterns.

Size Limits

Each fact below carries its source, consulted 2026-09-21.

Measure: wc -l for each file's line count; /context to check which CLAUDE.md and rules files loaded into the current session; /memory to list memory file locations.

When creating/updating: If a file passes the 200-line target, tell the user and suggest path-scoped rules or trimming content that is not needed in every session. Imports do not help here, because imported files load at launch.

Key Principles

Ordering and emphasis (sources: code.claude.com/docs/en/memory, code.claude.com/docs/en/best-practices, platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices; consulted 2026-09-21):


Progressive Disclosure

Keep main CLAUDE.md to universal content, near the 200-line target. Distribute the rest:

Modular rules (.claude/rules/; files with paths frontmatter load only for matching files):

.claude/rules/
  |- code-style.md
  |- security.md
  |- frontend/react.md
  |- backend/api.md

Imports (loaded at launch with the referencing CLAUDE.md; they organize content but do not reduce context):

@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.

Constraints

See reference.md ยง Content Guidelines for inclusion/exclusion rules and anti-patterns.

Validation Checklist

See reference.md ยง Templates, ยง Modular Rules, and ยง Import Syntax for detailed examples.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.