# Dart Cleanup

> Orchestrates specialized Dart refactoring, code quality, testing, and modern language features on demand. Use when cleaning up, modernizing, refactoring, or optimizing Dart code. Don't use for non-Dart projects or general codebase search.

- Skill: `kevmoo/dart-cleanup` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kevmoo/dart-cleanup`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kevmoo/dart-cleanup/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: kevmoo (https://skillmd.com/u/kevmoo)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kevmoo/dart-cleanup

---


# 🎯 Dart Cleanup & Refactoring Router

> [!NOTE]
> **Personal Environment Router**: This skill is optimized for `@kevmoo`'s local development environment and assumes specialized skills are checked out under `~/github/kevmoo/` and `~/github/dart-lang/`. Other users should clone the required repositories or adapt the catalog paths in [Skill Catalog](#-skill-catalog) to match their local layout.

Orchestrates specialized Dart workflows from local GitHub checkouts without pre-loading heavy individual skills into static prompt memory.

---

## 🛠️ Operating Protocol

### 1. Intent Evaluation & Confidence Matching (Strict Single-Skill Target)

When invoked with text (e.g. `/dart-cleanup convert expect matchers to checks`), evaluate the input against the [Skill Catalog](#-skill-catalog) using this 3-tier confidence decision tree:

* **Tier 1: Unambiguous Clear Match (High Confidence / 90%+ sure)**
  * Exactly 1 skill in the catalog clearly maps to the requested transformation.
  * *Action*:
    1. Check for the target `SKILL.md` at its candidate path in `~/github/`.
    2. If missing, output the [Missing Checkout Safety Net](#missing-checkout-safety-net).
    3. If present, call `view_file` on the target `SKILL.md`, hydrate its untruncated instructions into active context, and execute the refactoring immediately.
* **Tier 2: Uncertain / Close Match (Medium Confidence)**
  * A skill seems close or relevant, but there is ambiguity.
  * *Action*: Stop and ask the user for confirmation before hydrating:
    > *"I think you might mean **`<skill-name>`** ([SKILL.md](file:///path/to/SKILL.md)). Would you like me to load and run this workflow?"*
* **Tier 3: No Clear Match or Bare Invocation (Low Confidence / Empty Input)**
  * No skill matches the prompt, or `/dart-cleanup` was invoked with no arguments.
  * *Action*: Output:
    > *"I couldn't find an unambiguous skill match for your request. Here is the catalog of available specialized Dart skills:"*
    Render the categorized [Skill Catalog](#-skill-catalog) with clickable `file://` links so the user can choose.

### 2. Missing Checkout Safety Net
If a target `SKILL.md` is selected but missing from the local filesystem, output:
> ⚠️ **Missing local checkout**: Target skill `<skill-name>` was not found at `~/github/...`. Please ensure `https://github.com/<org>/<repo>` is cloned into `~/github/`.

---

## 📋 Skill Catalog & Path Priority

### A. Refactoring & Code Quality
* **`dart-cognitive-complexity`**: Reduces cognitive complexity, nested loops, and deep conditionals via pattern matching & guard clauses. Includes a gated Tier 3 method-object reference for extreme cases.
  * *Path*: [SKILL.md](file://~/github/kevmoo/analytica.dart/skills/dart-cognitive-complexity/SKILL.md)
* **`dart-undead`**: Audits, triages, and safely remediates unreachable and dead declarations in Dart and Flutter codebases using deterministic reachability analysis (`pkg:undead`).
  * *Path*: [SKILL.md](file://~/github/kevmoo/analytica.dart/skills/dart-undead/SKILL.md)
* **`dart-dedupe`**: Detects, audits, and safely remediates structural code duplication across Dart and Flutter repositories using the standalone Dedupe engine (`pkg:dedupe`) and empirical test gating.
  * *Path*: [SKILL.md](file://~/github/kevmoo/analytica.dart/skills/dart-dedupe/SKILL.md)
* **`dart-build-cli-app`**: CLI entrypoint structure, argument parsing, cross-platform scripts, exit codes.
  * *Path*: [SKILL.md](file://~/github/dart-lang/skills/skills/dart-build-cli-app/SKILL.md)

### B. Language Modernization & Formatting
* **`dart-best-practices`**: Effective Dart guidelines, class design, null safety, and general style.
  * *Path*: [SKILL.md](file://~/github/kevmoo/dash_skills/skills/dart-best-practices/SKILL.md)
* **`dart-modern-features`**: Records, pattern matching, switch expressions, extension types, class modifiers.
  * *Path*: [SKILL.md](file://~/github/kevmoo/dash_skills/skills/dart-modern-features/SKILL.md)
* **`dart-multiline-strings`**: Converts consecutive print statements & string concatenations into triple-quoted strings.
  * *Path*: [SKILL.md](file://~/github/kevmoo/dash_skills/skills/dart-multiline-strings/SKILL.md)
* **`dart-long-lines`**: Formats code to adhere to the 80-column line limit (`lines_longer_than_80_chars`).
  * *Path*: [SKILL.md](file://~/github/kevmoo/dash_skills/skills/dart-long-lines/SKILL.md)

### C. Testing & Assertions
* **`dart-migrate-to-checks-package`**: Converts legacy `expect(a, equals(b))` matchers to modern `package:checks` syntax (`check(a).equals(b)`).
  * *Path*: [SKILL.md](file://~/github/dart-lang/skills/skills/dart-migrate-to-checks-package/SKILL.md)
* **`dart-use-pattern-matching`**: Refactors complex conditionals and destructuring to idiomatic Dart 3 pattern matching.
  * *Path*: [SKILL.md](file://~/github/dart-lang/skills/skills/dart-use-pattern-matching/SKILL.md)
* **`dart-test-fundamentals`**: Core `package:test` practices, grouping, `setUp`/`tearDown` lifecycles, and `dart_test.yaml`.
  * *Path*: [SKILL.md](file://~/github/kevmoo/dash_skills/skills/dart-test-fundamentals/SKILL.md)
* **`dart-matcher-best-practices`**: Best practices for legacy `package:matcher` assertions.
  * *Path*: [SKILL.md](file://~/github/kevmoo/dash_skills/skills/dart-matcher-best-practices/SKILL.md)
* **`dart-collect-coverage`**: Collecting coverage using `package:coverage` and creating LCOV reports.
  * *Path*: [SKILL.md](file://~/github/dart-lang/skills/skills/dart-collect-coverage/SKILL.md)


