cfsa-antigravity 2.19.0 → 2.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/package.json +1 -1
  2. package/template/.agent/kit-sync.md +3 -3
  3. package/template/.claude/commands/audit-ambiguity-execute.md +6 -0
  4. package/template/.claude/commands/audit-ambiguity-rubrics.md +6 -0
  5. package/template/.claude/commands/audit-ambiguity.md +6 -0
  6. package/template/.claude/commands/bootstrap-agents-fill.md +6 -0
  7. package/template/.claude/commands/bootstrap-agents-provision.md +6 -0
  8. package/template/.claude/commands/bootstrap-agents.md +6 -0
  9. package/template/.claude/commands/create-prd-architecture.md +6 -0
  10. package/template/.claude/commands/create-prd-compile.md +6 -0
  11. package/template/.claude/commands/create-prd-design-system.md +6 -0
  12. package/template/.claude/commands/create-prd-security.md +6 -0
  13. package/template/.claude/commands/create-prd-stack.md +6 -0
  14. package/template/.claude/commands/decompose-architecture-structure.md +6 -0
  15. package/template/.claude/commands/decompose-architecture-validate.md +6 -0
  16. package/template/.claude/commands/evolve-contract.md +6 -0
  17. package/template/.claude/commands/evolve-feature-cascade.md +6 -0
  18. package/template/.claude/commands/evolve-feature-classify.md +6 -0
  19. package/template/.claude/commands/evolve-feature.md +6 -0
  20. package/template/.claude/commands/ideate-discover.md +6 -0
  21. package/template/.claude/commands/ideate-extract.md +6 -0
  22. package/template/.claude/commands/ideate-validate.md +6 -0
  23. package/template/.claude/commands/implement-slice-setup.md +6 -0
  24. package/template/.claude/commands/implement-slice-tdd.md +6 -0
  25. package/template/.claude/commands/plan-phase-preflight.md +6 -0
  26. package/template/.claude/commands/plan-phase-write.md +6 -0
  27. package/template/.claude/commands/propagate-decision-apply.md +6 -0
  28. package/template/.claude/commands/propagate-decision-scan.md +6 -0
  29. package/template/.claude/commands/propagate-decision.md +6 -0
  30. package/template/.claude/commands/remediate-pipeline-assess.md +6 -0
  31. package/template/.claude/commands/remediate-pipeline-execute.md +6 -0
  32. package/template/.claude/commands/remediate-pipeline.md +6 -0
  33. package/template/.claude/commands/remediate-shard-split.md +6 -0
  34. package/template/.claude/commands/resolve-ambiguity.md +6 -0
  35. package/template/.claude/commands/setup-workspace-cicd.md +6 -0
  36. package/template/.claude/commands/setup-workspace-data.md +6 -0
  37. package/template/.claude/commands/setup-workspace-hosting.md +6 -0
  38. package/template/.claude/commands/setup-workspace-scaffold.md +6 -0
  39. package/template/.claude/commands/sync-kit.md +6 -0
  40. package/template/.claude/commands/update-architecture-map.md +6 -0
  41. package/template/.claude/commands/validate-phase-quality.md +6 -0
  42. package/template/.claude/commands/validate-phase-readiness.md +6 -0
  43. package/template/.claude/commands/verify-infrastructure.md +6 -0
  44. package/template/.claude/commands/write-architecture-spec-deepen.md +6 -0
  45. package/template/.claude/commands/write-architecture-spec-design.md +6 -0
  46. package/template/.claude/commands/write-be-spec-classify.md +6 -0
  47. package/template/.claude/commands/write-be-spec-write.md +6 -0
  48. package/template/.claude/commands/write-fe-spec-classify.md +6 -0
  49. package/template/.claude/commands/write-fe-spec-write.md +6 -0
  50. package/template/.claude/skills/accessibility/SKILL.md +522 -0
  51. package/template/.claude/skills/accessibility/references/WCAG.md +162 -0
  52. package/template/.claude/skills/accessibility/references/ia-spec-checklist.md +35 -0
  53. package/template/.claude/skills/adversarial-review/SKILL.md +90 -0
  54. package/template/.claude/skills/antigravity-workflows/SKILL.md +81 -0
  55. package/template/.claude/skills/antigravity-workflows/resources/implementation-playbook.md +36 -0
  56. package/template/.claude/skills/api-design-principles/SKILL.md +169 -0
  57. package/template/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  58. package/template/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
  59. package/template/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  60. package/template/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
  61. package/template/.claude/skills/api-design-principles/resources/implementation-playbook.md +513 -0
  62. package/template/.claude/skills/api-versioning/SKILL.md +166 -0
  63. package/template/.claude/skills/api-versioning/references/typescript.md +157 -0
  64. package/template/.claude/skills/architecture-mapping/SKILL.md +219 -0
  65. package/template/.claude/skills/bootstrap-agents/SKILL.md +258 -0
  66. package/template/.claude/skills/brainstorming/SKILL.md +177 -0
  67. package/template/.claude/skills/brand-guidelines/SKILL.md +44 -0
  68. package/template/.claude/skills/clean-code/SKILL.md +196 -0
  69. package/template/.claude/skills/clean-code/references/typescript.md +126 -0
  70. package/template/.claude/skills/code-review-pro/SKILL.md +152 -0
  71. package/template/.claude/skills/concise-planning/SKILL.md +107 -0
  72. package/template/.claude/skills/cross-layer-consistency/SKILL.md +117 -0
  73. package/template/.claude/skills/database-schema-design/SKILL.md +205 -0
  74. package/template/.claude/skills/database-schema-design/references/relational.md +228 -0
  75. package/template/.claude/skills/deployment-procedures/SKILL.md +241 -0
  76. package/template/.claude/skills/design-anti-cliche/SKILL.md +159 -0
  77. package/template/.claude/skills/design-direction/SKILL.md +45 -0
  78. package/template/.claude/skills/error-handling-patterns/SKILL.md +226 -0
  79. package/template/.claude/skills/error-handling-patterns/references/go.md +162 -0
  80. package/template/.claude/skills/error-handling-patterns/references/python.md +262 -0
  81. package/template/.claude/skills/error-handling-patterns/references/rust.md +112 -0
  82. package/template/.claude/skills/error-handling-patterns/references/typescript.md +178 -0
  83. package/template/.claude/skills/find-skills/SKILL.md +145 -0
  84. package/template/.claude/skills/git-advanced/SKILL.md +972 -0
  85. package/template/.claude/skills/git-workflow/SKILL.md +420 -0
  86. package/template/.claude/skills/idea-extraction/SKILL.md +644 -0
  87. package/template/.claude/skills/logging-best-practices/SKILL.md +192 -0
  88. package/template/.claude/skills/logging-best-practices/references/go.md +49 -0
  89. package/template/.claude/skills/logging-best-practices/references/python.md +52 -0
  90. package/template/.claude/skills/logging-best-practices/references/typescript.md +215 -0
  91. package/template/.claude/skills/migration-management/SKILL.md +200 -0
  92. package/template/.claude/skills/migration-management/references/relational.md +214 -0
  93. package/template/.claude/skills/minimalist-surgical-development/SKILL.md +135 -0
  94. package/template/.claude/skills/parallel-agents/SKILL.md +165 -0
  95. package/template/.claude/skills/parallel-debugging/SKILL.md +135 -0
  96. package/template/.claude/skills/parallel-feature-development/SKILL.md +157 -0
  97. package/template/.claude/skills/performance-budgeting/SKILL.md +144 -0
  98. package/template/.claude/skills/pipeline-rubrics/SKILL.md +51 -0
  99. package/template/.claude/skills/pipeline-rubrics/references/architecture-rubric.md +19 -0
  100. package/template/.claude/skills/pipeline-rubrics/references/be-rubric.md +21 -0
  101. package/template/.claude/skills/pipeline-rubrics/references/fe-rubric.md +20 -0
  102. package/template/.claude/skills/pipeline-rubrics/references/ia-rubric.md +19 -0
  103. package/template/.claude/skills/pipeline-rubrics/references/scoring.md +32 -0
  104. package/template/.claude/skills/pipeline-rubrics/references/vision-rubric.md +12 -0
  105. package/template/.claude/skills/prd-templates/SKILL.md +107 -0
  106. package/template/.claude/skills/prd-templates/references/architecture-completeness-checklist.md +28 -0
  107. package/template/.claude/skills/prd-templates/references/architecture-design-template.md +88 -0
  108. package/template/.claude/skills/prd-templates/references/be-spec-classification.md +41 -0
  109. package/template/.claude/skills/prd-templates/references/be-spec-template.md +107 -0
  110. package/template/.claude/skills/prd-templates/references/bootstrap-verification-protocol.md +50 -0
  111. package/template/.claude/skills/prd-templates/references/constraint-exploration.md +41 -0
  112. package/template/.claude/skills/prd-templates/references/data-placement-template.md +74 -0
  113. package/template/.claude/skills/prd-templates/references/decision-confirmation-protocol.md +68 -0
  114. package/template/.claude/skills/prd-templates/references/decision-propagation.md +121 -0
  115. package/template/.claude/skills/prd-templates/references/decomposition-templates.md +226 -0
  116. package/template/.claude/skills/prd-templates/references/deep-ideation-loading-protocol.md +114 -0
  117. package/template/.claude/skills/prd-templates/references/design-system-decisions.md +198 -0
  118. package/template/.claude/skills/prd-templates/references/design-system-prerequisite-check.md +18 -0
  119. package/template/.claude/skills/prd-templates/references/domain-exhaustion-criteria.md +37 -0
  120. package/template/.claude/skills/prd-templates/references/engagement-tier-protocol.md +58 -0
  121. package/template/.claude/skills/prd-templates/references/engineering-standards-template.md +126 -0
  122. package/template/.claude/skills/prd-templates/references/evolution-layer-guidance.md +91 -0
  123. package/template/.claude/skills/prd-templates/references/expansion-modes.md +27 -0
  124. package/template/.claude/skills/prd-templates/references/fe-classification-procedures.md +47 -0
  125. package/template/.claude/skills/prd-templates/references/fe-spec-template.md +90 -0
  126. package/template/.claude/skills/prd-templates/references/feature-ledger-protocol.md +149 -0
  127. package/template/.claude/skills/prd-templates/references/folder-seeding-protocol.md +77 -0
  128. package/template/.claude/skills/prd-templates/references/fractal-cx-template.md +58 -0
  129. package/template/.claude/skills/prd-templates/references/fractal-feature-template.md +93 -0
  130. package/template/.claude/skills/prd-templates/references/fractal-node-index-template.md +55 -0
  131. package/template/.claude/skills/prd-templates/references/gate-applicability.md +92 -0
  132. package/template/.claude/skills/prd-templates/references/ideation-crosscut-template.md +36 -0
  133. package/template/.claude/skills/prd-templates/references/ideation-index-template.md +111 -0
  134. package/template/.claude/skills/prd-templates/references/ideation-meta-template.md +126 -0
  135. package/template/.claude/skills/prd-templates/references/infrastructure-report-template.md +71 -0
  136. package/template/.claude/skills/prd-templates/references/input-classification.md +23 -0
  137. package/template/.claude/skills/prd-templates/references/map-guard-protocol.md +65 -0
  138. package/template/.claude/skills/prd-templates/references/operational-templates.md +116 -0
  139. package/template/.claude/skills/prd-templates/references/persona-completeness-gate.md +20 -0
  140. package/template/.claude/skills/prd-templates/references/placeholder-guard-template.md +21 -0
  141. package/template/.claude/skills/prd-templates/references/placeholder-workflow-mapping.md +50 -0
  142. package/template/.claude/skills/prd-templates/references/shard-boundary-analysis.md +103 -0
  143. package/template/.claude/skills/prd-templates/references/shard-split-remediation.md +157 -0
  144. package/template/.claude/skills/prd-templates/references/skill-loading-protocol.md +36 -0
  145. package/template/.claude/skills/prd-templates/references/slice-completion-gates.md +29 -0
  146. package/template/.claude/skills/prd-templates/references/spec-coverage-sweep.md +44 -0
  147. package/template/.claude/skills/prd-templates/references/surface-model.md +61 -0
  148. package/template/.claude/skills/prd-templates/references/tdd-testing-policy.md +39 -0
  149. package/template/.claude/skills/prd-templates/references/vision-template.md +57 -0
  150. package/template/.claude/skills/prd-templates/references/workflow-checkpoint-protocol.md +112 -0
  151. package/template/.claude/skills/prd-templates/references/write-verification-protocol.md +57 -0
  152. package/template/.claude/skills/prompt-engineer/SKILL.md +203 -0
  153. package/template/.claude/skills/regex-patterns/SKILL.md +333 -0
  154. package/template/.claude/skills/regex-patterns/references/go.md +44 -0
  155. package/template/.claude/skills/regex-patterns/references/javascript.md +63 -0
  156. package/template/.claude/skills/regex-patterns/references/python.md +77 -0
  157. package/template/.claude/skills/regex-patterns/references/rust.md +43 -0
  158. package/template/.claude/skills/resolve-ambiguity/SKILL.md +278 -0
  159. package/template/.claude/skills/security-scanning-security-hardening/SKILL.md +231 -0
  160. package/template/.claude/skills/session-continuity/SKILL.md +732 -0
  161. package/template/.claude/skills/session-continuity/protocols/01-session-resumption.md +38 -0
  162. package/template/.claude/skills/session-continuity/protocols/02-progress-generation.md +85 -0
  163. package/template/.claude/skills/session-continuity/protocols/03-progress-update.md +70 -0
  164. package/template/.claude/skills/session-continuity/protocols/04-pattern-extraction.md +60 -0
  165. package/template/.claude/skills/session-continuity/protocols/05-session-close.md +37 -0
  166. package/template/.claude/skills/session-continuity/protocols/06-decision-analysis.md +84 -0
  167. package/template/.claude/skills/session-continuity/protocols/07-spec-pipeline-generation.md +48 -0
  168. package/template/.claude/skills/session-continuity/protocols/08-spec-pipeline-update.md +55 -0
  169. package/template/.claude/skills/session-continuity/protocols/09-parallel-claim.md +122 -0
  170. package/template/.claude/skills/session-continuity/protocols/10-placeholder-verification-gate.md +83 -0
  171. package/template/.claude/skills/session-continuity/protocols/11-parallel-synthesis.md +21 -0
  172. package/template/.claude/skills/session-continuity/protocols/ambiguity-gates.md +48 -0
  173. package/template/.claude/skills/skill-creator/SKILL.md +203 -0
  174. package/template/.claude/skills/skill-creator/references/.gitkeep +0 -0
  175. package/template/.claude/skills/skill-creator/scripts/.gitkeep +0 -0
  176. package/template/.claude/skills/spec-writing/SKILL.md +110 -0
  177. package/template/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
  178. package/template/.claude/skills/systematic-debugging/SKILL.md +297 -0
  179. package/template/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  180. package/template/.claude/skills/systematic-debugging/condition-based-waiting.md +115 -0
  181. package/template/.claude/skills/systematic-debugging/defense-in-depth.md +122 -0
  182. package/template/.claude/skills/systematic-debugging/find-polluter.sh +63 -0
  183. package/template/.claude/skills/systematic-debugging/root-cause-tracing.md +169 -0
  184. package/template/.claude/skills/systematic-debugging/test-academic.md +14 -0
  185. package/template/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
  186. package/template/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
  187. package/template/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
  188. package/template/.claude/skills/tdd-workflow/SKILL.md +186 -0
  189. package/template/.claude/skills/tdd-workflow/references/typescript.md +231 -0
  190. package/template/.claude/skills/tech-stack-catalog/SKILL.md +49 -0
  191. package/template/.claude/skills/tech-stack-catalog/references/constraint-questions.md +237 -0
  192. package/template/.claude/skills/tech-stack-catalog/references/dev-tooling-decisions.md +37 -0
  193. package/template/.claude/skills/tech-stack-catalog/references/surface-decision-tables.md +69 -0
  194. package/template/.claude/skills/technical-writer/SKILL.md +242 -0
  195. package/template/.claude/skills/testing-strategist/SKILL.md +319 -0
  196. package/template/.claude/skills/testing-strategist/references/typescript.md +328 -0
  197. package/template/.claude/skills/verification-before-completion/SKILL.md +97 -0
  198. package/template/.claude/skills/workflow-automation/SKILL.md +166 -0
  199. package/template/.claude/skills/workflow-automation/references/inngest.md +88 -0
  200. package/template/.claude/skills/workflow-automation/references/temporal.md +64 -0
