Skip to content

feat(skills): PostHog cloud team skills — read path#2609

Merged
k11kirky merged 2 commits into
mainfrom
posthog-code/skills-06a-team-read
Jun 12, 2026
Merged

feat(skills): PostHog cloud team skills — read path#2609
k11kirky merged 2 commits into
mainfrom
posthog-code/skills-06a-team-read

Conversation

@k11kirky

@k11kirky k11kirky commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Problem

Users have no way to browse or inspect skills that their team has published to PostHog cloud. Without visibility into team-shared skills, there's no path to discovering and installing them locally.

Changes

Adds a Team Skills tab to the Skills view that surfaces skills published by the team to PostHog cloud. The tab is conditionally shown only when the org has the team-skills feature enabled (gated server-side via a 403 response).

  • Added API client types (LlmSkill, LlmSkillListItem, LlmSkillResolveResponse, etc.) and four new methods: listLlmSkills, getLlmSkillByName, resolveLlmSkill, and getLlmSkillFile.
  • Introduced TeamSkillsService (injectable singleton) that fetches the team skill listing, filters to latest versions only, and cross-references local skill names to mark which skills are already installed.
  • Registered skillsCoreModule in the desktop DI container.
  • Added useTeamSkills, useTeamSkillDetail, and useTeamSkillFile React Query hooks.
  • Built TeamSkillsTab, TeamSkillsSection, and TeamSkillDetailPanel components. The detail panel shows the SKILL.md body rendered as Markdown, a file tree for companion files, and a read-only code editor for non-Markdown files. Skills already installed locally are badged as Installed.

How did you test this?

Unit tests were added for TeamSkillsService.listTeamSkills covering: feature unavailability (API returns null), correct mapping and local-install marking, and filtering out non-latest versions.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

React Doctor could not complete this scan.

No React dependency found in /tmp/react-doctor-baseline-d0UCbG/package.json. Add "react" to dependencies (or peerDependencies) and re-run.

Reviewed by React Doctor for commit f478aff.

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/ui/src/features/skills/SkillsView.tsx:116-131
**Orphaned tab state when `teamAvailable` flips**

The "Team" `TabsTrigger` is only rendered when `teamAvailable` is true, but `tab` state is never reset if `teamAvailable` becomes false while the user is already on the team tab (e.g., after the 60-second stale refetch returns a 403). The content branch `tab === "team" && teamAvailable` then silently falls through to the installed-skills view with no tab appearing active, leaving the user seeing one view but no highlighted tab label to indicate what they're looking at. Consider resetting `tab` to `"installed"` when `teamAvailable` transitions from `true` to `false`, or at minimum ensuring the guard also resets `tab` state.

### Issue 2 of 2
packages/core/src/skills/teamSkillsService.test.ts:25-29
**Mock uses `as unknown` cast instead of typed partial**

`makeClient` casts with `as unknown as PostHogAPIClient`, bypassing TypeScript checks entirely. The project convention is to include all required properties so the compiler still validates the mock's shape. For a class this large, a typed helper like `Partial<PostHogAPIClient>` cast to the type, or using a library utility (e.g., `vi.mocked`), keeps the intent clearer and avoids future drift if `PostHogAPIClient` changes its method signatures.

Reviews (1): Last reviewed commit: "feat(skills): PostHog cloud team skills ..." | Re-trigger Greptile

Comment thread packages/ui/src/features/skills/SkillsView.tsx
Comment thread packages/core/src/skills/teamSkillsService.test.ts
@k11kirky k11kirky marked this pull request as ready for review June 11, 2026 13:55
Comment thread packages/ui/src/features/skills/useTeamSkills.ts
Comment thread packages/api-client/src/posthog-client.ts
@k11kirky k11kirky force-pushed the posthog-code/skills-06a-team-read branch from 829fa8e to ee58852 Compare June 12, 2026 07:50
@k11kirky k11kirky force-pushed the posthog-code/skills-05-marketplace branch from 26e5ccb to 1f13739 Compare June 12, 2026 07:50
@k11kirky k11kirky force-pushed the posthog-code/skills-06a-team-read branch from ee58852 to a397721 Compare June 12, 2026 08:19
@k11kirky k11kirky force-pushed the posthog-code/skills-05-marketplace branch from 1f13739 to 7853c15 Compare June 12, 2026 08:19

k11kirky commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

@k11kirky k11kirky force-pushed the posthog-code/skills-05-marketplace branch from 7853c15 to c949c44 Compare June 12, 2026 11:43
@k11kirky k11kirky force-pushed the posthog-code/skills-06a-team-read branch from a397721 to db84e11 Compare June 12, 2026 11:43
@k11kirky k11kirky changed the base branch from posthog-code/skills-05-marketplace to graphite-base/2609 June 12, 2026 12:20
@k11kirky k11kirky changed the base branch from graphite-base/2609 to main June 12, 2026 12:35
k11kirky added 2 commits June 12, 2026 12:36
Uses the existing LLMSkill API (products/ai_observability); no
posthog-side code changes are required. The llm-analytics-skills flag
already gates the endpoints server-side per-request, and llm_skill:read
/llm_skill:write are valid self-serve scopes that a *-scoped desktop
OAuth token passes.

- api-client: listLlmSkills (403 -> null, meaning "feature off"),
  getLlmSkillByName, resolveLlmSkill, getLlmSkillFile, with handwritten
  interfaces following the existing api-client convention (this package
  deliberately has no Zod).
- core: TeamSkillsService owns the merged listing decision — feature
  availability (flag off -> group absent, no errors) and marking team
  skills that already exist locally by name. Bound via skillsCoreModule
  in the renderer composition.
- UI: "Team" group in SkillsView with read-only detail view rendering
  the skill body + companion files through the PR 1 components; files
  fetch lazily on selection. Search filters the team group too.

Generated-By: PostHog Code
Task-Id: f4e84f1a-19c9-490c-9b98-47787a7dddcf
… the client mock

Review feedback on #2609: the active tab is derived so a mid-session 403
cannot leave the view on a Team tab whose trigger no longer renders; the
test client mock is validated against the real method signature via
satisfies + a typed vi.fn.

Generated-By: PostHog Code
Task-Id: f4e84f1a-19c9-490c-9b98-47787a7dddcf
@k11kirky k11kirky force-pushed the posthog-code/skills-06a-team-read branch from db84e11 to f478aff Compare June 12, 2026 12:36
@k11kirky k11kirky merged commit 46a24e7 into main Jun 12, 2026
24 checks passed
@k11kirky k11kirky deleted the posthog-code/skills-06a-team-read branch June 12, 2026 12:47
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.

2 participants