# AI use cases for Sloppy (Heyosseus/sloppy)

Repo: [Heyosseus/sloppy](https://github.com/Heyosseus/sloppy) | Use cases: 4 | Page: https://dedupedai.com/use-cases/heyosseus-sloppy/

Sloppy is a deterministic, local PHP static analyser that flags code patterns that cost maintenance, with hooks for Claude Code, Gemini CLI and Codex, CI annotations, a Pest plugin and an MCP server.

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

- Catch agent-written PHP debt before the edit lands: https://dedupedai.com/use-cases/heyosseus-sloppy/catch-agent-debt-while-it-codes/
- Gate CI on new PHP debt only: https://dedupedai.com/use-cases/heyosseus-sloppy/adopt-sloppy-on-legacy-php-without-blocking-builds/
- Review a branch for new PHP debt before merge: https://dedupedai.com/use-cases/heyosseus-sloppy/review-a-branch-for-what-it-introduced/
- Fix mechanical PHP findings in one pass: https://dedupedai.com/use-cases/heyosseus-sloppy/fix-mechanical-php-findings-in-one-pass/

## How to catch agent-written PHP debt before the edit lands with Sloppy

Repo: [Heyosseus/sloppy](https://github.com/Heyosseus/sloppy) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Install Sloppy hooks so Claude Code, Gemini CLI or Codex checks each PHP edit and fixes new findings.

**Who it is for:** A PHP or Laravel developer who lets an AI coding agent write most of the code and wants it to clean up its own mistakes.

**The problem:** Agents repeatedly produce swallowed exceptions, queries inside loops and oversized methods, and code review catches them late.

**The outcome:** After each PHP edit the agent receives only the findings that edit introduced and fixes them before the developer reviews the change.

### Steps

1. Run `composer require --dev heyosseus/sloppy` in the project root.
2. Run `vendor/bin/sloppy` to scan the project and confirm the output.
3. Run `vendor/bin/sloppy agents install` to add the Claude Code hooks, or `vendor/bin/sloppy agents install --host=gemini` or `vendor/bin/sloppy agents install --host=codex` for those agents. (inferred, check the README)
4. Ask the agent to make a small change to a PHP file and watch it run Sloppy after the edit.

### Prompt to paste into your agent

```text
In the Heyosseus/sloppy project, install the agent hooks for this repository at <project path> by running the install command for the host agent. Then make a small edit to <target PHP file> that adds a try/catch block, and confirm the agent reports any new findings from that edit. Output the list of findings and whether the agent fixed them.
```

### Caveat

Sloppy only reports pattern-based findings and does not judge whether the code is AI-generated, so a finding is a prompt to review the code, not proof of a defect.

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/heyosseus-sloppy/catch-agent-debt-while-it-codes/

## How to gate CI on new PHP debt only with Sloppy

Repo: [Heyosseus/sloppy](https://github.com/Heyosseus/sloppy) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Baseline today's findings, then fail pull requests only when a branch adds new ones.

**Who it is for:** A tech lead adopting code quality checks on an existing Laravel or PHP codebase with years of history.

**The problem:** A first scan returns hundreds of findings, and blocking every build on old debt stops the team from merging anything.

**The outcome:** Existing findings are accepted into a baseline, and pull requests get annotations only for findings the branch introduced.

### Steps

1. Run `composer require --dev heyosseus/sloppy` in the repository.
2. Run `vendor/bin/sloppy baseline` to accept the debt that already exists. (inferred, check the README)
3. Run `vendor/bin/sloppy ci` locally to see what the pipeline would report. (inferred, check the README)
4. Add the GitHub Action to the workflow with `uses: heyosseus/sloppy-action@v1` and `diff-branch: main`.

### Prompt to paste into your agent

```text
In the Heyosseus/sloppy project, set up a baseline for the PHP repository at <project path> by running the baseline command, then run the CI command. Output the number of accepted baseline entries and the CI result. Verify that the CI command reports no findings on the unchanged branch.
```

### Caveat

The README says baseline entries are keyed on class and member rather than line numbers, but a team still has to commit and maintain the baseline file as the codebase changes.

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/heyosseus-sloppy/adopt-sloppy-on-legacy-php-without-blocking-builds/

## How to review a branch for new PHP debt before merge with Sloppy

Repo: [Heyosseus/sloppy](https://github.com/Heyosseus/sloppy) | Difficulty: Intermediate | Time: 15 minutes | Basis: From the README

Compare a branch with main and rank only the findings it introduced, highest risk first.

**Who it is for:** A PHP developer about to open or review a pull request who wants to know where to look first.

**The problem:** A large diff hides which new code is risky, and inherited problems in untouched files add noise.

**The outcome:** A ranked list of findings the branch introduced, with the files to read first and where to stop.

### Steps

1. Check out the feature branch in the project.
2. Run `vendor/bin/sloppy diff main` to report only what the branch introduced. (inferred, check the README)
3. Run `vendor/bin/sloppy review main` to rank the same findings by risk. (inferred, check the README)
4. Open the top-ranked file and read the findings from that file first.

### Prompt to paste into your agent

```text
In the Heyosseus/sloppy project, run the diff and review commands against main for the branch checked out in <project path>. Output the top five ranked findings with their file and rule identifier. Verify that every finding is in a file the branch changed.
```

### Caveat

The README describes the ranking as a risk measure for the analysed paths, so the order is a guide to reading, not a verdict on any file.

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/heyosseus-sloppy/review-a-branch-for-what-it-introduced/

## How to fix mechanical PHP findings in one pass with Sloppy

Repo: [Heyosseus/sloppy](https://github.com/Heyosseus/sloppy) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Let Rector and Pint fix the findings a machine can change, then review what is left.

**Who it is for:** A PHP developer with a backlog of Sloppy findings who wants the mechanical ones cleared quickly.

**The problem:** Mechanical findings such as restating comments take time to fix by hand, while judgement-based findings still need a person.

**The outcome:** Mechanical findings are fixed, formatting is applied, and a list of findings that still need a person remains.

### Steps

1. Commit or stash current work so the changes from the fix pass are easy to review.
2. Run `vendor/bin/sloppy` to list the findings before fixing.
3. Run `vendor/bin/sloppy fix` to apply Rector, remove narrating comments and format with Pint. (inferred, check the README)
4. Run `vendor/bin/sloppy` again and review the remaining findings that need a person.

### Prompt to paste into your agent

```text
In the Heyosseus/sloppy project, run the fix command on the PHP repository at <project path>. Output the number of findings before and after the fix pass, and the findings that still need a person. Verify that the test suite of the project still passes after the fix.
```

### Caveat

The fix pass changes code with Rector and Pint, so the project's own tests should be run after it, as the README does not promise the output is behaviour-preserving for every project.

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/heyosseus-sloppy/fix-mechanical-php-findings-in-one-pass/
