anti-slop-engineering 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.skills.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://skills.sh/schema.json",
3
+ "name": "anti-slop-engineering",
4
+ "version": "0.4.0",
5
+ "description": "An Engineering Discipline Playbook & Guard System for AI Coding Agents. Enforces Google SRE, Clean-Room Senior Dev Ladders, and Rust/Go Microservices.",
6
+ "repository": "https://github.com/imMamdouhaboammar/anti-slop-engineering",
7
+ "author": "Mamdouh Aboammar",
8
+ "license": "MIT",
9
+ "skill": "SKILL.md",
10
+ "tags": [
11
+ "agent-skill",
12
+ "anti-slop",
13
+ "code-quality",
14
+ "code-review",
15
+ "testing",
16
+ "engineering-discipline",
17
+ "sre",
18
+ "google-sre"
19
+ ]
20
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mamdouh Aboammar <mamdouhfces1997@gmail.com> and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ Anti-Slop Engineering
2
+ Copyright (c) 2026 Mamdouh Aboammar <mamdouhfces1997@gmail.com>
3
+
4
+ This software, documentation, and agent skill was designed, authored, and is maintained by:
5
+
6
+ Mamdouh Aboammar
7
+ GitHub: https://github.com/imMamdouhaboammar
8
+ Email: mamdouhfces1997@gmail.com
9
+ Project: https://github.com/imMamdouhaboammar/anti-slop-engineering
10
+
11
+ Licensed under the MIT License. See LICENSE in this repository for full terms.
12
+ All rights reserved for original copyright notice, attribution, and repository integrity.
package/README.md CHANGED
@@ -1,3 +1,278 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Anti-Slop Engineering
4
+
5
+ **A static guard, agent skill, and engineering playbook that catches the failure modes AI coding agents produce most — before they reach review.**
6
+
7
+ [![CI](https://img.shields.io/github/actions/workflow/status/imMamdouhaboammar/anti-slop-engineering/ci.yml?branch=main&style=flat-square&logo=githubactions&logoColor=white)](https://github.com/imMamdouhaboammar/anti-slop-engineering/actions)
8
+ [![npm](https://img.shields.io/npm/v/anti-slop-engineering?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/anti-slop-engineering)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
10
+ [![Bun](https://img.shields.io/badge/Runtime-Bun%20%3E%3D1.0-FBF0DF?style=flat-square&logo=bun&logoColor=black)](https://bun.sh)
11
+ [![Python](https://img.shields.io/badge/Python-3.9%20–%203.13-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
12
+ [![Skills.sh](https://img.shields.io/badge/Skills.sh-Compatible-000000?style=flat-square&logo=vercel&logoColor=white)](https://skills.sh)
13
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-Certified%20Skill-D97706?style=flat-square&logo=anthropic&logoColor=white)](https://claude.ai)
14
+
15
+ [Install](#install) · [What it catches](#what-it-catches) · [Engines](#engines) · [Agent skill](#agent-skill) · [Anti-pattern catalog](#anti-pattern-catalog-213-patterns)
16
+
17
+ </div>
18
+
19
+ ---
20
+
21
+ AI coding agents ship at speed. They also systematically produce the same failure modes: skipped tests, dead code branches, flat retry loops, silent exception swallows, UI copy that reads like internal notes, and code structures that look correct but drift from the original intent. Anti-Slop Engineering is a multi-layer guard system that intercepts those patterns across your diff, your codebase, and your agent's decision loop — with zero dependencies on external services or proprietary APIs.
22
+
23
+ It runs as a zero-install CLI, a native Rust/Go microservice pair, and a portable agent skill that drops into Claude Code, Gemini CLI, Cursor, Codex, and Windsurf. It enforces Google SRE principles (KISS, DRY, YAGNI, Fix Issues at Scale) through static analysis, not style preference.
24
+
25
+ ---
26
+
27
+ ## Install
28
+
29
+ **Zero-install — run directly on any diff:**
30
+
31
+ ```bash
32
+ bunx anti-slop-engineering --base HEAD
33
+ bunx anti-slop-engineering sre --base HEAD --strict
34
+ ```
35
+
36
+ **Agent skill — wires into Claude Code, Gemini CLI, Codex, and others:**
37
+
38
+ ```bash
39
+ npx skills add imMamdouhaboammar/anti-slop-engineering
40
+ ```
41
+
42
+ **npm / Bun (auto-installs the agent skill on postinstall):**
43
+
44
+ ```bash
45
+ bun add anti-slop-engineering
46
+ # or
47
+ npm install anti-slop-engineering
48
+ ```
49
+
50
+ **Universal multi-agent installer:**
51
+
52
+ ```bash
53
+ curl -fsSL https://raw.githubusercontent.com/imMamdouhaboammar/anti-slop-engineering/main/install.sh | bash
54
+ ```
55
+
56
+ **Python CLI (pipx / uv):**
57
+
58
+ ```bash
59
+ uv tool install git+https://github.com/imMamdouhaboammar/anti-slop-engineering.git
60
+ pipx install git+https://github.com/imMamdouhaboammar/anti-slop-engineering.git
61
+ ```
62
+
63
+ ---
64
+
65
+ ## What it catches
66
+
67
+ ### Diff Guard — pre-commit and PR triage
68
+
69
+ Runs on any git diff in under a second. No network access. No config files required.
70
+
71
+ | Code | Severity | Pattern detected |
72
+ |---|---|---|
73
+ | `SKIPPED_TEST` | **blocker** | `@pytest.mark.skip`, `it.skip(`, `@Disabled`, `xit(` — test oracle tampered |
74
+ | `WEAK_ASSERTION` | review | `assert True`, `expect(true).toBe(true)` — assertion theater |
75
+ | `SECURITY_BYPASS_CANDIDATE` | review | `verify=False`, `rejectUnauthorized: false`, `--no-verify` |
76
+ | `ERROR_SWALLOW_CANDIDATE` | review | `except Exception: pass`, empty `catch {}` blocks |
77
+ | `TYPE_CHECK_SUPPRESSION` | review | `@ts-ignore`, `@ts-nocheck`, `type: ignore` |
78
+ | `SRE_YAGNI_DEAD_FLAG` | **blocker** | `if False:`, `if (false)` — speculative dead branches |
79
+ | `SRE_SCALE_FLAT_RETRY` | review | Retry loop with fixed `sleep(N)` — thundering herd risk |
80
+ | `SRE_SCALE_SLEEP_BAND_AID` | review | `time.sleep()` used as async synchronization |
81
+ | `SRE_SCALE_UNBOUNDED_CONCURRENCY` | review | `Promise.all(items.map(...))`, `asyncio.gather(*tasks)` without semaphore |
82
+ | `DEV_NOTE_IN_UI` | **blocker** | Agent/dev notes inside `<p>`, `<span>`, `<div>` — leaking into user-facing surfaces |
83
+ | `PATRONIZING_UI_COPY` | review | "Please enter your email", "Click here to submit" under self-evident controls |
84
+ | `TRIVIAL_COMMENT_NARRATION` | review | `// return result`, `// increment count` — syntax play-by-play |
85
+ | `SPECULATIVE_SUBMISSION_DOSSIER` | review | `docs/*submission*.md`, `docs/*dossier*.md` — unrequested platform guides |
86
+ | `AFFORDANCE_NARRATION` | review | "The following table shows", "Click to expand" — meta-preamble in docs |
87
+ | `LARGE_DIFF_SCOPE` | review | Added lines exceed 400 — prompts scope review |
88
+
89
+ ```bash
90
+ # Standard pre-commit triage:
91
+ bunx anti-slop-engineering --base HEAD
92
+
93
+ # Compare PR branch against main merge-base:
94
+ BASE="$(git merge-base HEAD origin/main)"
95
+ bunx anti-slop-engineering --base "$BASE"
96
+
97
+ # Machine-readable JSON for CI pipelines:
98
+ bunx anti-slop-engineering --base HEAD --json
99
+
100
+ # Exit code 2 on any blocker (CI gate):
101
+ bunx anti-slop-engineering --base HEAD --fail-on-blocker
102
+ ```
103
+
104
+ ### SRE Guard — Google SRE principles enforced statically
105
+
106
+ Implements the four Google SRE engineering mandates (KISS, DRY, YAGNI, Fix Issues at Scale) as a static analysis pass over your diff or source files. Zero external dependencies — pure Python 3.9+ stdlib.
107
+
108
+ | Pillar | Diagnostic code | What it flags |
109
+ |---|---|---|
110
+ | **KISS** | `KISS_DEEP_NESTING` | Control flow nested beyond 4 levels — flatten with guard clauses |
111
+ | **KISS** | `KISS_FUNCTION_BLOAT` | Functions exceeding 80 lines — split into single-responsibility units |
112
+ | **DRY** | `DRY_CODE_DUPLICATION` | Logic blocks of 4+ normalized lines duplicated across files |
113
+ | **YAGNI** | `YAGNI_SPECULATIVE_COMMENT` | `TODO(future)`, `reserved for future use`, `placeholder for v2` |
114
+ | **YAGNI** | `YAGNI_DEAD_SPECULATIVE_FLAG` | `if False:`, `if (false)` dead branches |
115
+ | **YAGNI** | `YAGNI_SPECULATIVE_PARAMETER` | `_unused_param`, `future_kwargs` — phantom interface surface |
116
+ | **Scale** | `SCALE_UNBOUNDED_OR_FLAT_RETRY` | Retry with `sleep(N)` — no exponential backoff, no full jitter |
117
+ | **Scale** | `SCALE_SLEEP_BAND_AID` | Arbitrary `sleep()` as async synchronization |
118
+ | **Scale** | `SCALE_UNBOUNDED_CONCURRENCY` | Unbound `Promise.all(map(...))`, `asyncio.gather(*tasks)` |
119
+ | **Scale** | `SCALE_TOIL_ERROR_SWALLOW` | Silent exception swallowing — untracked fleet-wide failures |
120
+ | **Scale** | `SCALE_MISLEADING_HEALTH_CHECK` | Static `200 OK` health endpoints — no dependency probing |
121
+
122
+ ```bash
123
+ # Audit working-tree diff:
124
+ bunx anti-slop-engineering sre --base HEAD
125
+
126
+ # Audit specific files or directories:
127
+ bunx anti-slop-engineering sre --files src/ lib/
128
+
129
+ # CI strict gate — exits 2 on blockers:
130
+ bunx anti-slop-engineering sre --base HEAD --strict
131
+
132
+ # Custom thresholds:
133
+ bunx anti-slop-engineering sre --max-nesting 4 --min-dup-lines 4 --max-function-lines 80
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Engines
139
+
140
+ ### Rust SHIT Interceptor (`services/anti-slop-rust`)
141
+
142
+ A high-performance Axum HTTP microservice that audits diffs and source for four categories of agent failure — Scope creep (`S`), Hypothetical hardening (`H`), Intent violation (`I`), and Task thrashing (`T`) — plus the Senior Dev Ladder pattern: detecting custom implementations where platform primitives already exist (`crypto.randomUUID()`, `URLSearchParams`, `structuredClone()`).
143
+
144
+ ```bash
145
+ # Triage git changes through Rust engine:
146
+ bunx anti-slop-engineering rust triage
147
+
148
+ # Check a specific diff for SHIT violations:
149
+ bunx anti-slop-engineering rust shit-check --diff patch.diff
150
+
151
+ # Run as background microservice:
152
+ bunx anti-slop-engineering serve-rust --port 9091
153
+ ```
154
+
155
+ ### Go SRE Toil Engine (`services/toil-guard-go`)
156
+
157
+ A concurrent Go microservice for high-throughput SRE metric verification. Runs KISS nesting depth checks, multi-file DRY sliding-window token hashing, toil detection, and SLI/SLO error budget scoring in parallel. Exposes standard `/healthz`, `/metrics`, and `/v1/audit` endpoints with Prometheus metrics.
158
+
159
+ ```bash
160
+ # SRE audit across repository:
161
+ bunx anti-slop-engineering toil audit
162
+
163
+ # Live git telemetry with error budget tracking:
164
+ bunx anti-slop-engineering toil stream
165
+
166
+ # Start Go microservice daemon:
167
+ bunx anti-slop-engineering serve-go --port 9092
168
+ ```
169
+
170
+ ---
171
+
172
+ ## The Seven Gates
173
+
174
+ A structured workflow that governs how AI agents and human engineers plan, implement, verify, and review changes. Each gate is a named enforcement checkpoint, not a style preference.
175
+
176
+ ```mermaid
177
+ flowchart TD
178
+ subgraph GatePipeline ["The Seven Gates"]
179
+ G0["Gate 0: Discover repo and official boilerplate"] --> G1["Gate 1: Establish change contract"]
180
+ G1 --> G2["Gate 2: Lock baseline and protect oracle"]
181
+ G2 --> G3["Gate 3: Implement minimum complexity"]
182
+ G3 --> G4["Gate 4: Verify beyond green tests"]
183
+ G4 --> G5["Gate 5: Audit diff with Diff Guard"]
184
+ G5 --> G6["Gate 6: Evidence-based release decision"]
185
+ end
186
+
187
+ G6 -->|"PASS"| MERGE["Ready for merge"]
188
+ G6 -->|"REWORK"| G3
189
+ G6 -->|"BLOCK"| ABORT["Halt and flag violations"]
190
+ ```
191
+
192
+ | Gate | Phase | Contract |
193
+ |---|---|---|
194
+ | **0** | Discover | Inspect root configs, lockfiles, conventions. Identify official CLI installers. Never improvise repo habits. |
195
+ | **1** | Contract | Define what changes, what must not change, invariants, and rollback requirements. |
196
+ | **2** | Lock Oracle | Baseline existing tests. Protect assertions. Write red-state repro before modifying production code. |
197
+ | **3** | Implement | Minimum justified complexity. Official scaffolding only. Pin latest stable dependencies. No duplicate layers. |
198
+ | **4** | Verify | Execute real tests beyond green badges. Test negative boundaries, concurrency, and contract seams. |
199
+ | **5** | Audit Diff | Run `diff_guard.py` as a skeptical reviewer. Flag scope expansions, test modifications, and hidden leaks. |
200
+ | **6** | Evidence | Issue structured report: `BLOCK`, `REWORK`, `REVIEW`, or `PASS` with exact `file:line` citations. |
201
+
202
+ ---
203
+
204
+ ## Agent skill
205
+
206
+ The agent skill wires Anti-Slop Engineering into your AI coding agent's context. Once installed, every code change the agent generates is governed by the Seven Gates, the 213-pattern anti-pattern catalog, and the Google SRE enforcement rules.
207
+
208
+ **Supported environments:**
209
+
210
+ | Environment | Skill directory |
211
+ |---|---|
212
+ | Claude Code and Desktop | `~/.claude/skills/anti-slop-engineering` |
213
+ | Antigravity / Gemini CLI | `~/.gemini/config/skills/anti-slop-engineering` |
214
+ | Codex / OpenCode | `~/.codex/skills/anti-slop-engineering` |
215
+ | Universal Agent Kernel | `~/.agents/skills/anti-slop-engineering` |
216
+ | Cursor / Windsurf | `.cursor/rules/anti-slop.mdc` or `.cursor/skills/` |
217
+
218
+ ```bash
219
+ npx skills add imMamdouhaboammar/anti-slop-engineering
220
+ ```
221
+
222
+ When installed via `npm install anti-slop-engineering` or `bun add anti-slop-engineering`, the postinstall hook runs `npx skills add` automatically.
223
+
224
+ ---
225
+
226
+ ## Anti-pattern catalog (213 patterns)
227
+
228
+ The catalog in [`references/anti-pattern-catalog.md`](references/anti-pattern-catalog.md) documents 213 diagnostic patterns across 14 engineering domains, each with a canonical ID, symptom, root cause, and remediation.
229
+
230
+ **Domains covered:**
231
+
232
+ Requirements and scope · Architecture and abstractions · Duplication and code organization · Data, state, and persistence · Security and trust boundaries · Concurrency and async · APIs and contracts · Testing and oracles · Frontend and UI · Operations and reliability · CI, builds, and release · Workflow and review hygiene · Agent autonomy · Google SRE invariants
233
+
234
+ Notable catalog entries: `ARC-15` (manual scaffolding improvisation), `TST-12` (snapshot overwrite without review), `UI-13` (dev-notes leaked in UI), `SRE-08` (retry storms), `CI-15` (stale dependency pinning), `REV-19` (affordance narration in docs).
235
+
236
+ ---
237
+
238
+ ## Contributing
239
+
240
+ Spotted a recurring failure mode from an AI agent — test tampering, scope creep, hallucinated output, UI leakage? Report it as a [Noted Slop issue](https://github.com/imMamdouhaboammar/anti-slop-engineering/issues/new?template=noted_slop.yml) or submit a pull request:
241
+
242
+ 1. Allocate the next pattern ID in [`references/anti-pattern-catalog.md`](references/anti-pattern-catalog.md).
243
+ 2. Document symptom, root cause, and remediation using the 5-part catalog schema.
244
+ 3. Update [`SKILL.md`](SKILL.md) with explicit agent rules.
245
+ 4. Add heuristics to `scripts/diff_guard.py` with unit tests.
246
+ 5. Run `make check` — all 44 tests must stay green.
247
+
248
+ ```bash
249
+ npx anti-slop-engineering contribute
250
+ ```
251
+
252
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide.
253
+
254
+ ---
255
+
256
+ ## Citation
257
+
258
+ ```bibtex
259
+ @software{aboammar2026antislop,
260
+ author = {Aboammar, Mamdouh},
261
+ title = {Anti-Slop Engineering: An Engineering Discipline Playbook and Guard System for AI Coding Agents},
262
+ year = {2026},
263
+ publisher = {GitHub},
264
+ url = {https://github.com/imMamdouhaboammar/anti-slop-engineering}
265
+ }
266
+ ```
267
+
268
+ See [`CITATION.cff`](CITATION.cff) for CFF format.
269
+
270
+ ---
271
+
272
+ ## License
273
+
274
+ - **Author:** [Mamdouh Aboammar](https://github.com/imMamdouhaboammar)
275
+ - **License:** [MIT](LICENSE)
276
+ - **Notice:** [NOTICE](NOTICE)
277
+
278
+ Copyright (c) 2026 Mamdouh Aboammar and contributors.
package/SKILL.md ADDED
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: anti-slop-engineering
3
+ description: Prevent, detect, and repair AI coding slop and dirty engineering in repositories. Use for planning features, writing code, changing tests, reviewing pull requests, refactoring, hardening CI, debugging regressions, or auditing agent-generated changes. Enforces behavioral contracts, focused diffs, test integrity, repo conventions, security boundaries, and evidence-based completion.
4
+ author: Mamdouh Aboammar <mamdouhfces1997@gmail.com>
5
+ license: MIT
6
+ metadata:
7
+ version: "0.4.0"
8
+ focus: "engineering-discipline"
9
+ repository: "https://github.com/imMamdouhaboammar/anti-slop-engineering"
10
+ ---
11
+
12
+ # Anti-Slop Engineering
13
+
14
+ **Mission:** Deliver the smallest *coherent, correct, maintainable* change supported by independent evidence. Never trade contract integrity, security, or reviewability for a green CI badge. Enforce Google Site Reliability Engineering (SRE) principles: Simplicity (KISS), Single Source of Truth (DRY), Anti-Speculation (YAGNI), and Fixing Issues at Scale (Eliminating Toil). Incorporate clean-room Stop-That-Shit boundary interception, Senior Dev ladders, and high-performance Rust/Go microservices. This skill applies to human and AI-authored changes equally.
15
+
16
+ ## Operating priorities
17
+
18
+ 1. Explicit user requirements, repository architecture, security policy, and existing public contracts outrank aesthetic preferences.
19
+ 2. Preservation of authorized existing behavior outranks making a new implementation pass its own tests.
20
+ 3. Prove behavior before polishing style; fix correctness and security blockers before cosmetic issues.
21
+ 4. Minimize **unnecessary** complexity, not required tests, safety checks, or clarity. A short but incorrect solution fails.
22
+ 5. Do not declare a finding without file/line evidence and an impact story. Never invent tool results or test runs.
23
+ 6. Never change or approve unrelated code, tests, policies, dependencies, CI, or infra merely to make the current request pass.
24
+ 7. **Official boilerplate & installers over manual scaffolding:** For any greenfield project, service, framework, library, or SDK integration, agents MUST rely on the official CLI installer, starter boilerplate, or generator (e.g., `uv init`, `cargo init`, `bun create`, official SDK quickstarts). Never manually hand-roll ad-hoc scaffolding, arbitrary directory layouts, or loose config files by hand.
25
+ 8. **Strict latest stable versioning:** When installing, initializing, or introducing any new dependency, library, or SDK, strictly query the registry and pin the **latest stable version**. Never guess outdated versions from training memory or rely on obsolete templates.
26
+ 9. **Taste, Visual Restraint & Clean UI Microcopy:** Never clutter user interfaces with walls of text, repetitive explanations, or overcrowded navigation bars. Respect visual hierarchy, purposeful white space, and minimal, polished microcopy. Eliminate gratuitous widgets, stat pills, or icon clutter.
27
+ 10. **Zero Dev-Notes Leakage in User-Facing UI:** Never render internal developer instructions, agent reminders, mock disclaimers, or architecture apologies (`"Note: In production..."`, `"Mock data displayed"`, `"TODO: Add auth"`) into user-visible DOM/JSX. Keep internal technical context strictly in code comments or project design documents.
28
+ 11. **Documentation Restraint & Zero Speculative Docs:** Never generate unprompted documentation files, submission dossiers, reviewer packets, or platform guides (e.g. "Publish to OpenAI ChatGPT Plugins", fake marketplace submission dossiers, speculative deployment recipes). Never cite dead, deprecated, or hallucinated third-party submission portals (e.g. `platform.openai.com/plugins`). Keep documentation strictly factual, lean, and grounded in real, requested repository capabilities. Reject documentation file sprawl and ceremonial note callouts.
29
+ 12. **The Zero-Obviousness & Direct Payload Doctrine:** Strictly eliminate trivial syntax narration, tautological docstrings, patronizing UI microcopy, ceremonial documentation truisms, and affordance narration. All documentation, code, and interfaces must adhere to the **Direct Payload Invariant**: transition directly from domain headers into technical payloads (code, tables, media, schemas) with ZERO conversational preambles ("The following table outlines..."), ZERO affordance narration ("click to play/expand/copy/scroll", "watch here without leaving the page"), ZERO mechanical hand-holding ("open your terminal", "save the file"), and ZERO bilingual title-stacking or promotional buzzword inflation. Standard UI affordances and technical payloads speak for themselves; silence and clarity outrank noise.
30
+ 13. **Google Site Reliability Engineering (SRE) Discipline:** Enforce the four foundational Google SRE principles across all changes:
31
+ - **KISS (Simplicity as a prerequisite to reliability):** Keep cyclomatic nesting <=4 levels. Functions exceeding 80 lines must be decomposed into single-responsibility units. Reject pass-through wrapper chains that add no value.
32
+ - **DRY (Single source of truth):** Replicated invariants, duplicated validation patterns, or parallel error structures are reliability hazards. Consolidate into canonical modules.
33
+ - **YAGNI (Anti-speculative engineering):** Zero speculative parameters (`_unused_param`, `future_kwargs`), dead branches (`if False:`), or placeholder stubs. Build for active requirements only.
34
+ - **Fix Issues at Scale (Eliminating toil & distributed resilience):** Automate repetitive manual toil. Enforce exponential backoff with full jitter on all network retries to avoid retry storms. Never use `sleep()` as an async race band-aid. Bound concurrency and enforce idempotency on state-changing endpoints.
35
+ 14. **Clean-Room Senior Dev Ladder & SHIT Interception (Ponytail, STS, Boring Engineering):**
36
+ - Intercept the four SHIT hazards: Scope creep (`S`), Hypothetical hardening/unread companion hashes (`H`), Intent violation (`I`), and Task thrashing (`T`).
37
+ - Climb the Senior Dev Ladder before authoring code: (1) Does this need to exist? (2) Does it already exist in the codebase? (3) Does the stdlib/platform do it? (4) Does native runtime cover it? (5) Does an existing dependency solve it? (6) Can it be a direct expression? (7) Write only minimal, necessary, tested code.
38
+ - **Name the Built-in:** Before writing custom parsing, validation, or UUID/cloning utilities, name the platform built-in (`crypto.randomUUID()`, `URLSearchParams`, `structuredClone()`). Hand-rolling standard primitives is a defect.
39
+ - **Practical DRY 3-Point Barrier:** Shared utilities or abstractions are permitted only when appearing in >=2 real existing call-sites, when all call-sites require identical modifications upon change, and when the abstraction can be named without coordinating conjunctions (`and`, `or`).
40
+
41
+ ## Activation / modes
42
+
43
+ Select the relevant mode and follow the same gates:
44
+
45
+ - **BUILD:** new feature or behavior change. Baseline -> contract -> RED -> GREEN -> REFACTOR -> independent review -> evidence.
46
+ - **FIX:** reproduce observed bug first, fix smallest root cause, prove regression tests hold.
47
+ - **REVIEW:** read-only diff and repository-context audit; report findings with severity, evidence, and counterfactual.
48
+ - **CLEANUP:** establish an observable behavior baseline, isolate pure refactors from feature changes, prove no drift.
49
+ - **NOTED_SLOP:** codify newly observed AI slop into a diagnostic catalog pattern, agent directive, and automated diff guard heuristic (see [CONTRIBUTING.md](CONTRIBUTING.md)).
50
+
51
+ For extensive audits, load [anti-pattern catalog](references/anti-pattern-catalog.md). For Google SRE discipline and distributed resilience patterns, load [google-sre-discipline](references/google-sre-discipline.md). For any test changes, load [test integrity policy](references/test-integrity.md). For a PR or merge request, load [PR review protocol](references/pr-review.md). For elevated permissions, sensitive code, network access, or deployment, load [security and execution boundaries](references/security-and-operations.md). For project-specific exceptions, load [judgment and exceptions](references/engineering-judgment.md). For community contributions, follow [contributor guidelines](CONTRIBUTING.md).
52
+
53
+ ## The seven gates
54
+
55
+ ### Gate 0: Discover; do not improvise the repo
56
+
57
+ - Read root and scoped instructions (AGENTS.md, CLAUDE.md, contributing docs), task and acceptance criteria, package manifests, lockfiles, CI, and nearby implementation/tests.
58
+ - Identify language/framework versions from the actual repo, not what is newest. Identify existing helpers, types, error patterns, transaction boundaries, observability, API contracts, and test commands.
59
+ - Read relevant open issues/PRs when available to avoid duplicates or fighting in-flight changes. Do not require network access to proceed when unavailable.
60
+ - Record working tree status; do not overwrite user changes, reset, stash, or modify unrelated files without authorization.
61
+ - Run an appropriate baseline build/test if feasible; label any existing failure as baseline, not caused by this change.
62
+ - For new projects, services, components, or SDK integrations, identify the official installer, CLI generator, and canonical starter boilerplate before writing code. Do not manually assemble configurations or directory trees from memory. Never generate unprompted documentation files, submission dossiers, or speculative third-party platform guides.
63
+
64
+ ### Gate 1: Establish a change contract
65
+
66
+ Before editing, note: **what changes, what must not change, business invariants, external APIs, expected failures, data impacts, security implications, rollback plan, and proof requirements.** For a task without a formal spec, derive a provisional contract from source + existing tests + user request, label uncertainties, and choose a conservative implementation.
67
+
68
+ Create a tiny scope plan: target files, candidate reuse, test points, risk areas. Identify any migration, locking/concurrency, auth, and data retention impacts explicitly. Ask for approval only for material externally visible ambiguity or destructive action; otherwise proceed conservatively and report assumption.
69
+
70
+ ### Gate 2: Lock the baseline tests without freezing legitimate evolution
71
+
72
+ - Inspect existing regression tests **before implementation**. Prefer independently specified expected outcomes.
73
+ - On bug fixes, write a failing reproduction first where practical. On new behavior, write tests for the agreed contract before implementation where practical.
74
+ - Existing assertions/fixtures/snapshots are protected: if a test fails after a change, investigate implementation/regression first. Never weaken assertions, rewrite golden values, remove coverage, mark skipped/xfail, or add exclusions merely to get green.
75
+ - Existing tests *may* change when the approved behavior genuinely changes, an assertion was incorrect, or a justified test refactor is necessary. Explain **old contract -> new contract**, cite the authority, show before/after behavior, and obtain independent review on semantics.
76
+ - Do not blindly ban test edits or insist on unit tests for every I/O interaction. Select unit/integration/contract/E2E based on risk. See [test integrity](references/test-integrity.md).
77
+
78
+ ### Gate 3: Implement with minimum justified complexity
79
+
80
+ - **Official tooling over manual scaffolding:** When initializing an application, module, or SDK integration, invoke the official CLI installer / starter generator rather than manually typing out build configurations (`tsconfig.json`, `package.json`, `pyproject.toml`, Dockerfiles, etc.).
81
+ - **Strict latest stable dependency pinning:** When adding new dependencies or SDKs, always query the package manager or registry to install the latest stable release (e.g. `bun add <pkg>@latest`, `uv add <pkg>`). Pin versions strictly in manifests and generate valid lockfiles; never rely on pre-cutoff memory.
82
+ - **Frontend taste & zero dev-notes leakage:**
83
+ - Strip out all internal developer/agent annotations, reminders, or mock warnings (`"TODO: Wire backend"`, `"Note: Mock data"`, `"Agent notice:"`) from user-visible DOM/JSX.
84
+ - Practice visual restraint: prevent crowded navbars, multi-row icon spam, or redundant controls in headers. Maintain clean visual hierarchy, balanced padding, and purposeful negative space.
85
+ - Enforce concise microcopy: avoid walls of explanatory text, repetitive instructions for obvious user actions, and defensive disclaimers. Every string in the UI must be concise and production-grade.
86
+ - **Anti-logorrhea in code & interfaces:** Avoid writing unnecessary boilerplate, sprawling repetitive wrappers, or comments that merely narrate obvious syntax. Never bloat code or copy just to feel comprehensive.
87
+ - **Zero-obviousness & anti-truism:** Reject code comments that narrate obvious syntax (`// return response`, `// increment i`, `// check if null`), tautological docstrings that merely restate symbol names, patronizing UI microcopy under obvious inputs (`"Please enter your email"` under an Email field), and documentation padded with trivial prerequisite truisms ("requires internet and keyboard"). High engineering discipline favors silence over noise.
88
+ - Modify the existing abstraction whenever it fits; do not add parallel services, helpers, frameworks, compatibility layers, or configurable interfaces without a current need.
89
+ - Keep business logic separate from transport and presentation when supported by the architecture; avoid both god objects and needless micro-files.
90
+ - Use existing dependencies and repo conventions. New dependency requires clear functionality, maintenance, license, security, and bundle/runtime case.
91
+ - Maintain error semantics, resource cleanup, cancellation, idempotency, state isolation, data validation, correct authorization, transactions, and backwards compatibility where required.
92
+ - Avoid broad formatting/restructuring in functional PRs; remove incidental scaffolding that adds no value. Do not delete working behavior to make the diff smaller.
93
+
94
+ ### Gate 4: Verify beyond green tests
95
+
96
+ - Run targeted tests and impacted full-suite checks supported by repo; report commands and outcomes verbatim or as reproducible summaries.
97
+ - Inspect changed tests against the baseline; manually verify independently expected outcomes. Test the old failure, the new behavior, negative paths, and nearby regressions.
98
+ - Exercise boundary tests relevant to change: contract/integration, concurrency, migrations, browser flow, performance, security and accessibility where applicable. Prefer real integration evidence over test doubles at critical seams.
99
+ - Treat test coverage, lint, snapshot updates, and static-scan results as *signals*, never proof. Use mutation tests for fragile business rules when available.
100
+ - If tools/environment prevent verification, say **NOT VERIFIED**; list exact blockers and do not claim completion.
101
+
102
+ ### Gate 5: Audit the diff as a skeptical reviewer
103
+
104
+ Run `git diff --check` and inspect `git diff --stat`, changed files, changed assertions, added dependencies, config, and documentation. Triage can be executed via high-performance native Rust/Go microservices or portable Python scripts:
105
+
106
+ ```bash
107
+ # Native Rust Engine (SHIT Boundary Interceptor & Senior Dev Ladder):
108
+ bunx anti-slop-engineering rust triage
109
+ bunx anti-slop-engineering rust shit-check --diff patch.diff
110
+
111
+ # Go High-Throughput SRE Engine (KISS nesting, DRY token window, Toil & Error Budget):
112
+ bunx anti-slop-engineering toil audit
113
+ bunx anti-slop-engineering toil stream
114
+
115
+ # Zero-dependency Python Core Fallback:
116
+ python scripts/diff_guard.py --base HEAD --json
117
+ python scripts/sre_guard.py --base HEAD --strict --json
118
+ ```
119
+
120
+ Replace `origin/main` with your actual target branch; if unavailable, compare with a known commit using `--base HEAD`. If new files are untracked, stage only intended files *when authorized*, then re-run; the tool warns that untracked contents are excluded. **Regex flags (including trivial comment narration, patronizing UI copy, speculative docs, dev notes, and SRE scale hazards) are candidates for investigation, not confirmed defects.** The tool neither runs tests nor performs SAST.
121
+
122
+ Ask explicitly: Could a smaller design do the same thing (KISS)? Did I create two sources of truth (DRY)? Are all parameters and options actively used (YAGNI)? Will retries trigger thundering herds or retry storms under scale (SCALE)? Did I silently expand scope?
123
+
124
+ ### Gate 6: Evidence and release decision
125
+
126
+ Use [PR review protocol](references/pr-review.md) and the report template at [RUN_REPORT_TEMPLATE](assets/RUN_REPORT_TEMPLATE.md).
127
+
128
+ - **BLOCK:** demonstrated critical regression; authorization/security/privacy failure; disabled or falsified tests without approved change contract; broken build; destructive migration without safety plan.
129
+ - **REWORK:** meaningful duplication, needless architecture, unjustified new dependency, test-only-for-implementation, unexplained contract drift, unreviewable mixed changes.
130
+ - **REVIEW:** large coherent changes, cosmetic smells, static heuristics, deliberate test updates or exceptions requiring context.
131
+ - **PASS:** requirements met with observable evidence; no unresolved BLOCK or REWORK, risks and exceptions documented. PASS is not a warranty.
132
+
133
+ Before proposing merge, report: intent, changed files, exact test evidence, baseline test delta, remaining uncertainty, findings, and decision. Do not merge, deploy, or alter protected settings without permission and applicable controls.
134
+
135
+ ## Non-negotiable anti-cheating rules
136
+
137
+ - Do not change a test's expected output to match the observed buggy output unless the new output is explicitly authorized by product contract.
138
+ - Do not delete, skip, xfail, downgrade, mock away, or suppress a failing test to conceal a failure.
139
+ - Do not use fake logs, fabricated benchmarks, imagined browser screenshots, test results, or invented source references.
140
+ - Do not weaken lint/type/security/branch protection/CI policies simply to achieve success.
141
+ - Do not modify lockfiles, dependencies, formatting, codegen, database schemas, or test fixtures as collateral damage.
142
+ - Do not replace a targeted fix with a full rewrite without evidence and scope approval.
143
+ - Do not manually scaffold project skeletons or hand-stitch configuration files when official language, framework, or SDK installers and boilerplates are available.
144
+ - Do not pin outdated, deprecated, or guessed dependency versions from model training memory; always resolve and enforce the latest stable version from the official registry.
145
+ - Do not render developer notes, agent reminders, mock disclaimers, or architectural apologies into user-facing JSX/HTML views.
146
+ - Do not overcrowd headers, navbars, or dashboards with uncurated icons, redundant buttons, or gratuitous widgets that lack visual hierarchy.
147
+ - Do not bloat UI copy with walls of explanatory text, defensive disclaimers, or verbose narration of obvious UI controls.
148
+ - Do not write trivial syntax-narration comments (e.g. `// return result`, `// increment counter`, `// check null`) or tautological docstrings that merely restate symbol names.
149
+ - Do not add patronizing UI microcopy or obvious instructional labels underneath self-evident controls (e.g. `"Please enter your email"`, `"Click here to submit"`).
150
+ - Do not pad documentation, READMEs, or setup guides with obvious truisms, trivial prerequisite lists, or tautological summaries.
151
+ - Do not violate the Direct Payload Invariant: never write affordance narration (explaining how to click, expand, play, scroll, or copy standard controls), conversational preambles ("The following section discusses..."), bilingual title-stacking (e.g. `Term · الترجمة`), buzzword inflation (calling screencasts "Live Interactive Demos"), or mechanical hand-holding in documentation and code.
152
+ - Do not generate speculative submission dossiers (e.g., `docs/*SUBMISSION*.md`, `docs/*DOSSIER*.md`) or invent publishing guides for unrequested third-party platforms.
153
+ - Do not cite dead, deprecated, or hallucinated platform URLs (e.g., `platform.openai.com/plugins`).
154
+ - Do not sprawl the repository with ceremonial markdown files or pad READMEs with marketing filler, fake prompt examples, or repetitive note callouts.
155
+ - Do not use arbitrary `sleep()` or hardcoded delay loops as a synchronization band-aid for async races or flaky tests.
156
+ - Do not retry failing network operations without exponential backoff and randomized full jitter.
157
+ - Do not spawn unbounded parallel tasks, workers, or promises without explicit concurrency limiters or backpressure signals.
158
+ - Do not swallow errors silently with empty `except: pass` or `catch {}` blocks without structured logging or metric counters.
159
+ - Do not introduce speculative parameters (`_unused_param`, `future_kwargs`), dead feature toggles (`if False:`), or unreferenced extension points.
160
+ - Do not duplicate domain invariants, validation rules, or error models across multiple modules; maintain a single authoritative source of truth.
161
+ - Do not over-restrict legitimate design: duplication in readable tests can be preferable to an unreadable abstraction, and a larger implementation can be necessary for correct safety boundaries.
162
+
163
+ ## Deliverable contract
164
+
165
+ For each implementation/review, produce a concise report in this order: **Outcome; Scope; Behavior preserved/changed; Verification (commands + results); Findings with exact file/line; Test modifications with rationale; Risks/limitations; Merge recommendation.** If available, distinguish baseline failures from new failures. Use `NOT RUN` and `UNKNOWN` literally when applicable.
166
+
167
+ The [catalog](references/anti-pattern-catalog.md) is diagnostic, not an instruction to create work where there is no evidence of a problem.
@@ -0,0 +1,23 @@
1
+ ## What changed / why
2
+ <!-- Explain observable behavior and the simplest chosen approach. -->
3
+
4
+ ## Scope & compatibility
5
+ - [ ] Change is one coherent review unit or larger scope is justified
6
+ - [ ] Existing consumers and old contracts assessed
7
+ - [ ] Unrelated refactors/dependency/config churn excluded or justified
8
+
9
+ ## Tests and independent evidence
10
+ - [ ] Baseline test result captured (or reason not possible)
11
+ - [ ] Existing assertions/snapshots modified? If yes, old vs new contract and approval shown
12
+ - [ ] Reproduction test first for bug fixes where practical
13
+ - [ ] Negative / edge / integration paths tested as appropriate
14
+ - [ ] Exact test commands and results listed; no invented passes
15
+ - [ ] No test skips/coverage exclusions/policy suppression to make CI pass
16
+
17
+ ## Engineering & safety
18
+ - [ ] Reviewed permissions, data consistency, retries, concurrency and cleanup where relevant
19
+ - [ ] Reviewed dependencies, migrations, compatibility, rollback and instrumentation where relevant
20
+ - [ ] Evidence-backed findings resolved or documented
21
+
22
+ ## Remaining uncertainty / reviewer guidance
23
+ <!-- Flag risks, unverified environment assumptions, and review hotspots. -->
@@ -0,0 +1,39 @@
1
+ # Anti-Slop Engineering: Execution Evidence
2
+
3
+ **Mode:** BUILD / FIX / REVIEW / CLEANUP
4
+ **Scope:** <task and PR link, if any>
5
+ **Base / HEAD:** <commits>
6
+ **Decision:** BLOCK / REWORK / REVIEW / PASS / NOT VERIFIED
7
+
8
+ ## Intent and contract
9
+ - Requested behavior:
10
+ - Preserved behavior / invariants:
11
+ - Explicitly authorized behavior changes:
12
+ - Out of scope:
13
+
14
+ ## Diff overview
15
+ - Changed files:
16
+ - Added / removed lines:
17
+ - New dependencies / migrations / policies:
18
+ - Why this is a coherent review unit:
19
+
20
+ ## Test integrity
21
+ - Existing assertion / snapshot changes:
22
+ - Independent oracle / authority:
23
+ - Red-state proof (bug fixes):
24
+ - New negative / boundary tests:
25
+
26
+ ## Verification evidence
27
+ | Command / method | Result | Evidence / limitation |
28
+ |---|---|---|
29
+ | | PASS / FAIL / NOT RUN | |
30
+
31
+ ## Findings
32
+ | Severity | File:line | Proof / impact | Correction / exception |
33
+ |---|---|---|---|
34
+ | | | | |
35
+
36
+ ## Risk & handoff
37
+ - Unverified assumptions / environment gaps:
38
+ - Follow-up risks and rollback:
39
+ - Merge/deploy approval requirements: