|
| 1 | +# CompressKit Project Instructions |
| 2 | + |
| 3 | +This file contains project-specific instructions for Claude Code when working on the CompressKit (formerly Encoding) project. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +CompressKit is a **multi-language lossless compression algorithm library** for educational purposes. It implements 4 classic compression algorithms (Huffman, Arithmetic Coding, Range Coder, RLE) in 3 languages (C++17, Go 1.21+, Rust 1.70+) with guaranteed cross-language binary format compatibility. |
| 8 | + |
| 9 | +## Brand Guidelines |
| 10 | + |
| 11 | +- **Project Name**: CompressKit |
| 12 | +- **Repository**: `LessUp/compress-kit` |
| 13 | +- **Documentation URL**: `https://lessup.github.io/compress-kit/` |
| 14 | + |
| 15 | +Always use `CompressKit` and `LessUp/compress-kit` in documentation and code comments. |
| 16 | + |
| 17 | +## Development Workflow |
| 18 | + |
| 19 | +This project follows **OpenSpec Spec-Driven Development**. See [AGENTS.md](AGENTS.md) for the complete workflow. |
| 20 | + |
| 21 | +### Quick Commands |
| 22 | + |
| 23 | +```bash |
| 24 | +make build # Build all implementations |
| 25 | +make test # Run all tests |
| 26 | +make bench # Run benchmarks |
| 27 | +make format # Format all code |
| 28 | +make lint # Lint all code |
| 29 | +make clean # Clean build artifacts |
| 30 | +``` |
| 31 | + |
| 32 | +## Known Issues |
| 33 | + |
| 34 | +### Range Coder Performance |
| 35 | + |
| 36 | +The Range Coder has a known decode performance issue for files >500KB. This is documented in: |
| 37 | +- `docs/en/algorithms/range.md` |
| 38 | +- `docs/zh/algorithms/range.md` |
| 39 | +- `openspec/specs/cross-language-testing/spec.md` |
| 40 | + |
| 41 | +Do not attempt to fix this without explicit user request, as it's documented for future improvement. |
| 42 | + |
| 43 | +## Code Style |
| 44 | + |
| 45 | +| Language | Tool | Config | |
| 46 | +|----------|------|--------| |
| 47 | +| C++ | clang-format | `.clang-format` (Google Style) | |
| 48 | +| Go | gofmt | Built-in | |
| 49 | +| Rust | rustfmt | Built-in | |
| 50 | +| Python | black | PEP 8 | |
| 51 | + |
| 52 | +## Cross-Language Compatibility |
| 53 | + |
| 54 | +All implementations MUST share identical binary file formats. When modifying any algorithm: |
| 55 | + |
| 56 | +1. Update the format spec in `openspec/specs/` |
| 57 | +2. Ensure all 3 language implementations match |
| 58 | +3. Run cross-language verification tests |
| 59 | +4. Update documentation if format changes |
| 60 | + |
| 61 | +## Security Constraints |
| 62 | + |
| 63 | +- Maximum input size: 4 GiB |
| 64 | +- Maximum output size: 1 GiB (decompression bomb protection) |
| 65 | +- All implementations must validate file sizes |
| 66 | + |
| 67 | +## Documentation |
| 68 | + |
| 69 | +- VitePress site in `docs/` |
| 70 | +- Bilingual: English (`docs/en/`) and Chinese (`docs/zh/`) |
| 71 | +- Run `npm run docs:dev` for local preview |
0 commit comments