skills/aeo-failure-patterns/SKILL.md
--- name: aeo-failure-patterns description: Recognize common errors and apply known fixes automatically. Hybrid: core patterns + project-specific learning. --- # AEO Failure Patterns **Purpose:** Recognize common errors and apply known fixes automatically. Uses hybrid architecture: core curated patterns + project-specific learned patterns. ## Architecture **Core Patterns (in this SKILL.md):** - 20-30 curated patterns with high-confidence fixes - Portable across projects - Confidence ≥ 0.85 →
npx skillsauth add ivzc07/aeo-skills skills/aeo-failure-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Purpose: Recognize common errors and apply known fixes automatically. Uses hybrid architecture: core curated patterns + project-specific learned patterns.
Core Patterns (in this SKILL.md):
Project-Specific Patterns (in PAI memory):
$PAI_DIR/MEMORY/aeo-failure-patterns.jsonInvoke when:
Error Signature:
Error: Cannot find module 'module-name'
or
SyntaxError: Named export 'ExportName' not found
Fix:
# Check if module installed
ls node_modules | grep module-name
# If missing, install
npm install module-name
# If wrong import, check package.json exports
cat node_modules/module-name/package.json | grep exports
Confidence: 0.90
Error Signature:
TypeError: Cannot read properties of undefined (reading 'propertyName')
or
Property 'propertyName' does not exist on type 'Type'
Fix:
// Add optional chaining
object?.propertyName
// Or add null check
if (object && object.propertyName) { ... }
// Or add type guard
if ('propertyName' in object) { ... }
Confidence: 0.85
Error Signature:
npm ERR! peer dep missing: module@version required by package@version
or
npm ERR! Conflicting peer dependency
Fix:
# Use --legacy-peer-deps flag
npm install --legacy-peer-deps
# Or use --force
npm install --force
# Or resolve manually
npm install module@required-version
Confidence: 0.80
Error Signature:
Error: Timeout - Async callback was not invoked within the 5000ms timeout
Fix:
// Add done callback
test('async test', (done) => {
asyncFunction()
.then(result => {
expect(result).toBe(value)
done() // ← Required
})
.catch(err => {
done(err)
})
})
// Or use async/await
test('async test', async () => {
const result = await asyncFunction()
expect(result).toBe(value)
})
Confidence: 0.90
Error Signature:
RangeError: Maximum call stack size exceeded
Fix:
// Likely infinite recursion - check base case
function recursive(data) {
// ❌ Missing base case
return recursive(data.processed())
// ✅ Add base case
if (data.isComplete()) return data
return recursive(data.processed())
}
Confidence: 0.85
Error Signature:
Error: EACCES: permission denied, open 'path/to/file'
Fix:
# Check file permissions
ls -la path/to/file
# If owned by different user, use sudo
sudo chown $USER:$USER path/to/file
# Or fix directory permissions
chmod 755 path/to/directory
Confidence: 0.95
Error Signature:
Error: ENOENT: no such file or directory, open '.env'
or
Config file not found: config.json
Fix:
# Copy example config
cp .env.example .env
# Or create from template
cat > .env << EOF
API_KEY=your-key-here
DATABASE_URL=your-database-url
EOF
Confidence: 0.90
Error Signature:
Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
Automatic merge failed; fix conflicts and commit
Fix:
# Find conflicted files
git status | grep "both modified"
# Edit file, resolve markers:
# <<<<<<< HEAD
# your changes
# =======
# their changes
# >>>>>>> branch-name
# After resolving:
git add file.txt
git commit
Confidence: 0.85
Error Signature:
fatal: refusing to merge unrelated histories
Fix:
git merge branch-name --allow-unrelated-histories
Confidence: 0.95
Error Signature:
Error: listen EADDRINUSE: address already in use :::3000
Fix:
# Find process using port
lsof -i :3000
# Kill it
kill -9 <PID>
# Or use different port
PORT=3001 npm start
Confidence: 0.95
Error Signature:
Access to fetch at 'http://api.example.com' from origin 'http://localhost:3000' has been blocked by CORS policy
Fix:
// Server-side: Add CORS headers
import cors from 'cors'
app.use(cors())
// Or specific origin
app.use(cors({
origin: 'http://localhost:3000'
}))
Confidence: 0.90
Error Signature:
SyntaxError: Unexpected token < in JSON at position 0
Fix:
// Check response before parsing
const response = await fetch(url)
const text = await response.text()
// Check if HTML (error page) or JSON
if (text.startsWith('<')) {
throw new Error('Received HTML instead of JSON')
}
const data = JSON.parse(text)
Confidence: 0.85
Error Signature:
Warning: Text content did not match. Server: "X" Client: "Y"
Fix:
// Ensure server and client render same content
// Check for date(), Math.random(), etc.
// ❌ Wrong - different on server vs client
<div>{Date.now()}</div>
// ✅ Correct - use useEffect for client-only
<div>{typeof window !== 'undefined' && Date.now()}</div>
// Or use useEffect
useEffect(() => {
setTimestamp(Date.now())
}, [])
Confidence: 0.85
Error Signature:
WebSocket connection to 'ws://localhost:3000' failed
Fix:
// Check if WebSocket server is running
// Add connection timeout
const ws = new WebSocket('ws://localhost:3000')
ws.onerror = (error) => {
console.error('WebSocket error:', error)
}
ws.onclose = (event) => {
if (event.code === 1006) {
console.log('WebSocket closed abnormally - server may be down')
}
}
Confidence: 0.80
Error Signature:
Error: Connection pool exhausted
Fix:
// Increase pool size
const pool = new Pool({
max: 20, // Increase from default
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000,
})
// Or ensure connections are released
const client = await pool.connect()
try {
await client.query('SELECT * FROM users')
} finally {
client.release() // ← Always release
}
Confidence: 0.90
Error Signature:
YAMLException: bad indentation of a mapping entry
Fix:
# ❌ Wrong - inconsistent indentation
key:
subkey: value
subsubkey: value
# ✅ Correct - consistent indentation
key:
subkey: value
subsubkey: value
Confidence: 0.95
Error Signature:
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
Fix:
// ❌ Wrong - sending response twice
app.get('/api/users', (req, res) => {
res.json({ users: [] })
res.json({ count: 0 }) // ← Error
})
// ✅ Correct - return after sending
app.get('/api/users', (req, res) => {
res.json({ users: [], count: 0 })
return // ← Prevent further execution
})
// Or use if/else
app.get('/api/users', (req, res) => {
if (error) {
res.status(500).json({ error })
} else {
res.json({ users })
}
})
Confidence: 0.90
Error Signature:
npm install hangs forever
Fix:
# Clear npm cache
npm cache clean --force
# Delete node_modules and package-lock.json
rm -rf node_modules package-lock.json
# Reinstall
npm install
Confidence: 0.85
Error Signature:
docker run <image> # exits immediately
Fix:
# ❌ Wrong - no process keeping container alive
FROM node:18
WORKDIR /app
COPY package.json .
RUN npm install
# ✅ Correct - use CMD or ENTRYPOINT
FROM node:18
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "start"] # ← Keeps container alive
Confidence: 0.90
Error Signature:
ReferenceError: process.env is not defined
Fix:
// vite.config.js / jest.config.js
export default {
test: {
env: {
process: { env: {} } // ← Add process.env polyfill
}
}
}
// Or set in test setup
process.env.API_KEY = 'test-key'
Confidence: 0.90
$PAI_DIR/MEMORY/aeo-failure-patterns.jsonPrevent infinite loops:
When human resolves an error:
# Extract pattern from resolution
pattern = {
error_signature: "Error message substring",
context: { language, framework },
fix: "Steps taken to fix",
confidence: 0.50, # Start low
success_count: 0,
failure_count: 0
}
# Write to memory
echo $pattern | jq -c '.' >> ~/.claude/MEMORY/aeo-failure-patterns.json
Promote to auto-fix:
{
"error_signature": "specific error message",
"context": {
"language": "javascript",
"framework": "react"
},
"fix": "step-by-step fix instructions",
"confidence": 0.85,
"success_count": 5,
"failure_count": 0,
"last_seen": "2026-01-22T10:00:00Z"
}
If no pattern matches or max retries reached:
❌ CANNOT AUTO-FIX - PATTERN NOT RECOGNIZED
Error: [error message]
Searched:
• 20 core patterns - no match
• 15 project patterns - no match
Action: Escalating to human for guidance.
Invoke aeo-escalation skill.
testing
Validate that tasks are sufficiently defined before execution. Returns score 0-100.
development
Internal code reviewer with veto power. Reviews changes before commit, blocks security issues.
testing
Human-AI interface for when to interrupt and involve humans. Presents clear options and records decisions.
development
Track token usage and enforce budget limits. Optional skill for cost-conscious projects.