# slop

Adopt this skill: https://proskills.md/skills/other/eklipse2k8-oas3-gen-claude-skills-slop

Page: https://proskills.md/skills/other/eklipse2k8-oas3-gen-claude-skills-slop
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: .claude/skills/slop/SKILL.md
size: 5166
upstream: https://github.com/eklipse2k8/oas3-gen/blob/main/.claude/skills/slop/SKILL.md

````text
---
name: slop
description: This skill should be used when the user asks to "remove slop", "deslop", "clean up slop", "clean up the diff", "strip AI slop from this change", or runs /slop after a change, to remove noise from changed oas3-gen Rust code while preserving behavior. Accepts an optional path, commit, or revision range to clean instead of the uncommitted changes.
argument-hint: "[path | commit | range]"
---

# Get Rid of Slop

Edit the changed Rust code to remove slop: code and comments that a careful
maintainer of the file would not have written. Preserve behavior.

## Find the Changes

1. If arguments name a commit or revision range, clean that change:
   `git show <commit>` or `git diff <range>`. If they name a path, clean its
   uncommitted diff (`git diff HEAD -- <path>`), or the whole file when it has
   none.
2. Otherwise, if `git diff HEAD` touches Rust files, clean the uncommitted work.
3. Otherwise clean the branch: `git diff main...HEAD`.

Edit the code as it stands at HEAD, and only where the change introduced or
modified it. Skip files the change touched that no longer exist, and skip the
generated crates under `fixtures/`, which regeneration rewrites. Read the code
around each change; the untouched code in the file sets the baseline for what
is normal there.

When the change touches `crates/oas3-gen/src/`, snapshot the generated output
before the first edit:

```bash
.claude/skills/slop/scripts/snapshot.sh /tmp/slop-before
```

## Slop to Remove

### Comments

- Inline comments (`//`) in changed code. The project allows none. Rename the
  function or its variables so the code says what the comment said, then delete
  the comment.
- Rustdoc that restates an item's name or signature. Rename instead. Rustdoc
  that records a decision or behavior the code can't state stays.
- Comments a human wouldn't add, or that are inconsistent with the rest of the
  file.

`pub` and `pub(crate)` items in `crates/oas3-gen` are not public API. They are
visible only so the external `tests/` package can reach generator internals.
Don't add rustdoc to them or preserve their signatures for that reason alone.
`oas3-gen-support` is the public runtime API that generated code depends on,
and its rustdoc stays.

### Structure

- A free function added on its own in a file: consider moving it into the
  `impl` block of the type it serves.
- A function with one caller: consider whether it needs to exist, or whether
  its body reads better at the call site. Callers in `tests/` count.
- Wrappers, indirection, traits, or helper functions without clear value.
- One shape repeated several times in the change: consider a `macro_rules!`
  that states the shape once, applied at each site. A macro with a single use
  is itself slop.

### Rust 2024 Idiom

The workspace uses edition 2024 with MSRV 1.89.

- Prefer functional, idempotent, side-effect-free code: iterator chains over
  `mut` accumulators and push loops, without nesting an iterator or allocating
  inside a per-element closure. Free functions stay pure; mutable state lives
  behind `&mut self`.
- Flatten nested `if let` into let chains (`if let Some(x) = a && let Ok(y) =
  b`), and use `let-else` for early returns.
- Remove `.clone()` calls where a borrow compiles.

### Defensive Code

- Checks or error handling abnormal for that area of the codebase, especially
  on trusted or already-validated paths: `match`, `if let`, `.ok()`, or
  `.unwrap_or_default()` that swallows a case that can't occur, re-validation of
  data the parser already checked, and `Result` returns from functions that
  can't fail. Validation belongs at boundaries only: CLI input and the parsed
  spec. A `match` arm that exhaustiveness requires stays.

### Anything Else

- Any other style inconsistent with the file or the project conventions.

## Guidelines

- Keep the change minimal: touch only what removing slop requires.
- Don't rewrite or reformat code unless the cleanup requires it.
- Prefer deleting code over adding abstractions.
- When intent is unclear, infer it from the surrounding code and keep behavior
  the same.

## Verify

1. When `/tmp/slop-before` was taken at the start, snapshot again and compare:

   ```bash
   .claude/skills/slop/scripts/snapshot.sh /tmp/slop-after
   diff -r /tmp/slop-before /tmp/slop-after
   ```

   Cleanup of generator logic leaves the output identical, so a difference
   there means an edit changed behavior; revert it. Cleanup of emitted code,
   the `quote!` templates in `codegen/`, changes the output on purpose. Confirm
   every difference comes from those edits, then rebuild the fixtures:

   ```bash
   .claude/skills/testing/scripts/build-fixtures.sh
   ```

   Delete `/tmp/slop-before` and `/tmp/slop-after` afterward.

2. Run the project checks. The snapshot covers only `fixtures/petstore.json`;
   `cargo test` covers the rest. `--no-fail-fast` keeps a failing test binary
   from hiding the ones after it.

   ```bash
   cargo +nightly fmt --all
   cargo clippy --all -- -W clippy::pedantic
   cargo test --no-fail-fast
   ```

Finish with one line per file listing what was removed. Quote any failing
command output.
````

## File: README.md
upstream: https://github.com/eklipse2k8/oas3-gen/blob/main/README.md

