error-pattern-safety

Validate regex patterns to prevent infinite loops in Go and JavaScript.

4.9k|489|Updated Aug 12, 2025
One-click install
npx skills add https://github.com/github/gh-aw --skill error-pattern-safety-github
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-pattern-safety
Source: https://github.com/github/gh-aw/tree/main/skills/error-pattern-safety
Command: npx skills add https://github.com/github/gh-aw --skill error-pattern-safety-github

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides safety guidelines to prevent infinite loops and unsafe behavior in agentic engines by validating and constraining regex patterns.

Core Features & Use Cases

  • Pattern safety rules: Enforces at-least-one-character requirements and avoids dangerous patterns like bare .*
  • Cross-language guidance: Covers JavaScript and Go regex usage with testing considerations
  • Use case: Ensure user-provided error patterns don't cause infinite loops or misbehavior in AI agents.

Quick Start

Validate a sample pattern against the safety rules and report whether it can cause zero-width looping or match an empty string.

Frequently Asked Questions about error-pattern-safety

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

FAQPage Schema
Why does my regex pattern cause an infinite loop in an AI agent?

Regex patterns cause infinite loops in agentic engines when they match empty strings or use bare .* constructs. This skill validates error patterns to enforce at least one character match, preventing zero-width looping behavior.

How do I validate error patterns to prevent infinite loops in JavaScript?

You validate error patterns by checking them against safety rules that enforce at least one character match and avoid bare .* constructs. This skill provides cross-language guidance for safe regex usage in JavaScript environments.

Can I use this pattern safety validation for regex in Go?

Yes, pattern safety validation applies to Go regex usage. This skill covers cross-language guidance for both Go and JavaScript, ensuring error patterns do not cause infinite loops in AI-driven workflows.

What is the best way to prevent bare .* regex patterns from breaking agentic engines?

The best way to prevent bare .* regex patterns from breaking agentic engines is to enforce safety rules requiring at least one character match. This skill validates patterns to avoid dangerous zero-width matches.

How do I test if a user-provided error pattern will cause misbehavior in an AI agent?

You test user-provided error patterns by validating them against safety rules to report whether they can cause zero-width looping or match an empty string. This skill provides testing guidance for reliable AI pattern usage.

Does this regex safety guidance work for both Go and JavaScript environments?

Yes, this regex safety guidance works for both Go and JavaScript environments. It applies to error-pattern validation across both languages, enabling safe pattern usage in AI-driven workflows.