OK so here goes.... I'm about to discuss and disagree with commonly held notions.
First, compounds added to the soil go far beyond simple npk concerns:
https://www.sciencedirect.com/...
That said, you're right.... Websites, YouTube videos, etc all have conflicting statements and most seem geared towards making clickbait.
As a few have mentioned here... Coffee grounds and spent tea are written candy. More on insect use later.
There are times when I've been given old, never brewed coffee. I've used that as well in the compost or mixed with polar shavings to feed fungi for mushrooms.... Then to use the resulting matrix as mushroom compost.
Regarding moderation...I don't follow that. I have a neighborhood coffee shop I have a deal with and I average 25-30 GALLONS of spent coffee grounds (and small amount of spent tea leaves) a week. I gleefully add that not only to compost but also directly into existing beds, containers, etc. I also use fresh grounds with poplar shavings as mentioned above. The result has been turning a nearly barren, lifeless compacted old urban lot into a haven. It isn't simply the use of coffee but the coffee is an integral part.
Caffeine and worms... Hasn't been an issue in the slightest. My beds and compost bins are absolutely teaming with life. I get worm castings as part of the compost and as part of everyday life in the beds. And that brings me to...soldier flies...
Yellow soldier flies and black soldier flies are a fundamental part of my composting and soil-building efforts. One thing I noticed 9 years ago is that areas where I dumped more coffee, got far more attention by soldier flies. They process larger bits like nobody's business. So in my composting, bacterial changes happen first. Then soldier flies and other large processors have their way. But the communities I get in coffee rich areas make it a soldier fly world. I get faster processing and enrichment. They make it a bit more mucky than the worms like but the worms are always getting at the edges. The muckiness moderates as they move away from those areas they find played out. But nothing reduces piles like soldierflies. That noted, I started experimenting. And basically what I found was there is no upper limit of spent coffee that makes things go bad in my system. I've even done well with beds of nothing but coffee grounds. That said, I much prefer mixed/layered efforts as I think the rewards are sweeter. Anyway, in my system, no amount of coffee is too much. My shop is 3 blocks away and I probably pick up twice a week, year-round, mixed with other errands. They're good to me and I don't leave them hanging. They text me when they need a pickup.
Anyway, the result of the large coffee component has been terrific tilth, candy for the invertebrates who produce thinks like castings, and all those soldierfly adults and larvae make food for a host of predators both invertebrate and vertebrate. There might come a day when I decide to ratchet back on the coffee, but that day is not in sight. The resulting plant growth, the rich and diverse soil communities, and ability of the soil to grab and keep moisture is testament to something going right. I'm not saying everyone needs the same volume of coffee grounds I've used, but I have seen nothing to suggest it had a downside and coffee seems to have numerous benefits. My results are anecdotal but there is far more specific science in them than I see in most, if not all, of the popular sites.
So, as a science dork I generally go down the rabbit hole for more concrete info. But not a lot exists with coffee grounds. I experiment a lot and build on it wherever I can. But if you look at the numerous YouTube videos all saying the same conflicting statements, it's clear most seem to be parroting things they've heard somewhere or watched in other videos.
YMMV... But I'll quietly keep saving loads of coffee from the landfill and making my soil community happy.