gap-trap

Rules your coding agent cannot skip.

gap-trap is a skill for coding agents. Run it once in a repository. It reads the code, writes the rules that fit it, and adds a check for each rule that fails the commit or the CI run when the rule is broken.

npx skills add pliablepixels/gap-trap

Or copy the skill folder into ~/.claude/skills/ by hand. Install notes

The gap-trap logo: a smiling net catching puzzle pieces marked with code brackets

Why rules in a text file are not enough

When an agent writes most of your code, you stop reading every diff. Quality drifts, and you find out when something breaks. Your instructions file says what not to do, but the only thing that reads it is the agent that breaks it.

gap-trap puts a check behind each rule. Here is the drift it looks for, and what catches it.

Writes a helper that already exists, or crosses a layer boundary because the shortcut compiled.

Contracts

Each part of the code with one right way to do things (HTTP, logging, settings, auth) gets a short entry: what to use, what never to use, and the check that finds a bypass.

Writes a test that asserts the code ran, not that it did the right thing.

Proven red

CI runs every new test against the code from before the change. If the test passes there too, it proves nothing, and the job fails.

Adds one more lint warning, one more file over 400 lines, to a backlog nobody has time to clear.

Ratchets

Known problems are counted and the counts are stored. A count may go down. It may not go up without a reason in the commit message.

Follows a rule for a week, then forgets it, or relearns a lesson the last session already paid for.

Gates and playbooks

Every rule names the gate that enforces it, so forgetting it fails the build. The facts the project learned the hard way go into playbooks the next session reads.

How you use it

  1. Install the skill

    With the skills CLI, or by copying the folder into your agent's skills directory.

    npx skills add pliablepixels/gap-trap
  2. Set up a repository

    The skill reads the repo and shows you a short plan. After you answer its questions, it writes the files, proves each gate fails when it should, and commits. It does not push.

    /gap-trap setup
  3. Refine it later

    After the first incidents, or about once a month. It looks for rules without gates, stale contracts, and lessons nobody wrote down, and proposes one PR.

    /gap-trap refine

It works with any language. Node and Python repos get gates inside their test suite. Go, Rust, Java, Ruby, .NET, PHP, Swift, and C++ get shell versions that need only git, grep, awk, and your test command. The skill needs Opus or a more capable model.

2,313commits in eight months
14reverts

Where it started

gap-trap packages the framework that zmNinjaNg runs on. One maintainer landed those commits with agents writing the code and no one reading the diffs line by line.

Chapter 14 of the zmNinjaNg developer guide describes that setup. It explains rules, contracts, and gates, and follows one feature from spec to merge.

Read the Agent development model