regex-builder

GitHub

用于根据自然语言描述构建正则表达式或解析现有正则。支持构建与解释两种模式,输出包含模式、逐Token分解、通过/失败测试用例及边缘情况说明,确保结果准确且可理解。

plugins/pm-engineering/skills/regex-builder/SKILL.md mohitagw15856/pm-claude-skills

Trigger Scenarios

需要编写正则表达式 验证或提取特定模式 请求解释正则表达式的含义

Install

npx skills add mohitagw15856/pm-claude-skills --skill regex-builder -g -y
More Options

Non-standard path

npx skills add https://github.com/mohitagw15856/pm-claude-skills/tree/main/plugins/pm-engineering/skills/regex-builder -g -y

Use without installing

npx skills use mohitagw15856/pm-claude-skills@regex-builder

指定 Agent (Claude Code)

npx skills add mohitagw15856/pm-claude-skills --skill regex-builder -a claude-code -g -y

安装 repo 全部 skill

npx skills add mohitagw15856/pm-claude-skills --all -g -y

预览 repo 内 skill

npx skills add mohitagw15856/pm-claude-skills --list

SKILL.md

Frontmatter
{
    "name": "regex-builder",
    "description": "Build a regular expression from a plain-English description, or explain an existing one. Use when asked to write a regex, match\/validate\/extract a pattern, or understand what a regex does. Produces the regex, a token-by-token breakdown, passing and failing test cases, and notes on flavor\/edge cases."
}

Regex Builder & Explainer Skill

Produce correct, readable regular expressions — and explain them so the user actually understands what they're shipping.

Working from a brief

Infer the regex flavor (JavaScript/PCRE/Python/Go) from context; if unstated, default to one and say so (assumed — confirm). Always deliver a working pattern and tests even from a loose description. Never leave placeholders.

Required Inputs

  • What should match and what should NOT — 3+ positive examples and, critically, 2+ near-miss negatives (the strings that look matchable but must be rejected). The negatives are where every regex bug lives.
  • The engine/flavor (JavaScript, PCRE, Python re, RE2, grep -E…) — anchors, lookbehind, and Unicode behaviour differ enough to break portability silently.
  • Where it runs — validation, extraction, or replacement changes how greedy the pattern should be.

Two modes

  • Build: the user describes what to match → produce the regex.
  • Explain: the user pastes a regex → break it down. Detect which from the input.

Output Structure

Pattern

The regex in a code block, plus the flavor and any flags (e.g. i, g, m) and why.

Breakdown

A token-by-token table or list: each part of the pattern and what it matches.

Token Matches
^ start of string

Test cases

  • Matches: 3–5 strings it should match
  • Rejects: 3–5 strings it should not match (include the tricky near-misses)

Notes

Edge cases, catastrophic-backtracking risks, anchoring, Unicode, and a simpler alternative if the regex is getting unwieldy (sometimes "don't use regex" is the right answer — say so).

Quality Checks

  • The pattern actually passes the listed "matches" and rejects the "rejects"
  • Flavor and flags are stated
  • The breakdown covers every token, not just the interesting ones
  • Edge cases / backtracking risks are flagged

Anti-Patterns

  • Do not give a regex with no test cases — always prove it
  • Do not ignore the flavor — \d, lookbehind, and named groups differ across engines
  • Do not produce an unreadable one-liner when a commented/verbose version or a non-regex approach is clearer
  • Do not silently assume anchoring — state whether it matches the whole string or a substring

Version History

  • 54fad50 Current 2026-07-19 12:57

    新增“Required Inputs”章节,明确需提供正反例、引擎类型及运行场景;更新Anti-Patterns部分以强调避免静默假设锚点。

  • a38bc30 2026-07-05 11:18

Same Skill Collection

exports/openclaw/360-feedback-template/SKILL.md
exports/openclaw/401k-plan-decoder/SKILL.md
exports/openclaw/ab-test-planner/SKILL.md
exports/openclaw/ab-test-readout/SKILL.md
exports/openclaw/accessibility-audit/SKILL.md
exports/openclaw/account-plan/SKILL.md
exports/openclaw/acquirer-red-team/SKILL.md
exports/openclaw/ad-copy/SKILL.md
exports/openclaw/aeo-optimizer/SKILL.md
exports/openclaw/agenda-or-cancel/SKILL.md
exports/openclaw/agent-design-review/SKILL.md
exports/openclaw/agent-observability-spec/SKILL.md
exports/openclaw/agent-spec/SKILL.md
exports/openclaw/ai-ethics-review/SKILL.md
exports/openclaw/ai-eval-plan/SKILL.md
exports/openclaw/ai-feature-prd/SKILL.md
exports/openclaw/ai-product-canvas/SKILL.md
exports/openclaw/air-quality/SKILL.md
exports/openclaw/altitude-shifter/SKILL.md
exports/openclaw/ambiguity-resolver/SKILL.md
exports/openclaw/analyst-relations-brief/SKILL.md
exports/openclaw/announcement-card/SKILL.md
exports/openclaw/api-docs-writer/SKILL.md
exports/openclaw/api-test-plan/SKILL.md
exports/openclaw/api-versioning-strategy/SKILL.md
exports/openclaw/apology-letter/SKILL.md
exports/openclaw/architecture-decision-record/SKILL.md
exports/openclaw/architecture-diagram/SKILL.md
exports/openclaw/archive-strategy/SKILL.md
exports/openclaw/assumption-bounty/SKILL.md
exports/openclaw/assumption-mapper/SKILL.md
exports/openclaw/async-update-format/SKILL.md
exports/openclaw/auto-repair-estimate-decoder/SKILL.md
exports/openclaw/autopilot-charter/SKILL.md
exports/openclaw/benefits-decoder/SKILL.md
exports/openclaw/bid-tender-review/SKILL.md
exports/openclaw/board-deck-narrative/SKILL.md
exports/openclaw/board-minutes/SKILL.md
exports/openclaw/board-pre-read/SKILL.md
exports/openclaw/bom-cost-review/SKILL.md
exports/openclaw/bookkeeping-categorization/SKILL.md
exports/openclaw/boolean-search-builder/SKILL.md
exports/openclaw/brag-doc/SKILL.md
exports/openclaw/brainstorming/SKILL.md
exports/openclaw/brief-builder/SKILL.md
exports/openclaw/briefing-note/SKILL.md
exports/openclaw/budget-builder/SKILL.md
exports/openclaw/budget-variance-analysis/SKILL.md
exports/openclaw/bug-diagnosis/SKILL.md
exports/openclaw/bug-report/SKILL.md

Metadata

Files
0
Version
471c606
Hash
6cbc57da
Indexed
2026-07-05 11:18

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-30 12:27
浙ICP备14020137号-1 $방문자$