code-cleanup

Audit generated code against GOAL.md and log changes in PROJECT_MANAGEMENT.md.

130|8|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/sandgardenhq/sgai --skill code-cleanup-sandgardenhq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-cleanup
Source: https://github.com/sandgardenhq/sgai/tree/main/cmd/sgai/skel/.sgai/skills/code-cleanup
Command: npx skills add https://github.com/sandgardenhq/sgai --skill code-cleanup-sandgardenhq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generated code often contains unnecessary imports, redundant functions, or unclear naming that hampers future maintenance and may drift from the project's original goal. This Skill systematically questions each part of the code, cross‑references it with GOAL.md, and removes or refactors anything that does not serve a clear purpose.

Core Features & Use Cases

  • Component Auditing: Walks through every function, class, and import, asking “Why is this here?” and checking alignment with the project goal.
  • Goal Alignment: Uses GOAL.md to validate that each code element contributes to the defined outcome.
  • Automated Refactoring: Eliminates redundant or unused code, simplifies complex sections, and applies concise naming guidelines.
  • Change Logging: Records all modifications in .sgai/PROJECT_MANAGEMENT.md for traceability.
  • Naming Guidelines: Enforces short, descriptive identifiers by removing obvious, redundant, or filler words.

Quick Start

Ask the code‑cleanup skill to review and tidy the newly generated files in your project.

Frequently Asked Questions about code-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove unused imports and redundant functions from generated code?

To remove unused imports and redundant functions from generated code, you can apply an automated cleanup process that systematically questions each component's purpose and eliminates anything unnecessary. The Skill audits every function and import to delete redundant code.

How do I ensure my project code stays aligned with its original goals?

To ensure code aligns with project goals, cross-reference each component against a GOAL.md file to verify relevance. The Skill validates that every function, class, and import contributes directly to the defined outcome.

What is the best way to refactor code for better maintainability?

The best way to refactor for maintainability is to systematically question each function, eliminate unused code, and apply concise naming guidelines. This process simplifies complex sections and enforces short, descriptive identifiers.

How do I keep track of code modifications during a refactoring session?

To keep track of code modifications during refactoring, log all changes in a project management file. The Skill records every modification inside .sgai/PROJECT_MANAGEMENT.md to ensure full traceability of removed or updated components.

Does this code cleanup process require a GOAL.md file to work?

Yes, the cleanup process requires a GOAL.md file to validate that each code element contributes to the defined outcome. It cross-references every function, class, and import against this document to verify relevance before removing or refactoring.