New to Claude Skills? Learn how to install them →

Pposthog on GitHub

Pipeline Doctor

Free

Your guide to PostHog's ingestion pipeline architecture.

by posthog37.6k stars on posthog/posthog
2 views
Updated Aug 11, 2026
Get this skill

Free · Opens the source repo

What Pipeline Doctor does

The Pipeline Doctor skill provides a comprehensive reference for understanding and utilizing PostHog's ingestion pipeline framework. It serves as a quick orientation tool for developers and designers working with event processing systems, enabling them to navigate the architecture and conventions effectively. The ingestion pipeline is designed to handle events through a structured, typed, and composable step chain, ensuring that data is processed efficiently and accurately.

This skill details the architecture of the ingestion pipeline, which includes a series of steps such as message awareness, preprocessing, and result handling. Each step is implemented using a factory function that ensures type safety and extensibility, making it easier for developers to maintain and enhance the pipeline. The skill also highlights key file locations within the codebase, allowing users to quickly find relevant resources, such as step types and result types, which are essential for effective development and debugging.

Additionally, the Pipeline Doctor skill outlines the various doctor agents available for specific concerns, such as step structure, result handling, composition, and testing. This structured approach allows users to select the appropriate agent based on their immediate needs, streamlining the development process and improving overall efficiency. By utilizing this skill, developers can ensure that their ingestion pipelines adhere to best practices and conventions established within the PostHog framework.

Overall, the Pipeline Doctor skill is an essential tool for anyone involved in developing or maintaining ingestion pipelines within the PostHog ecosystem. It provides clear guidance and resources to help users navigate the complexities of event processing, making it easier to build robust and scalable systems.

When to use it

Use this skill when working with PostHog's ingestion pipelines to ensure proper architecture and conventions are followed.

When not to use it

This skill is not suitable for users unfamiliar with event processing or those looking for a general-purpose development tool.

What you can build with it

Understanding Pipeline Architecture

Use this skill to gain a quick overview of PostHog's ingestion pipeline architecture and its components.

Selecting the Right Doctor Agent

When facing specific concerns in your pipeline, refer to this skill to choose the appropriate doctor agent for assistance.

Navigating Key File Locations

Utilize the skill to quickly locate important files and resources within the PostHog codebase related to the ingestion pipeline.

How to install Pipeline Doctor

View source

1. Install with the skills CLI

npx skills add posthog/posthog/ingestion-pipeline-doctor-nodejs --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by posthog

Pipeline Doctor

Quick reference for PostHog's ingestion pipeline framework and its convention-checking agents.

Architecture overview

The ingestion pipeline processes events through a typed, composable step chain:

Kafka message
  → messageAware()
    → parse headers/body
    → sequentially() for preprocessing
    → filterMap() to enrich context (e.g., team lookup)
    → teamAware()
      → concurrentlyPerGroup(token:distinctId) for per-entity processing
      → gather()
      → pipeChunk() for chunk operations
      → handleIngestionWarnings()
    → handleResults()
  → handleSideEffects()
  → build()

See nodejs/src/ingestion/pipelines/analytics/joined-ingestion-pipeline.ts for the real implementation.

Key file locations

WhatWhere
Step typenodejs/src/ingestion/framework/steps.ts
Result typesnodejs/src/ingestion/framework/results.ts
Doc-test chaptersnodejs/src/ingestion/framework/docs/*.test.ts
Joined pipelinenodejs/src/ingestion/pipelines/analytics/joined-ingestion-pipeline.ts
Doctor agents.claude/agents/ingestion/
Test helpersnodejs/src/ingestion/framework/docs/helpers.ts

Which agent to use

ConcernAgentWhen to use
Step structurepipeline-step-doctorFactory pattern, type extension, config injection, naming
Result handlingpipeline-result-doctorok/dlq/drop/redirect, side effects, ingestion warnings
Compositionpipeline-composition-doctorBuilder chain, concurrency, grouping, branching, retries
Testingpipeline-testing-doctorTest helpers, assertions, fake timers, doc-test style

Quick convention reference

Steps: Factory function returning a named inner function. Generic <T extends Input> for type extension. No any. Config via closure.

Results: Use ok(), dlq(), drop(), redirect() constructors. Side effects as promises in ok(value, [effects]). Warnings as third parameter.

Composition: messageAware wraps the pipeline. handleResults inside messageAware. handleSideEffects after. concurrentlyPerGroup for per-entity work. gather before chunk steps.

Batching lifecycle hooks (BatchingPipeline beforeBatch/afterBatch): enrich-only. Hooks may enrich elements and batch context but must return exactly the elements they received — a count change is a broken invariant and feed() throws. Filtering belongs in sub-pipeline steps that return drop(). An empty feed() is a no-op (no hooks, no capacity). Details: nodejs/src/ingestion/framework/docs/14-batching.test.ts.

Fan-out/fan-in (fanOut(fn).via((sub) => …).fanIn(fn)): per-element sub-work with cardinality restored — one element fans out to N sub-elements (e.g. per-blob uploads), a regular sub-pipeline processes them (maxConcurrency on the sub concurrently block, retry on the per-sub step), and fan-in folds the OK results back into the parent. Reach for it over concurrently/concurrentlyPerGroup when the unit of concurrency is smaller than the element; hand-rolled p-limit/Promise.all inside a step is the tell. Sequencing is compile-time enforced (an unclosed stage cannot build). Sub-result contract: OK collected; DROP excludes the sub silently; DLQ fails the parent with aggregated reasons; REDIRECT is excluded with a warning — sub redirects never escape the stage. Sub-pipelines are context-agnostic: team/message data goes in the sub-element value, and context-gated surface (teamAware, handleIngestionWarnings, …) is uncallable. Fan-out/fan-in functions are cheap, synchronous, and named. Parents emit unordered as they complete. Details: nodejs/src/ingestion/framework/docs/17-fan-out-fan-in.test.ts.

Testing: Step tests call factory directly. Use consumeAll()/collectChunks() helpers. Fake timers for async. Type guards for result assertions. No any.

Running all doctors

Ask Claude to "run all pipeline doctors on my recent changes" to get a comprehensive review across all 4 concern areas.

Frequently asked questions about Pipeline Doctor

Similar skills