agentleFS
surfmind-spacesurfmind-space/awesome-surfmind/skills/regex-decoder/SKILL.md

regex-decoder

Skill8 starsChanged 5 months agoMITView on GitHub

Breaks a regular expression down into plain-language parts with examples of what it matches and what it rejects. Use when the user asks to explain, decode, or understand a regex, regexp, or pattern — "what does this regex match", "explain this pattern", a .match/.test call.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Call out edge cases that bite people: anchoring, greediness, escaping, capture vs.

    line 19

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

Regex Decoder

Break a regular expression down into plain-language parts so the user understands exactly what it accepts and rejects. Work only from the pattern and flags given; don't assume a feature works in every engine, and don't rewrite the pattern without preserving its behavior.

  1. Identify the regex flavor if visible (JavaScript, Python, PCRE, RE2, Rust, POSIX) and any flags, since they change meaning.
  2. Break the pattern into ordered pieces — each anchor, character class, quantifier, group, and literal as its own piece — and explain each in plain language.
  3. Give a couple of strings it matches and a couple it rejects, including a near-miss that shows where the boundary is.
  4. Call out edge cases that bite people: anchoring, greediness, escaping, capture vs. non-capture groups, Unicode behavior, and catastrophic-backtracking risk when relevant.

Return concise headings and include these sections when they fit: Plain-English summary, Piece by piece, Matches / Rejects, Edge cases, Safer rewrite (only if it preserves behavior). If the pattern is ambiguous or the flavor is unknown, say so and explain the most common interpretation. Respond in the same language as the user's request.

Example

Pattern (JavaScript): ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Plain-English summary: A loose email check — local part, then @, then a domain ending in a dot and at least two letters.

Piece by piece:

  • ^ — anchors to the start of the string.
  • [a-zA-Z0-9._%+-]+ — one or more letters, digits, or . _ % + - (the local part).
  • @ — a literal at-sign.
  • [a-zA-Z0-9.-]+ — one or more letters, digits, dots, or hyphens (the domain).
  • \. — a literal dot (escaped, so not "any character").
  • [a-zA-Z]{2,} — two or more letters (the TLD).
  • $ — anchors to the end of the string.

Matches: a@b.io, jane.doe+test@mail.example.com

Rejects: a@b.c (TLD too short), no-at-sign.com (no @), a@b.io (leading space — anchors forbid it).

Edge cases: Anchors mean the whole string must match, so surrounding whitespace fails. It accepts plenty of invalid addresses (a@-.io, consecutive dots) — fine for a form hint, not for true validation.

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.