Files
noteflow/.claude/hookify.warn-new-file-search.local.md

1.6 KiB

name, enabled, event, action, conditions
name enabled event action conditions
warn-new-file-search true file warn
field operator pattern
file_path regex_match ^(src|client/src|tests)/.*.(py|ts|tsx|js|jsx)$
field operator pattern
old_text equals

⚠️ New File Creation: Search for Existing Code First!

You're creating a new source file. Before proceeding, you MUST search for existing similar code.

Required checks before creating this file:

  1. Search for similar names:

    Use Grep or find_symbol to search for:
    - Similar class names
    - Similar function names
    - Similar module names
    
  2. Check neighboring files:

    Use Glob or list_dir to examine:
    - Files in the same directory
    - Files in sibling directories
    - Related modules that might already have this functionality
    
  3. Search for similar patterns:

    Use search_for_pattern to find:
    - Similar functionality that could be reused
    - Base classes that could be extended
    - Utilities that already solve this problem
    

Why this matters:

  • Code duplication creates maintenance burden
  • Existing code may already solve your problem
  • Reusing code ensures consistency
  • This project forbids creating new modules without justification (see CLAUDE.md)

If similar code exists:

  • Extend the existing module instead
  • Add to an existing file if appropriate
  • Import and reuse existing utilities

If you've already searched: Proceed with file creation. This is just a reminder.

Project reference: See CLAUDE.md section on "Module Creation" - creating new files/modules is forbidden without valid justification.