Files
peltier.io/scripts/install-skill.sh
T
benbrownandClaude Fable 5 477c5472dd skill: make the peltier skill consumable across agent harnesses
The SKILL.md Agent Skills standard (agentskills.io) is now read natively by
Codex, Copilot, VS Code, Cursor, Gemini CLI, opencode, Goose, Amp, Zed,
Factory, and ZeroClaw — so the portable move is not per-harness adapter
files (forked content that drifts) but one canonical skill placed where
each harness actually looks.

- Spec-compliant frontmatter: license, compatibility (the Linux-only
  measurement story, stated up front), version/author/tags top-level
  (ZeroClaw's runtime reads those; the spec ignores unknown fields).
  reference/ renamed to references/ per the spec's conventional layout.
- .agents/skills/peltier/ mirror: the cross-tool convergence path (Codex,
  Zed, Cursor, Gemini CLI, Copilot, opencode, Goose, Amp). Byte-identical
  to the .claude canonical, enforced by CI — drift between the two copies
  is a red build, not a footnote.
- AGENTS.md at the repo root for the ~20 harnesses that read it (Claude
  Code does not; CLAUDE.md remains its file). Deliberately thin: it points
  at CLAUDE.md and the skill instead of restating rules.
- scripts/install-skill.sh: stamps a consumer repo at both discovery paths
  (--layout claude|agents|both), or emits a script-less --zeroclaw-variant.
  ZeroClaw's skill security policy blocks script files by default
  (skills.allow_scripts off) — its audit rejected the full skill and passes
  the variant, verified against the real zeroclaw binary. The variant loses
  nothing: preflight.sh still exists exactly once, in the peltier checkout
  the skill already requires, and SKILL.md now documents running it from
  there. Re-implementing preflight inline is named as a refusal condition.
- CI (skill-preflight): frontmatter upgraded to a full Agent Skills spec
  conformance check on BOTH copies (name rules, dir match, description and
  body limits, metadata string-map), plus mirror equality and a functional
  installer test (both layouts identical to canonical, variant carries no
  scripts/, nonexistent target refused).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 11:59:26 -04:00

87 lines
3.5 KiB
Bash
Executable File

#!/bin/sh
# install-skill.sh — stamp the peltier Agent Skill into a consumer repo.
#
# sh scripts/install-skill.sh <target-repo> [--layout claude|agents|both]
# sh scripts/install-skill.sh --zeroclaw-variant <out-dir>
#
# The skill is one directory (SKILL.md + references/ + scripts/ + assets/),
# already in the Agent Skills format (agentskills.io) that Claude Code, Codex,
# Copilot, VS Code, Cursor, Gemini CLI, opencode, Goose, Amp, Zed and others
# load natively. All this script does is copy that one canonical directory to
# the discovery path(s) a harness actually reads:
#
# .claude/skills/peltier/ Claude Code (also read by Copilot, VS Code,
# opencode, Amp, and Cursor in compat mode)
# .agents/skills/peltier/ the cross-tool convergence path (Codex, Zed,
# Cursor, Copilot, VS Code, Gemini CLI, opencode,
# Goose, Amp)
#
# --layout both (the default) writes both. That is two copies in YOUR repo;
# keep them identical (re-run this script to update both; peltier's own CI
# shows the diff -r pattern for enforcing it).
#
# --zeroclaw-variant writes a copy WITHOUT scripts/ to <out-dir>: ZeroClaw's
# skill security policy blocks script files by default (skills.allow_scripts
# is off), so its variant runs preflight from the peltier checkout instead —
# the skill's SKILL.md already explains that path. Then install it with:
# zeroclaw skills install <out-dir>
#
# The skill still needs a peltier checkout at runtime (bench-runner lives
# there). Set PELTIER_HOME in the environment your agent runs in.
set -eu
usage() {
sed -n '2,30p' "$0" | sed 's/^# \{0,1\}//'
exit 2
}
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
src="$here/../.claude/skills/peltier"
[ -f "$src/SKILL.md" ] || { echo "install-skill: cannot find the skill at $src" >&2; exit 1; }
copy_skill() { # $1 = dest dir, $2 = "full" | "noscripts"
rm -rf "$1"
mkdir -p "$1"
cp -R "$src/." "$1/"
if [ "$2" = "noscripts" ]; then rm -rf "$1/scripts"; fi
}
case "${1:-}" in
""|-h|--help) usage ;;
--zeroclaw-variant)
out=${2:-}; [ -n "$out" ] || usage
copy_skill "$out" noscripts
echo "wrote script-less variant to $out (ZeroClaw blocks script files in skills by default)"
echo "next: zeroclaw skills install \"$out\" # optionally --bundle <alias>, then add the"
echo " bundle to agents.<alias>.skill_bundles so your agent loads it"
echo "note: at runtime the skill runs preflight from your peltier checkout —"
echo " set PELTIER_HOME to that checkout for the agent's environment"
exit 0
;;
esac
target=$1; shift
layout=both
while [ $# -gt 0 ]; do
case "$1" in
--layout) layout=${2:-}; shift 2 ;;
*) usage ;;
esac
done
case "$layout" in claude|agents|both) ;; *) usage ;; esac
[ -d "$target" ] || { echo "install-skill: target repo '$target' is not a directory" >&2; exit 1; }
wrote=""
if [ "$layout" = claude ] || [ "$layout" = both ]; then
copy_skill "$target/.claude/skills/peltier" full
wrote="$wrote $target/.claude/skills/peltier"
fi
if [ "$layout" = agents ] || [ "$layout" = both ]; then
copy_skill "$target/.agents/skills/peltier" full
wrote="$wrote $target/.agents/skills/peltier"
fi
echo "installed:$wrote"
echo "next: set PELTIER_HOME=/path/to/peltier.io in the environment your agent runs in"
echo " (the skill drives the real bench-runner from that checkout; preflight refuses without it)"