Add installSkill() to SDK for skill lifecycle management

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
backend, cli

Research direction

Start with the existing install flow in packages/cli/src/commands/skills/install.ts and trace the SDK facade and downloadSkillBundle() implementation to see where the install lifecycle belongs. Compare the existing CLI behavior with the proposed options and acceptance criteria, then inspect the SDK’s unit test conventions. Done when the SDK method installs and verifies a skill, handles overwrite and cleanup, reports the specified errors, and the CLI uses it.

Written by the indexing model from the issue text.

Description

pkg/sdk-typescript

Summary

The SDK currently supports downloading skill bundles (client.downloadSkillBundle()) but has no method for the full install lifecycle — extracting to the correct directory, handling overwrites, and verifying the result.

The CLI implements this in packages/cli/src/commands/skills/install.ts with:

  • Download via mpak.client.downloadSkillBundle()
  • Write to temp file
  • Extract with unzip -o to ~/.claude/skills/
  • Force/overwrite handling
  • Cleanup of temp files

This should move to the SDK so that platform consumers (e.g., mcp-operator, integration-manager) can install skills programmatically without shelling out to the CLI.

Proposed API

interface InstallSkillOptions {
  /** Target directory for skills (default: ~/.claude/skills/) */
  skillsDir?: string;
  /** Overwrite existing installation */
  force?: boolean;
  /** Specific version (default: latest) */
  version?: string;
}

interface InstallSkillResult {
  name: string;
  shortName: string;
  version: string;
  installPath: string;
}

// On the Mpak facade:
async installSkill(name: string, options?: InstallSkillOptions): Promise<InstallSkillResult>

Acceptance Criteria

  • Mpak.installSkill() downloads, verifies, extracts, and returns install metadata
  • Handles force option for overwriting existing installations
  • Cleans up temp files on success and failure
  • Throws MpakNotFoundError if skill doesn't exist
  • Throws MpakInvalidBundleError if extraction fails
  • Unit tests with mocked client
  • CLI skill install command updated to use SDK method

Context

Needed for the NimbleBrain platform to use the SDK directly instead of shelling out to the CLI. See also: platform migration plan for mcp-operator integration.

Dominant language
TypeScript
Stars
14
Forks
13
Avg merge
16m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NimbleBrainInc/mpak

All issues in NimbleBrainInc/mpak

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.