Skip to content

Claude Code guide in three levels, Beginner to Advanced: hands-on lessons with checked exercises, every volatile fact cited to its source. Independent community guide.

chore: remove orphaned files and de-personalize settings

Wesam Abousaid44004cb35bd2
diff --git a/.claude/commands/mermaid.md b/.claude/commands/mermaid.md
deleted file mode 100644
index c79e9ba..0000000
--- a/.claude/commands/mermaid.md
+++ /dev/null
@@ -1,6 +0,0 @@
-create a mermaid diagrams that represent all the sql together with their entity relationship. ie an entity relationship diagrams. include the properties of each table in the diagram.
-2 sql files are located in lana/app/migrations/
-create a mermaid diagram for each sql files. one lana.md in docs/lana.md, and the other docs/cala.md
-make sure the mermaid compile by running `npx -p @mermaid-js/mermaid-cli mmdc -i docs/{lana|cala}.md -o test.md`
-when complete, verify that every entity in any .sql migration file appears in the mermaid file
-also, you can remove test.md, we just want to use `mmdc` to verify the code generated compiles
\ No newline at end of file
diff --git a/.claude/hooks/pre_tool_use.py b/.claude/hooks/pre_tool_use.py
deleted file mode 100755
index 13962f9..0000000
--- a/.claude/hooks/pre_tool_use.py
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/env -S uv run --script
-# /// script
-# requires-python = ">=3.8"
-# ///
-
-import json
-import sys
-import re
-from pathlib import Path
-
-def is_dangerous_rm_command(command):
- """
- Comprehensive detection of dangerous rm commands.
- Matches various forms of rm -rf and similar destructive patterns.
- """
- # Normalize command by removing extra spaces and converting to lowercase
- normalized = ' '.join(command.lower().split())
-
- # Pattern 1: Standard rm -rf variations
- patterns = [
- r'\brm\s+.*-[a-z]*r[a-z]*f', # rm -rf, rm -fr, rm -Rf, etc.
- r'\brm\s+.*-[a-z]*f[a-z]*r', # rm -fr variations
- r'\brm\s+--recursive\s+--force', # rm --recursive --force
- r'\brm\s+--force\s+--recursive', # rm --force --recursive
- r'\brm\s+-r\s+.*-f', # rm -r ... -f
- r'\brm\s+-f\s+.*-r', # rm -f ... -r
- ]
-
- # Check for dangerous patterns
- for pattern in patterns:
- if re.search(pattern, normalized):
- return True
-
- # Pattern 2: Check for rm with recursive flag targeting dangerous paths
- dangerous_paths = [
- r'/', # Root directory
- r'/\*', # Root with wildcard
- r'~', # Home directory
- r'~/', # Home directory path
- r'\$HOME', # Home environment variable
- r'\.\.', # Parent directory references
- r'\*', # Wildcards in general rm -rf context
- r'\.', # Current directory
- r'\.\s*$', # Current directory at end of command
- ]
-
- if re.search(r'\brm\s+.*-[a-z]*r', normalized): # If rm has recursive flag
- for path in dangerous_paths:
- if re.search(path, normalized):
- return True
-
- return False
-
-def is_env_file_access(tool_name, tool_input):
- """
- Check if any tool is trying to access .env files containing sensitive data.
- """
- if tool_name in ['Read', 'Edit', 'MultiEdit', 'Write', 'Bash']:
- # Check file paths for file-based tools
- if tool_name in ['Read', 'Edit', 'MultiEdit', 'Write']:
- file_path = tool_input.get('file_path', '')
- if '.env' in file_path and not file_path.endswith('.env.sample'):
- return True
-
- # Check bash commands for .env file access
- elif tool_name == 'Bash':
- command = tool_input.get('command', '')
- # Pattern to detect .env file access (but allow .env.sample)
- env_patterns = [
- r'\b\.env\b(?!\.sample)', # .env but not .env.sample
- r'cat\s+.*\.env\b(?!\.sample)', # cat .env
- r'echo\s+.*>\s*\.env\b(?!\.sample)', # echo > .env
- r'touch\s+.*\.env\b(?!\.sample)', # touch .env
- r'cp\s+.*\.env\b(?!\.sample)', # cp .env
- r'mv\s+.*\.env\b(?!\.sample)', # mv .env
- ]
-
- for pattern in env_patterns:
- if re.search(pattern, command):
- return True
-
- return False
-
-def main():
- try:
- # Read JSON input from stdin
- input_data = json.load(sys.stdin)
-
- tool_name = input_data.get('tool_name', '')
- tool_input = input_data.get('tool_input', {})
-
- # Check for .env file access (blocks access to sensitive environment files)
- if is_env_file_access(tool_name, tool_input):
- print("BLOCKED: Access to .env files containing sensitive data is prohibited", file=sys.stderr)
- print("Use .env.sample for template files instead", file=sys.stderr)
- sys.exit(2) # Exit code 2 blocks tool call and shows error to Claude
-
- # Check for dangerous rm -rf commands
- if tool_name == 'Bash':
- command = tool_input.get('command', '')
-
- # Block rm -rf commands with comprehensive pattern matching
- if is_dangerous_rm_command(command):
- print("BLOCKED: Dangerous rm command detected and prevented", file=sys.stderr)
- sys.exit(2) # Exit code 2 blocks tool call and shows error to Claude
-
- # Ensure log directory exists
- log_dir = Path.cwd() / 'logs'
- log_dir.mkdir(parents=True, exist_ok=True)
- log_path = log_dir / 'pre_tool_use.json'
-
- # Read existing log data or initialize empty list
- if log_path.exists():
- with open(log_path, 'r') as f:
- try:
- log_data = json.load(f)
- except (json.JSONDecodeError, ValueError):
- log_data = []
- else:
- log_data = []
-
- # Append new data
- log_data.append(input_data)
-
- # Write back to file with formatting
- with open(log_path, 'w') as f:
- json.dump(log_data, f, indent=2)
-
- sys.exit(0)
-
- except json.JSONDecodeError:
- # Gracefully handle JSON decode errors
- sys.exit(0)
- except Exception:
- # Handle any other errors gracefully
- sys.exit(0)
-
-if __name__ == '__main__':
- main()
\ No newline at end of file
diff --git a/.claude/settings.json b/.claude/settings.json
index adc918b..3d32071 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -3,7 +3,6 @@
"allow": [
"Bash(mkdir:*)",
"Bash(uv:*)",
- "Bash(/Users/wesam/.local/bin/uv:*)",
"Bash(find:*)",
"Bash(mv:*)",
"Bash(grep:*)",
@@ -26,7 +25,7 @@
"hooks": [
{
"type": "command",
- "command": "/Users/wesam/.local/bin/uv run .claude/hooks/post_tool_use.py"
+ "command": "uv run \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/post_tool_use.py"
}
]
}
@@ -37,7 +36,7 @@
"hooks": [
{
"type": "command",
- "command": "/Users/wesam/.local/bin/uv run .claude/hooks/notification.py --notify"
+ "command": "uv run \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/notification.py --notify"
}
]
}
@@ -48,7 +47,7 @@
"hooks": [
{
"type": "command",
- "command": "/Users/wesam/.local/bin/uv run .claude/hooks/stop.py --chat"
+ "command": "uv run \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop.py --chat"
}
]
}
@@ -59,7 +58,7 @@
"hooks": [
{
"type": "command",
- "command": "/Users/wesam/.local/bin/uv run .claude/hooks/subagent_stop.py"
+ "command": "uv run \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/subagent_stop.py"
}
]
}