The message in those speeches was so reflective of Mr. Trump’s views that it earned Mr. Miller a spot as the warm-up act for Mr. Trump’s campaign rallies. His words became Mr. Trump’s — “We’re going to build that wall, and we’re going to build it out of love,” Mr. Miller often said.

“Steve is a true believer in every sense of the word, not just in this message of economic populism but in President Trump as a leader,” said Jason Miller, who worked with him in the Trump campaign and is not related. “Steve’s fiercely loyal and has a better understanding of the president’s vision than almost anyone.”

It is sometimes hard to tell Mr. Trump’s voice from that of Mr. Miller, who suppressed his own orotund speech to capture the president’s more visceral, off-the-cuff style. Not that he has had much choice: As one of three or four staff members to fly around with Mr. Trump during the last few months of the campaign, Mr. Miller was summoned to speechwriting tasks by a bark of “Ready!” from Mr. Trump, who insisted on dictating practically every word — and laced into staff members who changed a word or inserted an overly complex policy point.

Mr. Miller’s flexibility as a speechwriter is offset by the consistent stridency of his political philosophy, which has remained much the same since he was the distinct minority at Santa Monica High School, a liberal outpost where he often railed against fellow students and the school administration. Mexican heritage celebrations and Iraq war protests were things of particular offense. He produced a 2003 essay, “How I Changed My Left Wing High School,” that capped a high school career steeped in political activism.

At Duke, Mr. Miller, who is Jewish, cut a similarly confrontational swath, and was briefly friendly with Richard Spencer, who later became a prominent white supremacist, when both were members of the university’s Young Conservatives chapter.