mcpbeat Sign in

Writing Skills

Guide for writing PostHog agent skills — job-to-be-done templates that teach agents how to use MCP tools to achieve a goal. Use when adding new product functionality that agents should know how to work with, creating a new skill, or updating existing skills in products/*/skills/.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
690
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/PostHog/posthog --skill writing-skills

The instruction itself

9 sections, as written by the author

Writing skills for PostHog agents

Read the full guide at docs/published/handbook/engineering/ai/writing-skills.md.

Quick workflow

# 1. Scaffold
hogli init:skill

# 2. Write your skill in products/{product}/skills/{skill-name}/SKILL.md

# 3. Lint
hogli lint:skills

# 4. Build to verify
hogli build:skills

# 5. Test locally with PostHog Desktop or a coding agent
hogli sync:skill -- --name <skill-name>

# 6. Delete the test skill (optional)
hogli unsync:skill -- --name <skill-name>

Distribution is automatic after merge — CI publishes to PostHog/skills.

When to write a skill

When new functionality is added to a product and agents need to know how to work with it.

A skill is not about what tools exist (that's the MCP server) —

it's about how an experienced person would approach a job using those tools.

Ask: "If a customer asked an agent to do X with my feature, would the agent know the right approach?"

If not, write a skill.

How many is too many?

Skill count is a budgeted, shared resource — agents pick from a list of _all_ skill descriptions, and many harnesses truncate that list once it grows long, so every extra skill makes the others less likely to fire.

Prefer a small set of focused skills, each with rich references/, over many thin ones:

  • New trigger → new skill. A skill earns its own entry point only when its "when to use it" is clearly distinct from every existing skill.
  • More detail → references/, not a new skill. Another failure mode, SDK variant, or query catalog is depth on an existing job — add it to that skill's references/ instead of spending a new slot.
  • Consolidate near-duplicate siblings. Skills sharing a diagnosis, bug class, or trigger should be one skill with references, not two.

Key rules

  • Name: lowercase kebab-case, prefer gerund form (analyzing-llm-traces, not llm-analytics). Never prefix with posthog-*.
  • Description: third person, specific, include trigger terms and when to use it. Max 1024 chars.
  • Structure: SKILL.md entry point + references/ for detailed content. Keep SKILL.md under 500 lines.
  • Frontmatter: name and description are required.
  • Tone: describe the workflow and reasoning, not a rigid script. Trust the agent to adapt.
  • Conciseness: the agent is smart — only include context it doesn't already have.

Skill structure

products/{product}/skills/{skill-name}/
    SKILL.md                         # entry point (required)
    references/                      # optional
        guidelines.md
        models-foo.md
        example-bar.md.j2            # Jinja2 template, rendered at build time
    scripts/                         # optional
        setup.sh

Only references/ and scripts/ subdirectories are collected. Others are ignored.

Template functions

Files ending in .j2 are rendered with Jinja2 at build time

by products/posthog_ai/scripts/build_skills.py.

Extend the build pipeline so the monorepo stays the source of truth —

when domain knowledge lives in code (Pydantic models, query runners, function registries),

add a template function rather than duplicating it as static markdown that drifts.

Available functions:

  • pydantic_schema("dotted.path.to.Model") — renders a Pydantic model's JSON Schema
  • render_hogql_example({"kind": "TrendsQuery", ...}) — renders a query spec to HogQL SQL
  • hogql_functions() — returns all available HogQL function names

Good example: querying-posthog-data

  • Clear entry point linking to 30+ reference files
  • Progressive disclosure — agents load only what they need
  • Mix of static .md and generated .md.j2 content
  • See products/posthog_ai/skills/querying-posthog-data/SKILL.md

Bad example: llm-analytics

An umbrella skill covering traces, experiments, evaluations, cost tracking, prompt management.

Too broad — agents can't determine when to activate it. Break into focused skills instead.

Other skills for the same job

different authors, same section of the catalogue
Writing Skills
by ZhanlinCui
×4

Use when creating new skills, editing existing skills, or verifying skills work before deployment

26k tokens scripts
Prompt Library
by ComeOnOliver
×2

Curated collection of high-quality prompts for various use cases. Includes role-based prompts, task-specific templates, and prompt refinement techniques. Use when user needs prompt templates, role-play prompts, or ready-to-use prompt examples for coding, writing, analysis, or creative tasks.

4k tokens
Edge Strategy Designer
by BaggaT236
×1

Convert abstract edge concepts into strategy draft variants and optional exportable ticket YAMLs for edge-candidate-agent export/validation.

7k tokens scripts
Langgraph Fundamentals
by langchain-ai
vendor ×1

INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.

6k tokens
Harness Model Protocol
by ComeOnOliver
×1

Analyze the protocol layer between agent harness and LLM model. Use when (1) understanding message wire formats and API contracts, (2) examining tool call encoding/decoding mechanisms, (3) evaluating streaming protocols and partial response handling, (4) identifying agentic chat primitives (system prompts, scratchpads, interrupts), (5) comparing multi-provider abstraction strategies, or (6) understanding how frameworks translate between native LLM APIs and internal representations.

12k tokens
Skill I18n
by ComeOnOliver
×1

Translate SKILL.md and README.md files into multiple languages for sharing skills internationally

11k tokens
Agent Setup Maintenance
by langfuse
vendor

| Shared workflow for editing Langfuse's repo-owned agent setup under `.agents/`. Use when changing AGENTS files, shared skills, `.agents/config.json`, generated shim behavior, provider discovery paths, or install-time agent sync.

769 tokens
Datalineage Summary
by google
vendor

>- Summarizes Google Cloud Data Lineage graphs to help users debug data quality issues and understand data provenance for BQ/GCS. Use when summarizing upstream and downstream data flows, and presenting complex lineage data as an intuitive Markdown report. Don't use for generic BigQuery queries, editing lineage relationships, or downstream deprecation. Don't use for downstream blast-radius impact analysis (use datalineage-bigquery-asset-impact-analysis skill instead).

2k tokens

How to use it

Copy the folder

Take posthog/writing-skills from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

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.