Responsible behaviour by the public
The Access Code says:
You can exercise access rights over open pasture (including the Scottish uplands and the common grazing land near many crofting communities in north-west Scotland). Keep a sensible distance from animals, particularly where there are calves or lambs present, and avoid separating a cow from her calf, or driving the animals over the land. Make sure that your dog does not chase or worry livestock by keeping it under close control or on a lead.
Responsible behaviour by land managers
As usual, take proper account of the interests of people exercising or seeking to exercise their access rights. For instance, don't leave an animal known to be dangerous in an area where there is a path or track likely to be used by the public, and do not allow a guard dog or working dogs to intimidate people, especially close to paths and tracks.