Skip to content

Add threads skills install to install the skill into agent skill dirs - #6

Merged
fioenix merged 3 commits into
mainfrom
feat/skills-install
Jun 30, 2026
Merged

Add threads skills install to install the skill into agent skill dirs#6
fioenix merged 3 commits into
mainfrom
feat/skills-install

Conversation

@fioenix

@fioenix fioenix commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Answers "how do I install the skill for my CLI agents?" — there was no built-in way (only npx skills add via a registry), and the skill wasn't bundled in the package.

What

  • Bundle the skill into the wheel (hatchling force-includethreads_cli/_skills/threads). Editable installs fall back to the repo's skills/ dir; _skill_bundle_dir() resolves either. Confirmed present in the built wheel.
  • threads skills install — copy the skill (SKILL.md + references; dev-only evals/, state/, .env excluded) into an agent skill dir. With no --target it detects the common dirs (~/.claude/skills, ~/.codex/skills, ~/.agents/skills, ~/.opencode/skills, ~/.copilot/skills, ~/.pi/skills) and prompts interactively, or asks for --target non-interactively. --target <dir> or --target all. Idempotent (overwrites).
  • threads skills list (detected dirs + install state) and threads skills path.
  • Docs (README, cheatsheet, AGENTS) and eval 8 updated; npx skills add kept as a registry-based alternative.

Verification

  • 76 tests passing (8 new in test_skills.py); ruff clean; build OK.
  • Smoke-tested: skills path/list resolve the repo bundle; install --target <tmp> copies SKILL.md + references and excludes evals; wheel contains the bundle.

🤖 Generated with Claude Code

fioenix and others added 3 commits June 30, 2026 13:25
There was no built-in way to install the skill — only `npx skills add` via a
registry, and the skill wasn't even bundled in the pip package. Add a
self-contained installer.

- Bundle skills/threads into the wheel (hatchling force-include →
  threads_cli/_skills/threads); editable installs fall back to the repo's
  skills/ dir. _skill_bundle_dir() resolves either.
- `threads skills install`: copy the skill (SKILL.md + references; dev-only
  evals/state excluded) into an agent skill dir. Detects the common dirs
  (~/.claude/skills, ~/.codex/skills, ~/.agents/skills, ...) and, with no
  --target, prompts interactively or asks for --target non-interactively.
  --target <dir> or --target all for explicit selection. Idempotent.
- `threads skills list` (detected dirs + install state) and `skills path`.
- Docs (README, cheatsheet, AGENTS) and eval 8 updated to the new command.

76 tests passing; ruff clean; build OK; skill confirmed present in the wheel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The evals had only human-readable expected_output. Add the schema's
expectations[] — 2-4 verifiable assertions per eval — so the skill can be
graded/benchmarked automatically (with vs. without skill). Focus on the
load-bearing behaviors: the publish gate is never bypassed, the API's real
limits (no feed, no demographics, no reach metric) are respected, and
onboarding uses the current commands.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eview)

Codex flagged two [high] issues with copytree(dirs_exist_ok=True) writing
into a live agent skill directory:
- stale/hostile files from an older install persisted after reinstall
  (merge didn't remove files no longer in the bundle);
- a destination symlink could be followed, turning reinstall into an
  arbitrary-file-overwrite primitive.

Install is now replace-not-merge: stage a fresh copy in a temp dir on the
same filesystem, unlink an existing symlink/file (never write through it)
or rmtree a real dir, then os.replace() atomically. Also fixed --target all
with no detected dirs (errors) and single-dir non-interactive (installs
without prompting instead of erroring).

Tests: stale-file removal, destination-symlink not followed (outside file
untouched), empty --target all, single-dir non-interactive. 80 passing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@fioenix
fioenix merged commit f84acf2 into main Jun 30, 2026
6 checks passed
@fioenix
fioenix deleted the feat/skills-install branch June 30, 2026 06:35
fioenix added a commit that referenced this pull request Jun 30, 2026
Follow-up to #6. Users know their agent CLI ("claude", "codex") but not the
skill-directory path, so --target now takes the agent name and derives the dir.

- --target accepts an agent name (claude/codex/agents/opencode/copilot/pi),
  'all', or a directory path (escape hatch). Unknown names error with the list.
- No --target auto-detects: single detected agent installs; several prompt
  (showing name + dir) or ask for --target non-interactively.
- `skills list` reports agent names. Install safety (replace-not-merge,
  symlink-safe) unchanged. Docs/--help/eval 8 updated.

82 tests; ruff clean; build OK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant