Skip to main content

pyskills

pyskills is a plugin system that lets Python packages register “skills” (units of LLM-usable functionality) via standard entry points. An LLM harness (e.g. solveit) discovers available pyskills without importing them, reads lightweight descriptions via AST inspection, and selectively loads chosen pyskills into context using standard imports.

It includes list_pyskills() for discovery, doc() for rendering module/class/function documentation in LLM-friendly format, xdir() for listing a module or class’s public symbols, pyskills.llms (pyskills-llms) for generating llms.txt and companion llms-*.txt files from pkg/skill.py, and an allow() system for registering safe callable access in sandboxed environments. Skills can be installed as regular packages with entry points, or dropped into an XDG data directory for quick local use.

pyskills follows the progressive disclosure approach of the Agent Skills specification. Both keep a short description for discovery apart from the full instructions loaded on demand. Agent Skills stores a skill as files: a SKILL.md with YAML frontmatter, plus scripts/ and references/ directories. A pyskill is a regular Python module instead. A standard entry point registers it, its docstrings document it, and import loads it. Because it’s ordinary Python, a host can use the same module to:

  • run its functions directly
  • read the structured documentation that doc() generates
  • run it in a sandbox, where the callables it registers with allow() may perform operations the sandbox otherwise denies
  • generate llms.txt and companion llms-*.txt reference files for web-based agents from the same pkg/skill.py source

Usage

Installation

Install the latest from pypi

$ pip install pyskills

How to use

from pyskills import *

Discover what pyskills are available. This works without importing any pyskill modules:

list_pyskills()
{'pyskills.skill': 'Pyskills is a plugin system allowing Python packages to register "skills" (units of LLM-usable functionality) via standard Python entry points. An LLM harness (e.g. solveit) discovers available pyskills without importing them, reads lightweight descriptions via AST inspection, and selectively loads chosen pyskills into context using standard imports.',
 'llmsurgery.skill': 'Read and work with Claude Code and Codex session transcripts.',
 'exhash.skill': 'Universal hash-verified text editing for local files. Use this when an LLM needs one safe editing interface for reading, previewing, and modifying text files.',
 'toolslm.read_md': 'Read long Markdown documents by section number: search sections, follow links, and retrieve text by short dotted addresses, so nothing is displayed but what the task needs.',
 'fastcore.editskill': 'Text, file, cell, and notebook editing from `fastcore.tools` and `fastcore.nbio`, plus the conventions the whole fastai editing toolkit follows. Read this before working with the editing tools in any package that shares them.',
 'clikernel.skill': 'Use the persistent `clikernel` MCP session as the default workspace for any task advanced through live Python execution -- stateful inspection, file-editing workflows, debugging, experiments, API probes, data transforms, or notebook-style work. Read this before writing, running, or debugging Python code in a session with `clikernel` connected.',
 'nbdev.skill': 'Author clear, executable nbdev notebooks where code, prose, examples, outputs, and tests form one coherent narrative.',
 'tracefunc.skill': "Trace a Python function's execution at AST-line level: per-line hit counts and live variable values, via `sys.monitoring`. Use when debugging *why* code takes a branch, loops, recurses, or computes a wrong value, without editing the code under investigation or using an interactive debugger.",
 'aidialog.dlgskill': 'Read, search, and edit dialogs and notebooks through the aidialog `Dialog`/`Message` model',
 'remold': "Structural search and rewrite for Python source: declarative ast-grep pattern rules, LibCST matcher transforms for everything patterns can't express, and tree-based symbol queries. Use this to edit code by structure (rename calls, move methods, rewrite APIs) where regexes break and `ast` loses comments.",
 'cordslite.skill': 'Load this skill when an agent needs to search, summarize, or find information in Discord using cordslite. It covers read-only workflows for connecting to Discord, opening a guild, orienting through channels, searching messages, reading threads, and fetching attachments.',
 'fastmux.skill': 'Live handles for tmux sessions, windows, and panes, plus named background sessions driven by sid. Use this when code needs to read terminal screens or scrollback, drive interactive processes, build pane layouts, search text across terminals, or keep a persistent terminal session that both an agent and the user can inspect and drive.',
 'fastcdp.skill': 'Drive Chrome via the DevTools Protocol: navigate, click and fill pages, read them as an LLM-friendly accessibility tree, buffer console/network/dialog activity for debugging, and call any raw CDP command.',
 'rgapi.skill': 'Fast and flexible file discovery and search for Python. Use this when code needs `fd`-style file finding or `rg`-style searching.',
 'aai_coding.coding_patterns': "Jeremy's coding style and conventions: read before writing, reviewing, or assessing any code.",
 'aai_coding.harness_docs': 'Official docs for the current LLM harness (Claude Code or codex): read before answering questions about harness behavior, config, or features.',
 'aai_coding.looker': 'Answer questions about images and PDFs via an isolated codex checker, without loading them into your own context (macOS-only). Use it to verify rendered output: PDFs, screenshots, captured windows.',
 'aai_coding.write_prose': "How to write prose that doesn't read as AI slop: read before writing anything for human readers.",
 'ghapi.skill': 'GitHub REST API access via `GhApi`, plus local git operations via `fastgit.Git`. Use this for day-to-day GitHub work: reading/creating issues and PRs, checking CI status, managing releases/branches/gists, and repo-local git operations -- all from Python, no shelling out to `gh`/`git` needed.',
 'fastanki.skill': 'Anki flashcard tools for LLM-driven spaced repetition. Direct sqlite + AnkiWeb sync, no Anki app needed.',
 'dialoghelper.solveitskill': 'Read, search, edit, and manage Solveit dialogs using dialoghelper.core, including dialog/message addressing, line-numbered inspection, targeted message edits, add/update/delete/copy/paste workflows, and safe editing patterns.',
 'dialoghelper.termskill': 'Read and edit Solveit dialog (or Jupyter) .ipynb files from a CLI / script. Solveit is an online notebook application (like Jupyter with AI integration) where each notebook is called a "dialog" and is stored as an `.ipynb` file containing `code`, `note` (markdown), and `prompt` (markdown with a special delimiter) messages (aka "cells"). The `dialoghelper` package provides tools for reading, searching, adding, updating, and deleting those messages.',
 'test.skill': 'A test skill.'}

