PTENES
MODULE 5.2

⚑ The polyskill CLI in practice

From installation to reconcile. Each command explained, demonstrated in a real case, with usage scenarios and common errors.

7
Topics
45
Minutes
Adv.
Level
Hands-on
Type

🎯What you get here

Learn every CLI command inside and out. Know which one to use for each situation (install, import an existing skill, build, validate, handle drift) and what to expect from the output.

Detailed content

1

πŸ“₯ Installation β€” Path A vs Path B

Two ways to install, depending on what you need. A is faster but limited. B is comprehensive β€” necessary for building your own skills.

A. Drag & drop (no CLI)

# Claude Code
cp -r skill/dist/claude/polyskill \
  ~/.claude/skills/polyskill

# OpenAI Codex
cp -r skill/dist/codex/polyskill \
  ~/.agents/skills/polyskill

The skill works for natural-language invocation. But if it needs to run polyskill build under the hood, it fails β€” CLI isn't on the PATH.

B. Source + CLI (complete)

git clone \
  https://github.com/inematds/pollyskill
cd pollyskill
npm install
npm run build
npm link

# Confirma
polyskill --version
polyskill detect

# Instala a meta-skill
cd skill && polyskill install

CLI on PATH. You can do everything: create skills, import, build, install, reconcile.

πŸ’‘Which one to choose

If you only want to USE existing cross-runtime skills, A is enough. If you’re going to CREATE/PORT your own skills, B is required. When in doubt, choose B β€” there’s no downside.

Key concepts

