Sort skills based on dependencies.