error-pattern-safety

Installation
SKILL.md

Error Pattern Safety Guidelines

Use these regex safety rules in agentic engines to prevent JavaScript infinite loops.

The Problem

With the JavaScript global flag (/pattern/g), zero-width matches can cause infinite loops because:

  1. JavaScript's regex.exec() with the g flag uses lastIndex to track position
  2. When a pattern matches zero-width, lastIndex doesn't advance
  3. The same position is matched repeatedly, causing an infinite loop

Dangerous Pattern Examples

❌ NEVER USE THESE PATTERNS:

Installs
47
Repository
github/gh-aw
GitHub Stars
4.7K
First Seen
Mar 18, 2026
error-pattern-safety — github/gh-aw