A commonwealth's attorney is the highest law enforcement official in his or her jurisdiction and in many jurisdictions supervises a staff which includes a chief deputy commonwealth's attorney, deputy commonwealth's attorneys and assistant commonwealth's attorneys.
A commonwealth's attorney is a constitutional officer, which means that the job is established in the state's constitution which defines the position, the broad powers of the elected officeholder and in Virginia, the requirement that every county and every city be served by a commonwealth's attorney. Cities in Virginia are independent jurisdictions (hence the term "independent city," a designation conceptually similar to that of cities having imperial immediacy under the Holy Roman Empire) and not part of any county.
The role of commonwealth's attorneys, district attorneys, and state's attorneys should not be confused with the role of a county attorney or city attorney whose authority is usually limited by individual state constitutions to non-felony infractions or misdemeanor cases.
Commonwealth's attorneys are elected in their respective jurisdictions in both Virginia and Kentucky.
The official name of Virginia is "Commonwealth of Virginia". At the time of the formation of the United States, it was one of three original states that used "Commonwealth" in its name, the others being Massachusetts and Pennsylvania. At the time, Virginia adopted "Commonwealth's attorney" as the title for its official prosecutors, while Massachusetts and Pennsylvania adopted the title district attorney.
When Kentucky broke away from Virginia in 1792 to become the 15th state, Kentucky adopted the style, laws and titles of Virginia, which it has retained, making it the only State outside the original 13 States to have "Commonwealth" in its official name.