From rcc
Creates and improves CLAUDE.md files for project memory and agent configuration using TDD workflow with task tracking. Activates on 'create CLAUDE.md', 'setup project', 'configure agent'.
npx claudepluginhub wayne930242/reflexive-claude-codeThis skill uses the workspace's default tool permissions.
**Writing CLAUDE.md IS establishing project memory that persists across sessions.**
Generates and optimizes CLAUDE.md files for Claude Code projects by analyzing codebase context and applying Anthropic best practices. Reduces token usage for effective project instructions. Use for init, create, optimize actions.
Generates project-specific CLAUDE.md files from Repo Auditor output via guided developer interviews. Use after repo audit; triggers on 'gerar claude.md', 'onboarding', 'setup claude md'.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
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.
Violating the letter of the rules is violating the spirit of the rules.
Pattern: Skill Steps Handoff: none Next: none
Before ANY action, create task list using TaskCreate:
TaskCreate for EACH task below:
- Subject: "[writing-claude-md] Task N: <action>"
- ActiveForm: "<doing action>"
Tasks:
Announce: "Created 7 tasks. Starting execution..."
Execution rules:
TaskUpdate status="in_progress" BEFORE starting each taskTaskUpdate status="completed" ONLY after verification passesTaskList to confirm all completed| TDD Phase | CLAUDE.md Creation | What You Do |
|---|---|---|
| RED | Test without CLAUDE.md | Observe agent missing conventions, using wrong commands |
| Verify RED | Document gaps | Note what Claude got wrong or had to guess |
| GREEN | Write CLAUDE.md | Create specific instructions addressing gaps |
| Verify GREEN | Test in new session | Verify Claude follows instructions correctly |
| REFACTOR | Trim and sharpen | Remove redundant/obvious content, improve specificity |
Goal: Understand what exists and what's needed.
If CLAUDE.md exists:
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.
Goal: Observe what Claude gets wrong without guidance.
Process:
What to look for:
Verification: Documented at least 2 specific things Claude got wrong.
Goal: Create specific, verifiable instructions addressing the gaps you documented.
| Include (Claude can't guess) | Exclude (Claude already knows) |
|---|---|
| Non-obvious bash commands for build/test/deploy | Standard language conventions |
| Code style rules that differ from defaults | Things a linter enforces |
| Repo conventions (branch naming, PR format) | General programming practices |
| Architecture decisions and their rationale | What's obvious from reading code |
| Development environment quirks (env vars, setup) | Detailed API docs (link instead) |
| Common gotchas or non-obvious behavior | Frequently changing information |
Sections: Code Style, Workflow, Architecture, Gotchas. See references/examples.md for complete example.
Instructions MUST be SPECIFIC, VERIFIABLE, NON-OBVIOUS, and ACTIONABLE.
Use MUST/NEVER/IMPORTANT sparingly — if everything is critical, nothing is.
| If the instruction is... | Use... |
|---|---|
| Scoped to specific file paths | .claude/rules/ with paths: glob |
| A reusable multi-step workflow | A skill in .claude/skills/ |
| Must be deterministically enforced | A hook in settings (exit code 2 = block) |
| Only relevant for certain tasks | A skill (loaded on-demand, saves tokens) |
Verification:
MUST, NEVER) sparingly but effectivelyGoal: Add project-specific information that helps agent work effectively.
Sections to consider:
Token efficiency:
Verification: Total < 200 lines. Every line earns its place.
Goal: Verify CLAUDE.md is effective and efficient.
Checklist:
.claude/rules/Verification: All checklist items pass.
Goal: Have CLAUDE.md reviewed by claudemd-reviewer subagent.
Agent tool:
- subagent_type: "rcc:claudemd-reviewer"
- prompt: "Review CLAUDE.md at [path]"
Outcomes:
Verification: claudemd-reviewer returns "Pass" rating.
Goal: Verify CLAUDE.md works in practice.
Process:
Signs of a good CLAUDE.md:
Signs of a bad CLAUDE.md:
Verification: Claude follows documented conventions correctly over 5+ turns.
These thoughts mean you're rationalizing. STOP and reconsider:
All of these mean: You're about to create a bloated, ineffective CLAUDE.md.
| Excuse | Reality |
|---|---|
| "I know what instructions are needed" | You know what YOU think. Baseline reveals actual gaps. |
| "Instructions can be vague for flexibility" | Vague instructions = Claude interprets freely = no control. |
| "Everything goes in CLAUDE.md" | CLAUDE.md = always loaded = expensive. Use skills and rules. |
| "More instructions = better coverage" | More instructions = more noise = important ones get lost. |
| "Standard practices need documenting" | Claude already knows standard practices. Document the exceptions. |
| "Linter rules belong here" | Linter rules belong in linters + hooks. Deterministic > advisory. |
digraph claudemd_creation {
rankdir=TB;
start [label="Need CLAUDE.md", shape=doublecircle];
analyze [label="Task 1: Analyze\ncurrent state", shape=box];
baseline [label="Task 2: RED\nTest without CLAUDE.md", shape=box, style=filled, fillcolor="#ffcccc"];
verify_red [label="Gaps\ndocumented?", shape=diamond];
write [label="Task 3: GREEN\nWrite instructions", shape=box, style=filled, fillcolor="#ccffcc"];
content [label="Task 4: Add\nproject content", shape=box];
validate [label="Task 5: Validate\nstructure", shape=box];
too_long [label="< 200\nlines?", shape=diamond];
extract [label="Extract to\nrules/skills", shape=box];
review [label="Task 6: REFACTOR\nQuality review", shape=box, style=filled, fillcolor="#ccccff"];
review_pass [label="Review\npassed?", shape=diamond];
test [label="Task 7: Test\nnew session", shape=box];
test_pass [label="Works?", shape=diamond];
done [label="CLAUDE.md complete", shape=doublecircle];
start -> analyze;
analyze -> baseline;
baseline -> verify_red;
verify_red -> write [label="yes"];
verify_red -> baseline [label="no\nmore tasks"];
write -> content;
content -> validate;
validate -> too_long;
too_long -> review [label="yes"];
too_long -> extract [label="no"];
extract -> validate;
review -> review_pass;
review_pass -> test [label="pass"];
review_pass -> write [label="fail\nfix issues"];
test -> test_pass;
test_pass -> done [label="yes"];
test_pass -> write [label="no\nimprove"];
}
scripts/init_claude_md.py