A 16-year-old San Francisco girl with a big heart is tying up some loose ends for Santa Claus.

Maddie Johnson got into the Santa business by happenstance this week, when she spotted 14 boxes full of discarded holiday gifts in a San Francisco parking lot. All of them were apparently stolen by that modern-day varlet known as a “porch pirate,” a thief who swipes delivered packages off people’s doorsteps.

“I couldn’t just let them sit there,” Maddie said. “These were people’s Christmas presents. And it was starting to rain.”

It seems the miscreant decided that the contents of the stolen parcels — children’s books, wedding pictures, Chinese herbal medicines — weren’t worth fencing. So the thief dumped the ripped-open boxes Monday in the Stern Grove parking lot. Maddie, who had come to Stern Grove to walk her dog, loaded the parcels into the trunk of her mom’s car. While her friends and family were enjoying the holiday break, she set out on the tedious task of delivering the gifts to the addresses on the boxes.

“It seemed like the right thing to do,” Maddie said. “I’d want somebody to do this for me.”

Block by block Wednesday, she went through the outer Sunset District. It was hard work. People don’t always answer a stranger’s knock, at Christmas or any other time.

Maddie rang the bell of a house on 44th Avenue, and a woman inside the home refused to come to the door.

“Oh well,” said Maddie, and she slipped contents of the box — six books — beneath the metal gate, one by one. It was an act of diligence that, if it was what the FedEx person had done from the start, would have allowed the porch pirate no packages to pirate.

A few blocks away, things got better.

Herbert Lau was home and answered the door, and Maddie gave him his Chinese herbal remedies — all 1,000 capsules of mushroom extract shipped from Hong Kong. Lau said he needed it for various ailments that affect a fellow in his eighth decade. Lau’s wife, Grace, gave Maddie a box of cookies in gratitude. Then it was off to the next house.

The neighborhood online bulletin board Nextdoor is full of reports about porch piracy and the laments of residents whose deliveries never came. San Francisco police report that larceny is actually down in San Francisco over the previous year — the first 10 months of 2018 showed a 9 percent decrease from a similar period in 2017. The holidays, of course, are peak season for porch pirates. It’s not yet known if thefts of delivered packages were up or down in the last month of the year.

Alex Bastian, a spokesman for the San Francisco district attorney’s office, said an increase in online purchases has resulted in “much more opportunity for this particular crime than ever before.” Online shoppers, he added, should consider having packages delivered to mail drops, lockers or their workplace, or require a signature for delivery.

Karen Myers said she had been meditating Wednesday afternoon when the doorbell rang. Maddie gave her back photographs taken at her niece’s wedding.

“Oh my God,” said Myers. “This is beyond special. This gives you faith in mankind. You saved Christmas.”

She gave Maddie a hug.

Emily Pierceall accepted her roommate’s package containing the blouse and jacket she figured were lost forever. Eric Hill got back the children’s book about Dog Man that he had bought for his son. (The book tells the tale of how the heroic Dog Man, part dog and part man, gets framed by some fleas and ends up in jail, which is perhaps where the porch pirate who took the book ought to be, Maddie said.)

In between deliveries, Maddie pondered what makes a porch pirate.

“Maybe he was poor and needed money,” Maddie said. “I feel bad for him, but you’re not supposed to take things that don’t belong to you. There’s never an excuse for that.”

When Maddie rang her final doorbell for the evening, on 46th Avenue, Ki Gaines and her husband, Greg Lukens, came to the door. In Lukens’ arms was the couple’s 5-month-old daughter, Esmé. Maddie handed the parents their ripped-open box — a bunch of stuff from Esmé’s 70-year-old great-aunt, who lives in Colorado. Inside were baby clothes, ornaments, magazines, a handmade card and clipped-out horoscopes predicting Esmé’s future, as the great-aunt is a great believer in astrology. Gaines read one of the the horoscopes to Esmé.

“Be careful when asking questions,” she said. “Tonight, listen to good music.”

Esmé harkened to her fate and said nothing.

Also in the box was a ripped-open package of chocolate. Apparently the bad guy had eaten a few pieces, there being no bottom to his depravity.

Gaines and Lukens gave Maddie a hug, too. The Good Samaritan got a lot of hugs, and maybe a few blisters on her feet.

Maddie, a junior at Sacred Heart Cathedral Preparatory high school, said the package deliveries kept her from completing her homework, an essay about the Bill of Rights, but it was worth it. She’s learning about the Ten Commandments instead of the first 10 amendments. Someone did what the rules say they shalt not, but Maddie’s feeling good about the outcome, plus she got a tin of cookies.

All that was left after the first round of deliveries were five packages.

“I’ll get it done,” she said. “It’s important to these people. If I was in the same situation, I’d want a stranger to do the same thing for me.”

Steve Rubenstein is a San Francisco Chronicle staff writer. Email: srubenstein@sfchronicle.com Twitter: @SteveRubeSF