Keep a robots.txt file simple. List the paths you intend to discourage crawlers from visiting, then check each rule against a public page that must remain crawlable and a path you mean to exclude. A missing slash or broad wildcard can affect more URLs than expected.
Use a robots.txt generator for a draft, but test the result with the relevant search engine's inspection tools and review the file after deployment. robots.txt is not an access-control system: blocked URLs can still be discovered, and private content needs authentication or removal from public hosting.
If you are unsure what a directive matches, do not publish it until you can name example URLs it includes and excludes.