Add installable agent skill (itrx-skill) - #20
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Equivalent of virgesmith/xenoform-rs#24 for
itrx.Why
Coding agents write correct
Itrchains more reliably when given a compact, purpose-built reference than when relying on the wholeREADME.mdbeing in context. Bundling one that agents can install makes that reference available in any downstream project usingitrx, 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),collecttargets, when reaching forItris actually worth it, and the pitfalls: single-pass/no-rewind,tee/copyshared-buffer growth,groupby/sorted_bysorting up front vs lazychunk_by, eagervalue_counts/rev,dedupbeing adjacent-only, 0-basednth,next/lastraising wherefindreturnsNone,productmaterialisingother.src/itrx/skill_cli.py+[project.scripts]— anitrx-skillconsole script with--install [PATH]/--remove [PATH](defaultPATH=.agents), creatingPATH/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## Unreleasedentry.Design decisions
skill/directory inside whateveritrxis installed in the active environment, so the skill always matches the installed version with nothing to go stale. Modelled on Streamlit'sstreamlit skillsCLI, which takes the same approach for the same reason.unzip -lon a built wheel that hatchling packagessrc/itrx/skill/SKILL.mdand registers the entry point with no extra config, same as the existingpy.typedmarker. (Note this differs from xenoform-rs, which usesuv_build.)os.path.relpathraisesValueError(notOSError); 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_targetfalls back to absolute there, with a test that forces theValueErrorpath.v0.4.0is already tagged, so the entry sits under## Unreleasedfor a later release commit.Verification
ruff check,ruff format --check,ty check srcclean;pytest193 passed, coverage 100%.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