Edit: Crap, just realized I ended up on the non-MV boards somehow. I'm not sure how much of this translates over to VXA or whatever this is for, so I'll leave it up anyway just in case yanfly has a non-MV equivalent of this. Sorry.
- - -
You can do that with Yanfly's skill core plugin using these note tags:
On the skill to swap
out while the state is active:
<Custom Show Eval>
if (!user.hasSkill(NEW_SKILL_ID)) user.learnSkill(NEW_SKILL_ID);
visible = !user.isStateAffected(STATE_ID);
</Custom Show Eval>
On the skill to swap
in while the state is active:
<Custom Show Eval>
visible = user.isStateAffected(STATE_ID);
</Custom Show Eval>
Replace NEW_SKILL_ID with the id of the skill that's going to replace the existing skill. Note that the actor will be taught this new skill permanently, but it'll never show unless the required state is active.
Replace STATE_ID with the state that's supposed to trigger the switch.