The doc and xdir functions

Once you’ve found a pyskill you want to use, import its module using standard python syntax:

import pyskills.skill

Use doc() to read its full documentation. doc() works on modules, classes, and functions, rendering LLM-friendly output in each case.

For a module, doc shows its docstring, public classes and functions with signatures and first docstring line, submodules, and any __docs__ cross-references. Calling doc(pkg) on a package renders the package’s own human-facing docs and appends a LLM docs: doc('pkg.skill') pointer when pkg/skill.py exists without importing it, while doc(pkg.skill) renders the compact LLM guide and its module/doc cross-references:

print(doc(pyskills.skill)[-500:])
test_func` exist to verify the system works: `doc()` them as a smoke test.

## Creating pyskills

`from pyskills import createskill; doc(createskill)` for how to build and register your own pyskill modules.
"""

## types:
- class SkillTestClass(str): ...  # Some class.

## functions:
- async def async_skill_test_func(x: int = 0) -> str: ...  # A test function…
- def skill_test_func(x: int = 0) -> str: ...  # A test function…

## elided: 1 submodules. `doc('pyskills.skill', all=True)` lists them.

For a function, doc renders the full signature with parameter comments (docments):

doc(pyskills.skill.skill_test_func)
def skill_test_func(
    x:int=0, # the input
)->str: # the output"""A test function"""

For a class, doc shows its hierarchy, docstring, full constructor documentation, and a method overview. Read a selected bound method separately for its full docments and usage notes. For dynamic APIs, use doc(instance) and xdir(instance) to discover the generated or session-bound surface:

doc(pyskills.skill.SkillTestClass)
class SkillTestClass(str):
    """Some class.
    More info about it."""
    def __init__(self): ...
    def f(self, x: int = 0) -> str: ...  # A test method
    @property
    def g(self) -> str: ...  # A test prop

Command line

pyskills-doc renders the same LLM-friendly documentation in a fresh process, importing the dotted symbol before displaying it:

pyskills-doc fastcore.script
pyskills-doc fastcore.script.call_parse
pyskills-doc --all aidialog.dlgskill

Run pyskills-doc --help for the complete command syntax.

pyskills-llms generates llms.txt (and any companion llms-*.txt files) from a package’s pkg/skill.py via AST:

pyskills-llms pyskills
pyskills-llms pyskills --out nbs/llms.txt --base-url https://example.com/docs/

In nbdev projects, nbdev-export calls pyskills.llms automatically to write nbs/llms.txt. In non-nbdev projects using fastship, ship-docs, ship-llms, ship-release, and ship-pr refresh llms.txt automatically.

The allow system

When pyskills run in a sandboxed environment like safepyrun, they need to declare which callables are trusted to perform otherwise-denied operations (filesystem writes, subprocesses, network access). safepyrun uses fastaudit to deny those effects unless they happen inside a callable registered in the __pytools__ registry. The allow() function is how pyskills register their trusted callables.

You can allow individual functions, methods, all public methods of a type, or one specific callable instance:

# Allow specific methods on a type
allow({str: ['zfill']})

# Allow all public methods on a type
allow({list: ...})

# Allow a function
allow(list_pyskills)

# Allow one specific callable instance (e.g. a dynamically-generated client op)
allow(client.images.create_image)

An object can also define __allow__, returning a list of items to register in its place; allow recurses into the result, so a container (such as a fastspec client or op group) can register all its callables at once.

Skill modules typically call allow() at module level, so permissions are registered automatically when the pyskill is imported. When safepyrun’s RunPython executes LLM-generated code, pure computation just runs; an operation with side effects is only permitted when it happens inside a registered callable.

The pyskills.skill module used in the examples above is itself registered as a pyskill entry point. It ships with pyskills both as a working sample and as a self-documenting pyskill that explains the system itself. Its docstring’s “Creating pyskills” section cross-references pyskills.createskill, a companion module (not registered as an entry point, so not shown in list_pyskills()) that documents how to build your own pyskills:

from pyskills import createskill
print(doc(createskill)[:300])
# module pyskills.createskill:

"""How to create a pyskills pyskill module.

A pyskill is a standard Python module that registers itself via entry points so LLM hosts can discover and load it.

## 1. Create your module

Your module needs:
- A docstring: first paragraph is the short description shown

Creating pyskills

pyskills keeps human and LLM documentation separate:

Audience Web Python Source
Human README.md, index.html doc(pkg) nbs/index.ipynb (nbdev) or pkg/__init__.py
LLM llms.txt doc(pkg.skill) plain pkg/skill.py (never notebook-generated)

Three module roles cover most packages:

  • pkg.skill: the package’s main LLM guide and cross-reference index, serving as the single source for both doc(pkg.skill) and llms.txt.
  • pkg.guidance: an optional companion docstring module for domain principles, judgement, or agent conduct (for example flashcard-design rules in fastanki.guidance or read-only Discord conduct in cordslite.guidance). Give it no entry point so it does not clutter list_pyskills(), and direct agents to it from pkg.skill; doc(pkg.skill) and llms.txt automatically promote pkg.guidance into Docs (llms-guidance.txt).
  • Named skills (such as fastcore.editskill, dialoghelper.solveitskill, or pyskills.createskill): subsystem tools, host-harness prompts, or secondary guides that stay separate from pkg.skill and llms.txt.

A pkg/skill.py module uses:

  • A docstring: the first paragraph is both the list_pyskills() catalog description (read via AST before import) and the llms.txt summary blockquote; the remaining body is the compact guide using ###+ headings so # pkg and ## Section stay reserved for llms.txt and doc().
  • Optional __docs__ and __base_url__: __docs__ maps section names to lists mixing Python module names ('mypkg.core', whose summary and .html.md URL are derived automatically) and (title, href, desc) tuples for non-module guides and external links. Any public module in pkg/ not listed in __docs__ is appended automatically under Optional; prefix internal modules with _ so doc(), xdir(), and llms.txt skip them uniformly. __base_url__ overrides the base URL (otherwise supplied by nbdev/fastship or read from [project.urls].Documentation in doc()).
  • Optional __all__ and allow(): __all__ curates the public API for import *; allow() declares trusted callables for sandboxed hosts and is never emitted to llms.txt.

Here’s a minimal example:

r'''Short description for `list_pyskills()` and `llms.txt`.

Compact guide read by the LLM via `doc(mypkg.skill)` and `llms.txt`.
When creating X for a user, read `doc(mypkg.guidance)`.'''

from pyskills.core import allow

__docs__ = {'Docs': ['mypkg.core', ('Quickstart', 'start.html.md', 'First steps')]}
__all__ = ['my_func', 'MyClass']

def my_func(x: int) -> str:
    "Does something useful"
    ...

class MyClass:
    "A useful class"
    def method(self) -> str:
        "Does something"
        ...

allow(my_func, {MyClass: ...})

To register your module as a discoverable pyskill, add an entry point in your pyproject.toml:

[project.entry-points.pyskills]
my_skill = "mypkg.skill"

The key is an arbitrary name; the value is the module path. After installing the package, list_pyskills() will include your pyskill automatically.

For full details on creating pyskills, including allow policies for write-guarded operations, see doc(createskill) after importing it as shown above.

Generating llms.txt

pyskills.llms (pkg_llms, update_llms_txt, and the pyskills-llms CLI) builds llms.txt from pkg/skill.py purely via AST without importing the package.

The generated file starts with # <pkg>, > <first paragraph>, and a normalized Base URL: https://.../ line so readers (llms_txt and exhash.open_doc) resolve relative links whether opened from the docs site, raw GitHub, or local disk. Modules in __docs__ and auto-discovered Optional modules link to their relative .html.md pages from nbdev or fastship; pure-docstring companions without a web page (such as pkg.guidance or pyskills.createskill) emit llms-*.txt files (llms-guidance.txt, llms-createskill.txt) copied verbatim by Quarto.

Generated files carry an HTML marker comment. update_llms_txt never overwrites a hand-written llms.txt that lacks a generated marker, and it removes stale generated llms-*.txt files when pkg/skill.py or a companion disappears. nbdev-export calls it for nbs/llms.txt whenever pkg/skill.py exists, and fastship runs it via ship-docs, ship-llms, ship-release, and ship-pr.

Folder-local skills

Hosts call enable_local_skills(opening_folder) once to expose public modules and packages from ancestor _pyskills/ directories. Local skills need a module docstring but no install or entry-point declaration. The standard entry-point API discovers them, and ordinary Python imports load them. The nearest local folder wins; conflicts with existing importable names raise an error. The scope stays fixed across cwd changes. Solveit’s dialoghelper bootstrap activates this automatically.

User-wide skills without packaging

The entry point approach above requires installing a package. But sometimes you want to create pyskills quickly without a full package: personal utility pyskills, or pyskills shared across multiple projects that each use isolated environments (like uv venvs).

pyskills provides an XDG-based pyskills directory for this. When you first import pyskills, it creates a directory at your platform’s XDG data home (typically ~/.local/share/pyskills/) and writes a .pth file into site-packages. This .pth file tells Python to add the pyskills directory to sys.path on startup, so any modules placed there are importable as standard Python modules without any special import machinery. This works across all Python environments on your system, even separate uv projects with isolated venvs.

You can check where this directory is (although you can use the functions below without needing to know):

pyskills_dir()
Path('/Users/jhoward/.local/share/pyskills')

You can drop pyskill modules directly into this directory, or use register_pyskill to create one programmatically:

register_pyskill('my_local.skill', docstr='A quick local pyskill.', code='''
from pyskills.core import allow

__all__ = ['hello']

def hello(name: str) -> str:
    "Greet someone"
    return f"Hello, {name}!"

allow(hello)
''')

This writes the module file into the XDG pyskills directory and creates a minimal entry point, so the pyskill immediately appears in list_pyskills().

You can also manage pyskills with enable_pyskill and disable_pyskill to toggle their visibility without deleting files, or use delete_pyskill to remove one entirely.

Metadata

Release files for pyskills 0.0.41

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

Source distribution (sdist)

Source distribution for pyskills 0.0.41
File Size Uploaded Provenance Actions
pyskills-0.0.41.tar.gz 47.1 kB Without provenance Details for pyskills-0.0.41.tar.gz

Built distribution (wheel)

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

Total release size: 89.0 kB

Release files / pyskills-0.0.41.tar.gz

Download URL pyskills-0.0.41.tar.gz
Size 47.1 kB
Tags Source
SHA-256 checksum
How to use checksums
04987d44a6a0e36d13be53957e1d57323b91bfe0760e4fb3e1db1faf9de15cb7
BLAKE2b-256 checksum
How to use checksums
01e07a9396fd9575fd7c42af9d50df2b198b23f0d0558946a883b3e70a62fd28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pyskills-0.0.41-py3-none-any.whl

Download URL pyskills-0.0.41-py3-none-any.whl
Size 41.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f301d1d5526d2d37f874c336b739d20c96ede8e83768d0209ed4714036af12c8
BLAKE2b-256 checksum
How to use checksums
ae5866f443ad7872d02b7cb37b1d0ed326689c309826b40260681f833d9e30a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for pyskills 0.0.41

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.0.41 This release

2 release files No provenance

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