A Dean of Guild, under Scots law, was one of a group of burghmagistrates who, in later years, had the care of buildings. The leader of the group was known as Lord Dean of Guild.
Originally, the post was held by the head of the Guild brethren of Scottish towns, and dates back to the 12th century. Later, the phrase Dean of Guild also described the courts set up in the 14th century to settle trade disputes. In the 19th century they became responsible for enforcing the burgh's building regulations, a role that was replaced in the mid 20th century by statutory legislation.
This should not be confused with the Dean of a guild, the head of such association.