That may be the most general question I have ever heard in my life.
But its a good one.
First of all the script get its own module. Everything special to this script will then be created inside this module. This includes functions, classes, constants and variables.
The most important thing for me is flexibility. As often as possible the user of the script should be able to alternate the behavior of the script by passing specific arguments the functions of the script. If the script is meant to be used by other people than me, than this becomes the goal of the script, to be as flexibile as possible. Most of the feature should be, if possible, be optional and can be enabled or disabled.
Also i like my scripts to be independent from the other script inside the script-editor, if possible they should rely only on the standard-libary of ruby or if needed RGSS-classes. This minimizes the chance that another script unwillingly changes the behavior of my script. (which will surely result in either a error or odd behavior)
I override functions only in my own classes or if the script is only meant to be used by me.
Oh and if i need a certain piece of code at several places (say at least 4 places) i create a function for it.