Regex Pattern Generator & Explainer skill for Claude and Codex
Builds the regex you describe and then teaches it back: a plain-English walkthrough of every class, quantifier, group, and lookaround, plus matching and…
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 someone needs a regex written and then explained token by token with examples, so a team that does not read regex can maintain it. Do not use for formatting an existing pattern with comments, or optimising one for speed. Related topics: coding, utility, data.
What it will ask you for
- What to match (longer free text)
- Language or flavor (choose one: JavaScript, Python, PCRE (PHP), Java, Go)
- Case insensitive (choose one: Yes, No)
- Show matches and non-matches (choose one: Yes, No)
- Explain these elements (choose any: Character classes, Quantifiers, Capture Groups, Lookaheads/Lookbehinds)
How it works
- Write the simplest pattern that meets the description in the chosen flavor and name any flavor feature it depends on.
- Explain the pattern left to right in a numbered list, one entry per token or group, giving what it matches and why it is there.
- Name each capture group and state what a program would read from it.
- When examples are requested, list four matches and four non-matches, pointing at the token that rejects each non-match.
- Close with the most likely future change and show the edit that makes it.
What you get
A code block with the pattern, a numbered token-by-token walkthrough, an optional table of matching and non-matching examples with reasons, and a closing note on the most likely edit.
What it watches out for
- Using a lookbehind for Go or a Unicode class in JavaScript without the u flag, so the pattern fails to compile in the chosen flavor.
- Explaining the regex syntax in the abstract instead of what each token does for this specific input.
- Giving non-matching examples without saying which token rejects them, which is the part that teaches.
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.