Communitygithub.com

SamuelChien/mega-skills-collection

優化多代理系統,實現協調的效能分析、工作負載分配與成本感知編排。適用於提升代理效能、吞吐量或可靠性。

mega-skills-collection 是什麼?

這是一個多代理優化工具組,專為改善多代理系統的協調、吞吐量與延遲而設計。它透過全面的效能分析、上下文視窗優化、代理協調效率提升及成本控制策略,幫助開發者識別瓶頸、設計編排方案並驗證改善成果。工具支援 Python 實現的平行執行框架、成本追蹤器與動態模型選擇,並提供參考工作流程(如電商平台或企業 API 優化)。它適用於 Claude Code、Cursor 等開發工具,強調逐步部署、回歸測試與持續監控,確保系統穩定性與可重複性。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/SamuelChien/mega-skills-collection/tree/HEAD/agent-orchestration-multi-agent-optimize

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

多代理優化工具組

使用此技能的時機

  • 改善多代理協調、吞吐量或延遲
  • 分析代理工作流程以找出瓶頸
  • 為複雜工作流程設計編排策略
  • 優化成本、上下文使用或工具效率

不應使用此技能的時機

  • 僅需調整單一代理提示詞
  • 沒有可衡量的指標或評估數據
  • 任務與多代理編排無關

指示

  1. 建立基線指標與目標效能目標。
  2. 分析代理工作負載並找出協調瓶頸。
  3. 逐步套用編排變更與成本控制。
  4. 透過可重複測試與回滾驗證改善成果。

安全性

  • 避免在未經回歸測試的情況下部署編排變更。
  • 逐步推出變更,以防止系統範圍的迴歸。

角色:AI 驅動的多代理效能工程專家

環境背景

多代理優化工具是一個先進的 AI 驅動框架,旨在透過智慧、協調的代理型優化來全面改善系統效能。此工具利用尖端 AI 編排技術,在多個領域提供全面的效能工程方法。

核心能力

  • 智慧多代理協調
  • 效能分析與瓶頸識別
  • 自適應優化策略
  • 跨領域效能優化
  • 成本與效率追蹤

參數處理

工具使用靈活的輸入參數來處理優化參數:

  • $TARGET:要優化的主要系統/應用程式
  • $PERFORMANCE_GOALS:特定的效能指標與目標
  • $OPTIMIZATION_SCOPE:優化深度(快速見效、全面性)
  • $BUDGET_CONSTRAINTS:成本與資源限制
  • $QUALITY_METRICS:效能品質閾值

1. 多代理效能分析

分析策略

  • 跨系統層級的分散式效能監控
  • 即時指標收集與分析
  • 持續效能特徵追蹤

分析代理

  1. 資料庫效能代理

    • 查詢執行時間分析
    • 索引使用率追蹤
    • 資源消耗監控
  2. 應用程式效能代理

    • CPU 與記憶體分析
    • 演算法複雜度評估
    • 並行與非同步操作分析
  3. 前端效能代理

    • 渲染效能指標
    • 網路請求最佳化
    • 核心網頁指標監控

分析程式碼範例

def multi_agent_profiler(target_system):
    agents = [
        DatabasePerformanceAgent(target_system),
        ApplicationPerformanceAgent(target_system),
        FrontendPerformanceAgent(target_system)
    ]

    performance_profile = {}
    for agent in agents:
        performance_profile[agent.__class__.__name__] = agent.profile()

    return aggregate_performance_metrics(performance_profile)

2. 上下文視窗最佳化

最佳化技巧

  • 智慧上下文壓縮
  • 語意相關性過濾
  • 動態上下文視窗大小調整
  • Token 預算管理

上下文壓縮演算法

def compress_context(context, max_tokens=4000):
    # 使用基於嵌入的截斷進行語意壓縮
    compressed_context = semantic_truncate(
        context,
        max_tokens=max_tokens,
        importance_threshold=0.7
    )
    return compressed_context

3. 代理協調效率

協調原則

  • 平行執行設計
  • 最小化代理間通訊開銷
  • 動態工作負載分配
  • 容錯代理互動

編排框架

class MultiAgentOrchestrator:
    def __init__(self, agents):
        self.agents = agents
        self.execution_queue = PriorityQueue()
        self.performance_tracker = PerformanceTracker()

    def optimize(self, target_system):
        # 平行代理執行搭配協調優化
        with concurrent.futures.ThreadPoolExecutor() as executor:
            futures = {
                executor.submit(agent.optimize, target_system): agent
                for agent in self.agents
            }

            for future in concurrent.futures.as_completed(futures):
                agent = futures[future]
                result = future.result()
                self.performance_tracker.log(agent, result)

4. 平行執行最佳化

關鍵策略

  • 非同步代理處理
  • 工作負載分割
  • 動態資源分配
  • 最小化阻塞操作

5. 成本最佳化策略

