|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Repository Overview |
| 6 | + |
| 7 | +This is a Vietnamese language Rust book built with mdBook - a comprehensive resource for learning Rust programming in Vietnamese. The book covers fundamental concepts through advanced topics and practical examples. |
| 8 | + |
| 9 | +## Development Commands |
| 10 | + |
| 11 | +### Local Development |
| 12 | +```bash |
| 13 | +# Start development server (auto-installs dependencies) |
| 14 | +./dev.sh |
| 15 | + |
| 16 | +# Start with custom port |
| 17 | +./dev.sh 3001 |
| 18 | + |
| 19 | +# Manual setup and serve |
| 20 | +cargo install mdbook mdbook-linkcheck |
| 21 | +mdbook serve --open --port 3000 |
| 22 | +``` |
| 23 | + |
| 24 | +### Building the Book |
| 25 | +```bash |
| 26 | +# Build the book for production |
| 27 | +mdbook build |
| 28 | + |
| 29 | +# Check links |
| 30 | +mdbook-linkcheck |
| 31 | +``` |
| 32 | + |
| 33 | +### Testing |
| 34 | +```bash |
| 35 | +# Test Rust code examples in the book |
| 36 | +mdbook test |
| 37 | + |
| 38 | +# Run tests for specific chapter |
| 39 | +mdbook test src/basic/ |
| 40 | +``` |
| 41 | + |
| 42 | +## Architecture & Structure |
| 43 | + |
| 44 | +### Content Organization |
| 45 | +- **`src/`** - All book content in Markdown format |
| 46 | + - **`SUMMARY.md`** - Table of contents defining book structure |
| 47 | + - **`basic/`** - Fundamental Rust concepts (variables, ownership, structs, traits, enums) |
| 48 | + - **`advanced/`** - Advanced topics (smart pointers, async programming) |
| 49 | + - **`crates/`** - Popular crate documentation and examples |
| 50 | + - **`design-pattern/`** - Rust design patterns and idioms |
| 51 | + - **`data-engineering/`** - Data processing and analysis with Rust |
| 52 | + - **`getting-started/`** - Installation and first project guides |
| 53 | + |
| 54 | +### Key Configuration Files |
| 55 | +- **`book.toml`** - mdBook configuration with Vietnamese language settings |
| 56 | +- **`dev.sh`** - Development script with auto-dependency installation |
| 57 | +- **`src/lib.rs`** - Minimal Rust file for GitHub language detection |
| 58 | + |
| 59 | +### Content Structure Patterns |
| 60 | +1. **Hierarchical Topics** - Each major concept has its own directory with README.md |
| 61 | +2. **Progressive Complexity** - Basic → Advanced → Specialized topics |
| 62 | +3. **Practical Examples** - Rust code files (`.rs`) embedded in chapters |
| 63 | +4. **Vietnamese Language** - All content in Vietnamese with technical terms explained |
| 64 | + |
| 65 | +### Build System |
| 66 | +- **mdBook** - Static site generator for technical documentation |
| 67 | +- **GitHub Actions** - Automated deployment to GitHub Pages |
| 68 | +- **Link Checking** - Validates all links in the book content |
| 69 | + |
| 70 | +## Development Workflow |
| 71 | + |
| 72 | +### Adding New Content |
| 73 | +1. Create/update Markdown files in `src/` directory |
| 74 | +2. Update `src/SUMMARY.md` if adding new chapters |
| 75 | +3. Include practical Rust code examples where appropriate |
| 76 | +4. Test locally with `./dev.sh` before committing |
| 77 | + |
| 78 | +### Content Guidelines |
| 79 | +- Write in Vietnamese with clear explanations |
| 80 | +- Include runnable Rust code examples |
| 81 | +- Use consistent formatting and terminology |
| 82 | +- Link to related concepts within the book |
| 83 | + |
| 84 | +### CI/CD Pipeline |
| 85 | +- **PR Builds** - Every PR builds the book and checks links |
| 86 | +- **Deployment** - Main branch automatically deploys to GitHub Pages |
| 87 | +- **Sitemap Generation** - Automatically generates sitemap for SEO |
| 88 | +- **Link Validation** - mdbook-linkcheck validates all external links |
| 89 | + |
| 90 | +## Book-Specific Considerations |
| 91 | + |
| 92 | +### Language and Localization |
| 93 | +- Primary language: Vietnamese (`vi`) |
| 94 | +- Technical terms include both Vietnamese and English |
| 95 | +- Code examples use English variable names with Vietnamese comments |
| 96 | + |
| 97 | +### Content Validation |
| 98 | +- All Rust code examples should compile and run |
| 99 | +- Links should be validated with mdbook-linkcheck |
| 100 | +- Vietnamese grammar and terminology should be consistent |
| 101 | + |
| 102 | +### Performance |
| 103 | +- Static site generation allows fast loading |
| 104 | +- GitHub Pages provides reliable hosting |
| 105 | +- Responsive design for mobile and desktop reading |
0 commit comments