1. When to use a comma:
* When "as well" is used as an afterthought or an additional thought:
* "I went to the store, and I bought milk, eggs, and bread as well."
* "She's a talented singer, and she's a great dancer as well."
* When "as well" is used to connect two independent clauses:
* "The sun is shining, and it's warm as well."
* "I finished my homework, and I'm going to the park as well."
2. When not to use a comma:
* When "as well" is part of a prepositional phrase:
* "I went to the store as well as the library."
* "He's a talented artist as well as a musician."
* When "as well" is used to modify a noun or pronoun:
* "They are both talented artists as well."
* "The food was delicious, and the service was excellent as well."
In summary:
* Use a comma before "as well" if it introduces an additional thought, connects two independent clauses, or acts as an afterthought.
* Do not use a comma before "as well" if it's part of a prepositional phrase or modifies a noun/pronoun.
Always read your sentence aloud to see if it sounds natural and grammatically correct. If in doubt, err on the side of caution and use a comma.