Rewrite skills code

Fixes #1091