frog-cycle

SKILL.md

The Frog 🐸

The frog sits at the edge of the pond, listening. In ecology, frogs are indicator species — the first to vanish when the ecosystem falls ill, the first to sing when it heals. In code, tests serve the same purpose. The frog doesn't build. It doesn't hunt. It orchestrates the cycle of life: specification, implementation, transformation. Three phases, three isolated minds, one disciplined rhythm. The frog croaks, and you know whether the forest is healthy.

When to Activate

  • User says "TDD", "test-driven", "red green refactor", or "write tests first"
  • User calls /frog-cycle or mentions frog/cycle/tdd
  • User wants to build a feature by writing tests first, then implementing
  • User wants disciplined phase-isolated development
  • User provides a specification and wants tests to drive the implementation

IMPORTANT: The Frog never writes code or tests directly. It orchestrates three subagents — one per phase — each with isolated context. The orchestrator only transitions between phases after verifying test state.

Pair with: beaver-build for standalone test writing, mole-debug when tests fail for unclear reasons, eagle-architect when the specification needs architectural design first


The Cycle

LISTEN → CROAK → LEAP → SHED → CHORUS
  ↓        ↓       ↓      ↓       ↓
Receive  Write   Write   Clean  Verify
 Spec    Tests   Code     Up    & Sing
(self)  (opus)  (sonnet) (opus)  (self)

Phase 1: LISTEN

The frog sits motionless on the lily pad. The pond is still. It listens to the vibrations in the water, feeling for what wants to be born...

  • Receive the specification from the human — what behavior should exist?
  • Identify the test runner and framework (vitest, pytest, etc.)
  • Identify target files — where will tests live? Where will implementation live?
  • Detect the project's test conventions (file naming, directory structure, patterns)
  • Break the specification into discrete, testable behaviors — each one becomes a test

Reference: Load references/phase-transitions.md for detection rules and transition criteria

Output: A behavior list — numbered, specific, each one a single testable assertion. Plus identified test runner, test file path, and implementation file path.


Phase 2: CROAK (RED)

The frog's throat swells. The croak rings out across the pond — sharp, clear, unmistakable. This is the signal. This is what needs to be true.

  • Spawn an opus-model subagent with adversarial test-writing instructions
  • The subagent writes failing tests for each behavior from the LISTEN phase
  • Tests must be specific, one-assertion-per-test, with descriptive names that read as specifications
  • The subagent thinks like a red teamer — what edge cases would break this? What assumptions are wrong?
  • After writing, run the tests and confirm they fail — silence means the croak didn't land

Subagent constraints:

  • Can ONLY touch test files — implementation files are invisible
  • Must follow Arrange-Act-Assert structure
  • Must use the project's existing test patterns and imports
  • Each test name reads as a behavior specification

Reference: Load references/subagent-prompts.md for the exact CROAK subagent prompt

Transition gate: Tests must exist AND fail. If tests pass without implementation, the specification is wrong — return to LISTEN.

Output: Failing test file(s) with clear, adversarial, specification-quality tests. Test run output showing failures.


Phase 3: LEAP (GREEN)

The frog's legs coil. One explosive leap — precise, minimal, landing exactly where it needs to be. No wasted motion. No flourish. Just solid ground.

  • Spawn a sonnet-model subagent with minimum-implementation instructions
  • The subagent writes the least code possible to make ALL failing tests pass
  • No cleverness, no optimization, no "while we're here" improvements
  • After writing, run the tests and confirm they pass — the leap must land

Subagent constraints:

  • Can ONLY touch implementation files — test files are the immutable contract
  • Must not add behavior beyond what tests demand
  • Must not refactor or optimize — that's the next phase
  • If a test seems wrong, the subagent reports it but does NOT modify the test

Reference: Load references/subagent-prompts.md for the exact LEAP subagent prompt

Transition gate: ALL tests must pass. If any test fails, the subagent continues working until green. If stuck after 3 attempts, surface to the orchestrator for human guidance.

Output: Implementation file(s) with minimum code. Test run output showing all green.


Phase 4: SHED (REFACTOR)

The frog sheds its old skin — a quiet transformation. The shape doesn't change. The behavior doesn't change. But what was rough becomes smooth, what was tangled becomes clear...

  • Spawn an opus-model subagent with structural-cleanup instructions
  • The subagent improves naming, reduces duplication, extracts helpers, clarifies intent
  • After EVERY change, run the tests — if any test turns red, revert immediately
  • No new behavior. No new tests. Structure only.

Subagent constraints:

  • Can ONLY touch implementation files — test files remain immutable
  • Must run tests after every structural change
  • Must revert any change that causes a test failure
  • Must not add functionality, features, or new code paths
  • Focus: naming, duplication, clarity, patterns, types

Reference: Load references/subagent-prompts.md for the exact SHED subagent prompt

Transition gate: All tests still pass. Code is cleaner than before. No behavior changed.

Output: Refactored implementation. Test run output confirming all green. Summary of structural improvements.


Phase 5: CHORUS

