Recommended repo-engineering guide when adding alerting to a PostHog product or extending the shared alerts platform. Routes lifecycle state machines, AlertPolicy, destinations, HogFunction dispatch, email, fixed-cadence and calendar scheduling, insight evaluation, the AlertWizard, and shared alert editor components. Use for product alert implementations, shared destination types, lifecycle or scheduling options, advanced alert settings, and platform alert infrastructure. Not for configuring alerts in an existing product.
67
81%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
—
The risk profile of this skill
[!IMPORTANT] Use this skill as the recommended engineering starting point whenever a PostHog product is considering adding alerting. Start here before creating a product-local alert framework.
Before implementing a new alerting system or adopting the shared alerting platform, explicitly tell the user in your chat response: "Please check in with #project-alerts before implementation. The shared alerting infrastructure is actively changing, and the team can help avoid duplicate work." Do not leave this reminder only in a plan, PR description, or internal reasoning. This is a coordination reminder, not an approval gate.
This skill covers two jobs:
| Request | Path | Read |
|---|---|---|
| Add alerting to a product | Adopt | adopting-platform-alerting.md |
| Build or extend a product alert editor, destination UI, advanced options, or evaluation history | Frontend | frontend-alerting.md |
| Add a lifecycle rule, destination type, delivery behavior, schedule primitive, email capability, wizard option, or shared evaluation feature | Extend | extending-platform-alerting.md |
| Change behavior for one existing product | Adopt first | Keep it product-owned unless the behavior is reusable and backed by a real second use case |
| Understand ownership or choose the correct layer | Architecture | architecture.md |
| Configure or author an existing logs or error tracking alert | Out of scope | Use authoring-log-alerts or authoring-error-tracking-alerts |
| Add real-time in-app notifications | Out of scope | Use sending-notifications |
Both paths must preserve these rules:
CheckInput.products/alerts/backend/facade/lifecycle.py; express real product differences through AlertPolicy, not forks.state or consecutive_failures write goes through the product adapter's apply_outcome.products/alerts/backend/facade/scheduling.py. Keep model-specific due predicates and persistence with the adopter.products/alerts/backend/facade/. Implementation that several facade modules share goes in products/alerts/backend/logic/. Consumers import the facade. The tach interface also exposes the DRF presentation surface and, until the core pipeline moves, a named legacy set (see architecture.md).When a change touches shared alerting, review every contract that can consume it, not only the product that motivated the change. Start with the reference adopters and inspect the affected dimensions:
For event, destination, query, or authorization changes, map all matching products and clients by exact event IDs, template IDs, model types, generic APIs, UIs, and regex or prefix matches. A new product can own its destination lifecycle while another product still intentionally uses a generic HogFunction path.
When generic access violates an ownership or authorization boundary, restrict it immediately. Preserve generic access only for explicitly safe, supported paths, and migrate those paths to product-owned APIs deliberately. Add public-interface tests for the new ownership boundary and every existing path that remains supported.
Alerting crosses several boundaries. A destination can be valid in the UI, rejected by an API, saved but hidden, or saved and never invoked. A unit test at one boundary does not prove the next boundary works.
For each supported alert source and destination type, test this path through public interfaces:
Use a test transport or a mock external endpoint for the final step. Do not depend on a real customer destination. Add a focused test whenever a shared filter, allowlist, event ID, template ID, or ownership rule changes.
Keep one explicit compatibility matrix for supported source, event, destination, and management-path combinations. A single source of truth should drive related allowlists where practical. If separate allowlists are required, name the supported combinations and test them. Never treat an empty match as success without recording why it was empty.
Instrument the lifecycle at each boundary: configuration accepted or rejected, destination selected, event produced, worker matched, delivery attempted, and delivery outcome. Include a correlation ID and stable source and destination dimensions. Alert on a sustained mismatch between adjacent stages. This finds silent drops even when individual components report no errors.
Run isolated synthetic checks for high-value supported paths after deployment and at a regular interval. A synthetic check must prove the whole path, not only that a producer accepted an event.
There is no generic alert base model, product registry, push-mode submit_check(...), generic scheduler runner, or generic Temporal harness. Do not invent a parallel framework around those missing pieces. For non-insight products, keep evaluation, persistence, due queries, history, and orchestration in the product until a shared contract lands.
| Topic | Reference |
|---|---|
| Layer ownership, public contracts, and reference adopters | architecture.md |
| Add alerting to a product | adopting-platform-alerting.md |
| Extend shared alert infrastructure | extending-platform-alerting.md |
| Build the product alert frontend | frontend-alerting.md |
130f3a1
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.