Skip to content

Trim CLAUDE.md: remove generic advice, keep project-specific content#6890

Open
knutwannheden wants to merge 2 commits intomainfrom
trim-claude-md
Open

Trim CLAUDE.md: remove generic advice, keep project-specific content#6890
knutwannheden wants to merge 2 commits intomainfrom
trim-claude-md

Conversation

@knutwannheden
Copy link
Copy Markdown
Contributor

Summary

  • Remove generic coding advice that Claude already knows: Java/TypeScript code style conventions (PascalCase, camelCase, indentation), best practices ("favor composition over inheritance"), version control guidelines ("write clear commit messages"), error handling ("validate inputs and fail fast"), task management boilerplate
  • Remove filler sections: "Important Instructions" with uncertain references ("if available"), "Conclusion" paragraph, redundant "Recipe Development" prose already covered by the code example
  • Keep all project-specific content: core architecture overview, build commands, project structure with all modules (including recently added csharp/docker/java-25), AST traversal patterns with instanceof gotcha, RewriteTest pattern, RPC test hang warnings, parser extension guide, sub-module CLAUDE.md references, JSpecify/licenseFormat/ADR/IDE.properties conventions

Reduces the file from ~240 lines to ~110 lines. Every line in CLAUDE.md costs context window tokens in every Claude Code session — generic advice that restates what the model already knows has real cost with no benefit.

Test plan

  • Verify the trimmed file retains all actionable, project-specific guidance
  • Confirm sub-module CLAUDE.md references still point to correct paths
  • Check that no project-specific conventions were accidentally removed

Remove sections that restate standard Java/TypeScript conventions Claude
already knows (Code Style, Best Practices, Version Control Guidelines,
Error Handling, Task Management, etc.). These add context window cost
every session without changing behavior.

Retain all project-specific content: core architecture, build commands,
project structure, AST traversal patterns, RPC test gotchas, parser
extension guide, sub-module CLAUDE.md references, and conventions.

Reduces file from ~240 lines to ~110 lines — roughly halving the per-session
token cost while preserving all actionable, non-obvious guidance.
The RPC hang/timeout guidance is already covered with more specific
detail in both rewrite-python/rewrite/CLAUDE.md (pytest --timeout)
and rewrite-javascript/rewrite/CLAUDE.md (--detectOpenHandles, queue.ts).
Remove the redundant generic version from the root file.
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready to Review

Development

Successfully merging this pull request may close these issues.

2 participants