agentleFS
PostHogKnown publisherPostHog/posthog-foss/.agents/skills/developing-subscriptions/SKILL.md

developing-subscriptions

Skill721 starsChanged 57 days agoMITView on GitHub

Guides PostHog engineers through subscription product changes. Use when changing subscription resource types, destinations, schedules, delivery workflows, retry or automatic disable behavior, permissions, limits, AI summaries, AI prompt reports, delivery history, subscription APIs, MCP tools, or subscription management UI. Not for configuring an existing subscription through MCP.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 14 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for a change to the Subscriptions product or its delivery system.

    line 13
  2. Very specific:

    Use the published managing-subscriptions skill to configure an existing subscription through MCP.

    line 15
  3. Very specific:

    Use adding-product-alerting when delivery depends on a threshold, anomaly, breach, or recovery state.

    line 16
  4. Distinctive:

    When investigating a subscription whose insight is missing, or changing insight deletion or restoration, read the insight deletion and …

    line 18
  5. Distinctive:

    Before implementation, name each affected boundary:

    line 32
  6. Distinctive:

    Do this before implementation for a new subscription feature.

    line 45
  7. Distinctive:

    Check whether the API, MCP tools, generated types, product docs, and published skill need updates.

    line 59
  8. Distinctive:

    Keep serializer validation, model behavior, generated types, MCP schemas, and frontend forms consistent.

    line 82
  9. Distinctive:

    Keep each subscription and delivery record scoped to the current team.

    line 83
  10. Distinctive:

    Treat every test delivery and update-triggered delivery as a real external side effect.

    line 84
  11. Distinctive:

    Keep external calls outside database transactions.

    line 85
  12. Distinctive:

    Keep retry and deduplication rules explicit at each queue and workflow boundary.

    line 88
  13. Distinctive:

    Add meaningful product events for user actions and delivery outcomes.

    line 91
  14. Distinctive:

    Create, read, update, pause, resume, test, expire, and delete

    line 97
  15. Distinctive:

    Do not treat API acceptance or workflow queueing as delivery success.

    line 108
  16. Distinctive:

    Use a mock destination or test transport for external delivery checks.

    line 109

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Developing subscriptions

Use this skill for a change to the Subscriptions product or its delivery system.

Use the published managing-subscriptions skill to configure an existing subscription through MCP. Use adding-product-alerting when delivery depends on a threshold, anomaly, breach, or recovery state.

When investigating a subscription whose insight is missing, or changing insight deletion or restoration, read the insight deletion and related-resource contract. It defines cleanup for subscriptions, alerts, and dashboard tiles, including single and bulk deletion and restore behavior.

1. Route the request

RequestPrimary path
Resource type, destination, schedule, delivery, lifecycle, or limitsThis skill
Subscription API, permissions, MCP tools, or delivery historyThis skill
Subscription creation or management UIThis skill
AI prompt report planning or outputThis skill and integrating-with-posthog-ai
Threshold, anomaly, breach, recovery, or quiet hoursadding-product-alerting
Configure an existing subscription through MCPPublished managing-subscriptions

Before implementation, name each affected boundary:

  • Configuration and validation
  • Persistence and schedule calculation
  • Workflow queue and retry behavior
  • Asset export or AI report generation
  • Destination delivery
  • Delivery history and failure notifications
  • API, MCP, and frontend clients
  • Billing, limits, and permissions

2. Define feature intake and acceptance criteria

Do this before implementation for a new subscription feature. Skip it for a narrow bug fix with an existing contract.

  1. State the user problem, intended actor, and explicit non-goals.
  2. State whether delivery uses a fixed schedule or a condition.
  3. State the supported resource types and destinations.
  4. State the default behavior for creation, updates, tests, pause, resume, expiration, and deletion.
  5. State which actions can send a real message and where the product asks for approval.
  6. State the project, organization, resource, and API scope requirements for reads and mutations.
  7. State behavior for old rows, missing owners, removed resources, invalid destinations, and exhausted schedules.
  8. State retry, deduplication, terminal state, and automatic disable behavior.
  9. State the plan limits, organization-wide limits, and billable AI behavior.
  10. State the acceptance criteria for success, partial recipient failure, permanent failure, and uncertain delivery.
  11. State the event or metric that shows adoption, delivery failure, and regression.
  12. Check whether the API, MCP tools, generated types, product docs, and published skill need updates.