````text
# (OAS3-GEN) OpenAPI 3.1+ Rust Generator

```rust
//     ██████╗  █████╗ ███████╗██████╗        ██████╗ ███████╗███╗   ██╗
//    ██╔═══██╗██╔══██╗██╔════╝╚════██╗      ██╔════╝ ██╔════╝████╗  ██║
//    ██║   ██║███████║███████╗ █████╔╝█████╗██║  ███╗█████╗  ██╔██╗ ██║
//    ██║   ██║██╔══██║╚════██║ ╚═══██╗╚════╝██║   ██║██╔══╝  ██║╚██╗██║
//    ╚██████╔╝██║  ██║███████║██████╔╝      ╚██████╔╝███████╗██║ ╚████║
//     ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝        ╚═════╝ ╚══════╝╚═╝  ╚═══╝
```

<!-- prettier-ignore-start -->
[![crates.io](https://img.shields.io/crates/v/oas3-gen?label=latest)](https://crates.io/crates/oas3-gen)
[![dependency status](https://deps.rs/crate/oas3-gen/0.29.1/status.svg)](https://deps.rs/crate/oas3-gen/0.29.1)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
[![openapi](https://badgen.net/badge/OAS/v3.1.2?list=1&color=purple)](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md)
<!-- prettier-ignore-end -->

Generate Rust types, a `reqwest` HTTP client, or an `axum` server trait and router
from an OpenAPI 3.1 document. The generator accepts JSON and YAML input.

## Quick Start

You'll need Rust 1.89 or later. Install the generator:

```zsh
cargo install oas3-gen
```

#### Alternative build with [Nix](https://nixos.org/)

 -  Make sure you have `nix` installed or install it with:
    ```shell
    sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemon
    ```
 -  Now simply run it with:
    - `nix run github:eklipse2k8/oas3-gen` will run the binary, fetching the git repo automatically.
    - Or locally in the repo with `nix run`
    - To globally install use `nix profile install`

Generate a client crate from your API document:

```zsh
oas3-gen generate client-mod -i api.json -o my-api --workspace
cargo check --manifest-path my-api/Cargo.toml
```

Replace `api.json` with the path to your document. To try the repository's
example, use [fixtures/petstore.json](fixtures/petstore.json). The output
contains a `Cargo.toml` with the required dependencies and a `src/` directory
with the client and its types.

To generate a server crate, use `server-mod`:

```zsh
oas3-gen generate server-mod -i api.json -o my-server --workspace
```

You'll implement the generated trait to handle requests. If you only need
data types, generate a single file:

```zsh
oas3-gen generate types -i api.json -o types.rs
```

## Generated Client

The petstore client includes this method for its health endpoint. This excerpt
omits imports and the other methods:

```rust
impl PetstoreClient {
    pub async fn get_health(
        &self,
        request: GetHealthRequest,
    ) -> anyhow::Result<ApiResponse<(), ()>> {
        request.validate().context("parameter validation")?;
        let mut url = self.base_url.clone();
        url.path_segments_mut()
            .map_err(|()| anyhow::anyhow!("URL cannot be a base"))?
            .push("health");
        let response = self.client.get(url).send().await?;
        GetHealthRequest::parse_response(response).await
    }
}
```

The method sends the request through [`reqwest::Client`][reqwest-client] and
passes the response to the generated decoder.

## Generated Server

Server output declares a trait method for the same operation. This excerpt
omits the other operations:

```rust
pub trait ApiServer: Send + Sync {
    fn get_health(
        &self,
        request: GetHealthRequest,
    ) -> impl std::future::Future<Output = anyhow::Result<ApiResponse<(), ()>>> + Send;
}
```

Implement `ApiServer`, then pass your service to the generated `router()`
function. It returns an [`axum::Router`][axum-router] that extracts requests,
calls your methods, and writes HTTP responses.

## Features

| Feature | Generated behavior |
|---|---|
| Types | Structs, enums, type aliases, and unions with Serde serialization where needed |
| HTTP clients | Async methods for API operations, with typed requests and responses |
| Axum servers | A service trait, request extractors, handlers, and routes |
| Body formats | JSON, text, and binary data, plus form and multipart requests |
| Authentication | API keys in headers, query parameters, and cookies, plus bearer tokens |
| Event streams | Server-Sent Events on both clients and servers |
| Validation | Checks for supported schema constraints, including lengths, ranges, patterns, and `multipleOf` |
| Builders | Optional `bon` builders for schema values and requests |
| Generation options | Operation filtering, name overrides, visibility, enum handling, and type adapters |

## Learn More

Read the [book](https://eklipse2k8.github.io/oas3-gen/) for client and server
walkthroughs, generation options, schema mappings, and known limitations.
Run `oas3-gen generate --help` for command-line usage.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution requirements and the
pull request process. Report bugs or suggest changes in
[GitHub issues](https://github.com/eklipse2k8/oas3-gen/issues).

## License

Licensed under the [MIT license](LICENSE.md).

Copyright (c) 2026 Individual contributors

[reqwest-client]: https://docs.rs/reqwest/0.13.5/reqwest/struct.Client.html
[axum-router]: https://docs.rs/axum/0.8.9/axum/struct.Router.html

See [OpenAPI v3.1.2]: <https://spec.openapis.org/oas/v3.1.2>
````
