agentleFS
garthcodesgarthcodes/claude-skills/skills/bug-hunt-fix/SKILL.md

bug-hunt-fix

Skill2 starsChanged 35 days agoMITView on GitHub

Fix a bug from bug-hunt and verify the fix using Playwright browser automation

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

33 rules. About 0 are common, 26 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈26

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the bug file provided and extract:

    line 17
  2. Distinctive:

    Read all related files mentioned in the bug report

    line 26
  3. Distinctive:

    Search for the error location in the codebase

    line 27
  4. Distinctive:

    Check related models, controllers, views, and services

    line 29
  5. Distinctive:

    Look for similar patterns or known issues in the codebase

    line 30
  6. Distinctive:

    Check test files for expected behavior

    line 31
  7. Distinctive:

    Before proposing any fix:

    line 35
  8. Distinctive:

    Consider multiple possible causes

    line 38
  9. Distinctive:

    Ensure your solution follows:

    line 44
  10. Distinctive:

    Document your proposed fix:

    line 54
  11. Distinctive:

    Follow existing code patterns and conventions

    line 66
  12. Distinctive:

    Add appropriate error handling

    line 67
  13. Very specific:

    Run linting after changes: bin/standardrb --fix

    line 70
  14. Very specific:

    Use $BASE_URL for the server check and every browser_navigate.

    line 82
  15. Distinctive:

    Ensure the development server is running:

    line 85
  16. Very specific:

    If not running, start it with bin/dev (it reads PORT= from .env) and wait for it to be ready.

    line 91
  17. Very specific:

    Use mcp__playwright__browser_snapshot to see the login form

    line 106
  18. Distinctive:

    Follow the exact steps to reproduce from the bug report, navigating through the UI like a real user:

    line 125
  19. Very specific:

    Use mcp__playwright__browser_snapshot for accessibility tree

    line 131
  20. Very specific:

    Use mcp__playwright__browser_take_screenshot for visual state (save to .playwright-mcp/)

    line 132
  21. Distinctive:

    After reproducing the steps:

    line 137
  22. Distinctive:

    Verify no new console errors were introduced

    line 140
  23. Distinctive:

    Verify no network errors occurred

    line 141
  24. Distinctive:

    Test edge cases related to the bug

    line 144
  25. Distinctive:

    Test that related functionality still works

    line 145
  26. Distinctive:

    If the bug was about Turbo Streams, verify the DOM updates correctly

    line 146
  27. Very specific:

    Add a "Fix Verification" section to the bug file (this is the ONLY edit allowed to /docs/bug-reports/):

    line 151
  28. Distinctive:

    Run the test suite if relevant tests exist

    line 179
  29. Distinctive:

    ALWAYS investigate thoroughly: before implementing any fix

    line 184
  30. Distinctive:

    Understand the root cause: - don't just patch symptoms

    line 185
  31. Distinctive:

    Document everything: - update the bug report with verification results

    line 191
  32. Distinctive:

    Check for regressions: - ensure the fix doesn't break related functionality

    line 192
  33. Distinctive:

    Document what happened in the bug report

    line 198

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Verify Bug Fix Command

You are tasked with fixing a bug that was found by bug-hunt and verifying the fix using Playwright browser automation.

Bug File to Analyze

$ARGUMENTS

Phase 1: Bug Analysis

Step 1: Read and Understand the Bug

Read the bug file provided and extract:

  • Summary: What is the bug?
  • Steps to Reproduce: How to trigger it
  • Expected vs Actual Behavior: What should happen vs what happens
  • Related Files: Files mentioned in the bug report
  • Technical Notes: Any hints about the cause

Step 2: Investigate the Codebase

Perform systematic investigation:

  • Read all related files mentioned in the bug report
  • Search for the error location in the codebase
  • Examine the stack trace if provided
  • Check related models, controllers, views, and services
  • Look for similar patterns or known issues in the codebase
  • Check test files for expected behavior
  • Review Turbo Stream templates if it's a UI update issue

Step 3: Root Cause Analysis

Before proposing any fix:

  • Identify the exact root cause
  • Understand WHY the bug occurs, not just WHERE
  • Consider multiple possible causes
  • Document your findings

Phase 2: Solution Planning

Step 4: Best Practices Review

Ensure your solution follows:

  • Rails 8 conventions and patterns from CLAUDE.md
  • Service object patterns for complex business logic
  • Proper error handling and user feedback
  • Hotwire/Turbo best practices for dynamic updates
  • ViewComponent patterns if UI components are involved
  • Security considerations
  • Performance implications

Step 5: Create Fix Plan

Document your proposed fix:

  • Root cause analysis summary
  • Proposed solution steps
  • Files that need to be modified
  • Potential side effects or risks
  • Testing strategy to verify the fix

Phase 3: Implementation

Step 6: Implement the Fix

When implementing:

  • Make minimal, targeted changes
  • Follow existing code patterns and conventions
  • Add appropriate error handling
  • Include necessary validations
  • For any front-end changes (views, partials, ViewComponents, Stimulus controllers, Turbo Stream templates, CSS/Tailwind, JavaScript): Use the /frontend-expert skill to implement the changes. This ensures proper Hotwire patterns, accessibility, and Tailwind conventions are followed.
  • Run linting after changes: bin/standardrb --fix

Phase 4: Verification with Playwright

Step 7: Resolve the Base URL

This checkout may be the main repo (default port) or a /build-feature worktree with its own server and database (PORT= in .env). Resolve it before touching the browser:

BASE_URL="$(bin/dev-url)"   # $PORT > PORT= in .env > 3000

Use $BASE_URL for the server check and every browser_navigate. Never hardcode the port.

Step 7b: Prerequisites Check

Ensure the development server is running:

curl -sk -o /dev/null -w "%{http_code}" "$BASE_URL" 2>/dev/null || echo "not running"

If not running, start it with bin/dev (it reads PORT= from .env) and wait for it to be ready.

Step 8: Authenticate

Use passwordless authentication:

Available Test Users:

RoleEmail
Adminadmin@example.com
Therapisttherapist@example.com
Coordinatorcoordinator@example.com
Standard Useruser@example.com

Authentication Flow:

  1. Navigate to $BASE_URL
  2. Use mcp__playwright__browser_snapshot to see the login form
  3. Enter the appropriate test email
  4. Click "Send Magic Link"
  5. Get the magic link from logs: tail -100 log/development.log | grep -A5 "magic_link"
  6. Navigate to the magic link URL
  7. Confirm authentication succeeded

Step 9: Set Viewport

Based on the bug's URL:

  • Staff/Admin routes (/staff/*, /admin/*): Desktop viewport (1280x800)
    mcp__playwright__browser_resize(width: 1280, height: 800)
  • Client Portal: Mobile-first viewport (375x667)
    mcp__playwright__browser_resize(width: 375, height: 667)

Step 10: Reproduce and Verify Fix

Follow the exact steps to reproduce from the bug report, navigating through the UI like a real user:

  1. After authentication, use the UI to navigate - click sidebar links, nav menus, and buttons to reach the page where the bug occurs. Do NOT navigate directly to URLs (except for initial load and magic link).
  2. Take initial snapshot with mcp__playwright__browser_snapshot
  3. Execute each reproduction step exactly as documented, clicking buttons and links as a user would
  4. Capture state at critical points:
    • Use mcp__playwright__browser_snapshot for accessibility tree
    • Use mcp__playwright__browser_take_screenshot for visual state (save to .playwright-mcp/)
  5. Check for console errors: mcp__playwright__browser_console_messages with level "error"
  6. Check network requests: mcp__playwright__browser_network_requests

Step 11: Verify Expected Behavior

After reproducing the steps:

  • Confirm the expected behavior now occurs (not the actual/buggy behavior)
  • Take a screenshot showing the fix works (save to .playwright-mcp/ - will be deleted in cleanup)
  • Verify no new console errors were introduced
  • Verify no network errors occurred

Step 12: Additional Verification

  • Test edge cases related to the bug
  • Test that related functionality still works
  • If the bug was about Turbo Streams, verify the DOM updates correctly

Phase 5: Documentation

Step 13: Update Bug Report

Add a "Fix Verification" section to the bug file (this is the ONLY edit allowed to /docs/bug-reports/):

---

## Fix Applied

**Date:** [Current Date]
**Status:** VERIFIED FIXED

### Changes Made
- [File 1]: [Brief description of change]
- [File 2]: [Brief description of change]

### Verification Results
- [x] Followed reproduction steps
- [x] Bug no longer occurs
- [x] Expected behavior confirmed
- [x] No console errors
- [x] No network errors
- [x] Edge cases tested

Note: Do NOT add screenshots to the bug-reports folder. Screenshots are for your verification during testing and should be deleted during cleanup.

Step 14: Clean Up

  • Close the browser: mcp__playwright__browser_close
  • Delete any screenshots you created during verification (in .playwright-mcp/ or elsewhere)
  • Run the test suite if relevant tests exist
  • Ensure linting passes

Important Guidelines

  1. ALWAYS investigate thoroughly before implementing any fix
  2. Understand the root cause - don't just patch symptoms
  3. Make minimal changes - fix the bug without over-engineering
  4. Follow existing patterns - maintain consistency with the codebase
  5. Use /frontend-expert for front-end changes - Any changes to views, partials, ViewComponents, Stimulus controllers, Turbo Stream templates, CSS/Tailwind, or JavaScript MUST use the /frontend-expert skill
  6. Navigate like a real user - During verification, click through the UI (sidebar, menus, buttons) to reach pages. Do NOT type URLs directly (except initial load and magic link).
  7. Verify with Playwright - actually reproduce and confirm the fix
  8. Document everything - update the bug report with verification results
  9. Check for regressions - ensure the fix doesn't break related functionality
  10. Bug reports folder policy - The ONLY edit you should make to /docs/bug-reports/ is updating the bug document itself to explain the fix. Do NOT create, modify, or add any other files in that folder (no screenshots, no new markdown files, no subfolders). Screenshots for verification should be saved elsewhere (e.g., .playwright-mcp/) and deleted during cleanup.

Error Handling

If verification fails:

  1. Document what happened in the bug report
  2. Analyze why the fix didn't work
  3. Return to Phase 2 with new insights
  4. Iterate until the fix is verified

Begin by reading the bug file and understanding the issue thoroughly.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.