# AI use cases for Gap Trap (pliablepixels/gap-trap)

Repo: [pliablepixels/gap-trap](https://github.com/pliablepixels/gap-trap) | Use cases: 4 | Page: https://dedupedai.com/use-cases/pliablepixels-gap-trap/

gap-trap is a skill for Claude Code and Codex that reads a repository, writes contracts and gates so AI-written code follows the codebase's rules, and adds CI checks that prove the tests can fail.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Set up gates so agent code stays correct: https://dedupedai.com/use-cases/pliablepixels-gap-trap/set-up-agent-code-gates/
- Find existing rule violations before they spread: https://dedupedai.com/use-cases/pliablepixels-gap-trap/audit-existing-repo-violations/
- Refine rules after incidents and keep gates current: https://dedupedai.com/use-cases/pliablepixels-gap-trap/refine-rules-after-incidents/
- Catch tests that pass against old code in CI: https://dedupedai.com/use-cases/pliablepixels-gap-trap/prove-new-tests-can-fail/

## How to set up gates so agent code stays correct with Gap Trap

Repo: [pliablepixels/gap-trap](https://github.com/pliablepixels/gap-trap) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Generate contracts, gates, and ratchets for a repo so AI-written code is checked before commit.

**Who it is for:** A developer whose AI agent writes most of the code in a repo and who has noticed drift, such as duplicate helpers or layer-boundary breaks, that nobody reviewed.

**The problem:** Agents follow written rules only until they forget them, and nothing blocks a broken rule from being committed.

**The outcome:** The repo has contracts, gates that fail commits or CI runs on broken rules, ratchets for known problems, and playbooks, all committed locally without a push.

### Steps

1. `npx skills add pliablepixels/gap-trap`
2. Open the target repository in Claude Code or Codex and run `/gap-trap setup`.
3. Read the short plan the skill shows (contracts, gates, commands) and answer its questions.
4. Review each generated contract line by line, since the README says this is the most important review step.
5. Check the commit the skill made and confirm nothing was pushed.

### Prompt to paste into your agent

```text
In the repo at <repo-path>, run `/gap-trap setup` after confirming gap-trap is installed with `npx skills add pliablepixels/gap-trap`. Report the list of contracts and gates the skill proposed and the commit it created. Verify that `git status` is clean and that no push happened.
```

### Caveat

The README warns that generated contracts must be validated carefully, and the skill is designed to run only on the top coding model of the harness.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/pliablepixels-gap-trap/set-up-agent-code-gates/

## How to find existing rule violations before they spread with Gap Trap

Repo: [pliablepixels/gap-trap](https://github.com/pliablepixels/gap-trap) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

List current violations by contract and rule in a repo right after setup, without changing code.

**Who it is for:** A tech lead who just set up Gap Trap and wants to see how far the existing code already is from the new rules.

**The problem:** New rules are only useful if you know which parts of the current code break them, and that list is hard to build by hand.

**The outcome:** A report of existing violations grouped by contract and rule, with no changes made to the repo.

### Steps

1. Finish `/gap-trap setup` in the repository.
2. When the skill asks whether to check the repo against the new framework, answer yes.
3. Read the violations list grouped by contract and rule.
4. Decide which violations to fix now and which to track with ratchets.

### Prompt to paste into your agent

```text
In the repo at <repo-path>, after `/gap-trap setup` has finished, answer yes to the framework check. Return the existing violations grouped by contract and rule. Verify that no files changed by running `git status` before and after.
```

### Caveat

The check lists violations and changes nothing, so the fixes are a separate step you have to plan yourself.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/pliablepixels-gap-trap/audit-existing-repo-violations/

## How to refine rules after incidents and keep gates current with Gap Trap

Repo: [pliablepixels/gap-trap](https://github.com/pliablepixels/gap-trap) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Find rules without gates and stale contracts, then turn lessons from commit history into one PR.

**Who it is for:** A maintainer of a gap-trap-managed repo who has had a bug from agent code or who runs the review about once a month.

**The problem:** Rules drift away from the code, contracts name code that no longer exists, and lessons from incidents stay in commit history.

**The outcome:** One pull request that adds missing gates, fixes stale contracts, and records lessons in the playbooks.

### Steps

1. Run `/gap-trap refine` in the managed repository.
2. Read the proposed findings: rules without gates, contracts naming missing code, and lessons from the commit history.
3. Check that each proposed playbook entry matches a real incident in the history.
4. Review and merge the single PR the skill proposes.

### Prompt to paste into your agent

```text
In the repo at <repo-path>, run `/gap-trap refine`. Return the list of rules without gates, stale contracts, and proposed playbook lessons. Verify that each lesson cites a real commit from `git log`.
```

### Caveat

Refine proposes one PR, so the maintainer must still review the lessons it writes into playbooks.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/pliablepixels-gap-trap/refine-rules-after-incidents/

## How to catch tests that pass against old code in CI with Gap Trap

Repo: [pliablepixels/gap-trap](https://github.com/pliablepixels/gap-trap) | Difficulty: Advanced | Time: 1 hour | Basis: From the README

Run every new test against the old code in CI and fail any test that passes there.

**Who it is for:** A developer whose agent writes tests that check that code ran rather than that it did the right thing.

**The problem:** A test that cannot fail proves nothing, and agents often write tests like that.

**The outcome:** A CI job that flags each new test that also passes on the old code, so weak tests are caught before merge.

### Steps

1. Run `/gap-trap setup` in the repository so the proven red CI job is added.
2. Open a PR that adds a new test.
3. Check the proven red CI job result for that PR.
4. If the job fails, rewrite the test so it fails on the old code and passes on the new code.

### Prompt to paste into your agent

```text
In the repo at <repo-path>, after gap-trap setup, open a PR that adds one new test. Report the result of the proven red CI job for that PR. Verify that the job ran in CI and not only locally.
```

### Caveat

The README says proven red runs only in CI, so you will not see its result from a local run.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/pliablepixels-gap-trap/prove-new-tests-can-fail/
