Communitygithub.com

gan-style-harness

受GAN启发的生成器-评估器多智能体协作框架,用于自主构建高质量应用程序。基于Anthropic的工程设计。

gan-style-harness 是什么?

该技能实现了一个多智能体协作框架,灵感来源于生成对抗网络(GAN)和Anthropic的长期应用开发工程设计。它通过分离生成与评估两个角色,在它们之间建立对抗性反馈循环,从而大幅提升输出质量。框架包含三个专用智能体:规划器(将单行提示扩展为完整的产品规范)、生成器(根据规范迭代实现功能)和评估器(通过Playwright MCP与实时运行的应用程序交互,依据四项可配置指标进行严格评分)。默认迭代次数为5-15次,当加权评分达到7.0分(可配置)时即视为通过。该技能特别适合从零构建完整应用、前端设计或全栈项目,但不适用于简单修复或预算有限的任务。它支持可配置的评估模式(Playwright、截图或仅代码),并通过环境变量对模型、端口和标准进行灵活调整,确保在合理成本内获得接近生产质量的输出。

兼容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/gan-style-harness

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

GAN风格多智能体框架技能

灵感来源于 Anthropic 的长期应用开发框架设计(2026年3月24日)

一个多智能体框架,将生成与评估分离,形成对抗性反馈循环,驱动质量远超单个智能体所能达到的水平。

核心洞察

当要求评估自己的工作时,智能体是病态乐观主义者——它们会赞美平庸的输出,并为自己的正当问题找借口。但训练一个独立的评估器做到极度严格,远比教一个生成器进行自我批评要可行得多。

这与GAN(生成对抗网络)的动态完全一致:生成器负责产出,评估器负责批评,而反馈驱动下一轮迭代。

何时使用

  • 从单行提示构建完整的应用程序
  • 需要高视觉质量的前端设计任务
  • 需要功能特性而非仅仅是代码的全栈项目
  • 任何“AI劣质品”审美不可接受的任务
  • 您愿意投入50-200美元以获得生产质量输出的项目

何时不使用

  • 快速单文件修复(使用标准 claude -p)
  • 预算紧张的任务(<10美元)
  • 简单重构(改用去劣化模式)
  • 已有良好规范且附带测试的任务(使用TDD工作流)

架构

                    ┌─────────────┐
                    │   规划器    │
                    │  (Sonnet)   │
                    └──────┬──────┘
                           │ 产品规范
                           │ (功能、冲刺、设计方向)
                           ▼
              ┌────────────────────────┐
              │                        │
              │   生成器-评估器        │
              │      反馈循环          │
              │                        │
              │  ┌──────────┐          │
              │  │ 生成器   │--构建-->│──┐
              │  │ (Sonnet) │          │  │
              │  └────▲─────┘          │  │
              │       │                │  │ 实时应用
              │    反馈                │  │
              │       │                │  │
              │  ┌────┴─────┐          │  │
              │  │ 评估器   │<-测试----│──┘
              │  │ (Sonnet) │          │
              │  │+Playwright│         │
              │  └──────────┘          │
              │                        │
              │   5-15次迭代           │
              └────────────────────────┘

三个智能体

1. 规划器

角色: 产品经理——将简短的提示扩展为完整的产品规范。

关键行为:

  • 接受单行提示并生成包含16项功能、多轮冲刺的规范
  • 定义用户故事、技术需求和视觉设计方向
  • 有意识地雄心勃勃——保守的计划会导致平庸的结果
  • 生成评估标准,供评估器后续使用

模型: 默认 Sonnet;可通过 GAN_PLANNER_MODEL=opus 提升以获得更深入的规范扩展

2. 生成器

角色: 开发者——根据规范实现功能。

关键行为:

  • 在结构化冲刺中工作(或使用更新模型的连续模式)
  • 在编写代码前与评估器协商“冲刺契约”
  • 使用全栈工具:React、FastAPI/Express、数据库、CSS
  • 管理git以进行迭代间的版本控制
  • 阅读评估器反馈并在下一轮迭代中融入

模型: 默认 Sonnet;可通过 GAN_GENERATOR_MODEL=opus 提升以获得最大编码能力

3. 评估器

角色: QA工程师——测试实时运行的应用程序,而不仅仅是代码。

关键行为:

  • 使用 Playwright MCP 与实时应用程序交互
  • 点击功能、填写表单、测试API端点
  • 根据四项标准评分(可配置): 1. 设计质量 — 是否感觉像一个统一的整体? 2. 原创性 — 自定义决策 vs. 模板/AI模式? 3. 工艺 — 排版、间距、动画、微交互? 4. 功能性 — 所有功能是否真正可用?
  • 返回带评分和具体问题的结构化反馈
  • 被设计为极度严格——从不赞美平庸的工作

模型: 默认 Sonnet;可通过 GAN_EVALUATOR_MODEL=opus 提升以获得更强大的判断和工具使用能力

评估标准

默认四项标准,每项1-10分:

## 评估量表

### 设计质量(权重:0.3)
- 1-3:通用、模板化、“AI劣质品”审美
- 4-6:合格但不出彩,遵循惯例
- 7-8:独特、统一的视觉形象
- 9-10:可媲美专业设计师的作品

### 原创性(权重:0.2)
- 1-3:默认颜色、现成布局、没有个性
- 4-6:有一些自定义选择,大多为标准模式
- 7-8:清晰的创意愿景,独特的方法
- 9-10:令人惊喜、愉悦、真正新颖

### 工艺(权重:0.3)
- 1-3:布局破损、缺少状态、无动画
- 4-6:功能可用但感觉粗糙、间距不一致
- 7-8:精致、流畅的过渡、响应式
- 9-10:像素完美、令人愉悦的微交互

