During the 2016 election, we often heard from supporters that Hillary Clinton was the most qualified candidate ever to run for president. Now, I voted for her (I would have voted for the contents of our compost bin against the grifter nominated by the other party), but we can settle down with that hyperbole. There are plenty of examples of more qualified candidates throughout our 230 years of history.
Exhibit A: John Quincy Adams. At the age of fourteen, he was secretary to the American ambassador to Russia. He attended Harvard and became a lawyer, and at the age of 27 was appointed American ambassador to the Netherlands. Two years later he became ambassador to Portugal, and when his pop won the Presidency in 1796 he was moved to head of diplomatic relations with Prussia. (He even checks the box of "family member was President".) In 1802 (age 35) he was elected to the Massachusetts state senate, and the next year was elected US Senator from Massachusetts. Adams was a Federalist like his dad, but the party that had coalesced to guarantee the adoption of the Constitution was running out of steam, and Adams frequently sided with the more dynamic Democratic-Republican party of his father's frenemy Jefferson. That fealty to country over party cost Adams his senate seat when the MA legislature elected his replacement a year early.
That's just the opening act. In 1809 President Madison appointed JQA as US Minister to Russia. He was successful in St. Petersburg, and in 1811 Madison appointed JQA to the US Supreme Court. Despite unanimous confirmation by the Senate, Adams declined the seat. He liked his politics and his diplomacy more than the cloistered life of the law.
For eight years Adams was Monroe's Secretary of State. In the years after thew War of 1812 he negotiated the border with Canada to the Pacific and helped end US-Great Britain tensions for good. He arranged for the acquisition of Florida from Spain and Oregon from Russia. Adams was the driving force behind the Monroe Doctrine, limiting European meddling in Latin American affairs.
Oh, and then he was President. The Election of 1824 was one of the more interesting ones in history, with the four-way race yielding no winner of an electoral college majority and winding up in the US Congress. Andrew Jackson had won a plurality of electoral college votes in the election, but Congress rightly viewed the General as a bit of a wild card, and instead installed Adams (with an assist from also-ran Henry Clay). The howling supporters of Jackson (mostly from slave states, but also NJ and PA) decried the "corrupt bargain" between Clay and Adams, which looked bad when Adams appointed Clay as secretary of state. (Tidbit: Adams had wanted Jackson as his running mate. He called the vice presidency "a station from which Jackson could hang no one".)
Adams' presidency was marred by the perception that it had been ill-won. In 1828, Jackson returned and demolished him, at the head of a newly invigorated Democratic Party that pioneered many modern electioneering techniques designed to build mass support. It's a shame, really - Jackson was a racist demagogue, while Adams was one of the more brilliant, thoughtful, creative, and visionary politicians of the 19th century. He proposed vast internal improvements including roads and canals designed to stitch the national economy and identity together. He proposed a national university and naval academy which the Congress balked to fund. He was sworn in on a book of constitutional law rather than the traditional Bible. He had far more accommodating views toward relations with native Americans than did many contemporaries.
Bored after his defeat (and full of loathing for Jackson), JQA returned to public life with a seat in the US House of Representatives in 1830. While in the House he would become a leading abolitionist in Congress, so persistent that the "gag rule" was adopted that forbade discussion of the issue. He would also oppose the Mexican-American War, rightly suspicious that it was a land grab for the expansion of slavery. Adams would serve nine terms, until his death in 1848 at the age of 81, when he suffered a cerebral hemorrhage at his desk in the well of the House and died in the capitol building.