jaime570

Red VS Blue Agents — Security skill for Claude Code

Security community

Two Claude agents duel to harden code: a Red Team pentester finds vulnerabilities (OWASP) and a Blue Team defender patches them, round by round.

How to install Red VS Blue Agents

This entry records only its repository, not the path inside it, so there is no exact command to give. Open jaime570/red-vs-blue-agents and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Red VS Blue Agents does

Two Claude agents duel to harden code: a Red Team pentester finds vulnerabilities (OWASP) and a Blue Team defender patches them, round by round. Built twice: raw Anthropic API vs Claude Agent SDK with tools (Bash, Bandit SAST).

Alternatives in Security

  • T3mp3st — autonomous red teaming platform; multi-agent offensive-security meta-harness 5.7k ★
  • Anthropic Cybersecurity Skills — 734+ structured cybersecurity skills for AI agents · MITRE ATT&CK mapped · agentskills.io open standard · Work 3.8k ★
  • Harden — Run the harden skill to perform a systematic project hardening audit 1k ★

README

Red Team vs Blue Team: Multi-Agent Code Security Duel

Two Claude-powered agents compete round by round to harden a piece of code:

  • 🔴 Red agent (ethical pentester) audits the code and returns a structured vulnerability report: severity, OWASP category, location, attack vector and recommendation.
  • 🔵 Blue agent (defender) receives the report and patches the code, explaining every change.
  • ⚖️ Orchestrator repeats Red → Blue, scores each round by severity and picks a winner:
    • Blue wins when Red can no longer find any CRITICAL or HIGH issues.
    • Red wins if the round limit is reached with blocking issues still open.

This is **defensive** security. The red agent audits *your own* code so the blue agent can fix it. It writes reports and fixes, never working exploits or malware.

Two implementations, one idea

The project implements the same duel twice to compare two ways of building agents:

duelo_seguridad.py duelo_seguridad_sdk.py
Approach Raw Anthropic Python SDK (Messages API) Claude Agent SDK
How agents work Pure text in, JSON out Agents use tools: read files, grep, run Bash and bandit (SAST), edit files in place
Blue's output Full patched code inside JSON Edits the files directly, can run tests
Scope One file or the built-in demo A file or a whole folder (worked on a copy in _work_duelo/)
Extras Saves the hardened code to a file Final cleanup pass for remaining MEDIUM/LOW issues, JSON reports per round

Building the raw version first made the agent loop explicit: prompting, structured output, parsing and orchestration are all hand-written. The Agent SDK version shows how much changes once agents can act on a real codebase.

Example run

On the built-in demo (a small Flask app with SQL injection, path traversal, a hardcoded secret and debug mode on), the red agent's score dropped each round until the blue agent won:

| Round | Red's findings | Score | |--