All Starfleet personnel were strictly forbidden from directly interfering with historical events and were required to maintain the timeline and prevent history from being altered. The directive also restricted people from revealing too much about the future so as not to cause paradoxes or alter the timeline. (VOY: "Endgame", "Shattered")
Dr. Leonard McCoy was transported from 2267 to 1930 by the Guardian of Forever. During his time there, he prevented Edith Keeler from being killed in a traffic accident, causing a change in the timeline that resulted in the Federation and Starfleet ceasing to exist (or, at least, as known by history). Upon learning of this from the Guardian, Captain James T. Kirk and Spock followed McCoy to 1930, where Kirk acted to preserve the timeline by allowing Keeler to die, even though he had become romantically involved with her. His actions restored the timeline, which culminated in the birth of the Federation and Starfleet. (TOS: "The City on the Edge of Forever")
The Temporal Prime Directive was mentioned by Captain Jean-Luc Picard in 2368. Picard postulated that the existence of such a directive might be what was preventing a traveler from the future from aiding him to avert the destruction of Penthara IV. Picard was unaware of any formal Starfleet equivalent to a Temporal Prime Directive at this date. (TNG: "A Matter of Time")
Captain Kathryn Janeway was aware of the directive's existence in 2371. (VOY: "Shattered") This was long before the temporal incursion by Captain Braxton in the timeship Aeon in 2373, indicating that the Temporal Prime Directive was not exclusively a 29th century regulation. (VOY: "Shattered", "Future's End") Julian Bashir once referred to the "temporal displacement policy," a principle taught at Starfleet Academy, in the year 2024, when he traveled back in time to that year from 2371. (DS9: "Past Tense, Part I") Starfleet Regulation 157, Section 3, Paragraph 18 also related directly to time travel. (DS9: "Trials and Tribble-ations")
The events of the Temporal Cold War indicate that the regulation had been rescinded, at least temporarily, by the 31st century. However, the Federation faction in the Temporal Cold War was dedicated primarily to keeping the timeline intact and preventing the other factions from interfering with it, which would be completely in keeping with the Temporal Prime Directive's intent. On a few occasions a temporal agent, Crewman Daniels, had to tell the crew of Enterprise NX-01 some things about the future. (ENT: "Cold Front", et al.)
In 1893 San Francisco, Lieutenant Commander Data sold his combadge to buy into a poker game. (TNG: "Time's Arrow") When Dr. Beverly Crusher arrived at the Sisters of Hope Infirmary, she kept her combadge concealed. (TNG: "Time's Arrow, Part II")
In 1986 San Francisco, before disembarking the HMS Bounty, Admiral Kirk instructed the members of his command crew who were in uniform to remove their rank (and Starfleet) insignia. (Star Trek IV: The Voyage Home)
In 1996 Los Angeles, Captain Janeway pocketed her combadge, while the elderly Captain Braxton had his 29th century combadge concealed inside his jacket. Nevertheless, because Henry Starling had captured the futuristic timeship Aeon and accessed its files, the company logo of Chronowerx Industries closely matched the Starfleet logo of the 29th century. (VOY: "Future's End") In addition, Rain Robinson clearly saw Lieutenant junior grade Tom Paris tinkering with his and Lieutenant Tuvok's broken combadges. (VOY: "Future's End, Part II")
In 2024 San Francisco, Lieutenant Jadzia Dax openly wore her combadge on borrowed clothing in front of 21st century denizens, claiming it was merely a broach. (DS9: "Past Tense, Part I", "Past Tense, Part II")
James T. Kirk and his crew had a long list of temporal violations, at least seventeen in total. (TOS: "The Naked Time", "Tomorrow is Yesterday", "Assignment: Earth", "All Our Yesterdays", "The City on the Edge of Forever", "Yesteryear"; Star Trek IV: The Voyage Home; Star Trek Generations; DS9: "Trials and Tribble-ations")
The directive was violated at least twice by USS Voyager crew members from alternate futures. First, Commander Chakotay and Ensign Harry Kim from 2390 altered the past by preventing Voyager from crashing on a class L planet and killing all aboard. (VOY: "Timeless") Later, an Admiral Kathryn Janeway from the year 2404 went back in time and successfully assisted Voyager in returning some sixteen years earlier than it had in her timeline. (VOY: "Endgame")
Additionally, the Janeway of the 24th century violated the directive by accepting the aid of her future self. Her future self took the following attitude regarding the directive – "It's less of a headache if you just ignore it." Her present self tried to avoid getting knowledge of the future, but after learning that it wasn't so good for several of her close crewmembers, she allowed her future self to tell her about it. Thanks to Admiral Janeway's efforts, Voyager returned home a full sixteen years early (and dealt a crippling blow to the Borg Collective in the process), but the admiral's efforts were a serious breach of the directive. (VOY: "Endgame")
While the directive was not officially identified in 2370, the senior staff of the USS Enterprise-D did ponder whether Captain Jean-Luc Picard had changed history after his jumps back and forth through time by telling them about the future that he had witnessed, but it was reasoned that his actions would not affect history as he had already changed the future by eliminating the anti-time eruption that had featured in the timelines he witnessed. (TNG: "All Good Things...")
The crew of Deep Space 9 had at least three violations: Quark accidentally altered the Roswell Incident (DS9: "Little Green Men"), Bashir and O'Brien got arrested for taking part in the famous K-7 Bar Fight while they were hunting down another violator Arne Darvin who planted a bomb on the station (DS9: "Trials and Tribble-ations"), and Sisko, Bashir, and Dax accidentally killed Gabriel Bell. (DS9: "Past Tense, Part I", "Past Tense, Part II")
The Temporal Prime Directive is mentioned, enforced, skirted, and even violated throughout the storylines of the multiplayer RPG Star Trek Online. In the mission "Everything Old is New", players act to prevent temporal interference by the Devidians on Drozana Station, traveling back to the 23nd century from the 25th. Players violate the Directive by aiding Dr. McCoy in saving crewmembers there. The mission "Past Imperfect" shows players enforcing the Directive, using the Guardian of Forever to travel back to rescue Miral Paris and destroy 25th-century technology. During the "Iconian War" storyline, players violate the Temporal Prime Directive drastically, using a Krenim weapon ship to attempt to erase the Iconian empire from history, as well as traveling back in time to the moment of the Iconian Empire's destruction, becoming part of a Predestination paradox. In the "Agents of Yesterday" expansion, players are deputized as "Temporal Agents" by a 26th-century Starfleet officer working on behalf of a galaxy-wide alliance. The alliance's goals are to prevent a coalition of Na'kuhl,Krenim,Vorgon, and Sphere-Builder extremists trying to alter the timeline and escalate the Temporal Cold War. They fight alongside the USS Enterprise-J at the Battle of Procyon V.
Voyager's violations of the Temporal Prime Directive are discussed in the novel Watching the Clock, which also cites Janeway allowing The Doctor to retain the use of the mobile emitter despite it originating from the twenty-ninth century, Janeway defending the decision by arguing that she wasn't prepared to deliberately handicap her chief medical officer in the name of an abstract rule. Although the Department of Temporal Investigations attempts to charge Janeway, they are advised to leave the issue alone by a representative of their department's future, who informs them that Admiral Janeway's actions actually preserved history rather than changing it. (This is suggested to be due to her role in bringing Voyager home "early" contributing to the final destruction of the Borg in Star Trek: Destiny.)
The novel Headlong Flight features a discussion about the relevance of the Temporal Prime Directive when the Enterprise-E of 2386 makes contact with the Enterprise-D of an alternate 2367 where (among other differences) Picard/Locutus died during the Battle of Wolf 359. Concluding that the threat of the Borg is sufficient reason to be cautious, and musing that their current situation made it difficult at best to apply the Temporal Prime Directive anyway, Picard arranged for the alternate Enterprise-D to be given access to Transphasic torpedo technology, which they had already obtained through a 'bending' of the Temporal Prime Directive in their universe.
In the novel A Pocket Full of Lies, Chakotay notes that he completed a classified incident report about the events of "Shattered" for the benefit of the DTI and attended a brief meeting about it when Voyager returned to Earth. Chakotay only reveals the full details of the crisis to the rest of the senior staff when he learned that an alternate version of Kathryn Janeway existed in this timeline due to those events, with Admiral Janeway granting a temporary suspension of the Temporal Prime Directive during the subsequent briefing with the understanding that it would not be recorded and all officers present would not discuss the matter with anyone outside the room.