mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-04-29 15:12:35 -05:00
Documentation updates across the codebase: Root documentation: - README.md: Updated references from book/ to site/ - CONTRIBUTING.md: Updated build and workflow instructions - .shared-ai-rules.md: Updated AI assistant rules for new structure GitHub configuration: - Issue templates updated for new module locations - Workflow references updated from book/ to site/ docs/ updates: - STUDENT_QUICKSTART.md: New paths and structure - module-rules.md: Updated module development guidelines - NBGrader documentation: Updated for module restructuring - Archive documentation: Updated references Module documentation: - modules/17_memoization/README.md: Updated after reordering All documentation now correctly references: - site/ instead of book/ - modules/XX_name/ instead of modules/source/
3.9 KiB
3.9 KiB
Shared AI Assistant Rules
These rules apply to ALL AI assistants working on this project (Cursor, Claude, GitHub Copilot, etc.)
Git Commit Guidelines
Commit Structure
- Make small, focused commits - one logical change per commit
- Never lump multiple unrelated changes into a single commit
- Each module fix should be its own commit
- Each feature should be its own commit
- Each bug fix should be its own commit
Commit Message Format
<type>: <short summary>
<optional detailed description>
Types:
fix: Bug fixesfeat: New featuresrefactor: Code restructuringdocs: Documentation changestest: Test additions or fixeschore: Maintenance tasks
Rules:
- Never use exclamation marks in commit messages
- Keep first line under 72 characters
- Use imperative mood: "Fix bug" not "Fixed bug"
- Be specific and descriptive
- Reference issue numbers when applicable
Good Examples:
Fix Module 06 optimizers AdamW gradient handling
Add KV cache support for transformer inference
Refactor attention masking to use standard conventions
Bad Examples:
Fix stuff!
Update files
Changes
WIP
What NOT to Commit
- Generated files (
.ipynbnotebooks - they're auto-generated from.py) __pycache__/directories- Build artifacts
- Temporary files
- IDE-specific configuration (
.vscode/,.idea/) - AI assistant folders (
.cursor/,.claude/,.ai/)
Code Quality
Critical Rules
- Test every change before moving to the next task
- Run inline tests immediately after defining them
- Never skip testing - it catches issues early
- Check imports - ensure all dependencies are available
Development Workflow
- Make a change
- Test the change
- Verify it works
- Commit (small, focused commit)
- Move to next change
Never:
- Make multiple changes without testing
- Commit untested code
- Bundle unrelated changes together
TinyTorch-Specific Rules
Module Development
- All source code lives in
modules/XX_name/name_dev.py .ipynbfiles are generated - don't edit them directly- Use
tito exportto sync changes to the package - Test with
tito test <module_name>
Testing Philosophy
- Inline tests = component validation within modules
tests/directory = integration tests across modules- Every module must have passing inline tests
- Integration tests verify modules work together
Code Organization
- Avoid duplication - create shared utilities
- Follow existing module structure
- Maintain consistent formatting
- Use the project's established patterns
Communication
With the User
- Be direct and concise
- Don't ask for permission for standard operations
- Propose solutions, don't just describe problems
- Show progress with concrete results
In Code
- Write clear, educational comments
- Explain non-obvious decisions
- Document complex algorithms
- Use meaningful variable names
Efficiency
Tool Usage
- Use specialized tools over terminal commands when available
- Make parallel tool calls when operations are independent
- Read multiple files simultaneously when needed
- Batch related operations
Problem Solving
- Be proactive - fix issues when you find them
- Think critically - challenge assumptions
- Consider edge cases - don't just test happy paths
- Learn from errors - patterns repeat
Quality Standards
Before Committing
- All tests pass
- No linter errors
- Imports are correct
- Code follows project style
- Commit message is clear and specific
- Only changed files are included
Before Marking Complete
- Feature works as intended
- Edge cases are handled
- Documentation is updated
- Tests are passing
- No regressions introduced
Remember: Quality over speed. Small, tested, well-documented commits are better than large, untested, rushed ones.