New to Claude Skills? Learn how to install them →

affaan-m on GitHub

GAN-Style Harness

Free

Enhance image generation with adversarial evaluation.

by affaan-m239.3k stars on affaan-m/ecc
3 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What GAN-Style Harness does

The GAN-Style Harness is a sophisticated multi-agent system designed to improve the quality of generated outputs through a structured feedback loop. It separates the roles of generation and evaluation, mimicking the dynamics of Generative Adversarial Networks (GANs). In this setup, a Generator agent creates outputs based on a detailed product specification, while an Evaluator agent rigorously critiques the work, ensuring that the final product meets high-quality standards. This approach addresses a common flaw in AI systems where self-evaluation can lead to overly optimistic assessments of their outputs.

The architecture of the GAN-Style Harness consists of three key agents: the Planner, the Generator, and the Evaluator. The Planner agent transforms a brief prompt into a comprehensive specification, defining user stories and technical requirements. The Generator then implements the features according to this specification, negotiating with the Evaluator to ensure alignment on expectations before coding begins. The Evaluator uses tools like Playwright to interact with the live application, scoring it on design quality, originality, craft, and functionality, thus providing structured feedback that informs subsequent iterations.

This skill is particularly beneficial for developers and designers working on projects that demand a high level of visual quality and functionality. Whether you're creating a full-stack application or focusing on frontend design, the GAN-Style Harness can help you achieve production-quality outputs. It is ideal for projects where aesthetic considerations are critical and where traditional AI approaches may fall short in delivering satisfactory results.

However, this skill is not suited for quick fixes or tasks with tight budget constraints. If you need to make simple changes or refactor existing code, other tools may be more appropriate. Similarly, if your project is already well-defined and has comprehensive tests, the GAN-Style Harness may not provide additional value beyond standard development practices.

When to use it

Use this skill when developing applications that require a high level of quality and visual appeal, especially in full-stack or frontend projects.

When not to use it

Avoid using this skill for quick fixes, simple refactoring, or projects with very tight budgets.

What you can build with it

Building a Complex Application

When tasked with creating a project management app, the GAN-Style Harness helps ensure all features meet high-quality standards through rigorous evaluation.

Frontend Design Excellence

For a project focused on user interface design, this skill ensures that the aesthetic quality is critically assessed and refined.

Full-Stack Development

In a full-stack project, the harness facilitates collaboration between generation and evaluation, resulting in a cohesive and functional application.

How to install GAN-Style Harness

View source

1. Install with the skills CLI

npx skills add affaan-m/ecc/gan-style-harness --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by affaan-m

GAN-Style Harness Skill

Inspired by Anthropic's Harness Design for Long-Running Application Development (March 24, 2026)

A multi-agent harness that separates generation from evaluation, creating an adversarial feedback loop that drives quality far beyond what a single agent can achieve.

Core Insight

When asked to evaluate their own work, agents are pathological optimists — they praise mediocre output and talk themselves out of legitimate issues. But engineering a separate evaluator to be ruthlessly strict is far more tractable than teaching a generator to self-critique.

This is the same dynamic as GANs (Generative Adversarial Networks): the Generator produces, the Evaluator critiques, and that feedback drives the next iteration.

When to Use

  • Building complete applications from a one-line prompt
  • Frontend design tasks requiring high visual quality
  • Full-stack projects that need working features, not just code
  • Any task where "AI slop" aesthetics are unacceptable
  • Projects where you want to invest $50-200 for production-quality output

When NOT to Use

  • Quick single-file fixes (use standard claude -p)
  • Tasks with tight budget constraints (<$10)
  • Simple refactoring (use de-sloppify pattern instead)
  • Tasks that are already well-specified with tests (use TDD workflow)

Architecture

                    ┌─────────────┐
                    │   PLANNER   │
                    │  (Sonnet)   │
                    └──────┬──────┘
                           │ Product Spec
                           │ (features, sprints, design direction)
                           ▼
              ┌────────────────────────┐
              │                        │
              │   GENERATOR-EVALUATOR  │
              │      FEEDBACK LOOP     │
              │                        │
              │  ┌──────────┐          │
              │  │GENERATOR │--build-->│──┐
              │  │ (Sonnet) │          │  │
              │  └────▲─────┘          │  │
              │       │                │  │ live app
              │    feedback             │  │
              │       │                │  │
              │  ┌────┴─────┐          │  │
              │  │EVALUATOR │<-test----│──┘
              │  │ (Sonnet) │          │
              │  │+Playwright│         │
              │  └──────────┘          │
              │                        │
              │   5-15 iterations      │
              └────────────────────────┘

