test-first-fix
Skill921 starsChanged 4 months agoMITView on GitHub
Use when: implementing bug fixes or features with RED-GREEN-REFACTOR. Priority order: get user approval before implementation, then apply minimal changes, then run regression checks.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- TrueImmortal82/open-code-skillstheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- TrueImmortal82/open-code-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- pyTermTk-agentsAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- review-branch-or-prSkill
- widget-creationSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
RED: Write and run a failing test
- Distinctive: line 13
Verify: Run broader tests to ensure no regressions
- Very specific: line 24
Create test file in tests/pytest/ or apps/*/tests/
- Distinctive: line 25
Write test that fails with current code
- Distinctive: line 26
Run test and confirm failure with clear error message
- Distinctive: line 44
Wait for explicit approval before coding the fix
- Distinctive: line 50
Prefer simple solutions over comprehensive ones
- Distinctive: line 51
Run the failing test → should now pass
- Distinctive: line 55
Run tests in the same module/category
- Very specific: line 56
Run full test suite if risky changes: pytest tests/pytest/
- Very specific: line 57
Check for flake8 issues: make test
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test-First Fix Workflow
Overview
This skill implements the RED-GREEN-REFACTOR workflow for bug fixes and features in pyTermTk:
- RED: Write and run a failing test
- Approval: Get user approval on the specific code change to resolve the issue
- GREEN: Implement minimal fix to make test pass
- Verify: Run broader tests to ensure no regressions
When to Use
- Fixing bugs in existing widgets or core functionality
- Implementing new features with clear test requirements
- Making changes that need verification before merging
Workflow
Step 1: RED Phase (Write Failing Test)
- Determine what behavior needs to be tested
- Create test file in
tests/pytest/orapps/*/tests/ - Write test that fails with current code
- Run test and confirm failure with clear error message
- Share the failing output with user
Example:
def test_textedit_follow_mode():
"""TextEdit should follow cursor in follow mode"""
widget = TTkTextEdit(followMode=True)
widget.setText("Line 1\nLine 2\nLine 3")
widget.setCursorPosition(2, 0)
assert widget.viewportTopLine() == 2 # Should scroll to show cursorStep 2: Approval Gate
STOP — Do not proceed without explicit user approval.
Ask user:
- "The test fails because [reason]. I'll fix it by [approach]. Approve?"
- Wait for explicit approval before coding the fix
This prevents wasted work if the approach is wrong.
Step 3: GREEN Phase (Minimal Fix)
- Implement the smallest code change that makes the test pass
- Prefer simple solutions over comprehensive ones
- Run the failing test → should now pass
- Confirm no other changes needed
Step 4: Verify (No Regressions)
- Run tests in the same module/category
- Run full test suite if risky changes:
pytest tests/pytest/ - Check for flake8 issues:
make test - Confirm all tests pass
Important Rules
- ❌ Never write test and implementation in same step
- ❌ Never implement before user approval
- ✅ Always ask for approval after RED phase
- ✅ Always verify no regressions after GREEN phase
- ✅ Prefer minimal changes (don't refactor unless needed)
Example Session
USER: Fix the TextEdit cursor position bug
AGENT (RED PHASE):
Created test at tests/pytest/widgets/textedit/test_cursor_bug.py
Test fails: AssertionError: expected 5, got 3
Root cause: setCursorPosition() doesn't update internal position correctly
Fix approach: Modify _cursorPos update in setCursorPosition()
Approve?
USER: Yes, go ahead
AGENT (GREEN PHASE):
[Implements fix]
Test now passes ✓
AGENT (VERIFY PHASE):
Running surrounding tests...
✓ 47 tests passed
✓ 0 tests failed
Done! Fix is ready.Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

