Communitygithub.com

SamuelChien/mega-skills-collection

通过智能协调、工作负载分配和成本感知编排来优化多智能体系统。适用于提升智能体性能、吞吐量或可靠性。

mega-skills-collection 是什么?

Multi-Agent Optimization Toolkit 是一个面向多智能体系统的性能优化工具集,专注于通过协调、分析和成本控制等手段提升系统效率。该技能支持包括数据库、应用和前端在内的多维度性能分析,能识别瓶颈并动态调整编排策略。它提供了可执行的 Python 代码示例,涵盖上下文压缩、并行执行、成本优化和延迟减少等关键技术。适用于 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".

相关技能