LLM 成本管理

  • Token 使用追蹤
  • 自適應模型選擇
  • 快取與結果重複使用
  • 高效提示工程

成本追蹤範例

class CostOptimizer:
    def __init__(self):
        self.token_budget = 100000  # 每月預算
        self.token_usage = 0
        self.model_costs = {
            'gpt-5': 0.03,
            'claude-4-sonnet': 0.015,
            'claude-4-haiku': 0.0025
        }

    def select_optimal_model(self, complexity):
        # 根據任務複雜度與預算進行動態模型選擇
        pass

6. 延遲縮減技術

效能加速

  • 預測式快取
  • 預熱代理上下文
  • 智慧結果記憶化
  • 減少往返通訊

7. 品質與速度的取捨

最佳化光譜

  • 效能閾值
  • 可接受的降級裕度
  • 品質感知最佳化
  • 智慧權衡選擇

8. 監控與持續改善

可觀測性框架

  • 即時效能儀表板
  • 自動化最佳化回饋迴圈
  • 機器學習驅動的改善
  • 自適應最佳化策略

參考工作流程

工作流程 1:電商平台優化

  1. 初始效能分析
  2. 代理型最佳化
  3. 成本與效能追蹤
  4. 持續改善循環

工作流程 2:企業 API 效能提升

  1. 全面系統分析
  2. 多層代理最佳化
  3. 迭代效能精煉
  4. 成本效率擴展策略

關鍵考量

  • 務必在最佳化前後進行測量
  • 最佳化過程中維持系統穩定性
  • 平衡效能增益與資源消耗
  • 實施漸進式、可逆的變更

目標最佳化:$ARGUMENTS

限制

  • 僅在任務明確符合上述範圍時使用此技能。
  • 請勿將輸出視為環境特定驗證、測試或專家審查的替代方案。
  • 如果缺少必要的輸入、權限、安全邊界或成功標準,請停止並要求澄清。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

SamuelChien/mega-skills-collection

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

SamuelChien/mega-skills-collection

Arquitecto de Soluciones Principal y Consultor Tecnológico de Andru.ia. Diagnostica y traza la hoja de ruta óptima para proyectos de IA en español.

SamuelChien/mega-skills-collection

Ingeniero de Sistemas de Andru.ia. Diseña, redacta y despliega nuevas habilidades (skills) dentro del repositorio siguiendo el Estándar de Diamante.

SamuelChien/mega-skills-collection

Estratega de Inteligencia de Dominio de Andru.ia. Analiza el nicho específico de un proyecto para inyectar conocimientos, regulaciones y estándares únicos del sector. Actívalo tras definir el nicho.

SamuelChien/mega-skills-collection

2D game development principles. Sprites, tilemaps, physics, camera.

SamuelChien/mega-skills-collection

3D game development principles. Rendering, shaders, physics, cameras.

SamuelChien/mega-skills-collection

Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences.

SamuelChien/mega-skills-collection

Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.

SamuelChien/mega-skills-collection

Ab Test Analyzer - Auto-activating skill for Data Analytics. Triggers on: ab test analyzer, ab test analyzer Part of the Data Analytics skill category.

SamuelChien/mega-skills-collection

A B Test Config Creator - Auto-activating skill for ML Deployment. Triggers on: a b test config creator, a b test config creator Part of the ML Deployment skill category.

SamuelChien/mega-skills-collection

When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "conversion experiment," "statistical significance," or "test this." For tracking implementation, see analytics-tracking.

SamuelChien/mega-skills-collection

Acceptance Criteria Creator - Auto-activating skill for Enterprise Workflows. Triggers on: acceptance criteria creator, acceptance criteria creator Part of the Enterprise Workflows skill category.

SamuelChien/mega-skills-collection

Use when a coding task should be driven end-to-end from issue intake through implementation, review, deployment, and acceptance verification with minimal human re-intervention.

SamuelChien/mega-skills-collection

Accessibility Audit Runner - Auto-activating skill for Frontend Development. Triggers on: accessibility audit runner, accessibility audit runner Part of the Frontend Development skill category.

SamuelChien/mega-skills-collection

You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.

SamuelChien/mega-skills-collection

Web accessibility patterns for WCAG 2.2 compliance including ARIA, keyboard navigation, screen readers, and testing

SamuelChien/mega-skills-collection

Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.

SamuelChien/mega-skills-collection

Create unified specification packages across Business, Development, and Design teams. Staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria) to build shared understanding. Does not write code.

SamuelChien/mega-skills-collection

Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect enrichment tools or your CRM. Trigger with "research [company]", "look up [person]", "intel on [prospect]", "who is [name] at [company]", or "tell me about [company]".

SamuelChien/mega-skills-collection

Validate messaging consistency across website, GitHub repos, and local documentation generating read-only discrepancy reports. Use when checking content alignment or finding mixed messaging. Trigger with phrases like "check consistency", "validate documentation", or "audit messaging".

相關技能