Skip to content

feat: docs-as-skillz#115

Open
sarahxsanders wants to merge 4 commits intomainfrom
docs-as-skills
Open

feat: docs-as-skillz#115
sarahxsanders wants to merge 4 commits intomainfrom
docs-as-skills

Conversation

@sarahxsanders
Copy link
Copy Markdown
Collaborator

@sarahxsanders sarahxsanders commented Apr 15, 2026

docs as skills time

auto generates a skill per section of the PostHog docs from posthog.com/llms.txt. each section becomes a downloadable skill with a SKILL.md + references/ directory. full explanation with changes in the README

try it out

pnpm run build:docs-skills
cp -r dist/skills/posthog-feature-flags .claude/skills/
claude
> How do I bootstrap feature flags in PostHog?

it will load the skill and use the right file under the reference directory

related PR:

  • wizard PR (in progress)

follow up tasks:

  • posthog.com: add repository dispatch to deploy pipeline
  • MCP PR: should we surface docs skills in the MCP?

@github-actions
Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci android
  • /wizard-ci angular
  • /wizard-ci astro
  • /wizard-ci django
  • /wizard-ci fastapi
  • /wizard-ci flask
  • /wizard-ci javascript-node
  • /wizard-ci javascript-web
  • /wizard-ci laravel
  • /wizard-ci next-js
  • /wizard-ci nuxt
  • /wizard-ci python
  • /wizard-ci rails
  • /wizard-ci react-native
  • /wizard-ci react-router
  • /wizard-ci stripe
  • /wizard-ci sveltekit
  • /wizard-ci swift
  • /wizard-ci tanstack-router
  • /wizard-ci tanstack-start
  • /wizard-ci vue

Test an individual app:

  • /wizard-ci android/Jetchat
  • /wizard-ci angular/angular-saas
  • /wizard-ci astro/astro-hybrid-marketing
Show more apps
  • /wizard-ci astro/astro-ssr-docs
  • /wizard-ci astro/astro-static-marketing
  • /wizard-ci astro/astro-view-transitions-marketing
  • /wizard-ci django/django3-saas
  • /wizard-ci fastapi/fastapi3-ai-saas
  • /wizard-ci flask/flask3-social-media
  • /wizard-ci javascript-node/express-todo
  • /wizard-ci javascript-node/fastify-blog
  • /wizard-ci javascript-node/hono-links
  • /wizard-ci javascript-node/koa-notes
  • /wizard-ci javascript-node/native-http-contacts
  • /wizard-ci javascript-web/saas-dashboard
  • /wizard-ci laravel/laravel12-saas
  • /wizard-ci next-js/15-app-router-saas
  • /wizard-ci next-js/15-app-router-todo
  • /wizard-ci next-js/15-pages-router-saas
  • /wizard-ci next-js/15-pages-router-todo
  • /wizard-ci nuxt/movies-nuxt-3-6
  • /wizard-ci nuxt/movies-nuxt-4
  • /wizard-ci python/meeting-summarizer
  • /wizard-ci rails/fizzy
  • /wizard-ci react-native/expo-react-native-hacker-news
  • /wizard-ci react-native/react-native-saas
  • /wizard-ci react-router/react-router-v7-project
  • /wizard-ci react-router/rrv7-starter
  • /wizard-ci react-router/saas-template
  • /wizard-ci react-router/shopper
  • /wizard-ci stripe/stripe-next-js-saas-starter
  • /wizard-ci stripe/stripe-saas-demo
  • /wizard-ci sveltekit/CMSaasStarter
  • /wizard-ci swift/hackers-ios
  • /wizard-ci tanstack-router/tanstack-router-code-based-saas
  • /wizard-ci tanstack-router/tanstack-router-file-based-saas
  • /wizard-ci tanstack-start/tanstack-start-saas
  • /wizard-ci vue/movies

Results will be posted here when complete.

Copy link
Copy Markdown
Collaborator

@gewenyu99 gewenyu99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool!

I have two requests to look at:

  • How do we avoid polluting the releases with way too many new releases. (we should have a maximum per day right?)
  • Can we avoid requesting to the website, and just use the md files built during build time for the posthog.com repo? It's all there, we don't need to download them from the website here.

Comment thread .github/workflows/sync-docs-skills.yml Outdated
Comment thread .github/workflows/sync-docs-skills.yml Outdated
- name: Check for changes
id: diff
env:
PREV_MENU_URL: ${{ github.server_url }}/${{ github.repository }}/releases/latest/download/docs-skill-menu.json
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine, but asking these just in case:

  • What if the contents of skills change but the menu doesn't
  • And I guess, do we need to curl to a tmp file or can we use git? I think the docs-skill-menu.json is kept locally right (or maybe not...)

Comment thread .github/workflows/sync-docs-skills.yml Outdated
* Fetch a URL as text, retrying on failure.
* retries = 1 means a single attempt (no retries).
*/
async function fetchText(url, retries = 1, delayMs = 500) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gonna be huge. On every website build, these mds get physically generated. We should zip and upload these files as release artifacts on the website and download them to package (or smthing similar)

This is a lot of requests that we don't need that will take a loooonnnnggg time.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

release artifacts

