cmd/sgai/skel/.sgai/skills/code-cleanup/SKILL.md
Clean up generated code by questioning why things are there and cross-referencing with GOAL.md, even when tempted to skip due to time pressure or thinking it's "good enough". After generating code, when tempted to commit messy code, or when noticing clutter that could be removed.
npx skillsauth add sandgardenhq/sgai code-cleanupInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Review generated code, question the purpose of each part, cross-reference with GOAL.md, and remove or simplify based on good taste and necessity. Do not skip cleanup even if the code is working - cleanup ensures maintainability and alignment with goals.
Even working code benefits from cleanup:
Do not skip cleanup if you notice:
| Excuse | Reality | |--------|---------| | "It's working, not critical" | Working code still needs cleanup to prevent confusion and debt. | | "Wait until review" | Reviews should focus on design, not cleanup. Do it now. | | "I have plans/dinner/end of day" | Cleanup is quick (20 min) and improves quality. | | "Review will catch it" | Proactive cleanup is better than reactive fixes. | | "Being pragmatic over perfection" | Cleanup is pragmatic - it saves time later. | | "Code is functional, tested" | Functional code still benefits from cleanup to maintain standards. | | "Minor issues don't break anything" | Minor issues accumulate into major problems over time. | | "Exhausted, prevent burnout" | Short cleanup prevents long-term fatigue from messy code. | | "Tomorrow's fresh perspective" | Delaying cleanup often means it never happens. | | "Low-impact technical debt" | All technical debt compounds; start small fixes now. |
A name has two goals:
After a name has accomplished those goals, any additional characters are dead weight.
If your language has a static type system, users usually know the type of a variable. Redundant type information in names is clutter.
// Bad:
String nameString;
List<DateTime> holidayDateList;
Map<Employee, Role> employeeRoleHashMap;
// Better:
String name;
List<DateTime> holidays;
Map<Employee, Role> employeeRoles;
For method names, don't describe parameters or types - the parameter list does that:
// Bad:
mergeTableCells(List<TableCell> cells)
// Better:
merge(List<TableCell> cells)
Ask yourself for each word: Would removing it cause confusion with something else? If no, remove it.
// Bad:
recentlyUpdatedAnnualSalesBid
finalBattleMostDangerousBossMonster
// Better:
bid
boss
A method or field occurs in the context of a class. Take that context for granted.
// Bad:
class AnnualHolidaySale {
int _annualSaleRebate;
void promoteHolidaySale() { ... }
}
// Better:
class AnnualHolidaySale {
int _rebate;
void promote() { ... }
}
The more deeply nested a name is, the more surrounding context it has, so shorter names are appropriate.
Remove filler words that add no semantic value. Usual suspects:
datastateamountvaluemanagerengineobjectentityinstanceA good name paints a picture in the mind of the reader. "Manager" doesn't convey what the thing does. Ask: "Would this identifier mean the same thing if I removed the word?" If so, the word doesn't carry its weight.
documentation
Start, stop, and steer agentic sessions in sgai workspaces. Use when you need to launch AI agent sessions, halt running sessions, or inject steering instructions to guide the agent mid-execution without stopping it.
development
Monitor sgai workspace status, events, progress, diffs, and workflow diagrams. Use when you need to observe what agents are doing, track progress, get the current state of all workspaces, subscribe to real-time updates via SSE, or inspect code changes.
development
Access agents, skills, and code snippets available in sgai workspaces. Use when you need to discover what agents are defined in a workspace, browse available skills, get skill instructions, find code snippets by language, or retrieve snippet content for a specific task.
data-ai
Handle agent questions and work gates in sgai workspaces. Use when an agent is blocked waiting for human input, when you need to respond to multi-choice questions, approve work gates, or provide free-text answers to agent queries.