Moderators and clerks in the Church of Scotland

The Church of Scotland maintains a presbyterian polity and is thus governed by a hierarchy of bodies known as church courts. Each of these courts has a moderator and a clerk.
Moderators.
The Moderator presides over the meeting of the court, much as a convener presides over the meeting of a church committee. The moderator is thus the chairperson, and is understood to be a member of the court acting "primus inter pares". The Moderator calls and constitutes meetings, presides at them, and closes them in prayer. The Moderator has a casting vote, but not a deliberative vote. During a meeting the title "Moderator" is used by all other members of the court as a form of address, but this is not done outwith the meetings. This convention expresses deference to the authority of the court rather than an honour for the Moderator as an individual.
Moderator of the Kirk Session.
The Kirk Session is the governing court of a parish. The Moderator is usually the parish minister. During a vacancy the presbytery appoints an interim moderator, usually the minister of a neighbouring parish or a retired minister although suitably trained elders may also moderate Kirk Sessions. The moderator is answerable to the presbytery, not to the kirk session, for his or her conduct in the court.
Moderator of the Presbytery.
The Presbytery is the governing court of the local area. The Moderator is usually the minister of a parish within the Presbytery's bounds, or a retired minister, though an elder may also be appointed. The Moderator is appointed by the Presbytery itself and usually serves for one year. Typically the Moderator conducts worship at ordinations and other ordinances seen as acts of the presbytery. If the Moderator is not a minister, then a minister (usually a former Moderator) will lead a service of ordination or the Sacrament of the Lord's Supper.
Moderator of the General Assembly.
The Moderator of the General Assembly is appointed for one year. He or she presides at the annual week-long meeting of the Assembly, and then has a representative function for the remainder of the year. Most often the Moderator is a parish minister, though Moderators are also frequently chosen from the ordained members of faculty at the four theological colleges. Occasionally (but only once in the recent history of the Church) elders have been appointed. The Moderator of the General Assembly traditionally wears a distinctive costume, though since the 1980s a series of Moderators have attempted to reduce its significance.
Unlike moderators of Presbyteries or Sessions the Moderator of the General Assembly is referred to by the courtesy title of "Moderator" at official functions during the year of office. Although this is a custom it is not incorrect to refer to a serving Moderator by their normal honorific (Mr/Mrs, Dr, Prof M______ etc.).
Clerks.
The word "clerk" is derived from "cleric", but in secular use it has come to mean little more than "secretary" or "accountant", and civil and criminal courts have a clerk who records proceedings. In the courts of the church, clerks are responsible for minute-keeping, correspondence and other documentation, but as the courts are heavily dependent on them, they often carry some considerable influence beyond their strict remit.
Session Clerk.
The Session Clerk is clerk to the Kirk Session. Usually the clerk is an elder, but occasionally a retired minister is appointed. The moderator acts as clerk when no other appointment can be made, but "this practice should last no longer than is absolutely unavoidable". Although it is permissible for a person from outside the Kirk Session to be co-opted to this position, it is very unusual for the session clerk not to be a full member of the session. The Clerk is elected by the Session, usually for an indefinite period, though some sessions appoint a Clerk for a fixed term, perhaps five years. 
The statutory duties of the Clerk are limited to correspondence and paperwork, but in most sessions the Clerk also takes responsibility for organising elders' duties and controlling the logistics at communion services, as a result of which the Clerk is often seen as something of a manager of the Session.
Presbytery Clerk.
The Presbytery Clerk is usually a parish minister, but might also be an elder, appointed by the Presbytery for an indefinite period. Because of the experience accumulated by Presbytery Clerks over the years, they are often seen as local experts on church law, to whose judgements both the Presbytery and Kirk Sessions are often content to defer. In the Presbyterian Church (U.S.A.) the Presbytery or Stated Clerk, is the ecclesiastical administrator of the presbytery.
Clerks to the Assembly.
The Principal Clerk to the General Assembly holds a full-time position. Until 2010 the position of Depute Clerk was also a full-time post but it has now reverted to being a part-time appointment. The Clerks work together with the Procurator and the Solicitor of the Church to ensure the legal correctness of the actions of the Assembly.