St Andrews was an episcopal burgh, under the lordship of the archbishop, which gave its inhabitants, the burgesses, similar privileges to a royal burgh. Merchants had the right to trade freely through the harbour, while artisans were only allowed to trade within the burgh, and only in certain goods. Merchants kept a monopoly on the most lucrative trade in fish, wool and hides, and grew very wealthy, keeping their wealth intact by frequent intermarriages. They formed a protective institution, the Guildry, founded upon commitment to the parish church, control of civic affairs, commercial interests and fraternity. Guild members came to dominate the town council with a small number of powerful families monopolising the posts of provost, always the head of the Guild, and bailies. The latter held many responsibilities including acting as judges at the regular burgh courts. Here they administered the burgh laws, ruling on petty crimes, infringements of local trading regulations and collection of rents and feu duty. The town council in the 18th century took over the regulation and control of standards for goods, holding an annual bread assize to decide weight of a pennyloaf of bread, depending on the price of the previous year's grain.
The craftsmen also formed mutual self-interest groups, known as craft organisations. Seven such organisations were established in pre-reformation St Andrews: the hammermen, wrights, baxters, tailors, cordiners, weavers and fleshers, in that order of precedence. They combined into the Seven Trades with a court of 42 members, made up of the deacon, boxmaster and 4 council members from each trade. The Convener of the Seven Trades had a seat on the town council. Anyone working in a burgh had to be a member of the local craft, which controlled admission to the craft, set standards of workmanship, approved apprentices, dictated prices, and regulated their trade. Apprentices were admitted to serve 7 year apprenticeships, after which their work would be judged, and upon payment of a fee they became journeymen, and could rise to master or freeman. Men could be elected freeman as eldest son of a freeman, by marrying the daughter of a freeman or by service. A master or deacon was chosen to lead the incorporation. The craft also operated as a welfare organisation, helping widows and orphans of members. Attendance at the funeral of a brother was obligatory and each craft had a mortcloth for loan. The religious aspect of the organisations was also very important. Each craft endowed an altar in the town church of Holy Trinity for its own patron saint; St Eloy, who had been a goldsmith in Limoges, France, was the patron of the Hammermen. It was a matter of civic pride to maintain the town church and both Guild and crafts contributed towards its upkeep. Both classes of burgess participated in the annual religious processions such as Corpus Christi, with banners of their insignia and in strict order of status, and might put on mystery plays illustrating stories from the Bible.
After the Reform Bill of 1832 and then the Scottish Burgh Reform Bill of 1833, many of the functions of the Seven Trades were transferred to the municipality. Membership continued to decline through the 19th century and the decision was taken in 1836 to sell the lands owned by the trades and divide the money between the members. The end to exclusive trading privileges for guild and craft members was brought about by the Burgh Trading Act of 1846, which allowed anyone to buy and seel within the burgh without being a member of any trade organisation. By 1847 all the property of the Seven Trades had been sold; the Convener remained but no more business was transacted.