## Lesson — Isolate rule execution in batches

**Tags:** architecture, error-handling
**Scope:** packages/core/src/ast-grep-query.ts

Wrap individual rule execution in try/catch blocks during batch processing to prevent a single malformed rule or NAPI throw from crashing the entire file scan.
