mode-optimize

Optimize code for refactoring, performance, and cleanup while preserving behavior.

Updated Jan 21, 2026
One-click install
npx skills add https://github.com/mahamaneharouna9-cpu/Apex-invoice-billing-automation --skill mode-optimize
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mode-optimize
Source: https://github.com/mahamaneharouna9-cpu/Apex-invoice-billing-automation/tree/main/.opencode/skill/mode-optimize
Command: npx skills add https://github.com/mahamaneharouna9-cpu/Apex-invoice-billing-automation --skill mode-optimize

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses code quality issues by refactoring, improving performance, and cleaning up code without altering its fundamental behavior.

Core Features & Use Cases

  • Performance Measurement: Establishes a baseline performance metric before optimization.
  • Bottleneck Identification: Pinpoints specific areas in the code that are causing performance degradation.
  • Code Refactoring: Implements improvements based on identified bottlenecks, prioritizing those with the highest impact.
  • Behavior Preservation: Ensures that all optimizations maintain the original functionality and pass existing tests.
  • Use Case: When a user reports that a specific feature is running too slowly, this Skill can be invoked to analyze the code, identify the performance bottlenecks, and apply optimizations to speed it up while ensuring it still functions correctly.

Quick Start

Use the mode-optimize skill to refactor the provided Python code for performance improvements.

Frequently Asked Questions about mode-optimize

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

FAQPage Schema
How do I refactor code to improve performance without changing behavior?

To refactor code for performance without changing behavior, establish baseline metrics, identify bottlenecks using profiling tools, and apply targeted optimizations. This process ensures tests pass and original functionality remains intact after the code cleanup.

What's the best way to identify performance bottlenecks in Python or JavaScript?

The best way to identify performance bottlenecks is to measure baseline performance first, then utilize language-specific profiling tools. This pinpoints exact code areas causing degradation, allowing targeted refactoring and optimization for JS/TS, Python, Java, or Go.

Can I optimize and clean up code while ensuring existing tests still pass?

Yes, you can optimize and clean up code while ensuring tests pass. The optimization process measures baselines, identifies bottlenecks, and implements improvements, explicitly prioritizing behavior preservation so all existing tests continue to pass after refactoring.

Does code refactoring support multiple programming languages like Go and Java?

Code refactoring and optimization support multiple programming languages including JavaScript, TypeScript, Python, Java, and Go. It utilizes language-specific profiling tools and common optimization patterns to ensure effective cleanup and performance enhancement across these environments.

Why does my code run slowly and how do I establish a performance baseline?

Code runs slowly due to specific bottlenecks, which you can find by establishing a performance baseline. Measuring this baseline before optimization allows you to pinpoint degradation areas and apply improvements that maintain original behavior.

When should I not use code optimization patterns for refactoring?

You should not use code optimization patterns when lacking baseline metrics or existing tests. Without measuring baselines and verifying behavior preservation, refactoring risks altering functionality and failing to address actual performance bottlenecks.