by Robert Louis Stevenson
Doctor Livesey is the local medical man and judge in Jim's hometown back in England. He's also friends with Squire Trelawney and part of the original group of treasure hunters. He's the only one of the original trio of good guys (Doctor Livesey, Squire Trelawney, and Jim Hawkins) who has actual military experience: he served at the battle of Fontenoy in 1745. Doctor Livesey is (obviously) a doctor, but that doesn't just prove that he's a smart guy. Doctor Livesey's job also tells us what kind of a man he is: practical and sympathetic.
On the practical side, when Squire Trelawney runs off to gather his crew for the Hispaniola, Doctor Livesey warns him not to go blabbing about their mission. He recognizes the danger of letting the whole world know that they're going on a treasure hunt – and he proves to be right. If Squire Trelawney hadn't told everyone about their quest, maybe Long John Silver wouldn't have sought him out and this whole unpleasant pirate thing could have been avoided.
Doctor Livesey's profession also gives him real empathy for other people, which makes him more flexible than the good-hearted but duty-bound Captain Smollett. For example, at the pirate camp where Jim is being held hostage, Doctor Livesey initially blames Jim for having run off and left his comrades at the fort in the first place. But his soft-heartedness soon wins him over to Jim again. Even though Jim has given his word to Long John Silver not to run away, and even though Jim's fragile pact with Long John Silver is probably all that is keeping the two rival groups on the island from killing each other, Doctor Livesey still tells Jim, "I'll take it on my shoulders [...] blame and shame, my boy; but stay here, I cannot let you" (30.43). In other words, Doctor Livesey would be willing to take responsibility for Jim's actions despite the consequences.
Another example of Doctor Livesey's sympathy for his fellow man, no matter what kind of men they are, comes near the end of the book. He announces to Long John Silver that, if the other three pirates on the island are sick with fever, he will treat them, regardless of the danger to his own life. He assures Long John Silver, "If I were sure they were raving [...] I should leave this camp, and at whatever risk to my own carcass, take them the assistance of my skill" (34.11).
These two episodes do more than just prove that Doctor Livesey is a nice guy. His practicality and sympathy for other people allow him to interact with the pirates more easily than Squire Trelawney (who's a lord, and a bit stupid to boot) or Captain Smollett (who refuses to negotiate with the pirates at all). All of the deals that the good guys strike with Ben Gunn and Long John Silver are thanks to Doctor Livesey's level-headed interactions with everyone in the book, friend and foe alike.
Like Jim, Doctor Livesey can talk to characters from all walks of life, which makes him both a good narrator (in the three chapters when Jim isn't there to observe events) and a good agent for moving the plot forward. He's a man of action, but he's neither as duty-bound and stiff-necked as Captain Smollett nor as reckless and careless as Squire Trelawney. Doctor Livesey is flexible and smart, like a grown-up version of Jim. Indeed, the similarity between Jim and Livesey as characters perhaps explains why their first-person narrations sound so much alike.
One last similarity between Doctor Livesey and Jim: both are hugely lucky. When Jim returns to the fort with the news that the one piece of food Ben Gunn craves is a piece of cheese, Doctor Livesey happens to have a hunk of Parmesan tucked away in his snuff box. Without Doctor Livesey and Jim's cunning and luck, we're pretty sure Squire Trelawney would have been murdered before he even reached Treasure Island.