1. Parenthetical element:
* Comma before and after the brackets if the bracketed material is a parenthetical element (extra information that could be removed without changing the sentence's meaning).
Example:
* "The dog, (which was a golden retriever), barked loudly."
2. Integral part:
* No comma before the brackets if the bracketed material is an integral part of the sentence (essential to the sentence's meaning).
Example:
* "The dog (a golden retriever) barked loudly."
Here's a breakdown of the rules:
* If the bracketed material is a complete sentence, a comma follows the closing bracket.
* If the bracketed material is a single word, a comma follows the closing bracket only if it would be used if the bracketed word were not present.
* If the bracketed material is a phrase or clause, a comma follows the closing bracket only if it would be used if the bracketed material were not present.
* If the bracketed material is a list, a comma follows the closing bracket only if it would be used if the bracketed list were not present.
Remember: These rules are not always absolute. If the sentence sounds awkward with a comma, it might be best to omit it.
If you're ever unsure, it's always a good idea to consult a style guide or a grammar textbook for guidance.