Deslop a Rust Codebase's Structure
Once per Rust codebase, when its module structure has grown sloppy — run the deslop-please linter and fix every flagged error from first principles toward deep modules and narrow interfaces.
- existing
- maintenance
- #rust
- #linting
- #refactoring
- #agents
- by Xiangpeng Hao (@MOVNTDQ)
- github.com
## Context
This repository is already built and running. You are doing a one-time cleanup of
its structure with [`deslop-please`](https://github.com/deterministic-machines/deslop-please),
an opinionated linter that flags sloppy code. It follows *A Philosophy of Software
Design*: **deep** modules, **narrow** interfaces. Deep modules hide the attention
for you and your agents, so you only need to care about the narrow interface.
`deslop-please` analyzes Rust workspaces (it installs with `cargo install
deslop-please` and reads `cargo metadata`). It reports four classes of problems:
- `module-cycle` — modules that use each other, even when what they exchange only
forms a chain.
- `tangle` — a module and its child module know each other, with no module cycle.
- `field-leak` — a type's fields are known and worked on outside the module that
owns them.
- `shallow-module` — callers use too much of a module's surface instead of a
narrow interface.
**The rules in the Guardrails section are binding. Read them before starting.**
## Goal
Fix every error `deslop-please` flags, from first principles toward deeper modules
and narrower interfaces, so a final run reports a clean codebase and intended
behavior is unchanged.
## Inputs
This prompt is self-contained: run it from the root of the Rust workspace you want
to deslop. The linter discovers the structure itself; there are no placeholders to
fill in.
## Instructions
1. Install the linter with `cargo install deslop-please`, then run `deslop-please`
from the repository root. Record the full list of errors before changing
anything.
2. Work out the fix for each error using the per-class questions in Guardrails.
Draw a diagram to help the user understand the before and proposed after
structure.
3. Land the fixes through the repository's normal change flow (commits or PRs
matching its conventions).
4. Re-run `deslop-please` and repeat until it reports no errors. If an error truly
should not be fixed, mute it with
`deslop-please --update-allow .deslop-please.allow` and run subsequent checks
with `deslop-please --allow .deslop-please.allow`, and say why in the report.
## Output format
- The deslopped codebase, landed through the repository's normal change flow.
- For each error class you touched, a diagram showing the before and after
structure.
- A final report listing: the errors found per class, the fix for each, anything
muted via `.deslop-please.allow` and why, and evidence that intended behavior is
unchanged (the repository's own build and tests passing).
## Guardrails
These rules are binding throughout the task:
- Errors flagged by `deslop-please` must be fixed from first principles — don't do
mechanical moves to hide them.
- `module-cycle` & `tangle`: what is the intended layer of abstraction? Which
module should be at which layer?
- `field-leak` & `shallow-module`: why do we have these fields/functions at all?
What are the patterns of use? Can they be hidden behind a narrow interface?
Don't fix each leak one at a time — fix them holistically.
- Draw a diagram to help the user understand the before and proposed after
structure.
- You may modify repository files; this is a refactor, not an audit.
- Intended behavior must be the same as when you started — verify it with the
repository's own build and tests at the end.More prompts
Untangle Codebase
Once per codebase, when it has grown tangled — a one-pass structural refactor so a typical change lands in one place and agents working in it break less.
- #refactoring
- #tech-debt
- #architecture
- #agents
mBy @mazeincoding
Audit and Fix a Site's SEO and AI-Search (GEO) Readiness
Once per site, when you want every public page brought into compliance with Google's SEO guidance plus AI-search readiness — route inventory, per-page 9-point audit, prioritized fixes, and verified SEO/GEO scores.
- #seo
- #geo
- #audit
- #web
- #agents
DBy @DanKornas
Audit Authorization and Data Isolation
Once per application, before giving real customers access — audit the codebase for broken access controls, privilege escalation and cross-tenant data exposure that a login system alone does not prevent.
- #security
- #authorization
- #multi-tenant
- #rbac
- #audit
SBy @Sujay__Raj