The "planet killer" was an informal name given by Spock in 2267, based on a description given by Commodore Matt Decker, to an automated, self-propelled doomsday machine capable of destroying entire planets. This robot was encountered by two Federation starships: the USS Constellation and the USS Enterprise. Its origin was unknown, but, based on its apparent trajectory, it was believed to have come from a galaxy other than the Milky Way.
On or around stardate 4202.1, the Constellation, under the command of Commodore Decker, encountered massive destruction in system L-370 – all seven planets had been utterly destroyed. Proceeding to system L-374 (stardate 4202.3), the ship found three intact planets, and a fourth in the process of breaking up. Orbiting the fourth planet was the planet killer, firing a pure antiproton beam at the planet and consuming the planet's rubble as fuel.
As the Constellation approached, it was attacked by the planet killer. The ship's deflector shields were quickly overwhelmed by the onslaught. The machine proved completely invulnerable to counterattack because its hull was composed of pure neutronium. The Constellation sustained heavy damage. The main bridge was destroyed, the phaser banks were exhausted, the warp drive was destroyed and the impulse drive was severely damaged. In addition, the machine projected a powerful dampening field which cut off all communications with Starfleet Command. The field also deactivated the Constellation's antimatter fuel and left the ship nearly powerless.
Unable to continue the attack or escape, Decker ordered the crew to evacuate to the third planet in the system. Decker himself remained aboard as the last man. However, having finished consuming the fourth planet, the machine then turned towards the third planet. Decker tried to beam his crew back up, but the machine attacked again, damaging the transporter. He could only watch helplessly as the machine consumed the planet below and killed his entire crew of 400 men and women.
A short time later, the Enterprise, under the command of Captain James T. Kirk, received a faint and garbled distress signal. Unable to make out any words aside from Constellation, she entered system L-374 and found her sister ship drifting and abandoned, with Commodore Decker the sole survivor aboard. Assessing the situation using the Constellation's sensor records taken by Science Officer Masada, Spock projected the weapon's point of origin to be from outside of the Milky Way Galaxy. He also determined, based on its present course, that it would enter the most densely populated regions of the Alpha Quadrant, including the nearby Rigel system. Decker became determined to stop the threat posed to the Federation by the planet killer.
As for who built the planet killer and for what purpose, Kirk could only speculate that it was built untold eons ago by some alien race as a "Doomsday machine" in a forgotten conflict - a weapon built primarily as a bluff, because if it was ever activated it would be equally devastating to both sides. Whether the planet killer's creators ultimately destroyed themselves or simply moved on, they don't exist anymore - but their automated weapon was left behind.
As the Enterprise held alongside the Constellation, it was suddenly and swiftly attacked by the planet killer. Although the Enterprise was more maneuverable, the weapon was extremely fast and gaining on its target. In the first volley, the Enterprise took heavy damage, with shields almost exhausted and transporters and communications damaged. While Captain Kirk was trapped with the boarding party aboard the Constellation, Spock ordered evasive action. Commodore Decker, taken aboard the Enterprise for medical treatment, exercised his authority to assume command under Starfleet General Order 104 and countermanded Spock's orders to avoid the machine and seek a clear space to warn Starfleet. With a combination of seeking retribution for the loss of his ship and crew, and the presumption that the nearby Rigel colonies would be the next target of the machine, Decker ordered an immediate attack on the weapon. However, the Enterprise was overwhelmed as quickly as the Constellation had been, and soon trapped by a tractor beam which was pulling the ship towards the planet killer's maw.
Meanwhile, on the Constellation, Chief Engineer Montgomery Scott managed to effect partial repairs to the impulse engines and a single phaser bank. Kirk launched a diversionary attack on the Planet Killer that allowed both ships to escape. The planet killer apparently had a relatively simple and straightforward defensive computer program that only allowed it to engage single targets within a specific range. The immediate danger past, Captain Kirk ordered Decker relieved of command of the Enterprise.
As the two Starfleet ships withdrew, the planet killer returned to L-374 and resumed consuming the planetary debris, taking in additional fuel. When Decker gave indications he was going to continue to press the attack despite narrowly avoiding disaster in the previous engagement, he was relieved of command by Spock under direct orders from Kirk on the basis that to continue to press the futile attacks would be indication he was suicidal, and was ordered to report to sickbay for a psychological examination.
Suffering from a mental break-down brought on by extreme stress and the loss of his ship, crew and command, Commodore Decker escaped custody and stole a shuttlecraft from the Enterprise, piloting it on a suicide course directly into the weapon's maw, where it was quickly destroyed. However, the Enterprise sensors detected a small drop in the power output of the planet killer – the shuttlecraft's explosion, however small, had in fact caused some minor damage to the weapon from the inside. Based on this data, Captain Kirk proposed detonating the Constellation's main impulse engines inside the Planet Killer, creating a much bigger explosion and hopefully causing major damage to the weapon, if not destroying it outright.
As the Enterprise held position near the Planet Killer, outside of weapons range, Kirk piloted the Constellation on a direct course toward the weapon. Beaming out at the last second, he detonated the Constellation's engines directly inside the weapon's maw, bypassing the neutronium hull, and effectively dropping its power output to zero (in essence completely disabling the machine). It should be noted that due to the presence of the seemingly impenetrable neutronium hull, the hulk (or "corpse") of the planet killer was left intact, floating lifelessly in space.
Norman Spinrad was displeased with the model used for the planet killer. As he told Allan Asherman in The Star Trek Interview Book, he envisioned the planet killer bristling with all sorts of evil-looking weapons.
The Star Trek Concordance refers to the device as the "Berserker", or "planet-eater"; the reference book The Monsters of Star Trek also used the "berserker" moniker in describing the weapon. It is also of note that the sketch of the berserker, titled "doomsday machine", that appeared in the Concordance was sketched by future franchise staffer Greg Jein.
The Ships of the Line book states that that the Planet Killer once had been the monster Norman Spinrad envisioned, boasting a "complete arsenal of weaponry", but centuries of combat had taken their toll so that, by the time the Constellation encountered it, only the main weapon remained.
The "planet-eater" was proposed, by J. Michael Straczynski and Bryce Zabel, to appear in a new Star Trek TV series they proposed in 2004. In a fourteen-page treatment which outlined their plans, Straczynski and Zabel supposed, "What if we discover that the device was a left-over piece of warfare tech from the race our characters are pursuing? Do they allow the planet-sized weapon to destroy a sparsely populated colony world if in doing so, they gain the time to get information that could save billions of lives elsewhere?" 
The "planet killer" was featured in several non-canon productions.
Peter David's novel Vendetta featured another "planet killer" that was believed to have originated as the weapon of an ancient race (perhaps the Preservers) to be used as a last resort against the Borg. According to David's story, the planet killer encountered by the Enterprise was an automated prototype, sent on a course that would have eventually carried it to Borg space, had the Enterprise not stopped it. Its basic design – destroy planets already assimilated by the Borg for use as fuel – coupled with an indestructible neutronium hull and antiproton beam (against which there was little or no defense), made it an ideal weapon against the Borg. The planet killer featured in Vendetta is much larger and also has the much more menacing appearance Spinrad initially imagined. During the novel's climax, in an engagement with three Borg cubes, the Borg fire weapons powerful enough to actually hurt the machine, revealing a secondary hull of rodinium beneath the neutronium, and an inorganic coolant fluid running through its conduits that causes the planet killer to appear to "bleed" when it is sufficiently damaged. It is finally "destroyed" when the planet killer's pilot attempts to take it up to Warp 10, trapping herself in an infinite time loop where she will always keep trying to reach Borg space but never succeed.
In the novel's prologue, a young Cadet Jean-Luc Picard presents a history report on the planet killer to his class at Starfleet Academy, noting that Captain Kirk's report was somewhat short on details, and so Picard interprets his statement that Commodore Decker died in the line of duty as meaning that Decker, not Kirk, piloted the Constellation into the weapon's maw. He also notes that the planet killer's need for planets as fuel meant that it could not have come from that far outside the galaxy, as there would be no planets for it to 'eat' in the inter-galactic void and it could not have passed through the galactic barrier through sheer inertia, which allowed the future pilot of the planet killer depicted in the main novel to retrieve the completed version from a dock just on the outskirts of the barrier.
The Star Trek comics published by WildStorm included a Voyager miniseries, Star Trek: Voyager - Planet Killer, where Voyager encounters another doomsday machine. In this encounter, it was revealed that the machine was the creation of an extinct species designated by the Borg as Species 4672, and Harry Kim presents a 'report' on the original encounter with the planet killer that includes an accurate record of Decker's fate. Voyager initially attempts to destroy the machine by repeating Kirk's trick with the Constellation using a damaged ship belonging to a new ally, but after this plan fails, they are able to shut it down by coating The Doctor's mobile emitter with neutronium- thus limiting the planet killer's ability to distinguish the emitter from itself- and using the Delta Flyer to transport him inside the machine so that he can inject it with Borg nanoprobes designed to "infect" it with a "virus".
In Kevin Lauderdale's short story "Devices and Desires" (in Constellations), the doomsday machine was taken to The Yard, a top secret facility where the alien technology Starfleet acquired was stored and studied. One of its researchers was Dr. Pad – a reference to Peter (Allen) David, above. This idea for the fate of the original doomsday machine was used for its return appearance in Before Dishonor, a partial sequel to the Vendetta storyline, when a new, upgraded Borg cube led by an assimilated Admiral Kathryn Janeway, now a new Borg Queen, attacked Earth, forcing the crew of the USS Enterprise-E to travel to the ship "museum" where the original machine was placed after its destruction. Spock, Geordi La Forge, and Seven of Nine subsequently reactivated the machine and used it to destroy the cube once and for all.
A third planet killer was featured in the novel Armageddon's Arrow; with the original planet killer established as a prototype for the one that featured in Vendetta, the Enterprise-E discover a prototype to the original planet killer on a moon in an unexplored region of space, which has been discovered by the Golvonek, a race inhabiting the planet Urphrel who are at war with their local neighbors. The Golvonek use this crashed version as a template to create their own, more primitive version of the planet killer, capable of destroying planets with a particle weapon but requiring a degree of active crew operation and suffering various operating problems. When the Golvonek planet killer travels back from the future to be discovered by the Enterprise in the present, it is eventually destroyed when its surviving crew crash it into its own past self to convince their worlds to seriously consider peace, while the proto-planet killer is salvaged by Federation scientists for future study.
In the PC game Star Trek: Starfleet Command, the Terran Empire from the mirror universe attempted to unleash a fleet of doomsday machines on our Earth. The player is able to destroy them by beaming prototype mines into the maws of the devices, shutting them down.
The PC game Star Trek: Starship Creator: Deluxe Edition had a mission based on the events of "The Doomsday Machine", wherein the player's ship first attempts to use torpedoes down the maw of the planet killer to destroy it, then tows a derelict ship into its path and detonates it.
In the Game Boy game Star Trek: 25th Anniversary, the entire game plot resolved around a doomsday machine that was discovered heading into Federation space. The player must find scattered parts to a protomatter fusion disruptor that was built to combat the planet killer.
In Star Trek Online, Ambassador B'Vat's faction of Klingons rediscovered a planet killer, and managed to modify and reactivate it for use as a weapon against the Federation. The player has to destroy the Klingon remote control systems and destroy the planet killer with an experimental Klingon torpedo, the Hargh'Peng. Two more planet killers are introduced in the "Agents of Yesterday" expansion. One of them causes the Galorndon Core to be inhospitable when it sucks up a Na'kuhl ship and it crashes to the planet. Another is fought over between players and Klingon of the 23rd century.
In the comic series The Q Conflict, when the four crews are forced to 'mix up' and compete against each other for Q, Trelane, the Metron and Ayelborne of the Organians, after the four crews reject Trelane's initial suggestion of competing against each other in a direct battle, their subsequent game of 'Capture the Flag' is interrupted when Trelane adds a planet killer to the conflict, although the Enterprise-E is able to destroy the planet killer with Quantum torpedoes while the other three ships keep it occupied.