Skip to content

Expose poe-code skill installation as a public SDK subpath #429

Description

@kamilio

Concrete need

poe-agent-tools needs to ship a hidden command named poe-agent-tools install-skill that installs this repository's checked-in skill file into the current project for Codex:

  • source skill file: .agents/skills/poe-agent-tools/SKILL.md
  • target agent: codex
  • target scope: local
  • expected installed path: .codex/skills/poe-agent-tools/SKILL.md

This command should call a poe-code SDK function. It should not shell out to poe-code, hand-roll file copies, duplicate path validation, or rely on private package internals.

Current blocker

As of poe-code@3.0.389:

  • The package includes internal files under packages/agent-skill-config/dist.
  • @poe-code/agent-skill-config is not published as an importable npm package.
  • poe-code's exports map exposes only ., ./agent, and ./memory; it does not expose ./skills.

So external repos cannot safely call installSkill without relying on private package internals or duplicating behavior.

SDK contract needed by poe-agent-tools

Please expose a public SDK subpath from poe-code:

{
  "exports": {
    "./skills": {
      "types": "./dist/skills.d.ts",
      "import": "./dist/skills.js"
    }
  }
}

The subpath should export an installSkill helper with this shape:

import { installSkill } from "poe-code/skills";

const result = await installSkill(
  "codex",
  {
    name: "poe-agent-tools",
    file: ".agents/skills/poe-agent-tools/SKILL.md"
  },
  {
    cwd: process.cwd(),
    homeDir: os.homedir(),
    scope: "local",
    dryRun: false
  }
);

// result.displayPath === ".codex/skills/poe-agent-tools/SKILL.md"
// result.skillPath === `${process.cwd()}/.codex/skills/poe-agent-tools/SKILL.md`

The helper should also accept direct content for callers that do not want the SDK to read from a file:

await installSkill(
  "codex",
  { name: "poe-agent-tools", content: skillMarkdown },
  { cwd, homeDir, scope: "local", dryRun }
);

Types needed by callers:

type SkillInstallSource =
  | { name: string; file: string }
  | { name: string; content: string };

type InstallSkillOptions = {
  cwd: string;
  homeDir: string;
  scope: "local" | "global";
  dryRun?: boolean;
};

type InstallSkillResult = {
  displayPath: string;
  skillPath: string;
};

If the implementation needs an injected filesystem for poe-code's own tests, expose that as an optional advanced option. The normal external SDK call must not require importing poe-code's internal FileSystem type.

Required behavior

  • scope: "local" installs under ${cwd}/.codex/skills for codex.
  • scope: "global" installs under ${homeDir}/.codex/skills for codex.
  • file paths are resolved relative to cwd unless absolute.
  • name is validated by the same skill-name validation used internally today.
  • Existing destination files should fail loudly unless the existing centralized skill machinery deliberately supports overwrite.
  • dryRun: true returns the intended path and writes nothing.
  • The implementation should continue to rely on @poe-code/agent-skill-config internally so path validation and mutation behavior stay centralized.

How poe-agent-tools will use this

Once this SDK exists, poe-agent-tools will:

  1. Add poe-code as a runtime dependency at the released version containing poe-code/skills.
  2. Add a hidden handwritten Toolcraft command through handwrittenCommands:
import os from "node:os";
import process from "node:process";
import { defineCommand, S } from "toolcraft";
import { installSkill } from "poe-code/skills";

export const installSkillCommand = defineCommand({
  name: "install-skill",
  hidden: true,
  params: S.Object({}),
  handler: async () => {
    return installSkill(
      "codex",
      {
        name: "poe-agent-tools",
        file: ".agents/skills/poe-agent-tools/SKILL.md"
      },
      {
        cwd: process.cwd(),
        homeDir: os.homedir(),
        scope: "local"
      }
    );
  }
});
  1. Include .agents/skills/poe-agent-tools/SKILL.md in the npm package files list.
  2. Remove the temporary pre-dispatch shell-out from src/bin/cli.ts.

Acceptance criteria

  • npm view poe-code@latest exports --json includes ./skills.
  • From a clean external package, this works:
node -e 'import("poe-code/skills").then(m => console.log(Object.keys(m)))'

and prints installSkill.

  • A clean external repo can run the SDK example above and create .codex/skills/poe-agent-tools/SKILL.md without importing private subpaths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions