error-pattern-safety

Identify unsafe error-pattern regex that can cause infinite loops in JavaScript.

Updated Feb 18, 2026
One-click install
npx skills add https://github.com/az9713/gh-aw --skill error-pattern-safety-az9713
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-pattern-safety
Source: https://github.com/az9713/gh-aw/tree/main/skills/error-pattern-safety
Command: npx skills add https://github.com/az9713/gh-aw --skill error-pattern-safety-az9713

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guideline helps engineers identify and remediate unsafe error-pattern regex that can cause infinite loops in JavaScript by ensuring patterns cannot match zero-width strings.

Core Features & Use Cases

  • Pattern safety rules: Enforces minimum 1-character matches and restricts use of bare .*.
  • Cross-language guidance: Provides testing templates for Go and JavaScript to validate patterns.
  • Risk mitigation: Offers conversion rules and safety checks to prevent pattern-induced hangs in production.

Quick Start

Audit your error-pattern regex to guarantee it cannot match empty strings and require at least one character after anchors.

Frequently Asked Questions about error-pattern-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my JavaScript regex cause an infinite loop during error matching?

Your error-pattern regex likely matches zero-width empty strings, causing JavaScript engines to loop infinitely. Patterns must require at least one character and avoid bare .* to guarantee safe matching.

How do I audit error-pattern regex for infinite loop risks?

Audit your error-pattern regex by checking that it cannot match empty strings. Ensure patterns enforce a minimum one-character match after anchors and restrict bare .* to prevent engine hangs.

What are the rules for safe regex patterns in JavaScript and Go?

Safe regex patterns require at least one character, avoid pure .* constructs, and use provided testing templates for Go and JavaScript. These rules prevent pattern-induced infinite loops in production workflows.

Can I use bare .* in my error log validation regex?

Bare .* is unsafe for error log validation because it can match zero-width strings and trigger infinite loops. You must replace it with patterns enforcing at least one character to maintain safety.

Does this regex safety guidance apply to both Go and JavaScript codebases?

Yes, it applies to codebases validating error logs across JavaScript, Go, and related tooling. It provides cross-language testing templates and conversion rules to enforce safe matching in both environments.

What is the best way to prevent regex hangs in production error validation?

The best way to prevent regex hangs is enforcing safety rules that ban zero-width matches. Require at least one character after anchors, restrict bare .*, and apply safe conversion practices documented for production workflows.