| name | resharper-safe-cleanup |
| description | Run JetBrains ReSharper CLI `jb cleanupcode` with the repository's narrow, versioned cleanup profile to apply safe automated cleanup edits such as removing unused `using` directives, shortening redundant qualified references, and removing redundant XAML namespace aliases. Use when the user wants ReSharper-driven cleanup changes rather than a dead-code report or a broad style rewrite. |
ReSharper Safe Cleanup
Use this skill to run the repository's committed cleanupcode profile while keeping the edit scope intentionally narrow.
Preconditions
- Require
jb on PATH; verify it with a command lookup, not jb --version. On PowerShell use Get-Command jb -ErrorAction SilentlyContinue; on other shells use where jb or command -v jb.
- Do not install ReSharper CLI tools yourself unless the user explicitly asks.
- If
jb is missing, stop and tell the user that JetBrains ReSharper Command Line Tools are required. Suggest:
- Require a solution-shared
.DotSettings file next to the target .sln. This skill assumes the cleanup profile is versioned in VCS, not stored only in Rider user settings.
- Build the target solution before cleanup so
cleanupcode can resolve symbols. For this repo, run dotnet build Clever.TokenMap.sln.
- Do not use this skill for broad style normalization, dead-code triage, or semantic refactors. Use
resharper-unused-code for inspectcode dead-code reporting.
Execution
- Run
python .codex/skills/resharper-safe-cleanup/scripts/run_safe_cleanup.py from the repository root.
- Pass
--solution <path> when the repo has multiple .sln files.
- Pass
--profile <name> only when the committed profile is not named Safe Cleanup.
- Use
--include / --exclude to scope cleanup when the user wants only part of the tree.
- Use
--dry-run to validate the resolved solution, settings, profile, and command without editing files.
- Read
.artifacts/resharper-safe-cleanup/cleanup-summary.md first.
- Review
git diff, then run the repo's normal verification and commit only after the cleanup result is acceptable.
Profile Contract
The orchestrator script intentionally rejects cleanup profiles that enable tasks outside this narrow allowlist:
CSOptimizeUsings
CSShortenReferences
Xaml.RemoveRedundantNamespaceAlias
This keeps the skill aligned with "unused usings + redundant qualifiers" cleanup and prevents accidental full-style rewrites through a broader profile.
Keep the Rider option Embrace 'using' directives in region turned off inside that profile. Configure that in the profile itself rather than expecting the script to compensate for it.
Output Files
The orchestrator writes:
.artifacts/resharper-safe-cleanup/cleanup-summary.md
.artifacts/resharper-safe-cleanup/cleanup-summary.json
.artifacts/resharper-safe-cleanup/cleanup-command.txt
Response Shape
When reporting results:
- State the exact solution, settings file, and profile used.
- Link the summary path.
- Summarize the cleanup scope and mention whether the profile stayed within the safe allowlist.
- Tell the user to review
git diff and run verification before committing.
Manual Fallback
If the orchestrator script is unsuitable, run:
jb cleanupcode --settings="<solution>.sln.DotSettings" --profile="Safe Cleanup" "<solution>.sln"
Build the solution first, and keep the profile narrow.