Back to Prisma

Brief: D1 — skill-install runner module

projects/agent-native/slices/init-skill-install/briefs/d1-r1.md

7.9.0-dev.173.4 KB
Original Source

Brief: D1 — skill-install runner module

Task

Create packages/cli/src/init/skill-install.ts implementing the slice spec's Chosen design: a pinned-version, package-manager-adaptive runner that installs the prisma/skills catalog via the upstream skills CLI, with a never-throws failure shape — plus its unit tests in packages/cli/src/__tests__/skill-install.vitest.ts. Work on branch tml-2968-s1-install-prisma-skills-during-prisma-init, created from origin/main.

Scope

In: packages/cli/src/init/skill-install.ts (new); packages/cli/src/__tests__/skill-install.vitest.ts (new). If isBun must be shared with Init.ts, hoisting that constant into the new module (or a tiny shared location under packages/cli/src/init/) is in scope.

Out: Init.ts wiring (dispatch D2), any Generate.ts surface, real network calls in tests, new package dependencies (execa is already a packages/cli dependency — use it), any file outside packages/cli/.

Completed when

  • skill-install.ts exports detectRunner(cwd), installSkills({ cwd }), and the constants SKILLS_CLI_VERSION (exact version literal), SKILL_AGENTS (['cursor','claude-code','codex','windsurf']), SKILLS_SOURCE ('prisma/skills').
  • installSkills executes <runner> skills@<version> add prisma/skills --agent cursor claude-code codex windsurf --skill '*' -y (runner per detection: npx --yes / pnpm dlx / yarn dlx / bunx; detection via npm_config_user_agent, then lockfile sniff in cwd, defaulting to npm; bun via runtime check), streams output, and resolves { ok: true } or { ok: false, manualCommand } — it never throws.
  • Unit tests cover: command assembly for npm/pnpm/yarn/bun; no-package.json/no-lockfile fallback to npm; failure resolves to the failure shape with a usable manualCommand. Execution is mocked/injected — no network.
  • packages/cli typecheck clean; the new vitest file green (discover exact script names in packages/cli/package.json; record the commands you ran).

Standing instruction

Stay focused on the goal; control scope. Trivial-and-related fixes that obviously serve the goal go in the same dispatch with a one-line note in your wrap-up message. Anything that pulls you off the goal — even if it looks useful — halts and surfaces.

References

  • Slice spec: projects/agent-native/slices/init-skill-install/spec.md — chosen design, pre-investigated edge cases (npx --yes is load-bearing; no-package.json detection fallback), slice-DoD.
  • Slice plan entry: projects/agent-native/slices/init-skill-install/plan.md § Dispatch 1.
  • Project spec/plan (background): projects/agent-native/spec.md, projects/agent-native/plan.md.
  • Prior art (shape reference only, code not portable): prisma-next's init skill-install — command shape documented in the slice spec; do not fetch the repo.
  • Repo conventions: AGENTS.md (kebab-case files, no barrel files, comment discipline, #field over private).

Operational metadata

  • Model tier: orchestrator-inherit — foundation dispatch; correctness here saves rounds.
  • Time-box: 45 minutes wall-clock. Overrun → halt and surface, do not extend.
  • Halt conditions: an out-of-scope surface must change to complete the task; execa turns out not to be available in packages/cli; the diff exceeds ~10 files; any slice-spec assumption observed false (I12).