Convert a codebase, feature, or module into an AI-agent-friendly CLI and/or MCP server. Covers npm packaging, stdio/SSE/Streamable HTTP surfaces, credential resolution, docs, tests, CI, and a companion Claude skill for users who need an existing capability exposed as a reusable agent tool.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Convert a codebase, feature, or module into an AI-agent-friendly CLI and/or MCP server. Covers npm packaging, stdio/SSE/Streamable HTTP surfaces, credential resolution, docs, tests, CI, and a companion Claude skill for users who need an existing capability exposed as a reusable agent tool.
user-invocable
true
when_to_use
Invoke to expose existing code as a reusable CLI or MCP tool.
Convert a codebase (or a scoped feature/module inside it) into an AI agent-friendly and user-friendly surface:
CLI — publishable on npm, credential-aware, scriptable
MCP server — stdio + SSE + Streamable HTTP, deployable on Cloudflare/Docker
Companion skill — a /ak:* skill discoverable on the Claude Plugins Marketplace
Principles: understand before wrap | agent-centric tool design | one source of truth (shared core, thin adapters) | credentials at every layer | ship with docs, tests, and CI.
Scope: converting existing code into CLI and/or MCP. Not for: building a server from scratch (use /ak:mcp-builder), raw npm scaffolding, or publishing without an agent-use story.
Phase 0 must run before Phase 1. No work without a tracked plan.
Phase 1 must complete before any design decision. Do not invent behavior you have not read.
Phase 3 must resolve the output mode before scaffolding.
In --ask, Phase 3 blocks on user answers. In , Phase 3 records decisions and proceeds.
--auto
0. Track (MANDATORY)
Invoke /ak:project-managementbefore touching code. This skill owns plan/task lifecycle; agentize is a consumer.
Purpose:
Create a dated plan directory under plans/ (naming from hook injection: {date}-{issue}-{slug}).
Register the phase checklist (Scout → Package) as trackable tasks.
Set the active plan context so downstream skills (scout, plan, cook, test, docs, skill-creator) write into the same plan folder.
Record the invocation arguments (mode flags, target feature/module) in plan.md.
Delegate format when calling project-management:
work context path (git root of the target)
reports path (plans/reports/)
plans path (plans/)
the literal agentize argv so the plan captures mode selection
Do not proceed until the plan directory exists and tasks are registered. If project-management returns BLOCKED or NEEDS_CONTEXT, resolve it before Phase 1.
1. Scout (MANDATORY)
Invoke /ak:scout to understand the target codebase. Without this, everything downstream is guessed.
Collect:
Entry points — public functions, classes, exported APIs, existing CLIs
Core capabilities — the 5–15 operations worth exposing as tools/commands
Inputs/outputs — parameter shapes, return shapes, side effects
Side effects — network, filesystem, DB, external services
Challenge the user on weak answers. Prefer fewer, sharper tools over broad coverage.
Output of Phase 3: a written decision record (plans/reports/agentize-decisions-<slug>.md) with mode, capability list, tool/command names, transports, deployment targets, and package metadata.
4. Scaffold
Create the repo layout. See references/monorepo-layout.md for the full tree.
For --cli or --mcp alone: single-package repo, still keep a src/core/ folder so the thin-adapter shape holds if the other surface is added later.
Use TypeScript by default when the target is JS/TS. For non-JS targets, CLI/MCP live in the target's idiomatic toolchain (e.g., Python + click/typer + mcp SDK), but the skill still produces equivalent structure.
5. Wrap
Extract core/ first. It must not import anything CLI- or MCP-specific. Every capability is a plain function: run(params) → result.
5a. CLI (packages/cli/)
Use commander or cac. Each command maps 1:1 to a core capability, plus meta commands (config, login, doctor).
Required:
--help, --version
--json for machine-readable output on every command