posthog/warlock
Guardrails for AI agents editing @posthog/warlock, adding or porting rules, proposing new categories, or reviewing Warlock PRs. Load when working in /warlock or on a PR that touches the Warlock source, rules, or docs.
npx skills add https://github.com/PostHog/warlock --skill warlock
The Warlock is a security-critical YARA-based content scanner for PostHog's agentic flows. This skill exists so AI agents don't have to reconstruct the project's charter and rules from source code alone. It is intentionally thin – the authoritative sources are the README and CONTRIBUTING. Follow the links when you need depth.
/warlocksrc/lib/yara-scanner.tsscan() signature, or integration-facing docs (INTEGRATING.md)The Warlock must never become any of the following. If the change you are considering violates one of these, stop and reconsider.
Full reasoning: README § Scope and anti-goals.
Run through the checklist in CONTRIBUTING § Rule-writing guide. In short:
meta: fields: description, remediation, severity, category, action, scan_contextCategory value (see src/scanner/types.ts); do not invent one inlineprompt_injection_ignore_previous)prompt_injection_ignore_previous.yar). See CONTRIBUTING § Put the rule in the right fileCATEGORIES is append-only. New categories are an API commitment – once shipped, they cannot be renamed or removed without a major version bump and a migration path. See README § API stability.
Before proposing one, confirm:
the Warlock exports triageMatches() as an opt-in utility. It takes scan matches + a consumer-provided LLM callback, returns each match annotated with true_positive or false_positive. The Warlock owns the prompt and parsing; the consumer owns the LLM. All failures default to true_positive.
When forced to choose between ugly code inside the Warlock and ugly code at every consumer call-site, the Warlock eats the ugly code. Examples: the CommonJS / ESM bridge, yara-x metadata normalization. Full principle: README § Centralize complexity.
Every PR description must state (a) the problem this change addresses in one to three sentences, and (b) why the Warlock is the right home for this change as opposed to the wizard, context-mill, or another tool. This guards against scope drift. See CONTRIBUTING § Acceptable-goal statement on every PR.
Take posthog/warlock from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.