Pre-built bundle
Path A
npm link
CLI on PATH
polyskill detect
Validates the install
Committed dist
Skills/dist/* in the repo
2

πŸš€ polyskill init <nome>

Create a portable skill workspace from scratch. Initial structure with definition.md stub, conventional folders, build config. You never create SKILL.md by hand.

In action

$ polyskill init my-reviewer
βœ“ Created workspace: ./my-reviewer

Structure:
  ./my-reviewer/
  β”œβ”€β”€ definition.md       # edit this
  β”œβ”€β”€ scripts/            # empty
  β”œβ”€β”€ references/         # empty
  β”œβ”€β”€ assets/             # empty
  └── .polyskill.json     # config

Next steps:
  cd my-reviewer
  $EDITOR definition.md
  polyskill build

initial definition.md

---
name: my-reviewer
description: Use when... [edit this]
---

# My Reviewer

Edite o corpo aqui. Suporta markdown padrΓ£o.

Pode referenciar arquivos relativos: `./references/x.md`
Pode delegar pra scripts: `./scripts/check.sh`

Key concepts

Initial structure
All set
definition.md
Not SKILL.md
.polyskill.json
Local config
Ready-made stub
Edit only
3

πŸ“€ polyskill import <path> --from claude|codex

Takes an existing skill from any runtime and generates an equivalent portable workspace. Bidirectional: --from claude gets from .claude/skills/, --from codex gets from .agents/skills/.

In action β€” importing a skill from Claude

$ polyskill import ~/.claude/skills/code-reviewer \
    --from claude

βœ“ Parsed ~/.claude/skills/code-reviewer/SKILL.md
βœ“ Copied 2 scripts, 3 references, 0 assets
⚠ Converted 2 backtick-bang occurrences β†’ prose fallback (with annotation in IR)
βœ“ Wrote ./code-reviewer/definition.md
βœ“ Workspace created

Next steps:
  cd code-reviewer
  polyskill build
  polyskill install   # instala nos DOIS runtimes

βœ“ What import preserves

  • β€’ All files in scripts/, references/, assets/
  • β€’ Frontmatter (name + description)
  • β€’ Complete markdown body
  • β€’ Relative links

⚠ What gets converted

  • β€’ Backtick-bang (Claude) β†’ fallback prose + marker in the IR
  • β€’ allowed-tools (Claude) β†’ generic tool restriction IR
  • β€’ Sidecar openai.yaml (Codex) β†’ branding IR + mcp_deps
  • β€’ Long description β†’ kept (front-loading only in the build for Codex)

πŸ’‘Free reverse engineering

Have 10 Claude skills you love? Import each with one command, then polyskill build generates a Codex version of each. Round tripβ€”it started as Claude-only, and now runs in both. Same thing if you started in Codex.

Key concepts

--from claude
Source .claude/skills/
--from codex
Source .agents/skills/
Preserves files
scripts/refs/assets
Annotate conversions
Marker in the IR
4

πŸ—οΈ polyskill build

Compile definition.md to dist/<target>/<skill>/. It’s the command you run every time you edit the skill. It can go in a watch or pre-commit hook.

Build output

$ polyskill build

βœ“ Parsed ./definition.md
βœ“ Built dist/claude/code-reviewer/SKILL.md
βœ“ Built dist/codex/code-reviewer/SKILL.md
βœ“ Built dist/codex/code-reviewer/agents/openai.yaml
βœ“ Copied scripts/, references/, assets/ to all targets
βœ“ Updated .polyskill-hashes

Build complete (3 files in 2 targets, 312ms).

What each adapter does during emit

Claude adapter
Codex adapter
Restore backtick-bang in IR markers
Converts dynamic markers into fallback prose
Emits allowed-tools in frontmatter if the IR has
Ignore allowed-tools (doesn't support)
No sidecar
Emits agents/openai.yaml if IR has branding/mcp
Literal description
Front-loading: triggers in the first 1-2KB

⚠️--force to ignore drift

$ polyskill build
βœ— Drift detected in dist/claude/x/SKILL.md (run reconcile or --force)

$ polyskill build --force
βœ“ Forced overwrite (drift discarded)

Use --force only when you're sure the manual adjustment can be discarded. Otherwise, use reconcile.

Key concepts

dist/<target>/
Output per adapter
.polyskill-hashes
Drift detection
--force
Overrides drift
Watch/pre-commit
Runs automatically
5

πŸ“¦ polyskill install

Combine build + copy to the canonical directories: ~/.claude/skills/<skill> e ~/.agents/skills/<skill>. Skill available instantly in both runtimes.

In action

$ polyskill install

βœ“ Built 2 targets (claude, codex)
βœ“ Claude Code     β†’ ~/.claude/skills/code-reviewer
βœ“ OpenAI Codex    β†’ ~/.agents/skills/code-reviewer

Reload notes:
  - Claude Code: hot-reload (jΓ‘ disponΓ­vel, /code-reviewer)
  - Codex: open desktop app β†’ Plugins β†’ refresh
          (CLI: skill aparece no prΓ³ximo $ + autocomplete)

Install complete.
⚑

Everyday command

Edited it? Run install. Skill updated in both. It's the most-used command after build.

πŸ”„

Reload

Claude reloads automatically. Codex CLI does too. Codex desktop needs a manual refresh.

πŸ—‘οΈ

Uninstall

There's no command. rm -rf ~/.claude/skills/x + rm -rf ~/.agents/skills/x.

Install scope

By default, it installs in global (~/.claude/, ~/.agents/). To install in the project:

$ polyskill install --scope project
βœ“ Installed to ./.claude/skills/ and ./.agents/skills/

Key concepts

build + copy
2-in-1 shortcut
Global default
~/.claude and ~/.agents
--scope project
Locates in the repo
Manual reload
Codex desktop only
6

πŸ” polyskill detect / status / adapters

Three commands read-only for inspection. They don’t edit anything. They’re for debugging and inspecting the current state.

polyskill detect

Tells you which runtimes are installed on the machine and where they are.

$ polyskill detect
βœ“ Claude Code     v1.4.2 (~/.claude/, npm)
βœ“ OpenAI Codex    v0.8.1 (~/.codex/, brew)
βœ— Gemini CLI      not installed
βœ— Cursor          not installed

polyskill status

Compare dist/ current with the installed directories. Shows what’s in sync.

$ polyskill status
Workspace: ./code-reviewer

Targets:
  claude     βœ“ in sync  (~/.claude/skills/code-reviewer)
  codex      ⚠ behind    (~/.agents/skills/code-reviewer, 2 commits old)

Run `polyskill install` to sync.

polyskill adapters

Lists the adapters installed in polyskill. Today: portable + claude + codex.

$ polyskill adapters
βœ“ portable    canonical source format
βœ“ claude      Claude Code (.claude/skills/)
βœ“ codex       OpenAI Codex (.agents/skills/ + sidecar)

Roadmap (not yet):
  - gemini
  - cursor

πŸ’‘Useful for troubleshooting

Skill not triggering? detect first, to check whether the runtime is visible. Weird build? status shows what’s out of sync. Adapter broke? adapters confirm it’s loaded.

Key concepts

Read-only
Don't edit
--json
Parseable
CI-friendly
Exit codes
Debug first stop
Always detect
7

🩺 polyskill validate / reconcile

Two commands for health. validate runs a linter per adapter (rules by target). reconcile resolves drift when someone edited it by hand outside polyskill.

polyskill validate β€” lint by target

$ polyskill validate

βœ“ portable     definition.md is valid
βœ“ claude       SKILL.md will be valid in Claude Code
βœ— codex        SKILL.md has issues:
                - description is 8.4KB, will be truncated to ~8KB
                - triggers "review PR" found at offset 8200 β†’ will be lost
                - move triggers to first 1-2KB (front-loading)

Validation FAILED for 1 target.

Each adapter has its own rules: Codex validates description size, Claude validates allowed-tools syntax, etc. validate runs in CI before merge.

polyskill reconcile β€” interactive drift

$ polyskill reconcile

⚠ Drift detected in 1 target:
  ~/.claude/skills/code-reviewer/SKILL.md

Diff (target vs last-built):
  + Added section: "## Special case: monorepo"
  ~ Modified body of "## Output format"

Options:
  [k] keep target version (import back into definition.md)
  [o] overwrite target with current build
  [m] manual merge (open editor)
  [s] skip (leave drift for now)

Choice (k/o/m/s): k

βœ“ Imported target β†’ definition.md updated
βœ“ Rebuilt all targets from new definition
βœ“ Drift resolved

When to run validate

  • β€’ Before commit (pre-commit hook)
  • β€’ In CI before merging
  • β€’ After importing a skill from another runtime
  • β€’ When editing description (checks for truncation)

When to run reconcile

  • β€’ Build aborts with a drift error
  • β€’ You know someone edited it by hand
  • β€’ Skill reverted to the source from another machine
  • β€’ Periodically as a sanity check

πŸ’‘Ideal setup

Pre-commit hook runs polyskill validate + polyskill build. CI runs both too. You run reconcile manually when drift appears. This triangle covers 95% of cases.

Key concepts

Rules per adapter
Specific linting
CI exit code
0 = ok, 1 = failure
4 reconcile options
keep/over/manual/skip
CI triangle
validate+build+reconcile

🎯Module summary

βœ“
Path A to use, Path B to create β€” npm link in B puts the CLI on the PATH.
βœ“
init creates a portable workspace β€” definition.md + convention-based dirs.
βœ“
import pulls in an existing skill in either direction β€” annotates conversions in the IR.
βœ“
build outputs to both targets + saves hash β€” --force to ignore drift.
βœ“
install = build + copy to canonical directories β€” global by default, --scope project if you want.
βœ“
detect/status/adapters = read-only inspection β€” first commands for troubleshooting.
βœ“
validate in CI + reconcile for drift β€” the skill health triangle.

Next track:

T6 β€” Advanced workflows (session handoff, two terminals, shared MCP, governance)