RegEx Pattern Formatter skill for Claude and Codex
Turns an unreadable one-line regex into a commented, line-by-line version in your language's verbose or concatenated form, so reviewers can follow each part…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when an existing regex is too dense to review and needs splitting into commented lines without changing what it matches. Do not use for writing a new regex from a description or making a slow regex faster. Related topics: coding, regex.
What it will ask you for
- Raw pattern (longer free text)
- What it validates (free text, e.g. "brief description of what the pattern matches")
- Language or flavor (choose one: JavaScript, Python, PCRE, Java, .NET)
- Comment style (choose one: // line comment, # line comment, /* block comment */)
- Max line length (number from 40 to 120)
- Include example tests (choose one: Yes, No)
How it works
- Read the raw pattern and state in one sentence what it actually matches, noting any gap from the stated purpose.
- Split the pattern at anchors, groups, alternations, and quantified classes, one logical piece per line under the length limit.
- Use the flavor's verbose mode where it exists, or commented string concatenation for JavaScript, escaping literal spaces and hashes in verbose mode.
- Comment each line with what it matches in plain words, not a restatement of the regex syntax.
- When tests are requested, add a table of example strings with match or no match, and confirm the formatted pattern gives the same results as the original.
What you get
One code block in the chosen language holding the formatted and commented pattern, an optional table of test strings with match results, and a one-line note on any suspected defect.
What it watches out for
- Enabling verbose mode without escaping a literal space or hash, which silently changes what the pattern matches.
- Commenting with the regex syntax restated ('one or more digits') instead of the meaning ('the area code').
- Splitting inside a character class or between a token and its quantifier, which breaks the pattern.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.