|
| 1 | +# Claude Code Configuration |
| 2 | + |
| 3 | +This directory contains Claude Code configuration and enhancements for the Python Deadlines project. |
| 4 | + |
| 5 | +## Directory Structure |
| 6 | + |
| 7 | +``` |
| 8 | +.claude/ |
| 9 | +├── settings.json # Main configuration file with hooks and permissions |
| 10 | +├── settings.local.json # Local overrides (not committed) |
| 11 | +├── agents/ # Specialized agents for domain tasks |
| 12 | +├── commands/ # Custom slash commands |
| 13 | +├── scripts/ # Hook scripts (pre/post actions) |
| 14 | +├── context/ # Auto-loaded documentation |
| 15 | +├── docs/ # Project documentation |
| 16 | +└── README.md # This file |
| 17 | +``` |
| 18 | + |
| 19 | +## Features |
| 20 | + |
| 21 | +### 🎣 Hooks (Active) |
| 22 | +Automated actions that run before/after Claude uses tools: |
| 23 | +- **Pre-Edit Hook** (`pre-edit-check.sh`): Warns when editing protected files |
| 24 | +- **Post-Edit Hook** (`format-python.sh`): Auto-formats Python files, validates YAML/JSON |
| 25 | +- **Pre-Write Hook** (`pre-write-check.sh`): Validates new file creation |
| 26 | +- **Pre-Bash Hook** (`validate-command.sh`): Blocks dangerous commands |
| 27 | + |
| 28 | +### 🤖 Specialized Agents |
| 29 | +Domain-specific agents for complex tasks: |
| 30 | +- **conference-specialist** - Conference data validation and enrichment |
| 31 | +- **qa-guardian** - Quality assurance and testing |
| 32 | + |
| 33 | +### 📝 Custom Commands |
| 34 | +Slash commands for common workflows: |
| 35 | +- `/add-conference` - Interactive conference addition |
| 36 | +- `/validate-data` - Comprehensive data validation |
| 37 | +- `/import-conferences` - Import from external sources |
| 38 | +- `/newsletter` - Generate newsletter content |
| 39 | +- `/quick-fix` - Automatic issue resolution |
| 40 | +- `/check-deadlines` - Check upcoming CFP deadlines |
| 41 | +- `/test-conference` - Test conference data entry |
| 42 | + |
| 43 | +### 📚 Context Documents |
| 44 | +Auto-loaded documentation for Claude: |
| 45 | +- **ADHD Support** - Development support for ADHD |
| 46 | +- **Critical Operations** - Safety guidelines and checklists |
| 47 | +- **Git Workflow** - Branching and deployment procedures |
| 48 | +- **Conference Schema** - Complete field reference |
| 49 | +- **Data Pipeline** - Processing workflow details |
| 50 | +- **Troubleshooting** - Common issues and solutions |
| 51 | + |
| 52 | +## Configuration |
| 53 | + |
| 54 | +### settings.json |
| 55 | +Main configuration file that defines: |
| 56 | +- **Permissions**: Tool access control (allow/ask/deny patterns) |
| 57 | +- **Hooks**: Pre/post actions for tools (Edit, Write, Bash) |
| 58 | +- **Environment**: Project-specific environment variables |
| 59 | +- **Output Style**: Response formatting preferences |
| 60 | +- **MCP Servers**: Integration with Model Context Protocol servers |
| 61 | + |
| 62 | +### Permissions System |
| 63 | +- **Allow**: Tools/commands that run without prompting |
| 64 | +- **Ask**: Tools that require user confirmation |
| 65 | +- **Deny**: Blocked patterns for safety |
| 66 | + |
| 67 | +Example patterns: |
| 68 | +```json |
| 69 | +"allow": ["Bash(pixi run:*)", "Read", "Edit"], |
| 70 | +"ask": ["Bash", "Write", "MultiEdit"], |
| 71 | +"deny": ["Bash(rm -rf /)", "Read(*.key)"] |
| 72 | +``` |
| 73 | + |
| 74 | +### Customization |
| 75 | +To add new features: |
| 76 | + |
| 77 | +1. **New Command**: Create `.md` file in `commands/` |
| 78 | +2. **New Hook**: Add script in `scripts/`, update `settings.json` |
| 79 | +3. **New Agent**: Add `.md` file in `agents/` with frontmatter |
| 80 | +4. **New Context**: Add `.md` file in `context/` or `docs/` |
| 81 | + |
| 82 | +## Security |
| 83 | + |
| 84 | +### Blocked Operations |
| 85 | +The configuration prevents: |
| 86 | +- Destructive git operations (`git push --force`, `git reset --hard HEAD~`) |
| 87 | +- System-wide deletions (`rm -rf /`, `rm -rf ~`) |
| 88 | +- Insecure file permissions (`chmod 777`) |
| 89 | +- Branch deletions (`git push origin :main`) |
| 90 | +- Fork bombs and malicious patterns |
| 91 | + |
| 92 | +### Protected Files |
| 93 | +Warnings are issued when editing: |
| 94 | +- GitHub workflow files (`.github/workflows/`) |
| 95 | +- License files (`LICENSE`) |
| 96 | +- Environment configuration (`.env`) |
| 97 | +- Secret files (`*.key`, `*.pem`) |
| 98 | +- Configuration files (`settings.json`, `CLAUDE.md`) |
| 99 | +- Archive data (`_data/archive.yml` - auto-managed) |
| 100 | + |
| 101 | +## Usage |
| 102 | + |
| 103 | +Claude Code automatically loads this configuration when working in the project. No manual activation needed. |
| 104 | + |
| 105 | +### Testing Hooks |
| 106 | +```bash |
| 107 | +# Test pre-command validation (should block) |
| 108 | +./.claude/scripts/validate-command.sh "rm -rf /" |
| 109 | + |
| 110 | +# Test pre-edit check |
| 111 | +./.claude/scripts/pre-edit-check.sh ".github/workflows/test.yml" |
| 112 | + |
| 113 | +# Test formatting hook |
| 114 | +./.claude/scripts/format-python.sh "utils/test.py" |
| 115 | + |
| 116 | +# Test pre-write check |
| 117 | +./.claude/scripts/pre-write-check.sh "_data/new-conference.yml" |
| 118 | +``` |
| 119 | + |
| 120 | +### MCP Servers |
| 121 | +The project integrates with MCP servers for enhanced functionality: |
| 122 | +- **Time**: Timezone management for conference deadlines |
| 123 | +- **Git**: Version control operations |
| 124 | +- **Filesystem**: Enhanced file operations |
| 125 | +- **Memory**: Knowledge persistence |
| 126 | +- **Context7**: Library documentation |
| 127 | + |
| 128 | +## Maintenance |
| 129 | + |
| 130 | +### Updating Hooks |
| 131 | +1. Edit script in `scripts/` |
| 132 | +2. Make executable: `chmod +x scripts/*.sh` |
| 133 | +3. Test manually using commands above |
| 134 | +4. Update `settings.json` hooks section |
| 135 | + |
| 136 | +### Adding Commands |
| 137 | +1. Create command documentation in `commands/` |
| 138 | +2. Follow existing template structure |
| 139 | +3. Test with Claude Code |
| 140 | +4. Document in this README |
| 141 | + |
| 142 | +### Adding Agents |
| 143 | +1. Create agent file in `agents/` |
| 144 | +2. Add frontmatter with name, description, tools |
| 145 | +3. Define agent personality and workflows |
| 146 | +4. Test agent invocation |
| 147 | + |
| 148 | +## Best Practices |
| 149 | + |
| 150 | +1. **Keep hooks fast** - They run on every tool use |
| 151 | +2. **Make hooks safe** - Always exit 0 unless blocking critical operations |
| 152 | +3. **Document commands** - Include examples and options |
| 153 | +4. **Update context** - Keep documentation current |
| 154 | +5. **Test changes** - Verify hooks work before committing |
| 155 | + |
| 156 | +## Troubleshooting |
| 157 | + |
| 158 | +### Hooks Not Running |
| 159 | +- Check `settings.json` syntax with `json` validator |
| 160 | +- Verify script permissions: `chmod +x scripts/*.sh` |
| 161 | +- Check hook configuration in settings.json |
| 162 | +- Enable hooks: `"disableAllHooks": false` |
| 163 | + |
| 164 | +### Command Not Found |
| 165 | +- Ensure `.md` file exists in `commands/` |
| 166 | +- Check file naming matches command name |
| 167 | +- Restart Claude Code session |
| 168 | +- Verify command documentation format |
| 169 | + |
| 170 | +### MCP Server Issues |
| 171 | +- Check server connectivity: `claude mcp list` |
| 172 | +- Verify `enableAllProjectMcpServers: true` |
| 173 | +- Check specific server configuration |
| 174 | +- Review server logs for errors |
| 175 | + |
| 176 | +## Project-Specific Features |
| 177 | + |
| 178 | +### Conference Data Validation |
| 179 | +- Automatic validation when editing `_data/conferences.yml` |
| 180 | +- Timezone verification for conference locations |
| 181 | +- HTTPS URL enforcement |
| 182 | +- Date logic validation (cfp < start < end) |
| 183 | + |
| 184 | +### Python Development |
| 185 | +- Auto-formatting with ruff on save |
| 186 | +- Linting and type checking integration |
| 187 | +- Test runner integration with pytest |
| 188 | +- Pixi environment management |
| 189 | + |
| 190 | +### ADHD Support |
| 191 | +- Task breakdown with TodoWrite |
| 192 | +- Energy management reminders |
| 193 | +- Focus patterns for common tasks |
| 194 | +- Break reminders at intervals |
| 195 | + |
| 196 | +## Contributing |
| 197 | + |
| 198 | +To improve Claude Code configuration: |
| 199 | +1. Test changes locally |
| 200 | +2. Document new features |
| 201 | +3. Update this README |
| 202 | +4. Submit PR with examples |
| 203 | + |
| 204 | +For issues or suggestions, create an issue in the repository. |
0 commit comments