De Sloppify

codewithmukesh/dotnet-claude-kit/skills/de-sloppify

作者 codewithmukesh23300897f4d1無授權條款754 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 個月前更新

Systematic code cleanup pipeline for .NET projects. Runs 7 ordered steps: formatting, unused usings, analyzer warnings, dead code removal, TODO resolution, sealed class audit, and CancellationToken propagation. Each step is verified independently with tests between phases. Load this skill when: "clean up", "de-sloppify", "tidy up", "remove dead code", "code cleanup", "housekeeping", "tech debt", "fix warnings", "seal classes", "add CancellationToken", "unused usings", "format code".

AI 產生的概覽

執行有序且逐步驗證的 .NET 七步程式碼清理流程,每一步都建置、測試並單獨提交。

功能
引導代理執行七步 .NET 清理流程:格式化、清除未使用的 using、修正分析器警告、移除無用程式碼、處理 TODO、密封未被繼承的類別,以及傳遞 CancellationToken。每一步都以 dotnet build 和 dotnet test 驗證並單獨提交,刪除前還會檢查反射、相依性注入慣例和序列化用法。最終產出逐步提交記錄,以及一份列出變更與受影響檔案的清理報告表。各步驟指令、安全檢查清單與範例位於 references/cleanup-steps.md。
適用情境
適用於程式碼庫整理情境,例如完整清理、提交 PR 前的快速整理、合併或相依套件升級後的警告清理、發行前強化,以及技術債衝刺。它應與功能開發分開進行,以保持清理提交的單純性。
執行需求
需要 .NET 專案與 dotnet CLI(dotnet format、dotnet build、dotnet test),以及用於診斷、無用程式碼、型別階層和反模式偵測的 MCP 工具。此技能不附帶指令碼,依賴內附的 references/cleanup-steps.md,並可將結構性步驟交由 refactor-cleaner 代理執行。

/de-sloppify — 7-Step Cleanup Pipeline

What

Runs an ordered, verified cleanup pipeline over a .NET codebase. Order matters: formatting first (it touches every file — get the churn out of the way before anything else), dead code late (earlier steps reveal it). Random cleanup misses things and creates merge conflicts; the pipeline doesn't.

Three rules make it safe:

  1. Verify after each step — dotnet build + dotnet test between steps. A cleanup that breaks something is worse than the mess it was fixing.
  2. Commit per step — each step is its own commit, so a bad Step 4 reverts without losing Steps 1-3.
  3. Safe removals only — before deleting "dead" code, check for reflection, DI-convention, and serialization usage that Roslyn cannot see.

Per-step commands, safety checklists, and code examples live in references/cleanup-steps.md — read it before executing.

When

  • "Clean up", "tidy up", "de-sloppify", "housekeeping", "tech debt"
  • After a large feature merge or dependency upgrade (new warnings accumulate)
  • Pre-release hardening, or a scheduled quarterly cleanup sprint
  • Before performance work (dead code out, classes sealed for devirtualization)
  • Never mixed with feature work — cleanup commits stay pure

How

Step 0: Pick the Steps

ScenarioSteps to run
Full cleanup pass / pre-release / quarterlyAll 7
Quick tidy before PR1, 2, 6
After large feature merge1, 2, 3, 4
After dependency upgrade2, 3
Before performance work4, 6
CI warning threshold exceeded3 only
Tech debt sprint4, 5

Steps 1-7 (execute in order, details in references/cleanup-steps.md)

#StepToolCommit message
1Format all codedotnet formatchore: apply dotnet format
2Remove unused usingsdotnet format analyzers --diagnostics IDE0005chore: remove unused using statements
3Fix analyzer warningsMCP get_diagnostics → triage by categorychore: fix analyzer warnings
4Remove dead codeMCP find_dead_code + safety check (reflection/DI/serialization grep)chore: remove dead code
5Resolve TODOsgrep TODO/HACK/FIXME → fix, file issue, or deletechore: resolve TODO comments
6Seal non-inherited classesMCP get_type_hierarchy per candidate + test-project grepchore: seal non-inherited classes
7Propagate CancellationTokenMCP detect_antipatterns → trace async chainschore: propagate CancellationToken through async chains

After every step: dotnet build + dotnet test, then commit. If a step breaks the build or tests, fix or revert that step before continuing — never carry a red state into the next step. Delegate structural steps (4, 6, 7) to the refactor-cleaner agent.

