Debug regex patterns with visual breakdowns
Regex Visual Debugger

Debug regex patterns with visual breakdowns, plain English explanations, test case generation, and flavor conversion. Use when user needs help with regular expressions or pattern matching.
--- name: regex-debugger description: Debug regex patterns with visual breakdowns, plain English explanations, test case generation, and flavor conversion. Use when user needs help with regular expressions or pattern matching. --- # Regex Visual Debugger Interactive regex testing, explanation, and debugging tool. ## When to Use This Skill Activate when the user: - Provides a regex pattern to debug - Asks "why isn't my regex working?" - Needs a regex pattern explained - Wants to test regex against strings - Asks to convert regex between flavors (Python, JS, etc.) - Needs regex pattern suggestions
Overview
Activate when the user: - Provides a regex pattern to debug - Asks "why isn't my regex working?" - Needs a regex pattern explained - Wants to test regex against strings - Asks to convert regex between flavors (Python, JS, etc.) - Needs regex pattern suggestions - Mentions regular expressions or pattern matching
Manual install (npx, ZIP)
npx skills add OneWave-AI/claude-skills --skill regex-debugger -g -a claude-codenpx degit OneWave-AI/claude-skills/regex-debugger#main ~/.claude/skills/regex-debuggerConnects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md5.1 KB
Read SKILL.md here
Show the full text194 lines
Regex Visual Debugger
Interactive regex testing, explanation, and debugging tool.
When to Use This Skill
Activate when the user:
- Provides a regex pattern to debug
- Asks "why isn't my regex working?"
- Needs a regex pattern explained
- Wants to test regex against strings
- Asks to convert regex between flavors (Python, JS, etc.)
- Needs regex pattern suggestions
- Mentions regular expressions or pattern matching
Instructions
Analyze the Regex Pattern
- Parse the regex structure
- Identify each component (groups, quantifiers, character classes)
- Check for common syntax errors
- Validate regex syntax for specified flavor
Provide Plain English Explanation
- Break down pattern piece by piece
- Explain what each part matches
- Describe overall pattern behavior
- Clarify quantifier greediness
- Explain capture groups vs. non-capturing groups
Visual Breakdown
- Show pattern structure hierarchically
- Highlight groups and alternations
- Indicate character classes and ranges
- Mark anchors and boundaries
Test Against Examples
- Test provided test strings
- Show what matches and what doesn't
- Highlight matched portions
- Explain why matches succeed or fail
- Show capture group contents
Identify Common Issues
- Unescaped special characters
- Incorrect quantifiers
- Greedy vs. non-greedy issues
- Anchor misplacement
- Unclosed groups
- Flavor-specific incompatibilities
Generate Test Cases
- Create strings that should match
- Create strings that should NOT match
- Include edge cases
- Test boundary conditions
Suggest Improvements
- More efficient patterns
- More readable alternatives
- Performance optimizations
- Edge case handling
Convert Between Flavors
- Python (re module)
- JavaScript
- Perl
- Java
- .NET
- PHP (PCRE)
Output Format
# Regex Analysis: `pattern`
## Plain English Explanation
This pattern matches [description]:
- `^` - Start of string
- `[A-Z]` - One uppercase letter
- `\d{3}` - Exactly 3 digits
- `$` - End of string
**Overall**: Matches strings like "A123", "Z999"
## Visual Structure
^ - Start anchor [A-Z] - Character class (uppercase letters) \d{3} - Digit, exactly 3 times $ - End anchor
## Test Results
### Matches
- `A123` -> Full match
- `Z999` -> Full match
### No Match
- `a123` -> Lowercase 'a' doesn't match [A-Z]
- `A12` -> Only 2 digits (needs 3)
- `A1234` -> Too many digits
## Capture Groups
1. Group 1: `[captured text]`
2. Group 2: `[captured text]`
## Issues Found
**Issue 1**: Pattern is too restrictive
- **Problem**: Doesn't handle lowercase letters
- **Fix**: Use `[A-Za-z]` instead of `[A-Z]`
## Suggested Improvements
```regex
# More flexible version
^[A-Za-z]\d{3,5}$
Changes:
- Added lowercase letters
- Changed
{3}to{3,5}for 3-5 digits
Generated Test Cases
Should Match
A123
Z999
B456
Should NOT Match
1ABC (starts with digit)
ABCD (no digits)
A12 (too few digits)
Flavor-Specific Notes
JavaScript: [any JS-specific notes] Python: [any Python-specific notes]
Conversion to Other Flavors
JavaScript
const pattern = /^[A-Z]\d{3}$/;
const match = str.match(pattern);
Python
import re
pattern = r'^[A-Z]\d{3}$'
match = re.match(pattern, string)
Performance Notes
- Current complexity: O(n)
- No backtracking issues
- Consider using non-capturing groups:
(?:...)for better performance
## Examples
**User**: "Why doesn't this regex match emails: `\w+@\w+\.\w+`?"
**Response**: Analyze pattern → Explain it matches simple emails only → Show test cases (fails on "[email protected]") → Identify issues (doesn't handle special chars, multiple TLDs) → Provide improved pattern → Generate comprehensive test cases
**User**: "Explain this regex: `^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$`"
**Response**: Break down pattern (IP address matcher) → Explain each component → Show it matches valid IPs (0-255 per octet) → Provide test cases → Visualize structure
**User**: "Convert this Python regex to JavaScript: `(?P<name>\w+)`"
**Response**: Identify named capture group (Python feature) → Convert to JS equivalent → Explain differences → Show both versions with usage examples
## Best Practices
- Always test regex with edge cases
- Explain in plain English first
- Show concrete examples (not just theory)
- Highlight common pitfalls for each pattern
- Provide both positive and negative test cases
- Consider performance implications
- Note flavor-specific features
- Suggest simpler alternatives when possible
- Use non-capturing groups for performance
- Escape special characters properly
- Be explicit about case sensitivity
- Test with Unicode characters if relevant
| 1 | |
| 2 | name regex-debugger |
| 3 | description Debug regex patterns with visual breakdowns, plain English explanations, test case generation, and flavor conversion. Use when user needs help with regular expressions or pattern matching. |
| 4 | |
| 5 | |
| 6 | # Regex Visual Debugger |
| 7 | |
| 8 | Interactive regex testing, explanation, and debugging tool. |
| 9 | |
| 10 | ## When to Use This Skill |
| 11 | |
| 12 | Activate when the user: |
| 13 | Provides a regex pattern to debug |
| 14 | Asks "why isn't my regex working?" |
| 15 | Needs a regex pattern explained |
| 16 | Wants to test regex against strings |
| 17 | Asks to convert regex between flavors (Python, JS, etc.) |
| 18 | Needs regex pattern suggestions |
| 19 | Mentions regular expressions or pattern matching |
| 20 | |
| 21 | ## Instructions |
| 22 | |
| 23 | **Analyze the Regex Pattern** |
| 24 | Parse the regex structure |
| 25 | Identify each component (groups, quantifiers, character classes) |
| 26 | Check for common syntax errors |
| 27 | Validate regex syntax for specified flavor |
| 28 | |
| 29 | **Provide Plain English Explanation** |
| 30 | Break down pattern piece by piece |
| 31 | Explain what each part matches |
| 32 | Describe overall pattern behavior |
| 33 | Clarify quantifier greediness |
| 34 | Explain capture groups vs. non-capturing groups |
| 35 | |
| 36 | **Visual Breakdown** |
| 37 | Show pattern structure hierarchically |
| 38 | Highlight groups and alternations |
| 39 | Indicate character classes and ranges |
| 40 | Mark anchors and boundaries |
| 41 | |
| 42 | **Test Against Examples** |
| 43 | Test provided test strings |
| 44 | Show what matches and what doesn't |
| 45 | Highlight matched portions |
| 46 | Explain why matches succeed or fail |
| 47 | Show capture group contents |
| 48 | |
| 49 | **Identify Common Issues** |
| 50 | Unescaped special characters |
| 51 | Incorrect quantifiers |
| 52 | Greedy vs. non-greedy issues |
| 53 | Anchor misplacement |
| 54 | Unclosed groups |
| 55 | Flavor-specific incompatibilities |
| 56 | |
| 57 | **Generate Test Cases** |
| 58 | Create strings that should match |
| 59 | Create strings that should NOT match |
| 60 | Include edge cases |
| 61 | Test boundary conditions |
| 62 | |
| 63 | **Suggest Improvements** |
| 64 | More efficient patterns |
| 65 | More readable alternatives |
| 66 | Performance optimizations |
| 67 | Edge case handling |
| 68 | |
| 69 | **Convert Between Flavors** |
| 70 | Python (re module) |
| 71 | JavaScript |
| 72 | Perl |
| 73 | Java |
| 74 | .NET |
| 75 | PHP (PCRE) |
| 76 | |
| 77 | ## Output Format |
| 78 | |
| 79 | |
| 80 | # Regex Analysis: `pattern` |
| 81 | |
| 82 | ## Plain English Explanation |
| 83 | This pattern matches [description]: |
| 84 | - `^` - Start of string |
| 85 | - `[A-Z]` - One uppercase letter |
| 86 | - `\d{3}` - Exactly 3 digits |
| 87 | - `$` - End of string |
| 88 | |
| 89 | **Overall**: Matches strings like "A123", "Z999" |
| 90 | |
| 91 | ## Visual Structure |
| 92 | |
| 93 | ^ - Start anchor |
| 94 | [A-Z] - Character class (uppercase letters) |
| 95 | \d{3} - Digit, exactly 3 times |
| 96 | $ - End anchor |
| 97 | |
| 98 | |
| 99 | ## Test Results |
| 100 | |
| 101 | ### Matches |
| 102 | - `A123` -> Full match |
| 103 | - `Z999` -> Full match |
| 104 | |
| 105 | ### No Match |
| 106 | - `a123` -> Lowercase 'a' doesn't match [A-Z] |
| 107 | - `A12` -> Only 2 digits (needs 3) |
| 108 | - `A1234` -> Too many digits |
| 109 | |
| 110 | ## Capture Groups |
| 111 | 1. Group 1: `[captured text]` |
| 112 | 2. Group 2: `[captured text]` |
| 113 | |
| 114 | ## Issues Found |
| 115 | **Issue 1**: Pattern is too restrictive |
| 116 | - **Problem**: Doesn't handle lowercase letters |
| 117 | - **Fix**: Use `[A-Za-z]` instead of `[A-Z]` |
| 118 | |
| 119 | ## Suggested Improvements |
| 120 | |
| 121 | # More flexible version |
| 122 | ^[A-Za-z]\d{3,5}$ |
| 123 | |
| 124 | **Changes**: |
| 125 | - Added lowercase letters |
| 126 | - Changed `{3}` to `{3,5}` for 3-5 digits |
| 127 | |
| 128 | ## Generated Test Cases |
| 129 | |
| 130 | ### Should Match |
| 131 | |
| 132 | A123 |
| 133 | Z999 |
| 134 | B456 |
| 135 | |
| 136 | |
| 137 | ### Should NOT Match |
| 138 | |
| 139 | 1ABC (starts with digit) |
| 140 | ABCD (no digits) |
| 141 | A12 (too few digits) |
| 142 | |
| 143 | |
| 144 | ## Flavor-Specific Notes |
| 145 | **JavaScript**: [any JS-specific notes] |
| 146 | **Python**: [any Python-specific notes] |
| 147 | |
| 148 | ## Conversion to Other Flavors |
| 149 | |
| 150 | ### JavaScript |
| 151 | |
| 152 | const pattern = /^[A-Z]\d{3}$/; |
| 153 | const match = str.match(pattern); |
| 154 | |
| 155 | |
| 156 | ### Python |
| 157 | |
| 158 | import re |
| 159 | pattern = r'^[A-Z]\d{3}$' |
| 160 | match = re.match(pattern, string) |
| 161 | |
| 162 | |
| 163 | ## Performance Notes |
| 164 | - Current complexity: O(n) |
| 165 | - No backtracking issues |
| 166 | - Consider using non-capturing groups: `(?:...)` for better performance |
| 167 | |
| 168 | |
| 169 | ## Examples |
| 170 | |
| 171 | **User**: "Why doesn't this regex match emails: `\w+@\w+\.\w+`?" |
| 172 | **Response**: Analyze pattern → Explain it matches simple emails only → Show test cases (fails on "[email protected]") → Identify issues (doesn't handle special chars, multiple TLDs) → Provide improved pattern → Generate comprehensive test cases |
| 173 | |
| 174 | **User**: "Explain this regex: `^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$`" |
| 175 | **Response**: Break down pattern (IP address matcher) → Explain each component → Show it matches valid IPs (0-255 per octet) → Provide test cases → Visualize structure |
| 176 | |
| 177 | **User**: "Convert this Python regex to JavaScript: `(?P<name>\w+)`" |
| 178 | **Response**: Identify named capture group (Python feature) → Convert to JS equivalent → Explain differences → Show both versions with usage examples |
| 179 | |
| 180 | ## Best Practices |
| 181 | |
| 182 | Always test regex with edge cases |
| 183 | Explain in plain English first |
| 184 | Show concrete examples (not just theory) |
| 185 | Highlight common pitfalls for each pattern |
| 186 | Provide both positive and negative test cases |
| 187 | Consider performance implications |
| 188 | Note flavor-specific features |
| 189 | Suggest simpler alternatives when possible |
| 190 | Use non-capturing groups for performance |
| 191 | Escape special characters properly |
| 192 | Be explicit about case sensitivity |
| 193 | Test with Unicode characters if relevant |
| 194 |
Details
- License
- MIT
- Stars on the repo
- ★ 306
- Checked
- Source
- OneWave-AI/claude-skills ↗
- Creator
- OneWave-AI · 16 listings
Similar skills
See all →
MCPExpert debugging specialist for errors, test failuresDebugger Agent
SkillEncountering any bug, test failure, or unexpected behaviorSystematic debugging
SkillRequires running verification commands and confirming outputVerification before completion
SkillGuides systematic root-cause debuggingDebugging and error recovery
SkillMaster systematic debugging techniques, profiling toolsDebugging strategies
SkillMaster error handling patterns across languages includingMore from OneWave-AI
SkillFinding security vulnerabilities , correctness bugsCode review pro
SkillMapping mismatched column names to one schemaCSV/Excel Merger
SkillDesigns relational and document database schemasDatabase schema designer
SkillBuild and run a labelled eval set for a System One model Evaluating a typed-decision config
SkillExtract and analyze data from invoices, receiptsFinancial Document Parser
SkillWrites conversion-focused landing page copyLanding page copywriter