@kentbeck/pharo-tdd
ADrive a Genie change test-first through the genie MCP tools, working entirely from the live image (no files). Use when adding behavior or fixing a bug in the image — anything where a test should lead.
Install
agr install @kentbeck/pharo-tdd --target claudeWrites 1 file into .claude/skills/, pinned to git-4fbb3f01.
- .claude/skills/pharo-tdd/SKILL.md
Document
name: pharo-tdd description: Drive a Genie change test-first through the genie MCP tools, working entirely from the live image (no files). Use when adding behavior or fixing a bug in the image — anything where a test should lead.
Pharo TDD loop (live image, via the genie MCP tools)
All work goes through the genie MCP tools — there are no files. Prefer the
most specific MCP tool available: read with the read tools, change methods with
define_method, change classes with define_class, and use dedicated
refactoring/removal tools when they exist. Use eval only as a last resort
when no specific MCP tool can express the operation, and keep it minimal.
Confirm every change by reading it back. Never assume a class/selector exists —
look it up first.
Loop
-
Locate. Find the class and its test class:
list_classes(package) →list_methods→get_method_source. Find the matching...Test(TestCase subclass). If none exists, create it viadefine_class(superclassTestCase). -
Red. Write or adjust ONE failing test with
define_method(protocoltests). Run it:run_testwithclass_name. Expect failure. If it passes immediately, the test isn't exercising the new behavior — fix the test before writing code. -
Green. Implement the smallest method that could pass, via
define_method. Runrun_testagain → expect green. Read the method back withget_method_sourceto confirm what's installed. -
Regression check. Run
run_testfor the wholepackage_name. A green class test with a red package is not done. -
Refactor. Clean up while green, re-running
run_testafter each step. (For larger cleanups, switch to thepharo-refactorskill.) -
Done. Persist with
save_imagegated on tests — passtest_packageso it runs them and saves the image only if green. Summarize what changed (class >> selector list).
Debugging a red test
Genie returns full stack traces: failing block source, receiver, and its
variables. Read them. Reproduce with run_test, read/search tools, and the
smallest existing MCP call that exercises the behavior. Use eval only if the
needed probe cannot be expressed through a dedicated MCP tool; if you must use
it, make it minimal and non-mutating unless the task explicitly requires a
mutation. Fix the smallest thing the trace implicates, then re-run the test.
Don't guess.
Rules
- One test, one reason to fail, at a time.
- Modern class API only (
ShiftClassInstaller/define_class), never the deprecatedsubclass:instanceVariableNames:classVariableNames:package:. - Tests are methods too — install them with
define_method, protocoltests. evalis always a last resort, never the default path.
Trustgrade A
- passBody integrity
Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.
- passType matchnot applicable to this artifact type
Whether the artifact is really the kind of thing its metadata claims it is.
- passFreshness
How long since the source repository was last pushed to.
- passPrompt injection
Scans the artifact's own text for instructions aimed at your agent rather than at you.
- passLicense
Whether the source repository declares an SPDX license permissive enough to redistribute.
How the grade is calculated
Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:
- Aevery check passed
- Bone warning
- Ctwo warnings
- Dprompt injection or body integrity failed, or three warnings
- Fone of those failed, and something else is wrong
These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.
Versions
git-4fbb3f0161ea2026-07-31