Final Report

markdown
## De-Sloppify Report
| Step | Changes | Files Affected ||------|---------|----------------|| 1. Format | Applied consistent formatting | 23 files || 2. Usings | Removed 47 unused usings | 18 files || 3. Analyzers | Fixed 12 warnings (8 nullability, 3 unused vars, 1 obsolete) | 9 files || 4. Dead Code | Removed 3 unused types, 5 unused methods | 6 files || 5. TODOs | Fixed 2, created issues for 3, removed 1 stale | 5 files || 6. Sealed | Sealed 14 classes | 14 files || 7. CancellationToken | Added propagation to 8 async chains | 11 files |
**Total: 7 commits, 86 files improved**

Example

User: /de-sloppify — full pass before the release
Claude: Running the 7-step pipeline...
Step 1: dotnet format — 23 files reformatted. Build + tests green. Committed.Step 2: IDE0005 — 47 unused usings removed across 18 files. Green. Committed.Step 3: 12 warnings triaged: 8 nullability fixed with null checks,  3 unused vars removed, 1 CS0618 migrated off the obsolete API. Committed.Step 4: find_dead_code → 9 candidates. Safety check: PaymentProcessor is  registered via DI convention — kept. Removed 3 types, 5 methods. Committed.Step 5: 6 TODOs → 2 fixed, 3 became issues (#141-#143), 1 stale removed. Committed.Step 6: 14 classes sealed (2 skipped: xUnit fixture base, virtual members). Committed.Step 7: 8 async chains now propagate ct end-to-end. Committed.
7 commits, 86 files improved. Full report above.

Related

  • references/cleanup-steps.md — per-step commands, safety checks, examples
  • /verify — run the full verification pipeline after cleanup
  • /health-check — re-grade the project to quantify the improvement
  • /code-review — cleanup handles style; review handles logic and design

來源與署名

來源:codewithmukesh/dotnet-claude-kit位於skills/de-sloppify提交2330089

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架

更多來自 codewithmukesh/dotnet-claude-kit 的技能

Wrap Up

codewithmukesh

在 session 結束時把已完成工作、待辦事項與經驗寫入交接檔案,並在 session 開始時重新載入。

Productivity & Workflow7542 個月前更新

Workflow Mastery

codewithmukesh

Claude Code workflow mastery for .NET developers. Covers parallel execution with git worktrees, plan mode strategy, verification loops, auto-formatting hooks, permission setup for dotnet CLI, prompting techniques, subagent patterns, and context discipline — token budget management, MCP-first navigation, lazy loading, and subagent isolation — all adapted for the .NET ecosystem. Load this skill when setting up Claude Code for a .NET project, optimizing workflows, running parallel sessions, when context is running low or sessions feel sluggish, when exploring a large codebase efficiently, or when the user mentions "productivity", "workflow", "parallel", "worktree", "plan mode", "permissions", "hooks", "10x", "setup Claude Code", "speed up development", "context", "tokens", "budget", "running out of context", "too many files", or "large codebase". Inspired by tips from Boris Cherny (creator of Claude Code) and the Anthropic team.

待分類7542 個月前更新

Vertical Slice

codewithmukesh

指導 .NET 開發者以垂直切片架構組織應用程式,涵蓋功能資料夾、端點分組與處理常式模式。

Software Development7542 個月前更新

Testing

codewithmukesh

Testing strategy for .NET 10 applications. Covers xUnit v3, WebApplicationFactory for integration tests, Testcontainers for real database testing, Verify for snapshot testing, and the AAA pattern. Load this skill when writing tests, setting up test infrastructure, reviewing test coverage, or when the user mentions "test", "xUnit", "WebApplicationFactory", "Testcontainers", "integration test", "unit test", "bUnit", "snapshot test", "Verify", "test coverage", "AAA pattern", "WireMock", or "FakeTimeProvider".

待分類7542 個月前更新

Tdd

codewithmukesh

Guided test-driven development workflow for .NET 10 using xUnit v3, WebApplicationFactory, Testcontainers, and Verify snapshots. Follows the strict red-green-refactor cycle. Use when: "TDD", "test-driven", "let's TDD this", "red green refactor", "write the test first", or when building a feature with clear acceptance criteria.

待分類7542 個月前更新

Spec

codewithmukesh

透過結構化提問,把模糊的功能想法轉化為雙方確認並持久化的規格文件。

Productivity & Workflow7542 個月前更新