The Three Agents

1. Planner Agent

Role: Product manager — expands a brief prompt into a full product specification.

Key behaviors:

  • Takes a one-line prompt and produces a 16-feature, multi-sprint specification
  • Defines user stories, technical requirements, and visual design direction
  • Is deliberately ambitious — conservative planning leads to underwhelming results
  • Produces evaluation criteria that the Evaluator will use later

Model: Sonnet by default; raise via GAN_PLANNER_MODEL=opus for deeper spec expansion

2. Generator Agent

Role: Developer — implements features according to the spec.

Key behaviors:

  • Works in structured sprints (or continuous mode with newer models)
  • Negotiates a "sprint contract" with the Evaluator before writing code
  • Uses full-stack tooling: React, FastAPI/Express, databases, CSS
  • Manages git for version control between iterations
  • Reads Evaluator feedback and incorporates it in next iteration

Model: Sonnet by default; raise via GAN_GENERATOR_MODEL=opus for maximum coding capability

3. Evaluator Agent

Role: QA engineer — tests the live running application, not just code.

Key behaviors:

  • Uses Playwright MCP to interact with the live application
  • Clicks through features, fills forms, tests API endpoints
  • Scores against four criteria (configurable):
    1. Design Quality — Does it feel like a coherent whole?
    2. Originality — Custom decisions vs. template/AI patterns?
    3. Craft — Typography, spacing, animations, micro-interactions?
    4. Functionality — Do all features actually work?
  • Returns structured feedback with scores and specific issues
  • Is engineered to be ruthlessly strict — never praises mediocre work

Model: Sonnet by default; raise via GAN_EVALUATOR_MODEL=opus for stronger judgment + tool use

Evaluation Criteria

The default four criteria, each scored 1-10:

## Evaluation Rubric

### Design Quality (weight: 0.3)
- 1-3: Generic, template-like, "AI slop" aesthetics
- 4-6: Competent but unremarkable, follows conventions
- 7-8: Distinctive, cohesive visual identity
- 9-10: Could pass for a professional designer's work

### Originality (weight: 0.2)
- 1-3: Default colors, stock layouts, no personality
- 4-6: Some custom choices, mostly standard patterns
- 7-8: Clear creative vision, unique approach
- 9-10: Surprising, delightful, genuinely novel

### Craft (weight: 0.3)
- 1-3: Broken layouts, missing states, no animations
- 4-6: Works but feels rough, inconsistent spacing
- 7-8: Polished, smooth transitions, responsive
- 9-10: Pixel-perfect, delightful micro-interactions

### Functionality (weight: 0.2)
- 1-3: Core features broken or missing
- 4-6: Happy path works, edge cases fail
- 7-8: All features work, good error handling
- 9-10: Bulletproof, handles every edge case

Scoring

  • Weighted score = sum of (criterion_score * weight)
  • Pass threshold = 7.0 (configurable)
  • Max iterations = 15 (configurable, typically 5-15 sufficient)

Usage

Via Command

# Full three-agent harness
/project:gan-build "Build a project management app with Kanban boards, team collaboration, and dark mode"

# With custom config
/project:gan-build "Build a recipe sharing platform" --max-iterations 10 --pass-threshold 7.5

# Frontend design mode (generator + evaluator only, no planner)
/project:gan-design "Create a landing page for a crypto portfolio tracker"

Via Shell Script

# Basic usage
./scripts/gan-harness.sh "Build a music streaming dashboard"

# With options
GAN_MAX_ITERATIONS=10 \
GAN_PASS_THRESHOLD=7.5 \
GAN_EVAL_CRITERIA="functionality,performance,security" \
./scripts/gan-harness.sh "Build a REST API for task management"

Via Claude Code (Manual)

# Step 1: Plan
claude -p --model sonnet "You are a Product Planner. Read PLANNER_PROMPT.md. Expand this brief into a full product spec: 'Build a Kanban board app'. Write spec to spec.md"

