Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

mode-optimize模式优化

Agent Skill

mode-optimize 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

225

周安装

9

GitHub Stars

16

下载量

73
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:mode-optimize(模式优化)
来源仓库:https://github.com/duck4nh/antigravity-kit
仓库路径:skills/mode-optimize
安装命令:
npx skills add https://github.com/duck4nh/antigravity-kit --skill mode-optimize
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/duck4nh/antigravity-kit --skill mode-optimize

简介

用于处理 GitHub 协作信息和代码变更上下文。

  • 适合在需要评估性能瓶颈或改进架构时提供支持。
  • 可参考来源仓库 README 了解具体分析维度。
  • 安装前需确认是否允许读取运行时指标或日志。mode-optimize 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 注意优化建议应与业务目标对齐,避免过度工程。

SKILL.md

Optimize Mode

Goal: Improve quality WITHOUT changing behavior.

Process

  1. Risk assessment (classify change type)
  2. Measure current state (baseline)
  3. Identify main bottleneck
  4. Choose safe optimization strategy
  5. Propose improvements + predict results
  6. Refactor by priority order
  7. Compare before/after
  8. Ensure tests still pass
  9. Document rollback plan

Performance Metrics by Language

LanguageBuild/SizeRuntimeProfiling Tool
JS/TSBundle < 500KBRender < 16msWebpack Analyzer, Lighthouse
PythonN/AResponse < 100mscProfile, py-spy
JavaJAR sizeGC pause < 50msJProfiler, VisualVM
GoBinary sizep99 latencypprof, go test -bench

Common Optimization Patterns

All Languages

IssueSolutionImpact
Slow DB queriesAdd indexes, limit results, eager loadingHigh
N+1 queriesBatch loading, JOINsHigh
Large payloadsPagination, compression, lazy loadingHigh
Repeated calculationsCaching, memoizationMedium
Memory leaksProper cleanup, weak referencesMedium

Language-Specific

LanguageCommon IssueSolution
JS/TSUnnecessary re-rendersReact.memo, useMemo, useCallback
JS/TSLarge bundleCode splitting, tree shaking, dynamic imports
PythonSlow loopsNumPy vectorization, list comprehensions
GoExcessive allocationsSync.Pool, pre-allocate slices

Output Format

## OPTIMIZE

**Issue:** [slow / duplicate code / hard to maintain]
**Language:** [JS/Python/Java/Go/PHP/Ruby]

**Baseline:**
- Response time: X ms
- Memory: X MB
- LOC: X

---

### Bottleneck:
| Issue | Location | Severity |
|-------|----------|----------|
| [Description] | `file:line` | High |

### Proposal:
| Item | Before | After | Change |
|------|--------|-------|--------|
| Response time | 500ms | 50ms | -90% |
| Memory | 200MB | 50MB | -75% |

### Regression Check:
- [ ] Tests still pass
- [ ] Behavior unchanged
- [ ] Performance verified

## Risk Assessment

### Risk Classification
| Change Type      | Risk Level | Rollback Ease | Strategy                        |
| ---------------- | ---------- | ------------- | ------------------------------- |
| Algorithm change | High       | Easy          | A/B test, gradual rollout       |
| Database schema  | High       | Hard          | Migration plan, rollback script |
| Caching layer    | Medium     | Medium        | Feature flag, monitor           |
| Code refactor    | Low        | Easy          | Tests, revert if fail           |

### Risk Questions
- [ ] What if optimization introduces bugs?
- [ ] Can we rollback easily?
- [ ] What's the blast radius?
- [ ] Who gets affected if fails?

### Safe Optimization Strategies

#### Strategy 1: Feature Flag (Recommended for critical paths)

// Use feature flag for new optimized code const useNewOptimization = featureFlags.get('use-v2-algorithm', false);

if (useNewOptimization) { return optimizedMethod(data); } else { return legacyMethod(data); }


#### Strategy 2: Gradual Rollout

Week 1: 5% of traffic Week 2: 25% of traffic Week 3: 50% of traffic Week 4: 100% of traffic

Monitor after each phase:

  • Error rate
  • Performance metrics
  • User complaints

#### Strategy 3: A/B Testing

Control: Current implementation Variant: Optimized implementation

Metrics to compare:

  • Response time (p50, p95, p99)
  • Error rate
  • Resource usage
  • User satisfaction

Statistical significance: 95% confidence


## Rollback Plan

### Document Before Optimizing

Rollback Trigger:

  • Error rate increases > 5%
  • p95 latency degrades > 20%
  • User complaints > X/hour

Rollback Steps:

  1. [Revert commit / disable feature flag]
  2. [Verify old behavior restored]
  3. [Monitor for Y minutes]
  4. [Document lessons learned]

### Optimization Safety Checklist

- Baseline metrics documented
- Rollback plan written
- Feature flag available (if critical)
- Monitoring/alerts configured
- Tests covering the change
- Code reviewed
- Staged rollout planned

Quick Optimization Examples

React Re-render

- function UserList({ users }) {
-   return users.map(u => <UserCard user={u} />);
- }
+ const UserList = React.memo(function UserList({ users }) {
+   return users.map(u => <UserCard key={u.id} user={u} />);
+ });

Python N+1 Query

- for order in orders:
-     print(order.customer.name)
+ orders = Order.objects.select_related('customer').all()
+ for order in orders:
+     print(order.customer.name)

Go Slice Pre-allocation

- var results []Result
- for _, item := range items {
-     results = append(results, process(item))
- }
+ results := make([]Result, 0, len(items))
+ for _, item := range items {
+     results = append(results, process(item))
+ }

Principles

DON'TDO
Optimize prematurelyMeasure first, optimize later
Change behaviorKeep behavior unchanged
Prioritize clevernessReadability > Performance
Skip testsRe-run tests after changes
Optimize everythingFocus on bottlenecks (80/20 rule)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.9%
按下载量换算27

Claude

25.81%
按下载量换算19

Cursor

19.51%
按下载量换算14

Gemini CLI

8.54%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills