AG_

Skills are not a Panacea. Toss some Hooks in the mix.

Linting and formatting are deterministic chores, so stop asking a model to remember them. Use a hook instead of a skill.

Agent Skills have been cropping up all over the place. Their mileage may vary, but overall I've had some pretty good experiences with many of those I took the time to actually read through (as opposed to just blindly adding them into my ~/.claude). I've also noticed that a lot of agent harness newcomers seem to try to toss in all sorts of things into them. I get it. A skill seems like a natural first move, or maybe the maybe barrier to entry is just the lowest to understand. Depending on what your skill is meant to do, this decision can yield some less than desirable outcomes.

For example, I noticed a buddy of mine crafting a small skill to ensure that their python code would be linted & formatted. He told me it was because he noticed that his git hooks would often still fail even after the agent had generated working code. I asked him if he had considered a hook instead. Especially since he always wanted his code to go through this check.

The first red flag in his approach was that he was tossing something he considered mandatory into something that wasn't necessarily deterministic. There are a bunch of additional mediating variables here. For example, I guess you could say that maybe he was planning on always explicitly invoking the skill via some slash command syntax e.g. /format_and_lint, but we can't say for sure. For the sake of argument (and to further justify this post's existence 😉), the skill was intended to be used without a slash command. This means that there is a chance that LLM model would potentially not even find the skill as relevant to the users prompt. That alone makes the skill much less useful. A skill that sometimes cleans up your code doesn't seem too cool, but maybe that's just me.

If you know you want some specific script or function to run at a predefined time reach for an agent hook. Unlike skills, they are deterministic. In my buddy's case, we tossed together a simple hook to always run ruff after his Claude Code session edited his codebase.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          { "type": "command", "command": "ruff format ..." }
        ]
      }
    ]
  }
}

Sure, you might have to do a little more reading of your agent harness of choice's docs to learn a little more about it's available tools...but I've never found actually reading docs to be a waste of time. And, if the determinism wasn't enough, a hook can actually yield some token savings! Every skill-driven lint run costs a model turn. That means tokens. Tokens the model uses to decided whether or not to run the formatter. Tokens to actually run it. Tokens to read whatever output the formatter yields.