# Step 2: Generate (iteration 1)
claude -p --model sonnet "You are a Generator. Read spec.md. Implement Sprint 1. Start the dev server on port 3000."

# Step 3: Evaluate (iteration 1)
claude -p --model sonnet --allowedTools "Read,Bash,mcp__playwright__*" "You are an Evaluator. Read EVALUATOR_PROMPT.md. Test the live app at http://localhost:3000. Score against the rubric. Write feedback to feedback-001.md"

# Step 4: Generate (iteration 2 — reads feedback)
claude -p --model sonnet "You are a Generator. Read spec.md and feedback-001.md. Address all issues. Improve the scores."

# Repeat steps 3-4 until pass threshold met

Evolution Across Model Capabilities

The harness should simplify as models improve. Following Anthropic's evolution:

Stage 1 — Weaker Models (Sonnet-class)

  • Full sprint decomposition required
  • Context resets between sprints (avoid context anxiety)
  • 2-agent minimum: Initializer + Coding Agent
  • Heavy scaffolding compensates for model limitations

Stage 2 — Capable Models (Opus 4.5-class)

  • Full 3-agent harness: Planner + Generator + Evaluator
  • Sprint contracts before each implementation phase
  • 10-sprint decomposition for complex apps
  • Context resets still useful but less critical

Stage 3 — Frontier Models (Opus 4.6-class)

  • Simplified harness: single planning pass, continuous generation
  • Evaluation reduced to single end-pass (model is smarter)
  • No sprint structure needed
  • Automatic compaction handles context growth

Key principle: Every harness component encodes an assumption about what the model can't do alone. When models improve, re-test those assumptions. Strip away what's no longer needed.

Configuration

Environment Variables

VariableDefaultDescription
GAN_MAX_ITERATIONS15Maximum generator-evaluator cycles
GAN_PASS_THRESHOLD7.0Weighted score to pass (1-10)
GAN_PLANNER_MODELsonnetModel for planning agent
GAN_GENERATOR_MODELsonnetModel for generator agent
GAN_EVALUATOR_MODELsonnetModel for evaluator agent
GAN_EVAL_CRITERIAdesign,originality,craft,functionalityComma-separated criteria
GAN_DEV_SERVER_PORT3000Port for the live app
GAN_DEV_SERVER_CMDnpm run devCommand to start dev server
GAN_PROJECT_DIR.Project working directory
GAN_SKIP_PLANNERfalseSkip planner, use spec directly
GAN_EVAL_MODEplaywrightplaywright, screenshot, or code-only

Evaluation Modes

ModeToolsBest For
playwrightBrowser MCP + live interactionFull-stack apps with UI
screenshotScreenshot + visual analysisStatic sites, design-only
code-onlyTests + linting + buildAPIs, libraries, CLI tools

Anti-Patterns

  1. Evaluator too lenient — If the evaluator passes everything on iteration 1, your rubric is too generous. Tighten scoring criteria and add explicit penalties for common AI patterns.

  2. Generator ignoring feedback — Ensure feedback is passed as a file, not inline. The generator should read feedback-NNN.md at the start of each iteration.

  3. Infinite loops — Always set GAN_MAX_ITERATIONS. If the generator can't improve past a score plateau after 3 iterations, stop and flag for human review.

  4. Evaluator testing superficially — The evaluator must use Playwright to interact with the live app, not just screenshot it. Click buttons, fill forms, test error states.

  5. Evaluator praising its own fixes — Never let the evaluator suggest fixes and then evaluate those fixes. The evaluator only critiques; the generator fixes.

  6. Context exhaustion — For long sessions, use Claude Agent SDK's automatic compaction or reset context between major phases.

Results: What to Expect

Based on Anthropic's published results:

MetricSolo AgentGAN HarnessImprovement
Time20 min4-6 hours12-18x longer
Cost$9$125-20014-22x more
QualityBarely functionalProduction-readyPhase change
Core featuresBrokenAll workingN/A
DesignGeneric AI slopDistinctive, polishedN/A

The tradeoff is clear: ~20x more time and cost for a qualitative leap in output quality. This is for projects where quality matters.

References

Frequently asked questions about GAN-Style Harness

Similar skills