optimize
Scans the repository for optimization opportunities — complexity, performance issues, large files, and maintainability problems — and fixes them one at a time with user confirmation. Use only when the user explicitly invokes this skill.
Best use case
optimize is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Scans the repository for optimization opportunities — complexity, performance issues, large files, and maintainability problems — and fixes them one at a time with user confirmation. Use only when the user explicitly invokes this skill.
Teams using optimize should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/optimize/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How optimize Compares
| Feature / Agent | optimize | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Scans the repository for optimization opportunities — complexity, performance issues, large files, and maintainability problems — and fixes them one at a time with user confirmation. Use only when the user explicitly invokes this skill.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Optimize When this skill is invoked, the agent should do the following: ## What to look for Scan the full codebase (`src/`) for the following categories of issues, ordered from easiest wins to bigger refactors: - **File size / split candidates** — files over ~300 lines that contain multiple distinct responsibilities; components that mix data-fetching with presentation; large utility files where functions could be grouped by domain. - **Component complexity** — components with too many props, deeply nested JSX, or logic that belongs in a custom hook. - **Duplicate / near-duplicate logic** — repeated patterns across files that could be extracted into a shared hook, util, or DAO function. - **Unnecessary re-renders** — missing `memo`, missing `useCallback`/`useMemo`, derived state computed in render body instead of memoized, objects/arrays created inline as props. - **Performance bottlenecks** — N+1 queries in DAOs, missing `Promise.all` for independent async calls in server components, expensive operations not cached. - **Dead code** — unused exports, unreachable branches, commented-out code blocks. - **Trivial readability** — deeply nested ternaries that could be a variable or early return; magic numbers/strings without a named constant. ## Workflow 1. **Scan first.** Read the relevant files — do not guess. Prioritize files flagged as large or complex by the file listing. 2. **Rank by effort vs. impact.** Pick the single highest-impact, lowest-effort issue (the "lowest hanging fruit"). 3. **Present the finding** in this format: ``` 📁 File: <path> 🔍 Issue: <one-sentence description> 💡 Fix: <one-sentence plan> Write 'go' to apply this fix, or 'skip' to find the next one. ``` 4. **Wait for the user to write `go`.** Do not make any edits until the user confirms. 5. **Apply the fix.** Make the smallest, most focused change that addresses the issue. 6. **After the fix**, immediately find the next lowest-hanging-fruit issue and present it in the same format. Return to step 4. 7. **If the user writes `skip`**, find the next issue without making changes. 8. **Keep looping** until the user says `stop`, `done`, or `exit`, or there are no more issues to report. ## Constraints - **One change at a time.** Never batch multiple fixes into a single edit. - **No speculative changes.** Only fix things you can see are actually a problem after reading the code. - **Preserve behavior.** Refactors must not change observable behavior. If unsure, note the risk in the finding. - **Respect AGENTS.md rules.** All existing architecture rules (data flow layers, critical file patterns, etc.) apply.
Related Skills
remember
When the user invokes this skill, the agent reflects on the most important lessons learned recently and suggests adding a new rule to AGENTS.md to prevent the same issue from recurring. Use when the user explicitly invokes the remember skill.
lint
Contains commands to lint, format, type check, test, and build the project. Use when the user explicitly invokes the lint skill.
connections-optimizer
Reorganize the user's X and LinkedIn network with review-first pruning, add/follow recommendations, and channel-specific warm outreach drafted in the user's real voice. Use when the user wants to clean up following lists, grow toward current priorities, or rebalance a social graph around higher-signal relationships.
prompt-optimizer
分析原始提示,识别意图和差距,匹配ECC组件(技能/命令/代理/钩子),并输出一个可直接粘贴的优化提示。仅提供咨询角色——绝不自行执行任务。触发时机:当用户说“优化提示”、“改进我的提示”、“如何编写提示”、“帮我优化这个指令”或明确要求提高提示质量时。中文等效表达同样触发:“优化prompt”、“改进prompt”、“怎么写prompt”、“帮我优化这个指令”。不触发时机:当用户希望直接执行任务,或说“直接做”时。不触发时机:当用户说“优化代码”、“优化性能”、“optimize performance”、“optimize this code”时——这些是重构/性能优化任务,而非提示优化。
llm-prompt-optimizer
Use when improving prompts for any LLM. Applies proven prompt engineering techniques to boost output quality, reduce hallucinations, and cut token usage.
llm-application-dev-prompt-optimize
You are an expert prompt engineer specializing in crafting effective prompts for LLMs through advanced techniques including constitutional AI, chain-of-thought reasoning, and model-specific optimizati
dx-optimizer
Developer Experience specialist. Improves tooling, setup, and workflows. Use PROACTIVELY when setting up new projects, after team feedback, or when development friction is noticed.
database-optimizer
Expert database optimizer specializing in modern performance tuning, query optimization, and scalable architectures.
database-cloud-optimization-cost-optimize
You are a cloud cost optimization expert specializing in reducing infrastructure expenses while maintaining performance and reliability. Analyze cloud spending, identify savings opportunities, and implement cost-effective architectures across AWS, Azure, and GCP.
Pricing Optimizer
Analyzes and optimizes pricing strategy using proven frameworks
Logistics Operations Optimizer
You are a logistics operations analyst. When the user describes their supply chain, shipping, or distribution setup, generate a complete optimization framework.
Fleet Management Optimizer
You are a fleet management analyst. Help the user optimize vehicle fleet operations, reduce costs, and improve utilization.