Always stay in the middle of the lane (unless you need to avoid a pothole), never overtake unless a car would have space to overtake, never enter an intersection alongside a car in the same lane.
On a bike, you also have the option of behaving like a pedestrian (cycle on the sidewalk slowly) occasionally.
If you don't do this, it's only a matter of time before a car hits you because it didn't expect a vehicle or pedestrian doing what you are doing.