agentleFS
poorvith-mppoorvith-mp/skills-developer/skills/regex/SKILL.md

regex

Skill0 starsChanged 3 months agoMITView on GitHub

Build and explain regular expressions with a breakdown of what each part matches and misses. Use when creating, debugging, or optimizing regular expressions.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    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:

    Test against sample inputs (both expected matches and near-misses).

    line 16
  2. Distinctive:

    When the user describes a pattern:

    line 55
  3. Distinctive:

    Always provide the regex with appropriate flags

    line 56
  4. Distinctive:

    Always break down the regex into labeled components:

    line 63
  5. Distinctive:

    Always provide 3-5 test cases showing what the regex matches and doesn't match.

    line 76
  6. Distinctive:

    Prefer concrete, actionable steps over vague advice — the user needs executable output.

    line 79
  7. Distinctive:

    Ask for missing context only when it blocks a correct answer.

    line 80
  8. Distinctive:

    Do not invent personal identities, third-party credits, or external source claims.

    line 81
  9. Distinctive:

    NEVER weaken or skip a failing test to make a change land.

    line 92
  10. Distinctive:

    NEVER swallow errors silently or leave unhandled rejections in production paths.

    line 93
  11. Distinctive:

    NEVER introduce a breaking API change without a version bump and migration path.

    line 94

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

Regular expressions fail on edge cases and catastrophic backtracking (ReDoS). Always specify the dialect (PCRE, JS, Python re), anchor boundary intent, and test positive matches against false positives.

Process

  1. Understand the matching requirement and target regex dialect.
  2. Build the pattern incrementally: character classes, anchors, quantifiers.
  3. Test against sample inputs (both expected matches and near-misses).
  4. Analyze quantifier safety to prevent catastrophic backtracking.
  5. Provide usage examples with proper flags and escaping.

Output Format

Regex Pattern

/your-pattern/flags

Explanation

ComponentMeaning
^Start of string
[a-z]Lowercase letter
+One or more times

Test Cases

✅ Should match:

  • example1 → match
  • example2 → match ❌ Should NOT match:
  • invalid1 → no match
  • invalid2 → no match

Usage Examples

JavaScript:


const regex = /pattern/flags;

const result = regex.test(string);

Python:


import re

result = re.match(r'pattern', string)

Instructions

When the user describes a pattern:

  • Always provide the regex with appropriate flags
  • Explain every component clearly
  • Include both positive and negative test cases
  • Provide code examples in the user's language of choice
  • Warn about any performance considerations
  • Offer a simpler alternative if the regex is complex

Regex Explanation Format

Always break down the regex into labeled components:

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

Breakdown:
^               → Start of string
[a-zA-Z0-9._%+-]+  → One or more valid email chars
@               → Literal @ sign
[a-zA-Z0-9.-]+  → Domain name
\.              → Literal dot (escaped)
[a-zA-Z]{2,}    → TLD: 2 or more letters
$               → End of string

Always provide 3-5 test cases showing what the regex matches and doesn't match.

Critical rules

  1. Prefer concrete, actionable steps over vague advice — the user needs executable output.
  2. Ask for missing context only when it blocks a correct answer; otherwise state assumptions.
  3. Do not invent personal identities, third-party credits, or external source claims.

Verification & Quality Checklist

  • Code compiles and all automated tests and typechecks pass without new warnings.
  • Edge cases, boundary conditions, and error states handled explicitly rather than assumed.
  • No hardcoded secrets, credentials, or insecure defaults introduced.
  • Changes are covered by a test that fails without them.

Anti-Patterns & Constraints

  • NEVER weaken or skip a failing test to make a change land.
  • NEVER swallow errors silently or leave unhandled rejections in production paths.
  • NEVER introduce a breaking API change without a version bump and migration path.

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.