agentleFS
nortonxnortonx/ai-tooling-free/skills/optimize/SKILL.md

optimize

Skill1 starsChanged 59 days agoMITView on GitHub

Analyze code for performance bottlenecks and recommend optimizations. Supports Vue SFCs. Args: [branch | backend | frontend | <path>]

76 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use arrange, teach-impeccable and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • HK-hubSkill

    arrange

    Improve layout, spacing, and visual rhythm. Fixes monotonous grids, inconsistent spacing, and weak visual hierarchy. Use when the user mentions layout feeling off, spacing issues, visual hierarchy, crowded UI, alignment problems, or wanting better composition.

    Also in 14 projects that use this

  • HK-hubSkill

    teach-impeccable

    One-time setup that gathers design context for your project and saves it to your AI config file. Run once to establish persistent design guidelines.

    Also in 17 projects that use this

  • zwy123zwySkill

    normalize

    将用户随意输入的提示词规范化为结构清晰、便于大模型执行的标准化提示词。适用于需要整理、统一提示词格式时调用。

    Also in 19 projects that use this

  • open-coder-aiSkill

    policy-init

    Create conformant Chock policy from request. args(request, target_path,

    Also in 3 projects that use this

  • +8 more from HK-hub

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 73 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If $ARGUMENTS is empty, stop and ask the user which scope to analyze before doing anything else.

    line 35
  2. Distinctive:

    anything else: treat as a component or module name and locate it

    line 53
  3. Distinctive:

    If no bottlenecks meet the criteria, output:

    line 88
  4. Distinctive:

    If the target file or component cannot be found, report that it does not exist and stop.

    line 98

“Common” is measured: kept by at least 6 in 10 of the 73 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Note: $ARGUMENTS is substituted by Claude commands only. In Copilot, the user must include their argument inline in the prompt; the skill body sees the literal text "$ARGUMENTS" unsubstituted. -->

Arguments

[branch | backend | frontend | <path>]

  • Optional. Picks the analysis scope; the skill prompts with a numbered menu if omitted.
  • Examples: /optimize branch, /optimize backend, /optimize src/services/payments.ts

Copilot CLI note: $ARGUMENTS does not substitute in skills; include the argument inline in your prompt.

Optimize: $ARGUMENTS

Analyze code for performance bottlenecks. Only flag a finding when the fix meets BOTH of these criteria:

  1. The fix removes a measurable cost: algorithmic complexity drop (e.g., O(n^2) -> O(n)), one fewer DB/HTTP round-trip per call, one fewer reactive re-render per interaction, >= 5% bundle-size reduction, or eliminated memory allocation in a hot path.
  2. The fix is <= 30 lines of code change OR is a one-line config/index change.

Skip:

  • Stylistic-only changes (rename, reorder, reformat).
  • Micro-optimizations whose impact you cannot estimate.
  • "Defensive" caching of values that are not measured to be hot.
  • Anything that adds a new dependency unless the dependency replaces >= 100 lines of in-repo code.

Scope

If $ARGUMENTS is empty, stop and ask the user which scope to analyze before doing anything else. Present this numbered menu verbatim and wait for a reply:

Which scope should I analyze?
  1. branch       : diff between this branch and main/master
  2. backend      : server-side code only (API, DB, services)
  3. frontend     : client-side code only (components, bundles, assets)
  4. <file path>  : a specific file (e.g. src/foo.ts)
  5. <component>  : a component or module name

Otherwise interpret $ARGUMENTS as:

  • branch: diff between this branch and main/master
  • backend: server-side code only
  • frontend: client-side code only
  • full: entire codebase under the current working directory
  • file path: analyze that specific file (stop if file does not exist)
  • anything else: treat as a component or module name and locate it

Analysis Areas

Apply the categories relevant to the detected scope:

  • Algorithms: O(n^2) or worse, redundant calculations, memory leaks
  • Database: N+1 queries, missing indexes, query optimization, caching strategies
  • API: response times, chatty interfaces, pagination, caching headers
  • Frontend: unnecessary re-renders or reactive computations, Vue SFC reactivity pitfalls (computed vs watch, missing shallowRef, v-memo), missing memoization (React useMemo/useCallback/React.memo, Svelte/Angular fine-grained signals), large bundle contributions, code-splitting, lazy loading, inefficient state management, expensive computations in render path, unoptimized assets
  • Async: await misuse in loops, missing parallelism (Promise.all), missed caching opportunities

Output Format

For each finding:

### <Severity: Critical | High | Medium>

- **Location**: `path/to/file.ext:line`
- **Category**: Algorithms | Database | API | Frontend | Async
- **Expected Improvement**: <Concrete impact, Big-O reduction, or latency metric>
- **Complexity**: Easy | Medium | Hard

#### Current Code
```<language>
// Current snippet

Optimized Code

// Optimized snippet

If no bottlenecks meet the criteria, output:

> "No performance bottlenecks meeting the severity criteria were identified in the scoped code."

## Rules

- **DO NOT implement fixes. DO NOT edit any files. Report only.**
- Technical facts and data overrule opinions and personal preferences.
- Match the codebase conventions and framework style (React, Vue, Svelte, Angular, Node, Go, Python).
- Address the code, not the developer.
- If the target file or component cannot be found, report that it does not exist and stop.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.