|
| 1 | +# Claude Coding Guidelines for SilkCircuit |
| 2 | + |
| 3 | +> Instructions for AI assistants working on the SilkCircuit theme |
| 4 | +
|
| 5 | +## Project Overview |
| 6 | + |
| 7 | +SilkCircuit is a vibrant Neovim theme featuring neon purples, electric pinks, and glowing cyan accents. The theme prioritizes performance, accessibility, and comprehensive plugin support. |
| 8 | + |
| 9 | +## Core Principles |
| 10 | + |
| 11 | +1. **Performance First** - Theme loads in <5ms with bytecode compilation |
| 12 | +2. **Accessibility** - All colors meet WCAG AA contrast standards |
| 13 | +3. **Plugin Auto-Detection** - Automatically detect and theme installed plugins |
| 14 | +4. **User Choice** - Three variants (neon/vibrant/soft) with persistent preferences |
| 15 | + |
| 16 | +## Code Style Guidelines |
| 17 | + |
| 18 | +### Lua Conventions |
| 19 | + |
| 20 | +```lua |
| 21 | +-- Module structure |
| 22 | +local M = {} |
| 23 | + |
| 24 | +-- Function definitions |
| 25 | +function M.function_name(param1, param2) |
| 26 | + -- Implementation |
| 27 | +end |
| 28 | + |
| 29 | +return M |
| 30 | +``` |
| 31 | + |
| 32 | +### Naming Conventions |
| 33 | + |
| 34 | +- Files: `snake_case.lua` |
| 35 | +- Functions: `snake_case` |
| 36 | +- Local variables: `snake_case` |
| 37 | +- Constants: `UPPER_SNAKE_CASE` (rare) |
| 38 | +- Highlight groups: `PascalCase` |
| 39 | + |
| 40 | +### Comments |
| 41 | + |
| 42 | +- Avoid unnecessary comments |
| 43 | +- Document complex logic only |
| 44 | +- Use present tense ("Returns" not "Will return") |
| 45 | +- No decorative comments |
| 46 | + |
| 47 | +## Key Files and Their Purposes |
| 48 | + |
| 49 | +### Core Files |
| 50 | + |
| 51 | +- `init.lua` - Entry point, loads theme |
| 52 | +- `palette.lua` - Color definitions and semantic mappings |
| 53 | +- `theme.lua` - Core highlight group definitions |
| 54 | +- `config.lua` - Configuration management |
| 55 | +- `util.lua` - Utility functions and compilation |
| 56 | + |
| 57 | +### Integration System |
| 58 | + |
| 59 | +- `integrations/init.lua` - Plugin detection and loading |
| 60 | +- `integrations/{plugin}.lua` - Individual plugin themes |
| 61 | + |
| 62 | +### User Features |
| 63 | + |
| 64 | +- `commands.lua` - User commands (`:SilkCircuit`, etc.) |
| 65 | +- `preferences.lua` - Persistent settings |
| 66 | +- `glow.lua` - Glow mode implementation |
| 67 | +- `variants.lua` - Theme variant system |
| 68 | + |
| 69 | +## Adding New Features |
| 70 | + |
| 71 | +### New Integration |
| 72 | + |
| 73 | +1. Create `integrations/{plugin}.lua` |
| 74 | +2. Add to detection in `integrations/init.lua` |
| 75 | +3. Add to integration list |
| 76 | +4. Test with and without plugin |
| 77 | + |
| 78 | +Template: |
| 79 | + |
| 80 | +```lua |
| 81 | +local M = {} |
| 82 | + |
| 83 | +function M.get(colors, opts) |
| 84 | + return { |
| 85 | + PluginElement = { fg = colors.purple }, |
| 86 | + -- Map plugin UI to semantic colors |
| 87 | + } |
| 88 | +end |
| 89 | + |
| 90 | +return M |
| 91 | +``` |
| 92 | + |
| 93 | +### New Command |
| 94 | + |
| 95 | +1. Add to `commands.lua` |
| 96 | +2. Follow naming pattern `:SilkCircuit{Feature}` |
| 97 | +3. Add to `:checkhealth` documentation |
| 98 | +4. Update help docs |
| 99 | + |
| 100 | +## Testing Guidelines |
| 101 | + |
| 102 | +### Before Committing |
| 103 | + |
| 104 | +1. Run `make lint` - Must pass |
| 105 | +2. Test all variants - `:SilkCircuit neon/vibrant/soft` |
| 106 | +3. Check compilation - `:SilkCircuitCompile` |
| 107 | +4. Verify contrast - `:SilkCircuitContrast` |
| 108 | +5. Run checkhealth - `:checkhealth silkcircuit` |
| 109 | + |
| 110 | +### Manual Testing |
| 111 | + |
| 112 | +- Open various file types (Lua, JS, YAML, Markdown) |
| 113 | +- Test with neo-tree open |
| 114 | +- Verify git status colors |
| 115 | +- Check floating windows |
| 116 | + |
| 117 | +## Performance Considerations |
| 118 | + |
| 119 | +### Do |
| 120 | + |
| 121 | +- Use `vim.tbl_deep_extend` for merging |
| 122 | +- Cache expensive operations |
| 123 | +- Compile regex patterns once |
| 124 | +- Use early returns |
| 125 | + |
| 126 | +### Don't |
| 127 | + |
| 128 | +- Parse files repeatedly |
| 129 | +- Create unnecessary tables |
| 130 | +- Use global variables |
| 131 | +- Block the main thread |
| 132 | + |
| 133 | +## Color Usage |
| 134 | + |
| 135 | +### Semantic Mapping |
| 136 | + |
| 137 | +Always use semantic colors from `palette.lua`: |
| 138 | + |
| 139 | +```lua |
| 140 | +-- Good |
| 141 | +{ fg = sem.keyword } |
| 142 | + |
| 143 | +-- Bad |
| 144 | +{ fg = colors.purple } |
| 145 | +``` |
| 146 | + |
| 147 | +### Contrast |
| 148 | + |
| 149 | +All foreground/background pairs must meet WCAG AA (4.5:1 ratio). |
| 150 | + |
| 151 | +## User Communication |
| 152 | + |
| 153 | +### Notifications |
| 154 | + |
| 155 | +```lua |
| 156 | +-- Use vim.notify with appropriate level |
| 157 | +vim.notify("Message", vim.log.levels.INFO) |
| 158 | +``` |
| 159 | + |
| 160 | +### Unicode Symbols |
| 161 | + |
| 162 | +- `→` for arrows/flow |
| 163 | +- `√` for success |
| 164 | +- `!` for warnings |
| 165 | +- `»` for tips |
| 166 | +- Avoid emojis |
| 167 | + |
| 168 | +## Common Tasks |
| 169 | + |
| 170 | +### Update Existing Highlight |
| 171 | + |
| 172 | +1. Find in `theme.lua` or relevant integration |
| 173 | +2. Modify using semantic colors |
| 174 | +3. Test in all variants |
| 175 | + |
| 176 | +### Fix Contrast Issue |
| 177 | + |
| 178 | +1. Run `:SilkCircuitContrast` |
| 179 | +2. Identify failing pair |
| 180 | +3. Adjust in `palette.lua` |
| 181 | +4. Re-test |
| 182 | + |
| 183 | +### Add Config Option |
| 184 | + |
| 185 | +1. Add to defaults in `config.lua` |
| 186 | +2. Document in README |
| 187 | +3. Handle in relevant module |
| 188 | +4. Add to `:checkhealth` |
| 189 | + |
| 190 | +## Git Workflow |
| 191 | + |
| 192 | +### Commit Messages |
| 193 | + |
| 194 | +- Use conventional commits |
| 195 | +- Be specific about changes |
| 196 | +- Reference issues if applicable |
| 197 | + |
| 198 | +Examples: |
| 199 | + |
| 200 | +- `fix: correct YAML key highlighting` |
| 201 | +- `feat: add mason.nvim integration` |
| 202 | +- `perf: optimize theme compilation` |
| 203 | + |
| 204 | +### Pull Requests |
| 205 | + |
| 206 | +- Update CHANGELOG.md |
| 207 | +- Run all tests |
| 208 | +- Include before/after screenshots for visual changes |
| 209 | + |
| 210 | +## Debugging |
| 211 | + |
| 212 | +### Common Issues |
| 213 | + |
| 214 | +1. **Highlights not applying**: Check `:hi {GroupName}` |
| 215 | +2. **Plugin not detected**: Verify in `:SilkCircuitIntegrations` |
| 216 | +3. **Slow loading**: Run `:SilkCircuitCompile` |
| 217 | +4. **Colors look wrong**: Check terminal true color support |
| 218 | + |
| 219 | +### Debug Mode |
| 220 | + |
| 221 | +```lua |
| 222 | +vim.g.silkcircuit_debug = true |
| 223 | +``` |
| 224 | + |
| 225 | +## Don'ts |
| 226 | + |
| 227 | +- × Don't add emojis to code |
| 228 | +- × Don't create files unless necessary |
| 229 | +- × Don't use hard-coded colors |
| 230 | +- × Don't skip contrast validation |
| 231 | +- × Don't add verbose comments |
| 232 | +- × Don't break existing functionality |
| 233 | + |
| 234 | +## Quick Reference |
| 235 | + |
| 236 | +### Commands |
| 237 | + |
| 238 | +- `:SilkCircuit {variant}` - Switch variant |
| 239 | +- `:SilkCircuitGlow` - Toggle glow mode |
| 240 | +- `:SilkCircuitContrast` - Check WCAG compliance |
| 241 | +- `:SilkCircuitCompile` - Compile for performance |
| 242 | +- `:SilkCircuitIntegrations` - Show detected plugins |
| 243 | +- `:checkhealth silkcircuit` - Full diagnostics |
| 244 | + |
| 245 | +### File Locations |
| 246 | + |
| 247 | +- Colors: `lua/silkcircuit/palette.lua` |
| 248 | +- Highlights: `lua/silkcircuit/theme.lua` |
| 249 | +- Plugin themes: `lua/silkcircuit/integrations/` |
| 250 | +- User config: `~/.config/nvim/lua/plugins/silkcircuit.lua` |
| 251 | + |
| 252 | +--- |
| 253 | + |
| 254 | +*When in doubt, prioritize user experience and maintain the vibrant aesthetic.* |
0 commit comments