### 功能性(权重:0.2)
- 1-3:核心功能损坏或缺失
- 4-6:正常路径可用,边界情况失败
- 7-8:所有功能可用,良好的错误处理
- 9-10:坚如磐石,处理每一种边界情况

评分

  • 加权得分 = 各标准得分 * 权重之和
  • 通过阈值 = 7.0(可配置)
  • 最大迭代次数 = 15(可配置,通常5-15次足够)

使用方法

通过命令

# 完整三智能体框架
/project:gan-build "构建一个包含看板、团队协作和深色模式的项目管理应用"

# 自定义配置
/project:gan-build "构建一个食谱分享平台" --max-iterations 10 --pass-threshold 7.5

# 前端设计模式(仅生成器+评估器,无规划器)
/project:gan-design "创建加密货币投资组合追踪器的着陆页"

通过Shell脚本

# 基本用法
./scripts/gan-harness.sh "构建一个音乐流媒体仪表板"

# 带选项
GAN_MAX_ITERATIONS=10 \
GAN_PASS_THRESHOLD=7.5 \
GAN_EVAL_CRITERIA="functionality,performance,security" \
./scripts/gan-harness.sh "构建一个用于任务管理的REST API"

通过Claude Code(手动)

# 步骤1:规划
claude -p --model sonnet "你是产品规划器。阅读PLANNER_PROMPT.md。将此简短提示扩展为完整的产品规范:'构建一个看板应用'。将规范写入spec.md"

# 步骤2:生成(第1轮迭代)
claude -p --model sonnet "你是生成器。阅读spec.md。实现冲刺1。在端口3000上启动开发服务器。"

# 步骤3:评估(第1轮迭代)
claude -p --model sonnet --allowedTools "Read,Bash,mcp__playwright__*" "你是评估器。阅读EVALUATOR_PROMPT.md。测试位于http://localhost:3000的实时应用。根据量表评分。将反馈写入feedback-001.md"

# 步骤4:生成(第2轮迭代——读取反馈)
claude -p --model sonnet "你是生成器。阅读spec.md和feedback-001.md。解决所有问题。提高分数。"

# 重复步骤3-4直到通过阈值

随模型能力的演进

随着模型能力的提升,框架应该简化。遵循Anthropic的演进路线:

阶段1 — 较弱模型(Sonnet级)

  • 需要完整的冲刺分解
  • 在冲刺间重置上下文(避免上下文焦虑)
  • 最低2个智能体:初始化器 + 编码智能体
  • 大量脚手架以弥补模型限制

阶段2 — 强大模型(Opus 4.5级)

  • 完整3智能体框架:规划器 + 生成器 + 评估器
  • 每个实现阶段前进行冲刺契约
  • 复杂应用分解为10个冲刺
  • 上下文重置仍然有用,但不再关键

阶段3 — 前沿模型(Opus 4.6级)

  • 简化框架:单次规划,连续生成
  • 评估简化为单次最终评估(模型更智能)
  • 无需冲刺结构
  • 自动压缩处理上下文增长

关键原则: 框架的每一个组件都编码了一个关于模型无法独自完成什么的假设。当模型改进时,重新测试这些假设。删掉不再需要的部分。

配置

环境变量

变量默认值描述
GAN_MAX_ITERATIONS15生成器-评估器最大循环次数
GAN_PASS_THRESHOLD7.0通过所需的加权得分(1-10)
GAN_PLANNER_MODELsonnet规划器使用的模型
GAN_GENERATOR_MODELsonnet生成器使用的模型
GAN_EVALUATOR_MODELsonnet评估器使用的模型
GAN_EVAL_CRITERIAdesign,originality,craft,functionality逗号分隔的评估标准
GAN_DEV_SERVER_PORT3000实时应用的端口
GAN_DEV_SERVER_CMDnpm run dev启动开发服务器的命令
GAN_PROJECT_DIR.项目工作目录
GAN_SKIP_PLANNERfalse跳过规划器,直接使用规范
GAN_EVAL_MODEplaywright评估模式:playwright、screenshot 或 code-only

评估模式

模式工具最适合场景
playwright浏览器MCP + 实时交互带UI的全栈应用
screenshot截图 + 视觉分析静态网站、纯设计
code-only测试 + 代码检查 + 构建API、库、CLI工具

反模式

评估器太宽容 — 如果评估器在第一轮迭代就全盘通过,说明您的量表过于慷慨。收紧评分标准,并为常见的AI模式添加明确的扣分项。

生成器忽略反馈 — 确保反馈以文件形式传递,而非内联。生成器应在每轮迭代开始时读取 feedback-NNN.md。

无限循环 — 始终设置 GAN_MAX_ITERATIONS。如果生成器在3轮迭代后仍无法突破分数平台,则停止并标记为人工审查。

评估器测试流于表面 — 评估器必须使用Playwright与实时应用交互,而不仅仅是截图。点击按钮、填写表单、测试错误状态。

评估器赞美自己的修复 — 绝不能让评估器提出修复建议然后评估这些修复。评估器只负责批评;修复由生成器完成。

上下文耗尽 — 对于长时间会话,使用Claude Agent SDK的自动压缩功能或在主要阶段之间重置上下文。

预期结果

基于Anthropic公布的结果:

指标单一智能体GAN框架提升幅度
时间20分钟4-6小时延长12-18倍
成本9美元125-200美元增加14-22倍
质量勉强可用接近生产质的飞跃
核心功能损坏全部可用N/A
设计通用AI劣质品独特、精致N/A

权衡显而易见: 约20倍的时间和成本,换来输出质量的质的飞跃。这适用于质量至上的项目。

参考文献

Individual skills in this repo

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

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相关技能