Skip to main content

help2skill

Status: alpha. The output format may still change before 1.0.

--help for LLM agents. Make a Click, Typer or argparse CLI easy for coding agents (Claude Code, Codex, Cursor, Gemini CLI…) to use correctly:

  • --llms flag: prints a compact Markdown reference of the command tree (every subcommand, argument, option, choice, default and env var), generated from the CLI itself, so it never goes stale.
  • SKILL.md export: writes an Agent Skills file whose reference block is regenerated from the CLI while your hand-written guidance is kept.
  • Drift check for CI: fails when the generated block is stale, or when hand-written examples mention a subcommand or option that does not exist (or an option placed at the wrong level, e.g. a group option after the subcommand).

No runtime dependencies. Works with Typer ≥ 0.26 (vendored Click), where code that does isinstance(cmd, click.Group) silently finds nothing.

Quick start

Click

import click
from help2skill.click import llms_option


@click.group()
@llms_option()
def cli(): ...
$ mytool --llms

llms_option() adds the flag to the root only, which prints the whole tree. To get --llms on every subcommand too (mytool db --llms prints just that subtree):

from help2skill.click import add_llms_option

add_llms_option(cli)

Typer

Root flag, no change to your entry point:

import typer
from help2skill.typer import LlmsOption

app = typer.Typer()


@app.callback()
def main(llms: LlmsOption = False): ...

Or --llms at every level: build the command once and make it your console script.

# mytool/cli.py
import help2skill.typer

main = help2skill.typer.command(app, name="mytool")
# pyproject.toml
[project.scripts]
mytool = "mytool.cli:main"

No click package is needed with Typer ≥ 0.26, which ships its own copy.

argparse

argparse has no hook for an extra flag, so use the command line (or the Python API):

$ help2skill markdown mytool.cli:parser
$ help2skill markdown "mytool.cli:build_parser()"   # a function that returns the parser

Large CLIs

--llms prints the full reference when it fits in 20,000 characters (about 5k tokens). Above that it prints the top-level help plus an index of every command, and tells the agent how to ask for one command (mytool <command> --llms, or --help when only the root has the flag). Set HELP2SKILL_LLMS_MAX_CHARS=0 for everything. Options repeated identically in three or more commands are described once, under "Shared options".

Lazy commands

Click's documented LazyGroup pattern works as is. Placeholder commands with a materialize() method are loaded automatically; for anything else pass resolve= (Python API) or --resolve module:func (command line).

SKILL.md and drift checks

$ help2skill skill mytool.cli:app --name mytool --description "Use mytool to ..." \
    -o src/mytool/.agents/skills/mytool/SKILL.md
$ help2skill check mytool.cli:app src/mytool/.agents/skills/mytool/SKILL.md

skill creates the file, or refreshes only the block between <!-- help2skill:begin … --> and <!-- help2skill:end --> if it already exists (--name is then optional). Write your own guidance above or below the block.

Program name. Commands are written with the name users type. help2skill uses --program if given, else the installed console script that points at the target, else the CLI's own name (@click.group(name="mytool"), ArgumentParser(prog="mytool")), else the skill name. markdown warns when it can only guess.

Settings are stored in the file. The begin marker records the program name, --max-chars and --hide-default, so check, a refresh and the pytest helper reuse them without repeating any option.

Stable in CI. The output does not depend on the machine or on the Click/Typer version: commands are sorted, type names are normalised and your home directory is written as ~ (other machine-specific paths trigger a warning). A default computed at run time (CPU count, today's date) would still differ, so leave it out:

$ help2skill skill mytool.cli:app -o SKILL.md --hide-default workers --hide-default --since

When the reference is longer than 30,000 characters, SKILL.md keeps an index and the full reference goes to references/commands.md beside it (fully generated; agents read it on demand). Change the limit with --max-chars (0 = never split).

What the check catches in code spans and fenced blocks of your hand-written text: unknown subcommands and options (with "did you mean"), options at the wrong level, values not among an option's or argument's choices, values given to flags, and single-letter clusters such as -fq. Lines continued with \ are joined, and lines are recognised with launchers in front: uv run [--with …] mytool …, uvx, pipx run, poetry run, python -m mytool, VAR=value mytool ….

Shipping the skill inside your package under .agents/skills/<name>/ makes it installable with library-skills. With setuptools, add the folder to package-data; hatchling includes it by default.

In pytest (build the path from __file__ so the test runs from any directory):

from pathlib import Path

from help2skill.testing import assert_skill_in_sync
from mytool.cli import app

SKILL = Path(__file__).parents[1] / "src/mytool/.agents/skills/mytool/SKILL.md"


def test_skill_in_sync():
    assert_skill_in_sync(app, SKILL)

With a src/ layout that is not installed, pass --app-dir src to the command line.

Python API

import help2skill

tree = help2skill.introspect(app, "mytool")  # Click, Typer or argparse
print(help2skill.render_markdown(tree))
help2skill.write_skill(app, "SKILL.md", name="mytool")
problems = help2skill.check_skill_file(app, "SKILL.md")

Security

help2skill imports the module you point it at, the same as running your CLI. It calls a function only when you write module:func() or the function's name contains "parser"; it never calls your main(). Generated files copy your help text verbatim, so review them for machine-specific values before committing. See SECURITY.md.

License

MIT. Built with AI assistance (Claude).

Metadata

Release files for help2skill 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for help2skill 0.1.0
File Size Uploaded Provenance Actions
help2skill-0.1.0.tar.gz 99.6 kB With provenance Details for help2skill-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for help2skill 0.1.0
File Interpreter ABI Platform Actions
help2skill-0.1.0-py3-none-any.whl Python 3 none any Details for help2skill-0.1.0-py3-none-any.whl

Total release size: 131.0 kB

Release files / help2skill-0.1.0.tar.gz

Download URL help2skill-0.1.0.tar.gz
Size 99.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e1209898d053ed935665767d29e66623ad5033005fbd63e576843bc7634b627
BLAKE2b-256 checksum
How to use checksums
50126e2fedbd9b6f2f3f1f18f61411e90a603d0ce63ce26b850f860f6dec7cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / help2skill-0.1.0-py3-none-any.whl

Download URL help2skill-0.1.0-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f877ba828a009dcf42ef2afc6e2809aabd67c97d7654f7c7a6092288413be939
BLAKE2b-256 checksum
How to use checksums
bb7f9ae76217a9b4f9ad063893264464422925207c6388dd9556888ab4de8e77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for help2skill 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for help2skill-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page