There are guidelines in the FAQ:
Best of all — edit and improve the existing questions and answers!
All contributions are licensed under Creative Commons and this site is collaboratively edited, like Wikipedia. If you see something that needs improvement, click edit and help us make it so!
We can see two things:
The relevant content in that page was contributed by Stack Overflow and Stack Exchange founder Jeff Atwood, so it's as official as it gets.
When should I edit posts?
Any time you feel you can make the post better, and are inclined to do so. Editing is encouraged!
Some common reasons to edit are:
- to fix grammatical or spelling mistakes
- to clarify the meaning of a post without changing it
- to correct minor mistakes or add addendums / updates as the post ages
- to add related resources or hyperlinks
Try to make the post substantively better when you edit, not just change a single character. Tiny, trivial edits are discouraged.
There's been considerable debate here on Meta about the phrase “clarify the meaning of a post without changing it”. Do note that this is only one of the reasons to edit. A distinct reason to edit is “to correct minor mistakes or add addendums / updates as the post ages”. As you can see, it is allowed to correct errors, including errors in code; and this is even encouraged by the general guideline to improve.
You are making a good edit when:
- You make the post easier to read: improve the quality of the English, expand abbreviations, add explanations of concepts that may be unfamiliar to readers, fix the formatting (code formatted as code, non-code not formatted as code, etc.).
- You correct factual errors in an answer.
- You make a thread easier to find by editing the question: choose proper tags, add likely search terms, make the title more descriptive.
You should not:
- Correct errors in a question, most of the time. An asker's misconception is generally something that should be clarified in an answer.
- Modify opinions. If the author of an answer makes a factual mistake, fix it. If you disagree with the answerer's opinion, write a competing answer or explain why you disagree in a comment.
- Change so much material that the answer is no longer primarily the work of its original author.
As a rule of thumb when editing, ask yourself: would the author have written this if he'd known better? If the answer is yes, your edit is probably good. If the answer is no, your edit is probably bad.
Keep in mind that sometimes, you should ignore all rules. If following the guidelines would lead to making the site markedly worse, go with what makes the site better. This is exceptional: if you think you're in an ignore-all-rules situation, think again. Here are a couple of examples of exceptional situations where the best thing runs contrary to the guidelines:
- A dangerous recommendation in an answer — stick-your-fingers-in-a-socket dangerous. If the danger is not apparent, edit away.
- A question with an accepted answer where both the asker and the answerer have left the site and the answer has become completely obsolete and must be significantly rewritten. It's better to have the up-to-date content in the accepted answer where it's visible to visitors who won't go through the thread's history in detail.
Again, these are exceptional cases. Generally speaking, improve the post while respecting the author, and you'll be good.