Reminder: Refactor your code
Reminder: Frequently refactor your code Over time, AI gets your code to be a mess. So you should regularly ask it to clean it up Instead of asking Agent to "refactor the code", ask it to: - Eliminate dead code: “Delete unused imports, variables, and functions; point out any test files that still call them.” - Tighten dependencies: "List packages that are imported but never referenced, and suggest how to remove them from requirements." - Kill duplication: “Detect code blocks duplicated ⩾ 3 times across modules; create a shared utility and update call sites.” - Strengthen typing: “Add or refine type hints where ‘Any’ or missing annotations are found; flag places where typing uncovered a bug.” - Demystify magic numbers: “Replace literals that look like config (timeouts, thresholds, etc.) with named constants in settings.py.” - Improve architecture: "Identify features or sections of the app that could be extracted to a separate module." You can also use these to target a specific part of the application Note: the list is not exhaustive! Let me know if you want more material or a course about this