You've hit upon something that is very crucial to make a final fantasy type of game.

I know it doesn't just apply to spells, but I'm gonna just call it spells throughout this ran b/c it's easier (skills could be thought of as physical spells with no MP cost).


There are several ways that a spell can be learned in various games:
1. Purchased from a shop
2. Learned at level up
3. Unlocked by specific event sequences
4. Learned by equipping a certain item and fighting with it for a while
5. Taking on a certain character class
6. Use some consumable item
7. Learned after victorious battle if certain in-battle conditions are met

All of those could be considered as "teachable moments" <groan>

I don't think we can discuss this without further noting that spells/skills/etc. always "belong" to a certain super-set, which determines the command and menu that the are called from.
To use a FFVI example, Pummel belongs to the Blitz category. Quadra Slice belongs to the SwdTech category. Pummel can't appear in SwdTech's list--it just can't happen.

Sure, it's my favorite, but this is not limited to that game. Several games have separate Black and White lists. It's the same idea essentially.

Now, ideally, each character will have his/her own list(s) for known spells/skills. A list per command that leads to the spell. Some characters will have more than one list.
I also should point out that having the lists be (arbitrarily) large is one of the main improvements that can be made on the FF formula.

Usually you want each character to have their own lists. There are exceptions. Gogo's lists are merely the AND of all party-members lists: in the case of Magic, it's all members in the current party. In the case of Rage, Lore, Blitz, SwdTech, or Dance, it's actually the (that's "THE") list of the representative character for that command. Since that's the exception, not the rule, I think it would be best to make the engine give everyone some lists, and if you need to make a special case like Gogo, then a special script can be inserted to build it.

------------------

How to make it as non-invasive as possible:

The battle module is probably the easiest in this regard: Only the battle-spoils routine needs to worry about learning skills. Make all character-data in-battle be a copy of the original (and use those exclusively in the battle). If it needs to be modified after the fight, modify the original. The only question here is why you learned it (natural magic at level up? A monster used a blue spell? Your magicite finally accrued enough points?). All those are valid reasons, and all would be handled in the spoils-routine.

Out of battle, I think it boils down to the event handler:
Shops are merely a cookie-cutter event; it should be able to access event commands. Purchasing the spell = learning the spell.
Event based learning (Rydia at Mt. Hobbs) is an event too. If you can make somebody walk around, you can access character data. Event commands are really something we need to nail down.
Using an item... that's a kinda tricky one. I am a fan of items that have the ability to call an event. FFVI uses events to accomplish the warp stone, tent, cabin, rename card... and a few others I can't think of. So the capability needs to be there anyway.

-------------------

What we need is an event system with commands that can reach in and modify any character's attributes. I'm not gonna call it 'global' (as that's a bad word in programming) but it's gonna be pretty close to global to do what it needs to do.