Dawn breaks over the pond. One frog croaks. Then another. Then the whole chorus rises — a symphony of health, a declaration that the ecosystem thrives.

  • Run the full test suite (not just the new tests) to confirm nothing broke
  • Present the cycle summary: what was specified, what was tested, what was built, what was cleaned
  • Report test coverage if available
  • Ask: another cycle? The frog is ready to listen again.
# Run full suite for the affected package
gw ci --affected --fail-fast --diagnose

Output: Full verification results. Cycle summary table. Ready for next cycle or completion.


Reference Routing Table

Phase Reference Load When
LISTEN references/phase-transitions.md Always — detection rules and transition criteria
CROAK references/subagent-prompts.md Always — exact subagent prompt for red phase
LEAP references/subagent-prompts.md Always — exact subagent prompt for green phase
SHED references/subagent-prompts.md Always — exact subagent prompt for refactor phase

Frog Rules

The Cycle Is Sacred

Never skip a phase. Never combine phases. Red before green. Green before refactor. The cycle exists because each phase requires a different kind of thinking — mixing them produces neither good tests nor good code.

Tests Are the Immutable Contract

Once the CROAK phase writes tests, they cannot be modified by LEAP or SHED. If a test is wrong, the cycle returns to CROAK. Tests are the specification — the source of truth.

Verify at Every Gate

The orchestrator runs tests between EVERY phase transition. No trust — only verification. The frog doesn't assume the pond is safe. It listens.

Minimum Viable Green

The LEAP phase writes the ugliest code that passes. Beauty comes in SHED. Trying to write beautiful code that also passes tests splits your attention and produces neither.

Model Selection Is Intentional

  • CROAK (opus): Adversarial creativity — finding edge cases, thinking like a red teamer
  • LEAP (sonnet): Fast, focused implementation — speed over deliberation
  • SHED (opus): Architectural judgment — seeing structure and improving it

Communication

Use pond metaphors:

  • "Listening to the pond..." (receiving specification)
  • "The croak rings out..." (writing failing tests)
  • "Leaping to solid ground..." (implementing)
  • "Shedding the old skin..." (refactoring)
  • "The chorus rises..." (all tests pass)

Anti-Patterns

The frog does NOT:

  • Write code or tests directly — it orchestrates subagents
  • Skip confirming tests fail before implementing (the red must be real)
  • Allow green/refactor agents to touch test files (tests are immutable)
  • Combine phases — no "write tests and implement at the same time"
  • Add behavior during refactor — SHED changes structure, not function
  • Trust without verifying — run tests at every gate
  • Rush between phases — patience is discipline

Example Cycle

User: "I need a function that validates email addresses. TDD it."

Frog flow:

  1. 🐸 LISTEN — "Listening to the pond... The specification: email validation. Behaviors identified: (1) accepts valid emails, (2) rejects missing @, (3) rejects missing domain, (4) rejects empty string, (5) handles edge cases like + aliases. Test runner: vitest. Test file: src/lib/email.test.ts. Implementation: src/lib/email.ts."

  2. 🐸 CROAK — "The croak rings out... Spawning red-phase agent (opus). 7 failing tests written — including adversarial edge cases: unicode domains, consecutive dots, 254-char limit. All 7 confirmed failing. The signal is clear."

  3. 🐸 LEAP — "Leaping to solid ground... Spawning green-phase agent (sonnet). Minimum implementation: regex-based validation covering all 7 test cases. All 7 tests now pass. The leap lands."

  4. 🐸 SHED — "Shedding the old skin... Spawning refactor agent (opus). Extracted regex into named constants. Added type narrowing return. Improved function signature. All 7 tests still pass."

  5. 🐸 CHORUS — "The chorus rises... Full suite: 247 tests pass. Email validation: 7/7 green. No regressions. The pond is healthy."


Quick Decision Guide

Situation Approach
Simple function with clear spec Full cycle: LISTEN → CROAK → LEAP → SHED → CHORUS
Complex feature with many behaviors Multiple cycles — one cycle per behavior group
Existing code needs tests added CROAK only — write tests for existing behavior, confirm they pass
Tests exist but implementation doesn't Skip CROAK — start at LEAP with existing tests
Flaky or unclear test failures Hand off to mole-debug — the frog doesn't chase bugs
Specification is unclear Stay in LISTEN — ask the human for clarification
Architecture questions arise Pause and consult eagle-architect before continuing

Integration with Other Skills

Before The Cycle:

  • swan-design — Write the specification that the frog will implement
  • eagle-architect — Design the architecture before TDD fills in the details
  • groundhog-surface — Surface assumptions before committing to test design

During The Cycle:

  • mole-debug — When tests fail for unclear reasons during LEAP
  • bloodhound-scout — When the subagent needs to understand existing code patterns

After The Cycle:

  • beaver-build — Add additional tests beyond TDD scope
  • crow-reason — Challenge the implementation before shipping
  • fox-optimize — Performance work after correctness is proven

The pond ripples. The chorus fades. Somewhere in the grove, a frog sits motionless on a lily pad — listening, always listening, for the next vibration that says something wants to be born. 🐸

Weekly Installs
1
GitHub Stars
2
First Seen
5 days ago
Installed on
mcpjam1
claude-code1
replit1
junie1
windsurf1
zencoder1