@@ -0,0 +1,333 @@
1
+ ---
2
+ name: regex-patterns
3
+ description: "Comprehensive regular expressions guide covering character classes, quantifiers, anchors, groups, lookahead/lookbehind, common patterns (email, URL, IP, phone, dates, semver), ReDoS prevention, Unicode support, flags, debugging, and when NOT to use regex."
4
+ version: 2.0.0
5
+ ---
6
+
7
+ # Regular Expressions Mastery
8
+
9
+ ## Stack-Specific References
10
+
11
+ Regex syntax is mostly universal but API usage differs by language. After reading the patterns below, read the reference for your language:
12
+
13
+ | Language | Reference | Engine Notes |
14
+ |----------|-----------|-------------|
15
+ | JavaScript | `references/javascript.md` | V8/SpiderMonkey — full PCRE-like features |
16
+ | Python | `references/python.md` | `re` module — PCRE-like, supports verbose mode |
17
+ | Go | `references/go.md` | RE2 — no backreferences or lookaround |
18
+ | Rust | `references/rust.md` | regex crate — RE2-like; `fancy-regex` for lookaround |
19
+
20
+ ---
21
+
22
+ ## 1. Fundamentals
23
+
24
+ ### Character Classes
25
+
26
+ ```
27
+ . Any character except newline (unless /s flag)
28
+ \d Digit [0-9]
29
+ \D Non-digit [^0-9]
30
+ \w Word character [a-zA-Z0-9_]
31
+ \W Non-word character [^a-zA-Z0-9_]
32
+ \s Whitespace [ \t\n\r\f\v]
33
+ \S Non-whitespace
34
+ [abc] Any of a, b, or c
35
+ [^abc] Not a, b, or c
36
+ [a-z] Range: a through z
37
+ [a-zA-Z] Any letter
38
+ [0-9a-fA-F] Hexadecimal digit
39
+ ```
40
+
41
+ ### Quantifiers
42
+
43
+ ```
44
+ * Zero or more (greedy)
45
+ + One or more (greedy)
46
+ ? Zero or one (optional)
47
+ {3} Exactly 3
48
+ {2,5} Between 2 and 5
49
+ {3,} 3 or more
50
+
51
+ *? Zero or more (lazy)
52
+ +? One or more (lazy)
53
+ {2,5}? Between 2 and 5 (lazy)
54
+
55
+ *+ Zero or more (possessive — not in all engines)
56
+ ++ One or more (possessive)
57
+ ```
58
+
59
+ ### Greedy vs Lazy
60
+
61
+ ```
62
+ Input: <b>bold</b> and <b>more bold</b>
63
+
64
+ <b>.*</b> Greedy: matches entire string (one match)
65
+ <b>.*?</b> Lazy: matches "<b>bold</b>" and "<b>more bold</b>" (two matches)
66
+ ```
67
+
68
+ ---
69
+
70
+ ## 2. Anchors and Boundaries
71
+
72
+ ```
73
+ ^ Start of string (or line with multiline flag)
74
+ $ End of string (or line with multiline flag)
75
+ \b Word boundary (between \w and \W)
76
+ \B Non-word boundary
77
+ \A Start of string (never affected by multiline — Python, Ruby)
78
+ \z End of string (absolute — Python, Ruby)
79
+ ```
80
+
81
+ ### Word Boundary Examples
82
+
83
+ ```
84
+ \bcat\b Matches "cat" in "The cat sat" — not in "concatenate"
85
+ \bpre\w+ Matches "prefix", "preview" — not "compress"
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 3. Groups
91
+
92
+ ### Capturing Groups
93
+
94
+ ```
95
+ (abc) Capture group — stores match for backreference
96
+ (\d{4}) Capture the year
97
+ (\w+)@(\w+) Two capture groups: username and domain
98
+
99
+ # Backreferences
100
+ (.)\1 Matches repeated character: "aa", "bb"
101
+ (\w+)\s+\1 Matches repeated word: "the the"
102
+ ```
103
+
104
+ ### Named Groups
105
+
106
+ Named group syntax varies by language:
107
+ - JavaScript: `(?<name>pattern)`
108
+ - Python: `(?P<name>pattern)`
109
+ - Go: `(?P<name>pattern)` (RE2 syntax)
110
+
111
+ ### Non-Capturing Groups
112
+
113
+ ```
114
+ (?:abc) Groups but does NOT capture (no backreference)
115
+ (?:com|org|net) Matches without storing
116
+ ```
117
+
118
+ ### Alternation
119
+
120
+ ```
121
+ cat|dog Matches "cat" or "dog"
122
+ (cat|dog)s Matches "cats" or "dogs"
123
+ (?:Mr|Mrs|Ms) Matches title without capturing
124
+ ```
125
+
126
+ ---
127
+
128
+ ## 4. Lookahead and Lookbehind
129
+
130
+ ### Lookahead
131
+
132
+ ```
133
+ (?=pattern) Positive: followed by pattern
134
+ (?!pattern) Negative: NOT followed by pattern
135
+
136
+ # Password: at least one digit, one uppercase, one lowercase
137
+ ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$
138
+
139
+ # Match "foo" only if followed by "bar"
140
+ foo(?=bar) Matches "foo" in "foobar", not in "foobaz"
141
+
142
+ # Match number NOT followed by percent
143
+ \d+(?!%) Matches "42" in "42 items", not in "42%"
144
+ ```
145
+
146
+ ### Lookbehind
147
+
148
+ ```
149
+ (?<=pattern) Positive: preceded by pattern
150
+ (?<!pattern) Negative: NOT preceded by pattern
151
+
152
+ (?<=\$)\d+ Matches "50" in "$50", not in "50 items"
153
+ (?<!un)happy Matches "happy" but not "unhappy"
154
+
155
+ # Note: lookbehinds must be fixed-width in most engines
156
+ # Go RE2 does NOT support lookaround at all
157
+ ```
158
+
159
+ ---
160
+
161
+ ## 5. Common Patterns
162
+
163
+ ### Email (Simplified)
164
+ ```
165
+ ^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$
166
+ # WARNING: For production, use a library. RFC 5322 regex is 6,300+ chars.
167
+ ```
168
+
169
+ ### URL
170
+ ```
171
+ https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)
172
+ # For strict validation, use the URL parser in your language instead.
173
+ ```
174
+
175
+ ### IPv4
176
+ ```
177
+ \b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b
178
+ ```
179
+
180
+ ### Phone (US)
181
+ ```
182
+ ^(?:\+1[-.\s]?)?(?:\(?\d{3}\)?[-.\s]?)?\d{3}[-.\s]?\d{4}$
183
+ ```
184
+
185
+ ### Date (YYYY-MM-DD)
186
+ ```
187
+ ^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$
188
+ # Validates format, NOT calendar correctness.
189
+ ```
190
+
191
+ ### Semantic Versioning
192
+ ```
193
+ ^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:(?:0|[1-9]\d*|\d*[a-zA-Z\-][\da-zA-Z\-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z\-][\da-zA-Z\-]*))*))?(?:\+[\da-zA-Z\-]+(?:\.[\da-zA-Z\-]+)*)?$
194
+ ```
195
+
196
+ ### Hex Color
197
+ ```
198
+ ^#(?:[0-9a-fA-F]{3}){1,2}$
199
+ ```
200
+
201
+ ### Slug
202
+ ```
203
+ ^[a-z0-9]+(?:-[a-z0-9]+)*$
204
+ ```
205
+
206
+ ---
207
+
208
+ ## 6. ReDoS Prevention
209
+
210
+ ### Dangerous Patterns — O(2^n)
211
+
212
+ ```
213
+ (a+)+$ Nested quantifiers
214
+ (a|a)+$ Overlapping alternation
215
+ (\w+\s*)+$ Repeated group with optional separator
216
+ ```
217
+
218
+ ### Prevention Rules
219
+
220
+ 1. NEVER nest quantifiers: `(a+)+` → flatten to `a+`
221
+ 2. NEVER use overlapping alternation with quantifiers
222
+ 3. NEVER use `.*` inside a repeated group — use `([^,]*,)+` instead
223
+ 4. Use atomic groups or possessive quantifiers when available
224
+ 5. Use negated character classes `[^"]*` over lazy `.*?`
225
+ 6. Set regex timeouts in production
226
+ 7. Consider RE2 (linear-time, no backtracking) for user inputs
227
+
228
+ ---
229
+
230
+ ## 7. Unicode Support
231
+
232
+ ### Unicode Categories (\p{})
233
+
234
+ ```
235
+ \p{L} Letter (any script)
236
+ \p{Lu} Uppercase letter
237
+ \p{Ll} Lowercase letter
238
+ \p{N} Number
239
+ \p{Nd} Decimal digit
240
+ \p{P} Punctuation
241
+ \p{S} Symbol
242
+ \p{Z} Separator (spaces)
243
+ \p{M} Mark (combining characters)
244
+
245
+ # Script-specific
246
+ \p{Script=Greek}
247
+ \p{Script=Han}
248
+ \p{Script=Arabic}
249
+ ```
250
+
251
+ > **Note:** Unicode property support varies by engine. JavaScript requires `/u` flag. Go RE2 supports `\p{L}` etc. Python `re` does NOT support `\p{}`—use the `regex` package.
252
+
253
+ ---
254
+
255
+ ## 8. Flags
256
+
257
+ ```
258
+ g Global: find all matches
259
+ i Case-insensitive
260
+ m Multiline: ^ and $ match line boundaries
261
+ s DotAll: . matches newline characters
262
+ u Unicode: enables \p{}, correct surrogate pair handling
263
+ x Extended/Verbose: ignore whitespace, allow comments (Python, Ruby, PCRE)
264
+ y Sticky: match at exact position (JavaScript)
265
+ ```
266
+
267
+ ---
268
+
269
+ ## 9. Debugging
270
+
271
+ 1. Use [regex101.com](https://regex101.com) — supports multiple engines
272
+ 2. Break complex patterns into named pieces and compose them
273
+ 3. Test incrementally — start simple, add one element at a time
274
+ 4. Test edge cases: empty string, very long string, Unicode, newlines
275
+ 5. Log intermediate results (capture groups)
276
+
277
+ ### Common Mistakes
278
+
279
+ ```
280
+ /file.txt/ # Dot matches anything — matches "file_txt"
281
+ /file\.txt/ # Correct: escaped dot
282
+
283
+ /\d{3}/ # Matches "123" inside "abc12345def"
284
+ /^\d{3}$/ # Correct: anchored to exact 3 digits
285
+
286
+ /<.*>/ # Greedy: matches entire "<a>text</a>"
287
+ /<[^>]*>/ # Correct: negated class
288
+ ```
289
+
290
+ ---
291
+
292
+ ## 10. When NOT to Use Regex
293
+
294
+ ### Use a Parser Instead
295
+ - HTML/XML — use DOM parser (cheerio, BeautifulSoup, lxml)
296
+ - JSON, YAML, TOML — use a parser
297
+ - Nested structures — regex cannot handle arbitrary depth
298
+ - Programming language syntax — use tree-sitter, ANTLR
299
+
300
+ ### Use String Methods Instead
301
+ ```
302
+ # Prefer:
303
+ startsWith('prefix') over /^prefix/.test(str)
304
+ endsWith('suffix') over /suffix$/.test(str)
305
+ includes('text') over /text/.test(str)
306
+ split(',') over split(/,/)
307
+ ```
308
+
309
+ ### When Regex IS Right
310
+ - Pattern matching in text (log parsing, data extraction)
311
+ - Input validation (format checks)
312
+ - Search and replace with pattern awareness
313
+ - Tokenizing simple grammars (CSV, log lines)
314
+ - Text cleanup (normalize whitespace, strip control characters)
315
+
316
+ ---
317
+
318
+ ## 11. Critical Reminders
319
+
320
+ ### ALWAYS
321
+ - Anchor with `^` and `$` when validating entire strings
322
+ - Use non-capturing groups `(?:...)` when you don't need the value
323
+ - Prefer negated character classes `[^"]*` over lazy `.*?`
324
+ - Test with adversarial inputs for ReDoS
325
+ - Escape user input before inserting into regex
326
+ - Use Unicode flag for international content
327
+
328
+ ### NEVER
329
+ - Parse HTML/XML/JSON with regex
330
+ - Use nested quantifiers without understanding backtracking
331
+ - Trust regex for email validation beyond basic format
332
+ - Use `.` when you mean a specific character class
333
+ - Build regex from untrusted input without escaping
@@ -0,0 +1,44 @@
1
+ # Go Regex Patterns
2
+
3
+ Language-specific API for the `regex-patterns` skill. Read `SKILL.md` first for universal syntax.
4
+
5
+ ---
6
+
7
+ ## Core API
8
+
9
+ ```go
10
+ package main
11
+
12
+ import (
13
+ "fmt"
14
+ "regexp"
15
+ )
16
+
17
+ func main() {
18
+ // Compile (returns error)
19
+ re, err := regexp.Compile(`^hello\s+(\w+)$`)
20
+ if err != nil {
21
+ panic(err)
22
+ }
23
+
24
+ // MustCompile panics on invalid pattern (for constants)
25
+ re = regexp.MustCompile(`\d+`)
26
+
27
+ // Methods
28
+ matched := re.MatchString("hello world") // bool
29
+ result := re.FindString("abc 123 def") // "123"
30
+ allResults := re.FindAllString("a1 b2 c3", -1) // ["1", "2", "3"]
31
+ submatch := re.FindStringSubmatch("hello world") // ["hello world", "world"]
32
+ replaced := re.ReplaceAllString("foo 123", "NUM") // "foo NUM"
33
+
34
+ fmt.Println(matched, result, allResults, submatch, replaced)
35
+ }
36
+ ```
37
+
38
+ ## Important: RE2 Engine
39
+
40
+ Go uses the **RE2 engine** which guarantees linear-time execution (no ReDoS). Trade-off:
41
+ - ✅ No backtracking — immune to ReDoS
42
+ - ❌ No backreferences (`\1`)
43
+ - ❌ No lookahead/lookbehind
44
+ - ✅ Supports `\p{L}` Unicode properties
@@ -0,0 +1,63 @@
1
+ # JavaScript Regex Patterns
2
+
3
+ Language-specific API for the `regex-patterns` skill. Read `SKILL.md` first for universal syntax.
4
+
5
+ ---
6
+
7
+ ## Syntax
8
+
9
+ ```javascript
10
+ // Literal
11
+ const re = /^hello\s+(\w+)$/i;
12
+
13
+ // Constructor (dynamic patterns)
14
+ const pattern = 'hello';
15
+ const re2 = new RegExp(`^${escapeRegExp(pattern)}$`, 'i');
16
+
17
+ // Escape special characters
18
+ function escapeRegExp(str) {
19
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
20
+ }
21
+ ```
22
+
23
+ ## Methods
24
+
25
+ ```javascript
26
+ str.match(re) // Match array or null
27
+ [...str.matchAll(/\d+/g)] // Iterator of all matches
28
+ str.replace(/foo/g, 'bar') // Replace
29
+ str.split(/[,;\s]+/) // Split
30
+ re.test(str) // Boolean
31
+ ```
32
+
33
+ ## Named Groups
34
+
35
+ ```javascript
36
+ const { groups } = /(?<year>\d{4})-(?<month>\d{2})/.exec('2025-06');
37
+ // groups.year === '2025'
38
+ ```
39
+
40
+ ## Unicode
41
+
42
+ ```javascript
43
+ // Requires /u or /v flag
44
+ /\p{L}+/u // Any letter (any script)
45
+ /\p{Nd}+/u // Decimal digit (any script)
46
+ /[\p{L}\p{M}]+/u // Unicode-aware word matching
47
+ /\p{Script=Greek}+/u // Script-specific
48
+ ```
49
+
50
+ ## Number Formatting with Lookaround
51
+
52
+ ```javascript
53
+ '1234567'.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
54
+ // "1,234,567"
55
+ ```
56
+
57
+ ## ReDoS Prevention
58
+
59
+ ```javascript
60
+ // No built-in timeout — use re2 package for linear-time engine
61
+ const RE2 = require('re2');
62
+ const re = new RE2(/pattern/);
63
+ ```
@@ -0,0 +1,77 @@
1
+ # Python Regex Patterns
2
+
3
+ Language-specific API for the `regex-patterns` skill. Read `SKILL.md` first for universal syntax.
4
+
5
+ ---
6
+
7
+ ## Core API
8
+
9
+ ```python
10
+ import re
11
+
12
+ # Compile for reuse
13
+ pattern = re.compile(r'^hello\s+(\w+)$', re.IGNORECASE)
14
+
15
+ # Methods
16
+ match = pattern.match(string) # Match at start
17
+ match = pattern.search(string) # Search anywhere
18
+ matches = pattern.findall(string) # All matches (list)
19
+ matches = pattern.finditer(string) # Iterator of Match objects
20
+ result = pattern.sub(r'bar', string) # Replace
21
+ parts = pattern.split(string) # Split
22
+
23
+ # Match object
24
+ if match:
25
+ match.group(0) # Full match
26
+ match.group(1) # First capture group
27
+ match.group('name') # Named group
28
+ match.start() # Start position
29
+ match.end() # End position
30
+
31
+ # Raw strings: ALWAYS use r'...' for regex
32
+ # r'\n' is literal backslash-n, not a newline
33
+ ```
34
+
35
+ ## Named Groups
36
+
37
+ ```python
38
+ pattern = r'(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})'
39
+ match = re.match(pattern, '2025-06-15')
40
+ match.group('year') # '2025'
41
+ ```
42
+
43
+ ## Verbose Mode
44
+
45
+ ```python
46
+ pattern = re.compile(r"""
47
+ ^ # Start of string
48
+ (?P<protocol>https?) # Protocol
49
+ :// # Separator
50
+ (?P<domain> # Domain group
51
+ [a-zA-Z0-9.-]+ # Domain name
52
+ \.[a-zA-Z]{2,} # TLD
53
+ )
54
+ (?P<path>/\S*)? # Optional path
55
+ $ # End of string
56
+ """, re.VERBOSE)
57
+ ```
58
+
59
+ ## ReDoS Prevention
60
+
61
+ ```python
62
+ # Use the 'regex' package with timeout
63
+ import regex
64
+ try:
65
+ regex.match(r'(a+)+$', input_string, timeout=1.0)
66
+ except regex.error:
67
+ pass # Timed out
68
+ ```
69
+
70
+ ## Unicode
71
+
72
+ ```python
73
+ # Python re does NOT support \p{} syntax
74
+ # Use the 'regex' package for Unicode property support:
75
+ import regex
76
+ regex.findall(r'\p{L}+', text) # All letters (any script)
77
+ ```
@@ -0,0 +1,43 @@
1
+ # Rust Regex Patterns
2
+
3
+ Language-specific API for the `regex-patterns` skill. Read `SKILL.md` first for universal syntax.
4
+
5
+ ---
6
+
7
+ ## Core API
8
+
9
+ ```rust
10
+ use regex::Regex;
11
+
12
+ fn main() {
13
+ // Compile
14
+ let re = Regex::new(r"^hello\s+(\w+)$").unwrap();
15
+
16
+ // Methods
17
+ let is_match = re.is_match("hello world"); // bool
18
+ let caps = re.captures("hello world").unwrap();
19
+ let name = &caps[1]; // "world"
20
+
21
+ // Named captures
22
+ let re = Regex::new(r"(?P<year>\d{4})-(?P<month>\d{2})").unwrap();
23
+ let caps = re.captures("2025-06").unwrap();
24
+ let year = &caps["year"]; // "2025"
25
+
26
+ // Find all matches
27
+ let re = Regex::new(r"\d+").unwrap();
28
+ let matches: Vec<&str> = re.find_iter("a1 b2 c3").map(|m| m.as_str()).collect();
29
+ // ["1", "2", "3"]
30
+
31
+ // Replace
32
+ let result = re.replace_all("foo 123 bar 456", "NUM");
33
+ // "foo NUM bar NUM"
34
+ }
35
+ ```
36
+
37
+ ## Important: Engine Limitations
38
+
39
+ The `regex` crate uses finite automata (like RE2):
40
+ - ✅ Guaranteed linear-time — immune to ReDoS
41
+ - ❌ No backreferences by default
42
+ - ❌ No lookahead/lookbehind by default
43
+ - Use the **`fancy-regex`** crate for those features (trades ReDoS safety for feature completeness)