You can either use a Skill Shop script, or event them using a conditional branch.
For example, #2 will need a conditional branch if player has "Book of Fire" in their inventory. If they do, NPC will offer you to learn the "Fire" skill.
If the player does not possess the item "Book of Fire", then the NPC won't teach the skill.