If I’m playing as a Barbarian or a Valkyrie or something similar, is there anything I can do with spellbooks other than just sell them for a little bit of gold?
Every class, spellcasting oriented or not, has a “specialty spell” which they are extra proficient with. They also have different masteries for each different school of magic. The Nethack Wiki contains detailed information on masteries and such in their individual role pages, and I’ve included a condensed table of that information at the bottom of this answer. These bonuses primarily affect the success rate of the spells working.
For example, Barbarians actually can reach Skilled in Attack spells. Their specialty spell is haste self, although they cannot advance past Unskilled for Escape spells. Even though you aren’t a true spellcaster, your success rate with those spells is enough that you can use them with relative ease. Of course, you probably won’t use spells that often as you’ll be beating your opponents to pieces, and one should also be mindful not to spend so many masteries on spellcraft and neglect your mightier physical prowess. But outside of spells, there’s little else that you would be spending your Pw on.
Of special note are Knights, who are more traditionally physical but their Quest Artifact gives them, and them alone, a lot of power when casting spells. In particular, they deal double damage with the magic missile and cone of cold spells, resulting in even higher damage capability than Wizards.
Of course, without boosting your Intelligence, it is difficult to read the non-blessed books. So until you get smarter, you might consider selling the ones you know you’ll never use, but stashing any that you might see yourself casting. Always keep in mind what your specialty spell is, and what masteries you can use. Sometimes, a spell can really shift the tides of battle, even if your blade is better 90% of the time.
Below is a table representing each role, what schools of magic they can reach what level of mastery, and what their specialty spell is. Note how every class other than the Valkyrie can reach Skilled in at least one school of magic, and the Valkyrie still gets a specialty spell in Attack spells.
Key: Atk = Attack, Clr = Clerical, Div = Divination, Enc = Enchantment, Esc = Escape, Hea = Healing, Mat = Matter *** = Expert, ** = Skilled, * = basic. Role │ Atk Clr Div Enc Esc Hea Mat │ Speciality Spell ─────────────┼─────────────────────────────┼───────────────────────────────── Archeologist │ * *** * * │ Magic mapping Barbarian │ ** │ Haste self Caveman │ * ** │ Dig Healer │ *** │ Cure sickness Knight │ ** ** ** │ Turn undead Monk │ * ** * * * *** ** │ Restore ability Priest │ *** *** *** │ Remove curse Ranger │ *** * * │ Invisibility Rogue │ ** ** ** │ Detect treasure Samurai │ ** ** │ Clairvoyance Tourist │ * * ** │ Charm monster Valkyrie │ * * │ Cone of cold Wizard │ *** ** *** ** *** ** *** │ Magic missile ─────────────┼─────────────────────────────┼───────────────────────────────── Role │ Atk Clr Div Enc Esc Hea Mat │ Speciality Spell