I like getting holistic about the build process in other repos, this is a good shout. much better to hit GitHub's storage for these mechanisms

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually built quite fast for me, but yea we need to think about intermediate ways of storing and fetching zips

// Sections excluded by default — SDK and API reference material that is too
// large and low signal-to-noise for skill context. Pass explicit slug args to
// override and build one of these directly.
const DEFAULT_EXCLUDE = new Set(['libraries', 'api', 'endpoints', 'open-api-spec']);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smart

Comment thread .github/workflows/sync-docs-skills.yml Outdated
@@ -0,0 +1,184 @@
name: Sync PostHog Docs Skills

# Triggered by posthog.com after a successful deploy, nightly as a fallback,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES

@daniloc
Copy link
Copy Markdown
Collaborator

daniloc commented Apr 16, 2026

outputs go to docs-skill-menu.json which I intentionally kept seperate from skill-menu.json for now

I think that's wise! no sense swamping the wizard with all of these things

that said… I wonder if it would be useful to provide these in a secondary tool so the wizard could work out surprising problems on the fly based on docs. (I don't know if this is a good idea, the caffeine is still metabolizing. but it would certainly enhance the agency of the wizard)

Comment thread scripts/build-docs-skills.js Outdated
}).join('\n')
: null;
const bodyParts = [
`You are a PostHog documentation assistant. Use the content below to answer questions about ${section.heading}.`,
Copy link
Copy Markdown
Member

@edwinyjlim edwinyjlim Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is prob placeholder, but what do we think the use case is for encyclopedic skills with the entire product docs? What is the objective or codified process we want to help the dev accomplish here with a skill?

low key, this feels like the hard part

Q&A is in the realm of InKeep, which can search across all of the docs, and people can connect and search with it via MCP

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this IS the golden question :)

skills are different than RAG and MCP. they're ambient context that the agent loads _automatically_based on what you're working on. you don't invoke a skill, the agent does. if you have PostHog feature flags skills installed and ask Claude "add a feature flag to gate this page", it pulls in the skill context on its own. skills remove any tool calls, search, decision making.

this matters because Claude has PH training data, but we have no insight into whether it's good, current, etc. skills give us a way to influence the training data for what we know is correct.

so the prompt should be less "answer questions" and more like:

"Use the content below when writing, reviewing, or debugging code that involves {PostHog feature flags}. Prefer these patterns over your training data."

TL;DR: skills are ground truth that we control, loaded before reasoning even starts

this is a really important team discussion though because this is a really important thing to nail together and as we start spreading skills far and wide, makes us all aligned on the vision 🌀 CC @daniloc @gewenyu99

@sarahxsanders
Copy link
Copy Markdown
Collaborator Author

useful to provide these in a secondary tool so the wizard could work out surprising problems on the fly based on docs

@daniloc @gewenyu99 THIS would be VERY cool for API references/SDKs, but I think it can be a separate problem to solve for now. I know Vincent is doing some work in those areas this quarter, that feels like a sickkkkk problem in tandem with that work

@edwinyjlim
Copy link
Copy Markdown
Member

bullish on docs-as-context stonks

I'm not sure what these skills in their current form enable without more curation, but only one way to find out. Two things for me and we can ship:

  • Let's make the naming super explicit for now posthog-docs-{category}
  • Remove the github workflow for cron. We can just create these docs skills within the normal build and release cycle

…l, updated skill prompts, docs-skills build into build release, menu name is human readable yay
@sarahxsanders sarahxsanders changed the title draft: docs-as-skillz feat: docs-as-skillz Apr 16, 2026
@sarahxsanders sarahxsanders marked this pull request as ready for review April 16, 2026 22:26
Comment on lines +253 to +256
for (const section of sections) {
const skillName = `posthog-docs-${section.slug}`;
const skillDir = path.join(SKILLS_DIR, skillName);
const refsDir = path.join(skillDir, 'references');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zip these skillz up

take a look at the main build script and reuse the zipToBuffer logic

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! I ended up extracting zipSkillToBuffer into scripts/lib/zip.js (trying to be better about reusing shared stuff) so both build scripts share it now. docs skills now build to a temp dir, zip into dist/skills and clean up after to mirror the main build

Comment thread scripts/lib/zip.js
});
}

module.exports = { zipSkillToBuffer };
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

}).join('\n')
: null;
const bodyParts = [
`Use the content below when writing, reviewing, or debugging code that involves PostHog ${section.heading}. Prefer these patterns and APIs over your training data.`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bam! this is good boilerplate. there's probably some further enhancement to do here which you could get from interrogating your claude: asking what further metadata would make use of the skill easier to pick up. but that can be a later iteration

Copy link
Copy Markdown
Collaborator

@daniloc daniloc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think: go for it. but specifically, this matters if every single section has a prominent link to its corresponding skill on posthog.com (which I know you agree with and want to do)

the use case I'd want to enable is anyone who needs to can easily dump whole sections of the docs into the project they're working on so that it all does the right thing, and quickly, ie:

"Hmm, I don't know why the hell this mechanism isn't working. I've given you three sections out of the posthog docs in the skills folder, analyze and assess"

it's power user stuff at this rate but a fine place to start imo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants