← ClaudeAtlas

violation-sweeplisted

Scans source and .claude/ files for anti-pattern violations, applies the top mechanical fixes, and reports pre/post counts.
e128/dotnet-reference · ★ 2 · Data & Documents · score 74
Install: claude install-skill e128/dotnet-reference
# Violation Sweep Scan for anti-pattern violations, apply mechanical fixes, and report counts. ## Steps ### 1. Pre-fix scan ```bash scripts/violation-scan.sh --json # source (src/) only scripts/violation-scan.sh --claude --json # also scan .claude/skills + .claude/agents ``` Pass `--claude` when the skill was invoked with `--claude`. Parse the JSON: - `violations` — overall count - `by_pattern` — object keyed by pattern name; each has `{count, reason, files}` Sort pattern entries by `count` descending. If `violations == 0`: emit "No violations found." and stop — skip Steps 2–4. ### 2. Fix top mechanical categories (or --dry preview) For the top 3 patterns by count, apply the fix described in each pattern's `reason` field. These are mechanical, one-line substitutions: | Pattern | Fix | |---------|-----| | `datetime-now` | Inject `TimeProvider` via DI; use `timeProvider.GetUtcNow()` | | `new-httpclient` | Inject `IHttpClientFactory`; use `factory.CreateClient()` | | `async-void` | Change return type to `async Task` (except event handlers) | | `sync-over-async` | `await` the task instead of `.Result` / `.GetAwaiter().GetResult()` | For each file in the pattern's `files` list: Read it, apply the fix with Edit. **If `--dry` was passed:** report the files and intended fix per pattern, then stop — skip Steps 3 and 4. ### 3. Post-fix scan (normal mode only) Re-run the same scan command from Step 1 and capture the post-fix total. ### 4. Show the diff, then stage