Skip to content

feat(workspaces): auto-discover user skills under data/skills/#309

Open
rudyll wants to merge 1 commit into
TraderAlice:masterfrom
rudyll:feat/user-skills-discovery
Open

feat(workspaces): auto-discover user skills under data/skills/#309
rudyll wants to merge 1 commit into
TraderAlice:masterfrom
rudyll:feat/user-skills-discovery

Conversation

@rudyll

@rudyll rudyll commented Jun 10, 2026

Copy link
Copy Markdown

What

Mirror the persona override model (data/brain/persona.md wins over default/persona.default.md) for skills:

  • Auto-discover any user skill dropped under data/skills/<name>/ (any directory containing a SKILL.md) and merge it into the template's bundledSkills. Lets users register a custom skill without editing the shipped template.json — and survives app upgrades because data/ lives in USER_DATA_HOME.
  • User-skill override: a data/skills/<name>/ of the same name as a default skill wins. Useful for tweaking a built-in (e.g. a personal sector-rotation variant) without forking the app.
  • WIP guard: a data/skills/<name>/ without a SKILL.md is silently skipped, so stash dirs don't accidentally inject into every new workspace.

Why

Today, adding a custom skill requires editing src/workspaces/templates/chat/template.json to extend bundledSkills, which means every app upgrade conflicts on that file or silently drops the user's skill. Persona already has a clean user-data override model — this brings skills in line.

How

  • context-injector.ts: factor out discoverUserSkills() + resolveSkillSource() helpers; merge template-declared skills with auto-discovered user skills (de-duplicated, deterministic alphabetical order); each skill resolves through the user-first helper before being copied to the three CLI paths (.claude/skills, .agents/skills, .pi/skills).
  • Existing behavior unchanged when no user skills exist — templates with empty bundledSkills and an absent or empty `data/skills/` remain no-ops.

Test plan

  • 4 new specs covering auto-discovery, override precedence, WIP-dir guard, and the empty case
  • All 15 `context-injector.spec.ts` tests pass (11 original + 4 new)
  • Sanity-check on a fresh workspace creation in dev (maintainer to verify)

Mirrors the persona override model (data/brain/persona.md wins over
default/persona.default.md) for skills:

- Auto-discover user skills under `data/skills/<name>/` (any dir with a
  SKILL.md) and merge into the template's bundledSkills. Lets users add
  custom skills without editing the shipped template.json — survives app
  upgrades since data/ is in USER_DATA_HOME.
- A user-shipped skill of the same name as a default one wins, same
  precedence as persona. Useful for tweaking a built-in (e.g. personal
  sector-rotation screen) without forking.
- Empty / SKILL.md-less directories under data/skills/ are silently
  skipped, so WIP folders don't accidentally inject.

context-injector.ts: extract `discoverUserSkills()` + `resolveSkillSource()`
helpers; merge template skills with discovered user skills (de-duplicated,
deterministic order); resolve each skill's source through the user-first
helper before copying to the three CLI discovery paths.

Tests: 4 new cases covering auto-discovery, override precedence, and
WIP-dir guard. All 15 specs pass.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

@rudyll is attempting to deploy a commit to the luokerenx4's Team Team on Vercel.

A member of the Team first needs to authorize it.

@rudyll rudyll marked this pull request as ready for review June 10, 2026 05:23
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.

1 participant