3. Define the change contract

State these decisions before implementation:

  1. Name the persisted fields and the source of truth for each field.
  2. Define create, update, test, scheduled, pause, resume, expiration, and delete behavior.
  3. Define whether the operation is idempotent and how retries prevent duplicate messages.
  4. Define the schedule anchor, time zone, recurrence rule, and next delivery calculation.
  5. Define which failures retry and which failures disable the subscription.
  6. Define how delivery records distinguish queued, completed, failed, skipped, and partial outcomes.
  7. Define how email, Slack, and Microsoft Teams differ across validation, storage, display, and delivery.
  8. Define how the API hides credentials, recipient details, upstream errors, and query diagnostics.
  9. Define behavior when AI credits, AI approval, or active-summary capacity changes after setup.
  10. Define compatibility for the frontend, API, MCP schema, workers, and Temporal workflows during deployment.

For a new API operation, add an MCP tool for each supported action. Exclude an action only with a documented reason. Record the required OAuth scopes.

4. Implement across boundaries

  1. Keep serializer validation, model behavior, generated types, MCP schemas, and frontend forms consistent.
  2. Keep each subscription and delivery record scoped to the current team.
  3. Treat every test delivery and update-triggered delivery as a real external side effect.
  4. Keep external calls outside database transactions.
  5. Pass large exports and report content by reference across Temporal activity boundaries.
  6. Preserve safe destination labels. Never return or log a Microsoft Teams webhook URL.
  7. Keep retry and deduplication rules explicit at each queue and workflow boundary.
  8. Record enough delivery state to separate configuration success from external delivery success.
  9. Preserve old rows and in-flight workflows during staged deployment.
  10. Add meaningful product events for user actions and delivery outcomes. Do not capture recipients, prompts, report content, or credentials.

5. Test the complete path

Cover each affected path through public interfaces:

  • Create, read, update, pause, resume, test, expire, and delete
  • Insight, dashboard, and AI prompt resources
  • Email, Slack, and Microsoft Teams destinations
  • Immediate, scheduled, retried, skipped, failed, and partially successful delivery
  • Duplicate requests, concurrent tests, workflow retries, and uncertain responses
  • Missing owner, removed source, disconnected integration, revoked permission, and invalid webhook
  • Free-plan limits, organization-wide summary limits, AI approval, and exhausted AI credits
  • API scopes, resource access, secret masking, and delivery history redaction
  • Old frontend with new backend and old worker with new workflow payloads
  • MCP schema and generated types after serializer changes

Do not treat API acceptance or workflow queueing as delivery success. Use a mock destination or test transport for external delivery checks.

6. Code map

ConcernStart here
API, serializers, validation, delivery historyee/api/subscription.py
Subscription and delivery modelsproducts/exports/backend/models/subscription.py
Delivery workflows and activitiesproducts/exports/backend/temporal/subscriptions/
Destination delivery and automatic disable behavioree/tasks/subscriptions/
Management UI and frontend logicproducts/subscriptions/frontend/
MCP tool definitionsproducts/subscriptions/mcp/tools.yaml
API behavior testsee/api/test/test_subscription.py
Destination delivery testsee/tasks/test/subscriptions/
Workflow testsposthog/temporal/tests/test_subscriptions_workflows.py
Published operational guidanceproducts/subscriptions/skills/managing-subscriptions/

Companion skills

SkillUse when
improving-drf-endpointsChange the subscription viewset, serializer, or OpenAPI contract
django-migrationsChange subscription or delivery persistence
adopting-generated-api-typesConsume changed generated API types
writing-kea-logicsChange subscription Kea logic
integrating-with-posthog-aiChange AI prompt planning or report generation
adding-product-alertingAdd condition-based delivery or shared alert infrastructure
writing-testsSelect the lowest-cost regression test
writing-user-facing-copyChange UI, error, notification, or documentation text

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.