/writing-claude-md
Creates or improves CLAUDE.md project configuration with token-efficient, actionable instructions. Use when creating CLAUDE.md, improving existing CLAUDE.md, or setting up project configuration. Use when user says "create CLAUDE.md", "setup project", "configure agent".
$ npx -y skills add wayne930242/Reflexive-Claude-Code --skill writing-claude-md --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/writing-claude-md
Context preview
The summary Claude sees to decide when to auto-load this skill.
Creates or improves CLAUDE.md project configuration with token-efficient, actionable instructions. Use when creating CLAUDE.md, improving existing CLAUDE.md, or setting up project configuration. Use when user says "create CLAUDE.md", "setup project", "configure agent".
SKILL.md
writing-claude-md.SKILL.mdname: writing-claude-md
description: Creates or improves CLAUDE.md project configuration with token-efficient, actionable instructions. Use when creating CLAUDE.md, improving existing CLAUDE.md, or setting up project configuration. Use when user says "create CLAUDE.md", "setup project", "configure agent".
Writing CLAUDE.md
Overview
**Writing CLAUDE.md IS establishing project memory that persists across sessions.**
CLAUDE.md is context, not enforced configuration. Claude treats it as high-priority guidance loaded every session. For deterministic enforcement, use hooks.
**Core principle:** Only include what Claude can't figure out from reading the code. Specific and verifiable > vague and aspirational.
Task Initialization (MANDATORY)
Follow [task initialization protocol](../../references/task-initialization.md).
**Tasks:** 0. Fetch latest official memory/CLAUDE.md spec 1. Analyze current state 2. RED - test without proper CLAUDE.md 3. GREEN - write CLAUDE.md 4. Add project content 5. Validate structure 6. REFACTOR - quality review 7. Test with new session
Announce: "Created 8 tasks (0–7). Starting execution..."
Task 0: Fetch Latest Official Spec
**Goal:** Pull the current Anthropic CLAUDE.md / memory spec before designing — never trust cached memory.
**Action:**
Skill tool: fetching-claude-docs
component: memory
question: "CLAUDE.md location precedence (project/user/local), import syntax,
auto-loading behavior, token cost, recommended structure"**Verification:** Received YAML with `source: https://code.claude.com/docs/en/memory.md` and non-empty `spec_excerpt`. Use as authoritative reference; if any rule in this SKILL conflicts with the fetched spec, the fetched spec wins.
Task 1: Analyze Current State
**Goal:** Understand what exists and what's needed.
**If CLAUDE.md exists:** 1. Read current content 2. Check length (target: < 200 lines) 3. Identify vague or unverifiable instructions 4. Check if content belongs elsewhere (rules, skills, hooks)
**If no CLAUDE.md:** Document what Claude would need to know that it can't learn from reading the code.
**Verification:** Can list specific instructions needed and why each can't be derived from code.
Task 2: RED - Test Without Proper CLAUDE.md
**Goal:** Observe what Claude gets wrong without guidance.
**Process:** 1. Start session with weak/no CLAUDE.md 2. Ask Claude to perform common project tasks 3. Note where it uses wrong commands, wrong conventions, wrong paths 4. Document specific gaps (not vague "drift")
**What to look for:**
- Wrong build/test commands
- Incorrect assumptions about project structure
- Missing project-specific conventions
- Wrong language or communication style
**Verification:** Documented at least 2 specific things Claude got wrong.
Task 3: GREEN - Write CLAUDE.md
**Goal:** Create specific, verifiable instructions addressing the gaps you documented.
**Before writing, walk through [prompt-design-principles.md](../../references/prompt-design-principles.md):**
- 5-skeleton framework — CLAUDE.md typically needs **Role** (what Claude does in this project), **Scope** (what's in/out), and **Standards** (concrete rules). Workflow and Completion usually live in skills / rules, not CLAUDE.md.
- Failure-mode reverse engineering — every `MUST` / `NEVER` line should trace to an observed or predicted failure (documented in Task 2 RED), not an aspirational wish.
- Conditional dispatch — avoid absolute rules that don't hold across all task variants.
What to Include vs Exclude
**Filter every line through this question first:** "Can Claude derive this from reading the code, package.json, or running `ls`?" If yes, exclude — it's noise that pushes real signal out of attention budget.
The 2026 ETH Zürich study found that LLM-auto-generated CLAUDE.md files **reduced** task success by ~3% and increased cost ~20% precisely because they re-stated derivable content. The same study found that named tools/commands in CLAUDE.md are used ~160× more — confirming Claude reads it carefully, so every wasted line displaces a useful one.
**Three-axis frame (WHAT / WHY / HOW):**
- **WHAT** — non-obvious project identity Claude can't infer: monorepo layout, unusual subdirectory roles
- **WHY** — rationale for surprising choices: historical constraints, legal/compliance drivers, prior incidents
- **HOW** — non-default tooling and commands: `bun` not `npm`, `uv` not `pip`, custom build scripts, project-specific test filters
| Include (Claude can't guess) | Exclude (Claude already knows or can derive) | |------------------------------|---------------------------------------------| | Non-default tooling (`bun` not `npm`, `uv` not `pip`) | Standard language conventions | | Build/test/deploy commands with project-specific flags | Things a linter or formatter enforces | | Repo conventions (branch naming, PR format) | General programming practices | | Why a surprising architecture exists (incident, constraint) | Big architecture overviews / directory listings (Claude can `ls`) | | Environment quirks, gotchas, prior incidents | Detailed API docs (link instead) | | Hidden invariants not visible in code | Restating what package.json / pyproject.toml already says | | Anti-patterns previously caught in review | Aspirational "write clean code" / "follow best practices" |
CLAUDE.md Structure
Sections: Code Style, Workflow, Architecture, Gotchas. See [references/examples.md](references/examples.md) for complete example.
Writing Rules
Instructions MUST be **SPECIFIC**, **VERIFIABLE**, **NON-OBVIOUS**, and **ACTIONABLE**.
Use `MUST`/`NEVER`/`IMPORTANT` sparingly — if everything is critical, nothing is.
When to Use Other Mechanisms Instead
| If the instruction is... | Use... | |--------------------------|--------| | A focused convention scoped to a directory or file glob | `.claude/rules/<name>.md` with `paths:` — loads only when Claude reads a matching file, so it costs
Read more
name: writing-claude-md description: Creates or improves CLAUDE.md project configuration with token-efficient, actionable instructions. Use when creating CLAUDE.md, improving existing CLAUDE.md, or setting up project configuration. Use when user says "create CLAUDE.md", "setup project", "configure agent".
Writing CLAUDE.md
Overview
**Writing CLAUDE.md IS establishing project memory that persists across sessions.**
CLAUDE.md is context, not enforced configuration. Claude treats it as high-priority guidance loaded every session. For deterministic enforcement, use hooks.
**Core principle:** Only include what Claude can't figure out from reading the code. Specific and verifiable > vague and aspirational.
Task Initialization (MANDATORY)
Follow [task initialization protocol](../../references/task-initialization.md).
**Tasks:** 0. Fetch latest official memory/CLAUDE.md spec 1. Analyze current state 2. RED - test without proper CLAUDE.md 3. GREEN - write CLAUDE.md 4. Add project content 5. Validate structure 6. REFACTOR - quality review 7. Test with new session
Announce: "Created 8 tasks (0–7). Starting execution..."
Task 0: Fetch Latest Official Spec
**Goal:** Pull the current Anthropic CLAUDE.md / memory spec before designing — never trust cached memory.
**Action:**
Skill tool: fetching-claude-docs
component: memory
question: "CLAUDE.md location precedence (project/user/local), import syntax,
auto-loading behavior, token cost, recommended structure"**Verification:** Received YAML with `source: https://code.claude.com/docs/en/memory.md` and non-empty `spec_excerpt`. Use as authoritative reference; if any rule in this SKILL conflicts with the fetched spec, the fetched spec wins.
Task 1: Analyze Current State
**Goal:** Understand what exists and what's needed.
**If CLAUDE.md exists:** 1. Read current content 2. Check length (target: < 200 lines) 3. Identify vague or unverifiable instructions 4. Check if content belongs elsewhere (rules, skills, hooks)
**If no CLAUDE.md:** Document what Claude would need to know that it can't learn from reading the code.
**Verification:** Can list specific instructions needed and why each can't be derived from code.
Task 2: RED - Test Without Proper CLAUDE.md
**Goal:** Observe what Claude gets wrong without guidance.
**Process:** 1. Start session with weak/no CLAUDE.md 2. Ask Claude to perform common project tasks 3. Note where it uses wrong commands, wrong conventions, wrong paths 4. Document specific gaps (not vague "drift")
**What to look for:**
- Wrong build/test commands
- Incorrect assumptions about project structure
- Missing project-specific conventions
- Wrong language or communication style
**Verification:** Documented at least 2 specific things Claude got wrong.
Task 3: GREEN - Write CLAUDE.md
**Goal:** Create specific, verifiable instructions addressing the gaps you documented.
**Before writing, walk through [prompt-design-principles.md](../../references/prompt-design-principles.md):**
- 5-skeleton framework — CLAUDE.md typically needs **Role** (what Claude does in this project), **Scope** (what's in/out), and **Standards** (concrete rules). Workflow and Completion usually live in skills / rules, not CLAUDE.md.
- Failure-mode reverse engineering — every `MUST` / `NEVER` line should trace to an observed or predicted failure (documented in Task 2 RED), not an aspirational wish.
- Conditional dispatch — avoid absolute rules that don't hold across all task variants.
What to Include vs Exclude
**Filter every line through this question first:** "Can Claude derive this from reading the code, package.json, or running `ls`?" If yes, exclude — it's noise that pushes real signal out of attention budget.
The 2026 ETH Zürich study found that LLM-auto-generated CLAUDE.md files **reduced** task success by ~3% and increased cost ~20% precisely because they re-stated derivable content. The same study found that named tools/commands in CLAUDE.md are used ~160× more — confirming Claude reads it carefully, so every wasted line displaces a useful one.
**Three-axis frame (WHAT / WHY / HOW):**
- **WHAT** — non-obvious project identity Claude can't infer: monorepo layout, unusual subdirectory roles
- **WHY** — rationale for surprising choices: historical constraints, legal/compliance drivers, prior incidents
- **HOW** — non-default tooling and commands: `bun` not `npm`, `uv` not `pip`, custom build scripts, project-specific test filters
| Include (Claude can't guess) | Exclude (Claude already knows or can derive) | |------------------------------|---------------------------------------------| | Non-default tooling (`bun` not `npm`, `uv` not `pip`) | Standard language conventions | | Build/test/deploy commands with project-specific flags | Things a linter or formatter enforces | | Repo conventions (branch naming, PR format) | General programming practices | | Why a surprising architecture exists (incident, constraint) | Big architecture overviews / directory listings (Claude can `ls`) | | Environment quirks, gotchas, prior incidents | Detailed API docs (link instead) | | Hidden invariants not visible in code | Restating what package.json / pyproject.toml already says | | Anti-patterns previously caught in review | Aspirational "write clean code" / "follow best practices" |
CLAUDE.md Structure
Sections: Code Style, Workflow, Architecture, Gotchas. See [references/examples.md](references/examples.md) for complete example.
Writing Rules
Instructions MUST be **SPECIFIC**, **VERIFIABLE**, **NON-OBVIOUS**, and **ACTIONABLE**.
Use `MUST`/`NEVER`/`IMPORTANT` sparingly — if everything is critical, nothing is.
When to Use Other Mechanisms Instead
| If the instruction is... | Use... | |--------------------------|--------| | A focused convention scoped to a directory or file glob | `.claude/rules/<name>.md` with `paths:` — loads only when Claude reads a matching file, so it costs
Showing the first part of this file.
A Claude Code plugin marketplace for skills-driven Agentic Context Engineering (ACE) — build, analyze, and maintain agent systems with structured workflows.
Repo: wayne930242/Reflexive-Claude-Code
Other skills on reflexive-claude-code.
- /analyzing-codebases
Detects project languages and monorepo state, runs language-appropriate static analysis (dependency graph, complexity, duplication, semantic patterns), and produces a refactor map ranking hotspots. Use when user invokes /aref or explicitly asks to analyze a codebase for
Open skill - /applying-refactors
Executes a refactor plan phase-by-phase on a dedicated branch with per-phase commits and mandatory reviewer checkpoints. Use when characterization-tests scaffold is complete and plan has phases ready to execute.
Open skill - /finalizing-refactors
Writes AGENTS.md per subproject, archives run artifacts, and suggests rcc handoff conditionally. Use when verifying-refactors passes (PASS or PASS-WITH-WEAK-TESTS).
Open skill - /planning-refactors
Converts a refactor map into a phased plan using parallel-change, branch-by-abstraction, or strangler fig patterns. Use when user has approved the refactor map from analyzing-codebases.
Open skill - /scaffolding-characterization-tests
Adds golden/snapshot tests to untested hotspot modules before refactoring. Use when refactor plan marks any phase with characterization_test.status=must-scaffold.
Open skill - /verifying-refactors
Validates hard structural rules (no cycles, file/fn line caps, cognitive/cyclomatic complexity) and runs mutation testing on touched modules. Use when applying-refactors has completed all phases on the refactor branch.
Open skill

