MV Random skills from specified skill pool on equipment

I'm working on a roguelike RPG where the party would receive skills only by equipment they actively wear, as long as they wear it. So everytime an enemy/chest drops a piece of equipmet, the equipment would gain 2 random skills from a certain specified skill pool. For example:

Any swords would always receive 2 random attack skills from a specified skill pool (e.g. a random "slash" skill and a random "fire" skill).
Spears would always receive 2 random attack skills from a differenct specified skill pool (e.g. a random "pierce" and a random "lightning" skill).
Armor would always receive 2 random buff skills and so on...

I already looked into yanfly's and dreamX's plugins but I couldn't find a solution to this specific problem. ChatGPT tried to write me scripts and a plugin, but even after like 5 tries, it still totally failed lol. Am I missing certain notetags, plugins or anything? I would be so glad if anyone could point me into the right direction.
With YEP_ItemCore I'm guessing you could use its <On Creation Eval> notetag:

For those with JavaScript experience, you can use the following Lunatic Mode to run JavaScript code upon the creation of the item. This only applies to newly made independent items. Item, Weapon, Armor <On Creation Eval> item.price = baseItem.price; item.price += Math.floor(Random() * 100); </On Creation Eval> The 'item' variable refers to the independent item being made. 'baseItem' refers to the item's base item. Any alterations made to the 'item' will be applied to the independent item.
To add traits using this notetag, something like this might work (untested):
JavaScript:
// Define random "Add Skill" ID pools.
var pools = [
  [ 1,  2,  3,  4,  5],  // IDs for added skill 1
  [11, 12, 13, 14, 15]   // IDs for added skill 2
];
// Give the item 1 Add Skill trait per pool, randomly selected.
for (var pool of pools) {
  item.traits.push({
    code: Game_BattlerBase.TRAIT_SKILL_ADD,
    dataId: pool[Math.randomInt(pool.length)]
  });
}

Original thread: https://forums.rpgmakerweb.com/threads/random-skills-from-specified-skill-pool-on-equipment.179296/