modrexio/modrex / .agents/skills/danger-audit
danger-audit
VerifiedAudit a diff for the five dangerous AI patterns
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.3 KB |
SKILL.md
View on GitHub---
name: danger-audit
description: Audit a diff for the five dangerous AI patterns
---
# danger-audit
Use this skill before finishing any non-trivial AI-assisted code change.
These patterns can hide bugs or break Modrex-specific behavior. They are stricter than a general style review.
## Target
Default to `git diff HEAD`.
If the user provides a path, branch, or file, audit that target.
## The five blockers
A change is not ready if it introduces one of these without a strong project-specific reason:
1. Silent catch / silent fallback
2. Generic helpers replacing game-specific logic
3. Defensive checks that hide broken invariants
4. Deep `if`/`else` nesting
5. Fake abstractions / speculative future-proofing
Read `.agents/rules/ai-danger-patterns.md` for full examples.
---
## 1. Silent catch / silent fallback
Block:
```ts
catch { return }
catch { return [] }
return data ?? [] // when this hides a failed load, parse, or install
```
Ask:
- Is the fallback a correct domain result?
- Would this make the UI lie?
- Would this hide a filesystem, IPC, archive, or network failure?
- Can the caller show a useful error instead?
Accept only when the fallback is genuinely optional (missing thumbnail, cache miss).
---
## 2. Generic helpers replacing game-specific logic
Block helpers that collapse game-specific behavior into generic behavior.
Danger signs:
- function names like `getModsPath`, `getGamePath`, `processGame`, `handleLoader`
- helpers that assume all games use the same `Mods` convention
- removal of explicit `payday2`, `payday3`, `pdth`, or `crimeboss` branching
- "cleanup" that makes code shorter by deleting domain cases
Ask:
- Which game-specific invariants existed before?
- Are all loaders still handled?
- Are Steam, Epic, Xbox, and legacy layouts still handled where relevant?
---
## 3. Defensive checks hiding broken invariants
Block defensive checks inside trusted code paths.
Danger signs:
- changing `InstalledMod` to `InstalledMod | null | undefined`
- returning `null` instead of fixing the caller
- `if (!value) return` deep inside business logic
- optional chaining added everywhere
- `?? ""`, `?? []`, `?? false` used to silence type errors
Ask:
- Is this value allowed to be missing by design?
- Should this be validated at a boundary instead?
- Is the type wrong?
---
## 4. Deep `if`/`else` nesting
Block new nested pyramids.
Danger signs:
- more than two levels of `if`
- `else` after `return`, `throw`, `continue`, or `break`
- happy path indented inside validation branches
- side effects hidden inside nested branches
Fix with: guard clauses, early returns, named booleans, smaller functions, `switch` for exclusive domain cases.
---
## 5. Fake abstractions / speculative future-proofing
Block abstractions that are not needed now.
Danger signs:
- `Manager`, `Service`, `Factory`, `Adapter`, `Strategy`, `Handler` added for one use
- options like `dryRun`, `force`, `silent`, `experimental`, `mode`
- new layers around existing direct code
- broad interfaces with one implementation
Ask:
- Does this remove real duplication?
- Does this name a real domain concept?
- Would inline code be clearer?
---
## Output format
```md
## Danger audit
### Blockers
- ...
### Cleanups
- ...
### Accepted
- ...
### Recommended next step
...
```
If clean:
```md
## Danger audit
No blocker-level AI danger patterns found.
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |