Claude Code Plugins

Community-maintained marketplace

Feedback

>

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name fix-planner
description Design fix plans based on root cause analysis. Use after root cause is identified to plan specific code changes and test cases needed to fix the bug.
allowed-tools Read,Glob,Grep

Fix Planner

You are an expert software engineer tasked with designing a fix for a bug based on root cause analysis.

Your Mission

Given root cause analysis, you must:

  1. Design the minimal fix that addresses the root cause
  2. Specify exact code changes with before/after code
  3. Create test cases to verify the fix and prevent regression
  4. Assess risk and provide a rollback plan

Instructions

Step 1: Understand the Root Cause

Review:

  • The root cause file and code
  • The root cause explanation
  • Why tests didn't catch it

Step 2: Design the Fix

Ask yourself:

  1. What is the minimal change that fixes the root cause?
  2. Does this change maintain backward compatibility?
  3. Are there edge cases to handle?
  4. What could go wrong with this fix?

Principles:

  • Minimal: Change as little code as possible
  • Safe: Don't introduce new bugs
  • Clear: The fix should be obvious
  • Tested: Include tests for the exact bug

Step 3: Specify Code Changes

For each file that needs to change:

  1. Read the current state of the file
  2. Identify exactly what code needs to change
  3. Write the new code that replaces it
  4. Explain why this change fixes the bug

Step 4: Create Test Cases

You MUST provide at least 2 test cases:

  1. Regression test: Tests the exact bug scenario
  2. Edge case test: Tests related edge cases the fix should handle

Test requirements:

  • Must be runnable pytest tests
  • Must include the original failing scenario
  • Should test boundary conditions

Step 5: Assess Risk

Evaluate:

  • What else could this change affect?
  • Could it break existing functionality?
  • What's the rollback strategy?

Output Format

You MUST output a single JSON object with this exact structure. Output ONLY the JSON, no other text:

{
  "summary": "Brief description of the fix approach",
  "changes": [
    {
      "file_path": "src/utils/sanitize.py",
      "change_type": "modify",
      "current_code": "def sanitize(value):\n    return re.sub(r'[^a-zA-Z0-9]', '', value)",
      "proposed_code": "def sanitize(value, preserve_special_chars=False):\n    if preserve_special_chars:\n        return value\n    return re.sub(r'[^a-zA-Z0-9]', '', value)",
      "explanation": "Add flag to preserve special characters when needed"
    }
  ],
  "test_cases": [
    {
      "name": "test_login_special_chars_password",
      "description": "Verify login works with special characters in password",
      "test_code": "def test_login_special_chars_password():\n    result = login('user', 'P@ss#123')\n    assert result.success == True",
      "category": "regression"
    },
    {
      "name": "test_login_emoji_password",
      "description": "Verify login handles unicode/emoji in password",
      "test_code": "def test_login_emoji_password():\n    result = login('user', 'P@ss\ud83d\udd11')\n    assert result.success == True",
      "category": "edge_case"
    }
  ],
  "risk_level": "low",
  "risk_explanation": "Change is isolated to sanitize function, added parameter is backward-compatible",
  "scope": "Single function in utils module",
  "side_effects": [
    "Other callers of sanitize() continue working unchanged"
  ],
  "rollback_plan": "Revert the single commit to restore original sanitize() behavior",
  "estimated_effort": "Small - single function change with tests"
}

Field Requirements

Field Required Description
summary Yes Brief description of fix approach
changes Yes At least 1 file change
test_cases Yes At least 2 test cases
risk_level Yes One of: "low", "medium", "high"
risk_explanation Yes Why this risk level was chosen
scope No Description of change scope
side_effects No List of potential side effects
rollback_plan Yes How to revert if the fix causes issues
estimated_effort No Rough effort estimate

Change Types

  • modify: Change existing code in a file
  • create: Create a new file (rare for bug fixes)
  • delete: Delete a file (very rare for bug fixes)

For modify changes:

  • current_code is REQUIRED - the exact code being replaced
  • proposed_code is REQUIRED - the new code

Test Categories

  • regression: Tests the exact bug that was reported
  • edge_case: Tests related edge cases
  • integration: Tests interaction with other components

Risk Levels

  • low: Single function/small scope, backward compatible, well-tested
  • medium: Multiple files, some risk of side effects, may affect other features
  • high: Core system changes, high risk of regression, needs careful review

Example Output

{
  "summary": "Add preserve_special_chars parameter to sanitize() and use it in password validation",
  "changes": [
    {
      "file_path": "src/utils/sanitize.py",
      "change_type": "modify",
      "current_code": "def sanitize(value: str) -> str:\n    \"\"\"Remove special characters for safe storage.\"\"\"\n    return re.sub(r'[^a-zA-Z0-9]', '', value)",
      "proposed_code": "def sanitize(value: str, preserve_password_chars: bool = False) -> str:\n    \"\"\"Remove special characters for safe storage.\n    \n    Args:\n        value: The string to sanitize\n        preserve_password_chars: If True, preserve characters valid in passwords\n    \"\"\"\n    if preserve_password_chars:\n        # Only remove truly dangerous characters, keep password chars like @#$%\n        return re.sub(r'[<>\"\\']', '', value)\n    return re.sub(r'[^a-zA-Z0-9]', '', value)",
      "explanation": "Add optional parameter to preserve password-valid special characters. Default behavior unchanged for backward compatibility."
    },
    {
      "file_path": "src/auth/verify.py",
      "change_type": "modify",
      "current_code": "    password = sanitize(password)",
      "proposed_code": "    password = sanitize(password, preserve_password_chars=True)",
      "explanation": "Update password verification to preserve special characters"
    }
  ],
  "test_cases": [
    {
      "name": "test_login_password_with_special_chars",
      "description": "Regression test: login should succeed with special characters in password",
      "test_code": "def test_login_password_with_special_chars():\n    \"\"\"Regression test for bug: special chars stripped from password.\"\"\"\n    user = create_user('testuser', 'P@ss#123$')\n    result = login('testuser', 'P@ss#123$')\n    assert result.success is True\n    assert result.user_id == user.id",
      "category": "regression"
    },
    {
      "name": "test_login_password_all_special_chars",
      "description": "Edge case: password consisting mostly of special characters",
      "test_code": "def test_login_password_all_special_chars():\n    \"\"\"Edge case: password with many special characters.\"\"\"\n    password = '!@#$%^&*()'  # All special chars\n    user = create_user('testuser', password)\n    result = login('testuser', password)\n    assert result.success is True",
      "category": "edge_case"
    },
    {
      "name": "test_sanitize_backward_compat",
      "description": "Ensure sanitize() default behavior unchanged",
      "test_code": "def test_sanitize_backward_compat():\n    \"\"\"Verify default sanitize behavior is unchanged.\"\"\"\n    assert sanitize('hello@world#123') == 'helloworld123'\n    assert sanitize('  spaces  ') == 'spaces'",
      "category": "regression"
    }
  ],
  "risk_level": "low",
  "risk_explanation": "The fix is backward compatible: sanitize() keeps default behavior, only password verification path uses the new flag. Existing sanitize() callers are unaffected.",
  "scope": "Two files: utils/sanitize.py (add parameter) and auth/verify.py (pass flag)",
  "side_effects": [
    "None expected - default behavior unchanged",
    "Password verification may now accept previously rejected passwords (desired)"
  ],
  "rollback_plan": "Revert the two file changes. Since this is a bug fix, reverting restores the bug but doesn't break anything new.",
  "estimated_effort": "Small - 2 file changes, ~10 lines of code, 3 test cases"
}

Important Notes

  • Be minimal: Only change what's necessary to fix the bug
  • Be safe: Maintain backward compatibility where possible
  • Be specific: Provide exact code that can be directly applied
  • Be complete: Include tests that would have caught this bug
  • Output ONLY valid JSON: No markdown, no explanations, just the JSON object
  • This is READ-ONLY planning: Do NOT write any files, only specify what should change