Skip to content

Instantly share code, notes, and snippets.

@andynu
Created March 6, 2026 19:48
Show Gist options
  • Select an option

  • Save andynu/ff8968803271f6be112948397523c7bd to your computer and use it in GitHub Desktop.

Select an option

Save andynu/ff8968803271f6be112948397523c7bd to your computer and use it in GitHub Desktop.
Claude Code slash command: Deduplicate local CLAUDE.md by removing content covered by global rules
allowed-tools
Glob(path:/home/andy/.claude/**), Read(path:/home/andy/.claude/**), Edit

Deduplicate Local CLAUDE.md

Remove content from the local project CLAUDE.md that duplicates global rules.

Instructions

  1. Read all global rules fresh (these change frequently, always re-read):

    • ~/.claude/CLAUDE.md
    • ~/.claude/rules/**/*.md (all files recursively)
  2. Read the local CLAUDE.md in the current project root

  3. Identify and remove content that duplicates global rules:

    • Generic Rails commands (bin/rails test, brakeman, rubocop, db:prepare, etc.)
    • Standard Rails conventions (migrations DDL-only, HAML, Minitest, FactoryBot)
    • Generic development commands (bin/dev, bin/setup, guard)
    • bd workflow instructions
    • wi_auth/CanCanCan patterns
    • Any "Development Commands" sections with standard Rails CLI usage
  4. Keep project-specific content:

    • Application overview and purpose
    • Domain-specific models and workflows
    • Unique integrations (external APIs, ERPs, etc.)
    • Project-specific configuration
    • Retirement/legacy status notes
    • Custom business logic documentation
  5. Consolidate remaining content:

    • Remove redundancy within the file itself
    • Tighten prose (remove filler phrases like "This file provides guidance...")
    • Combine related sections where sensible
  6. Show the user what you're removing and why before making edits

Goal

The local CLAUDE.md should only contain information that is unique to this project and not covered by global rules. Keep it focused and concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment