Skip to content

Add installable agent skill (itrx-skill) - #20

Merged
virgesmith merged 2 commits into
mainfrom
feat/agent-skill
Sep 1, 2026
Merged

virgesmith merged 2 commits into
mainfrom
feat/agent-skill

Conversation

@virgesmith

Copy link
Copy Markdown
Owner

Equivalent of virgesmith/xenoform-rs#24 for itrx.

Why

Coding agents write correct Itr chains more reliably when given a compact, purpose-built reference than when relying on the whole README.md being in context. Bundling one that agents can install makes that reference available in any downstream project using itrx, not just this repo.

What

  • src/itrx/skill/SKILL.md — the bundled skill. Covers construction, the lazy/eager split (including which non-lazy methods short-circuit and so are still safe on infinite sources), collect targets, when reaching for Itr is actually worth it, and the pitfalls: single-pass/no-rewind, tee/copy shared-buffer growth, groupby/sorted_by sorting up front vs lazy chunk_by, eager value_counts/rev, dedup being adjacent-only, 0-based nth, next/last raising where find returns None, product materialising other.
  • src/itrx/skill_cli.py + [project.scripts] — an itrx-skill console script with --install [PATH] / --remove [PATH] (default PATH=.agents), creating PATH/skills/itrx.
  • src/test/test_skill_cli.py — full coverage of both subcommands.
  • README.md — an "Agent skill" section plus a pointer from the install section; relnotes.md — an ## Unreleased entry.

Design decisions

  • Symlink into the target project rather than copy — the link points at the skill/ directory inside whatever itrx is installed in the active environment, so the skill always matches the installed version with nothing to go stale. Modelled on Streamlit's streamlit skills CLI, which takes the same approach for the same reason.
  • Bundled inside the package rather than fetched from a URL — no network dependency for install, and verified with unzip -l on a built wheel that hatchling packages src/itrx/skill/SKILL.md and registers the entry point with no extra config, same as the existing py.typed marker. (Note this differs from xenoform-rs, which uses uv_build.)
  • Symlink-or-refuse, no overwriting — a refusal never touches a pre-existing real file or directory, or a symlink this script doesn't own. No multi-harness detection, no global-install mode, no prompts.
  • Relative link target where one exists, absolute where none does — a relative target survives the project directory being moved, but on Windows there is no relative path between different drives and os.path.relpath raises ValueError (not OSError); that is the normal end-user layout of a venv on one drive and a project on another, and it broke every Windows job in the upstream PR. _link_target falls back to absolute there, with a test that forces the ValueError path.
  • No version bumpv0.4.0 is already tagged, so the entry sits under ## Unreleased for a later release commit.

Verification

  • ruff check, ruff format --check, ty check src clean; pytest 193 passed, coverage 100%.
  • Console script smoke-tested end to end in a throwaway project: install → idempotent re-install → remove.

Follow-ups

Only targets PATH/skills/itrx (default .agents); multi-harness target dirs (e.g. .claude/skills) could be added later if wanted.

🤖 Generated with Claude Code

Coding agents write correct `Itr` chains more reliably given a compact,
purpose-built reference than by holding the whole README in context.
Bundling one that agents can install makes it available in any downstream
project using itrx, not just this repo.

- src/itrx/skill/SKILL.md: bundled skill covering the Itr API, the
  lazy/eager split, when reaching for Itr is worth it, and the pitfalls
  (single-pass iterators, tee buffering, groupby vs chunk_by, eager
  value_counts/rev/sorted_by, 0-based nth).
- src/itrx/skill_cli.py + [project.scripts]: `itrx-skill --install [PATH]`
  / `--remove [PATH]` (default PATH `.agents`) symlinks the skill to
  PATH/skills/itrx, so it always matches the installed version. Refuses to
  touch a pre-existing file, directory, or foreign symlink. The link target
  is relative where one exists, absolute where none does (different Windows
  drives, where os.path.relpath raises ValueError).
- src/test/test_skill_cli.py: full coverage of both subcommands.
- README "Agent skill" section and a relnotes entry.

Verified with `unzip -l` on a built wheel that hatchling packages
src/itrx/skill/SKILL.md and the entry point with no extra config.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
SKILL.md referred to `doc/apidoc.md` as a repo-relative path, but the wheel
ships only `itrx/skill/SKILL.md` — no `doc/`. In the case the skill is built
for (symlinked into a downstream project) that path does not resolve, or
worse resolves to the downstream project's own unrelated `doc/`.

Reference the blob URL on main instead, with an explicit instruction to
consult it for any detail the skill omits. Notes that it tracks main rather
than the installed version, and that `Itr.<method>.__doc__` is the
authoritative check for what is actually installed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@virgesmith
virgesmith merged commit df6ef1b into main Sep 1, 2026
9 checks passed
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