| name | code-optimization-suggestions |
| description | Analyzes code and project structure to find optimization opportunities without making changes. Triggers when users say things like "optimize my code", "review my code for improvements", "find inefficiencies in my code", "suggest code improvements", "analyze my code quality", "check for complexity issues", "find unused code", "code review suggestions", or "how can I improve my code". Produces labeled suggestions: [Delete] for unused/dead code, [Improve] for better implementations, and [Complexity] for algorithmic inefficiencies. |
Code Optimization Suggestions Skill
Analyze the codebase and provide structured suggestions without modifying any files.
Workflow
-
Explore the structure
- List all files and folders to understand the project layout
- Identify the main languages, frameworks, and patterns in use
-
Analyze each relevant file
- Read source files thoroughly
- Track function/variable definitions and their usages
- Note algorithmic patterns and data structures
- Identify duplicated logic across files
-
Categorize findings into three types:
- [Delete] — Code that is never called, imported, or referenced anywhere in the project
- [Improve] — Code that works but has a clearly better, simpler, or more idiomatic implementation
- [Complexity] — Code with poor time/space complexity that could be optimized algorithmically
-
Output suggestions using this exact format:
[Delete] `functionName` in <filename>, line <N>–<N>: This function is defined but never called anywhere in the project. Safe to remove.
[Improve] <filename>, line <N>: You currently have:
<existing code snippet>
Consider replacing with:
<improved code snippet>
Reason: <brief explanation>
[Complexity] <filename>, line <N>–<N>: This section runs at O(n²) due to nested loops over the same collection. Consider <alternative approach> to reduce it to O(n log n) or O(n).
- Summarize at the end:
- Total count of each suggestion type
- Highest-priority items to address first
Constraints
- Do NOT edit, create, or delete any files
- Do NOT run the code
- Only suggest changes you are confident about — flag uncertainty explicitly
- If a file is too large to fully analyze, state which sections were reviewed