Skip to content

Instantly share code, notes, and snippets.

@itseduvieira
Created September 18, 2025 11:54
Show Gist options
  • Select an option

  • Save itseduvieira/d9b97839a59a5b5b44fd1ee3e95701b1 to your computer and use it in GitHub Desktop.

Select an option

Save itseduvieira/d9b97839a59a5b5b44fd1ee3e95701b1 to your computer and use it in GitHub Desktop.
Add this to your existing CLAUDE.md so it can handle your file duplication problem

Web App Development Guidelines

🚨 CRITICAL: File Management Protocol

READ FIRST: docs/file-management-spec.md

Before Making ANY Changes:

  1. List affected files explicitly
  2. State file operations clearly:
    • DELETE: path/to/old-file.js (reason)
    • CREATE: path/to/new-file.js (purpose)
    • UPDATE: path/to/existing-file.js (changes)
  3. Update docs/file-references.md after changes

Current Architecture:

Always check docs/file-references.md for the current file structure before making changes.

Change Protocol:

BEFORE: "I need to refactor the authentication"

REQUIRED FORMAT:
"I need to refactor authentication:
- DELETE: src/utils/oldAuth.js (outdated implementation)
- CREATE: src/hooks/useAuth.js (modern React hook)
- CREATE: src/services/authService.js (API integration)
- UPDATE: src/components/Login.js (use new hook)
- UPDATE: src/components/UserProfile.js (use new hook)"

Memory Instructions for Selena MCP

If Selena MCP is available, use these commands to maintain project memory:

{
  "remember": "Always follow file-management-spec.md protocol",
  "never_forget": "Delete old files when creating new implementations",
  "protocol": "List DELETE/CREATE/UPDATE operations before every change",
  "reference_file": "docs/file-references.md contains current project structure",
  "cleanup_rule": "No outdated files should remain after refactoring"
}

Quick Commands for File Management:

# List all source files
find src -type f \( -name "*.js" -o -name "*.jsx" -o -name "*.ts" -o -name "*.tsx" \) | sort

# Find references to old functions/files
grep -r "oldFunctionName" src/
grep -r "from './old-file'" src/

# Check for unused imports
npx eslint src/ --fix

Project Rules:

  1. Never leave old and new implementations coexisting
  2. Always update imports when moving/renaming files
  3. Maintain docs/file-references.md as single source of truth
  4. Explicit file operations prevent confusion

## Instructions for Using Selena MCP

If Selena MCP is available in your Claude Code session, run these commands:

@selena remember "Project uses file-management-spec.md protocol - always DELETE old files when creating new ones"

@selena remember "Before any code changes: list affected files, state DELETE/CREATE/UPDATE operations explicitly"

@selena remember "docs/file-references.md contains current project structure - check it before making changes"

@selena remember "Never leave outdated files mixed with new implementations - this causes logic conflicts"

@selena save-rule "file-management: Always follow the protocol in docs/file-management-spec.md"

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