Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/az9713-error-pattern-safety
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/error-pattern-safety
What's inside
- Skill name
error-pattern-safety- Description
- Error Pattern Safety Guidelines for Agentic Engines
- License
- MIT
- Instructions
- 204 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Error Pattern Safety Guidelines
This document outlines the safety guidelines for error pattern regex in agentic engines to prevent infinite loops in JavaScript.
## The Problem
When using regex patterns with the JavaScript global flag (`/pattern/g`), patterns that can match zero-width (empty strings) can cause infinite loops. This happens 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:**
```javascript
// Pure .* - matches everything including empty string at end
/.*/g
// Single character with * - matches zero or more (including zero)
/a*/g
// Patterns that can match empty string
/(x|y)*/g
```
## Safe Pattern Examples
**✅ ALWAYS USE PATTERNS LIKE THESE:**
```javascript
// Required prefix before .*
/error.*/gi
/error.*permission.*denied/gi
// Specific structure with required content
/\[(\d{4}-\d{2}-\d{2})\]\s+(ERROR):\s+(.+)/g
// Required characters throughout
/access denied.*user.*not authorized/gi
```
## Pattern Safety Rules
1. **Always require at least one character match**
- Use `.+` instead of `.*` when you need "something"
- Ensure pattern has required prefix/suffix
2. **Never use bare `.*` as the entire pattern**
- Always combine with required text: `error.*`
- Never just `.*` or `.*?`
3. **Test patterns against empty string**
```javascript
const regex = /your-pattern/g;
if (regex.test("")) {
throw new Error("Pattern matches empty string - DANGEROUS!");
}
```
4. **Use specific anchors when possible**
- Start: `^error.*`
- End: `.*error$`
- Word boundaries: `\berror\b`
## Validation Tests
All error patterns must pass these tests:
### Go Tests (pkg/workflow/engine_error_patterns_infinite_loop_test.go)
```go
// Test that pattern doesn't match empty string
func TestPatternSafety(t *testing.T) {
pattern := "your-pattern"
regex := regexp.MustCompile(pattern)
if regex.MatchString("") {
t.Error("Pattern matches empty string!")
}
}
```
### JavaScript Tests (pkg/workflow/js/validate_errors.test.cjs)
```javascript
test("should not match empty string", () => {
const regex = new RegExp("your-pattern", "g");
expect(regex.test("")).toBe(false);
});
```
## Safety Mechanisms in validate_errors.cjs
The `validate_errors.cjs` script has built-in protections:
1. **Zero-width detection**: Checks if `regex.lastIndex` stops advancing
2. **Iteration warning**: Warns at 1000 iterations
3. **Hard limit**: Stops at 10,000 iterations to prevent hang
```javascript
// Safety check in validate_errors.cjs
if (regex.lastIndex === lastIndex) {
core.error(`Infinite loop detected! Pattern: ${pattern.pattern}`);
break;
}
```
## Adding New Error Patterns
When adding new error patterns to engines:
1. **Write the pattern with required content**
```go
{
Pattern: `(?i)error.*permission.*denied`,
LevelGroup: 0,From az9713/gh-aw, MIT.
More from az9713/gh-aw
- 0.354score
github-discussion-query
az9713
Query GitHub discussions efficiently with jq argument support for filtering
SkillDFreshness: DClaude Code +9 - 0.354score
github-script
az9713
Best practices for writing JavaScript code for GitHub Actions using github-script
SkillDFreshness: DClaude Code +9 - 0.354score
debugging-workflows
az9713
Guide for debugging GitHub Agentic Workflows - analyzing logs, auditing runs, and troubleshooting issues
SkillDFreshness: DClaude Code +9 - 0.354score
console-rendering
az9713
Instructions for using the struct tag-based console rendering system in Go
SkillDFreshness: DClaude Code +9 - 0.354score
github-pr-query
az9713
Query GitHub pull requests efficiently with jq argument support for filtering
SkillDFreshness: DClaude Code +9 - 0.354score
github-issue-query
az9713
Query GitHub issues efficiently with jq argument support for filtering
SkillDFreshness: DClaude Code +9 - 0.352score
gh-agent-session
az9713
GitHub CLI Agent Session Extension
SkillDFreshness: DClaude Code +9 - 0.352score
documentation
az9713
Documentation Brief description for SEO and navigation
SkillDFreshness: DClaude Code +9 - 0.352score
github-mcp-server
az9713
GitHub MCP Server Documentation
SkillDFreshness: DClaude Code +9 - 0.352score
error-messages
az9713
Error Message Style Guide for Validation Errors
SkillDFreshness: DClaude Code +9 - 0.352score
gh-agent-task
az9713
GitHub CLI Agent Task Extension
SkillDFreshness: DClaude Code +9 - 0.352score
github-copilot-agent-tips-and-tricks
az9713
Tips and Tricks for Working with GitHub Copilot Agent PRs
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Feb 14, 2026 (8 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/az9713/gh-aw
- Website
- github.com/github/gh-aw
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from az9713
- 0.461score
codex-first
az9713
Claude Code-only work routing: delegate implementation, fixing, exploratory subagents, rebasing, and PR merging/landing to Codex CLI while Claude specifies…
SkillBFreshness: BClaude Code +9 - 0.430score
offer-shaper
az9713
Convert a vague AI idea or buyer pain into a concrete paid offer with buyer, promise, deliverable, price, proof mechanism, and sales path.
SkillCFreshness: C★ 1Claude Code +9 - 0.430score
context-reset
az9713
Preserve durable project state before clearing or compacting context so Claude Code can reset without losing business, technical, and verification state.
SkillCFreshness: C★ 1Claude Code +9 - 0.430score
break-test
az9713
Red-team a project, automation, app, or offer by trying to break it technically, commercially, operationally, and in front of a buyer.
SkillCFreshness: C★ 1Claude Code +9 - 0.430score
council-session
az9713
Run the full Idea-to-Capital council loop across buyer, CFO, technical, distribution, verification, and packaging perspectives.
SkillCFreshness: C★ 1Claude Code +9 - 0.430score
opportunity-triage
az9713
Evaluate an AI project, automation, SaaS, content product, or service idea for buyer demand, profitability, speed to validation, and whether to build…
SkillCFreshness: C★ 1Claude Code +9
Cite this page
error-pattern-safety skill. Agent Mart. https://agentmart.dev/skills/az9713-error-pattern-safety (last updated 2026-10-24)