agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…
TDD: enforce RED-GREEN-REFACTOR, tests before code.
$ npx -y skills add johnson7788/multiuserclaw --skill test-driven-development --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/test-driven-developmentContext preview
The summary Claude sees to decide when to auto-load this skill.
TDD: enforce RED-GREEN-REFACTOR, tests before code.
name: test-driven-development
description: "TDD: enforce RED-GREEN-REFACTOR, tests before code."
version: 1.1.0
author: Hermes Agent (adapted from obra/superpowers)
license: MIT
platforms: [linux, macos, windows]
metadata:
hermes:
tags: [testing, tdd, development, quality, red-green-refactor]
related_skills: [systematic-debugging, plan, subagent-driven-development]Write the test first. Watch it fail. Write minimal code to pass.
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
**Violating the letter of the rules is violating the spirit of the rules.**
**Always:**
**Exceptions (ask the user first):**
Thinking "skip TDD just this once"? Stop. That's rationalization.
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? Delete it. Start over.
**No exceptions:**
Implement fresh from tests. Period.
Write one minimal test showing what should happen.
**Good test:**
def test_retries_failed_operations_3_times():
attempts = 0
def operation():
nonlocal attempts
attempts += 1
if attempts < 3:
raise Exception('fail')
return 'success'
result = retry_operation(operation)
assert result == 'success'
assert attempts == 3Clear name, tests real behavior, one thing.
**Bad test:**
def test_retry_works():
mock = MagicMock()
mock.side_effect = [Exception(), Exception(), 'success']
result = retry_operation(mock)
assert result == 'success' # What about retry count? Timing?Vague name, tests mock not real code.
**Requirements:**
**MANDATORY. Never skip.**
# Use terminal tool to run the specific test pytest tests/test_feature.py::test_specific_behavior -v
Confirm:
**Test passes immediately?** You're testing existing behavior. Fix the test.
**Test errors?** Fix the error, re-run until it fails correctly.
Write the simplest code to pass the test. Nothing more.
**Good:**
def add(a, b):
return a + b # Nothing extra**Bad:**
def add(a, b):
result = a + b
logging.info(f"Adding {a} + {b} = {result}") # Extra!
return resultDon't add features, refactor other code, or "improve" beyond the test.
**Cheating is OK in GREEN:**
We'll fix it in REFACTOR.
**MANDATORY.**
# Run the specific test pytest tests/test_feature.py::test_specific_behavior -v # Then run ALL tests to check for regressions pytest tests/ -q
Confirm:
**Test fails?** Fix the code, not the test.
**Other tests fail?** Fix regressions now.
After green only:
Keep tests green throughout. Don't add behavior.
**If tests fail during refactor:** Undo immediately. Take smaller steps.
Next failing test for next behavior. One cycle at a time.
Do **not** write all tests first and then all implementation. That is horizontal slicing: RED becomes "write a pile of imagined tests" and GREEN becomes "make the pile pass." It produces brittle tests because the tests are designed before the implementation has taught you what behavior and interface actually matter.
Use vertical tracer bullets instead:
WRONG: RED: test1, test2, test3, test4 GREEN: impl1, impl2, impl3, impl4 RIGHT: RED→GREEN: test1→impl1 RED→GREEN: test2→impl2 RED→GREEN: test3→impl3
A tracer bullet is one end-to-end behavior slice. It proves the path works, teaches you about the interface, and keeps each next test grounded in what you just learned.
**"I'll write tests after to verify it works"**
Tests written after code pass immediately. Passing immediately proves nothing:
Test-first forces you to see the test fail, proving it actually tests something.
**"I already manually tested all the edge cases"**
Manual testing is ad-hoc. You think you tested everything but:
Automated tests are systematic. They run the same way every time.
**"Deleting X hours of work is wasteful"**
Sunk cost fallacy. The time is already gone. Your choice now:
The "waste" is keeping code you can't trust.
**"TDD is dogmatic, being pragmatic means adapting"**
TDD IS pragmatic:
"Pragmatic" shortcuts = debugging in production = slower.
**"Tests after achieve the same goals — it's spirit not ritual"**
No. Tests-after answer "What does this do?" Tests-first answer
基于 Hermes 改造的轻量级 AI 助手框架,可以快速打造商用 SaaS 平台,支持多租户隔离部署、多平台渠道接入、工具调用、定时任务和 Web 实时通信。 在线体验地址: (直接注册即可使用) 当前默认内核后端:Hermes Agent
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…
Use this skill any time a .pptx file is involved in any way — as input, output, or both. This includes: creating slide decks,…