# Pre-Commit Checklist **MANDATORY**: Check ALL items before every commit. ## 1. Task Validation - [ ] Task is listed in `planning.md` - [ ] All task dependencies are complete - [ ] Prerequisites are verified - [ ] Success criteria understood ## 2. Code Reading (Before Implementation) - [ ] Used `grep_search` to find related code - [ ] Read existing function signatures with `read_file` - [ ] Verified function return types - [ ] Checked parameter names and types - [ ] No assumptions made about signatures ## 3. Code Quality - [ ] **Run linter**: `conda run -n ai_engg ruff check . --fix` - [ ] **Fix ALL errors** (especially): - Line length (88 character limit) - Import order (stdlib → third-party → local) - Unused imports - Formatting issues - [ ] Code tested and works - [ ] Type hints added to new functions - [ ] Docstrings added to new functions ## 4. Documentation - [ ] Update `planning.md` if task complete (mark ✅) - [ ] Commit message follows format: `type: brief summary` - [ ] Commit is atomic (one logical change) ## 5. Git - [ ] `git status` checked - [ ] Only relevant files staged - [ ] No debug files or `.pyc` included - [ ] No secrets or credentials ## Common Commit Types - `feat:` - New feature - `fix:` - Bug fix - `refactor:` - Code restructuring - `docs:` - Documentation only - `test:` - Adding/updating tests - `chore:` - Maintenance tasks ## Recent Mistakes to Avoid - ❌ Skipping task dependency check (did 2.3 before 2.2b) - ❌ Assuming function signatures (3 errors in train_with_mlflow.py) - ❌ Not running ruff (71 errors accumulated) - ❌ Committing without testing ## Quick Commands ```bash # Check code quality conda run -n ai_engg ruff check . --fix # Run specific test conda run -n ai_engg python scripts/test_module.py # Check git status git status # Stage and commit git add git commit -m "type: message" ``` --- **Remember**: 30 seconds of reading prevents 5 minutes of debugging!