Homebrew is friendly until it isn't. The friendly part lasts about six months; then you hit one of these traps and a workshop's worth of wisdom drops on your head. Here's the wisdom without the workshop.
Never use sudo brew. It's the number one cause of broken Homebrew installs. The Cellar must be owned by your user. If you've already done it, repair with sudo chown -R $(whoami) /opt/homebrew.
Pin versions you depend on. If your codebase needs Python 3.12 specifically, install python@3.12 (versioned formula) instead of python (always latest). When 3.13 ships and changes a stdlib API, you won't lose a morning.
Use brew autoremove regularly. Every install pulls in dependencies. When you uninstall the parent, the deps stay — over time, they pile up. brew autoremove safely removes anything no longer needed.
Keep a Brewfile in your dotfiles. Even if you only own one Mac today, future-you will own another. A Brewfile collapses "reinstall my whole dev setup" from a half-day to a coffee break.
Watch caveats. Some packages need PATH additions, shell hooks, or post-install service registration. brew info prints them; reading them at install time saves a frustrated debugging session two weeks later.