tiran/tiran-skills
Portable, agent-neutral coding skills and playbooks (Python packaging, PyTorch), auto-discovered under skills/.
Scaffold a new Python project from zero: src/ layout, PEP 621 metadata, a chosen build backend (hatchling for pure Python; meson-python / scikit-build-core / maturin for compiled) with dynamic VCS versioning, py.typed, ruff, a type checker, pytest + coverage, tox or nox via uv, and hardened GitHub Actions CI (SHA-pinned, Trusted Publisher, CodeQL/Scorecard/Dependabot). Always writes a README, LICENSE, and .gitignore. Orchestrates the choose-python-build-backend, modernize-python-metadata, ship-type-information, and secure-python-release-pipeline skills. Use when asked to start a new package, scaffold/bootstrap a Python project, set up a repo from zero, turn a loose script into a proper package, or bring an existing project up to this standard (adopt the layout, metadata, tooling, or CI it lacks).
Recommend the right PEP 517 build backend for a new or existing Python package, and give enough context to migrate. Chooses by three axes: purelib (pure Python) vs platlib (compiled C/C++/Rust/Torch), static vs dynamic/VCS metadata, and native language/build system. Covers uv-build, flit-core, hatchling (incl. compiled via scikit-build-core[hatchling] / a custom build hook), meson-python, scikit-build-core, maturin, and setuptools (legacy). Weighs compiled-project concerns: Cython, PyTorch extensions, pybind11/nanobind bindings, the stable Python ABI (abi3 / limited API), and fast parallel builds (CMake+Ninja, Meson). Use when asked "which build backend should I use", to pick a backend for a new project, or to decide whether to move an existing project off setuptools.
Audit a Python package — and any C/C++/Go/Rust code it ships — for its use of cryptography, across three use cases: inventory what crypto a package uses at all (algorithms, providers, linkage, RNG, CA stores), find insecure or weak cryptography, and assess FIPS 140-3 / NIST compliance. Flags insecure use of approved primitives (AES-ECB, RSA PKCS#1 v1.5, static IV/nonce, random for secrets, timing-unsafe compares, disabled TLS verification), weak RSA/EC key sizes, and — for FIPS — refused hashes (MD5, MD4, RIPEMD-160), restricted ones (SHA-1), non-approved primitives (BLAKE2/3, ChaCha20-Poly1305, 3DES, scrypt/Argon2/bcrypt, X25519/X448 key agreement, secp256k1), vendored or statically linked crypto (bundled OpenSSL/BoringSSL/AWS-LC/NSS/GnuTLS/libgcrypt/ nettle/libsodium) that escapes the system validated module, hardcoded TLS versions/ciphers that bypass crypto-policies, bundled CA trust stores, and problematic PyPI deps (bcrypt, pycryptodome, pynacl, ecdsa, rsa, m2crypto, …). Source-first, then confirmed against the built wheel/binaries. Gathers evidence; does not certify compliance.
Improve a Python package's metadata and move it into a PEP 621 [project] table in pyproject.toml — filling in what's missing along the way. Covers the readme field (dropping the open().read() hack), SPDX license expressions, trove classifiers, well-known project URLs, authors/keywords/requires-python, dependency version constraints (avoid upper caps), PEP 735 dependency groups vs extras, and the build-system table. Keeps the existing build backend (setuptools is fine). Includes a Poetry → PEP 621 migration lens (the [tool.poetry] field map and caret/tilde → floor translation; PDM too). Use when asked to clean up packaging metadata, move metadata out of setup.py/setup.cfg, migrate a Poetry (or PDM) project to [project]/PEP 621, or improve a project's PyPI page.
Make a Python package work correctly on the free-threaded (no-GIL) CPython build (PEP 703; the cp313t/cp314t "t" ABI) and declare that it does, so importing it does not silently re-enable the GIL. Covers the pure-Python thread-safety pass (mutable global/class state, caches, contextvars vs threading.local) and, for C/C++/Cython/pybind11/nanobind/Rust-PyO3 extensions, declaring support (Py_mod_gil / PyUnstable_Module_SetGIL / the per-binding flag), fixing data races with critical sections (Py_BEGIN_CRITICAL_SECTION), PyMutex, atomics and thread-local state, the borrowed-reference hazards and their strong-reference replacements (PyList_GetItemRef, PyDict_GetItemRef), building cp3Xt wheels (meson-python, scikit-build-core, maturin, setuptools, cibuildwheel), and testing under load with ThreadSanitizer and pytest-run-parallel. Use to add free-threading / no-GIL / nogil / free-threaded / PEP 703 support, ship a cp313t/cp314t wheel, or stop the GIL being re-enabled. For a single stable-ABI abi3t wheel (3.15+) pair it with port-to-python-limited-api.
Build a Python package (usually with a compiled C/C++/Cython/Fortran/Rust extension) with the meson-python PEP 517 backend, or port one off a bespoke setuptools setup.py. Covers the pyproject.toml backend, the meson.build (project / extension_module / install_sources), VCS/dynamic versioning computed in meson.build, editable installs, config-settings, and abi3 / limited-API wheels. Use when asked to adopt meson-python or Meson, scaffold a new meson-python project, drop setup.py, or produce standards-based wheels.
Port a hand-written C/C++ CPython extension from the version-specific C API to the Limited API (Py_LIMITED_API) so one stable-ABI abi3 wheel loads on every later Python instead of one per version — and optionally target Python 3.15 abi3t (PEP 803 + PEP 793 PyModExport) for a single wheel across GIL-enabled and free-threaded builds. Covers the usual first step of converting static PyTypeObject types to heap types (PyType_FromSpec / PyType_Slot), module state, multi-phase init, API substitutions, and the build flags / abi3 / abi3.abi3t wheel tags for meson-python, scikit-build-core, maturin, and setuptools. Use to adopt the limited API / stable ABI / abi3 / abi3t, stop rebuilding a C extension per Python version, or convert static types to heap types. Not for pybind11/nanobind (see pybind11-to-nanobind) or the PyTorch C++ ABI (see port-to-torch-stable-abi).
Migrate a Python package with a compiled (C/C++/CUDA) extension from a bespoke setuptools / setup.py build to scikit-build-core + CMake (PEP 517/518/621). Covers the pyproject.toml build backend, CMakeLists install rules, dynamic versioning, editable installs, wheels/CI, and optional abi3 via nanobind. Use when asked to modernize a package's build, adopt scikit-build-core or CMake, get rid of setup.py, or produce standards-based wheels for an extension module.
Port a Python package's compiled C++/CUDA/ROCm extension to the PyTorch stable ABI (torch::stable, STABLE_TORCH_LIBRARY, TORCH_TARGET_VERSION) so one wheel works across Torch versions, then assess Python abi3 (Py_LIMITED_API). Use when a project ships a Torch extension that is version-locked to a single Torch release, or when asked to adopt the stable ABI / torch::stable / stop rebuilding per Torch version.
Port a Python C++ extension's bindings from pybind11 to nanobind. Covers the mechanical API renames (NB_MODULE, def_rw/def_ro, python_error), the removed pybind11 features to design around (holders, py::array, multiple inheritance, module-local bindings), STL caster opt-in headers, custom __init__/type casters, the CMake nanobind_add_module build, and abi3/stable-ABI wheels. Use when asked to migrate to nanobind, cut binding compile time / binary size, or produce one abi3 wheel for a pybind11 extension.
Build, verify, and publish a Python package from GitHub Actions securely. Splits sdist and wheel builds so a broken sdist is caught (wheels build FROM the sdist), publishes to PyPI via a Trusted Publisher (OIDC, no API token) in a separate download-and-upload job, uses cibuildwheel for C/C++/Rust/platlib wheels, and hardens the pipeline (minimal permissions, SHA-pinned actions, Dependabot with cooldown + CodeQL grouping, no cache on release, zizmor audit, attestations). Use when asked to set up or review CI/CD, release to PyPI, or add wheels/trusted publishing.
Ship complete, verified type information for a Python package. Add annotations to untyped code (autotyping, infer-types, pyrefly infer, MonkeyType), drop the py.typed marker (PEP 561), and generate .pyi stubs for compiled C/C++/Rust extensions (nanobind stubgen, pybind11-stubgen, mypy stubgen, pyo3-stub-gen; __text_signature__ for hand-written C). Verify with mypy, pyright (--verifytypes), ty, and pyrefly plus stubtest, then package the stubs so the built wheel actually carries them. Pairs with pybind11-to-nanobind, port-to-python-limited-api, and port-to-free-threaded-python. Use when asked to add type annotations, ship py.typed, generate or fix .pyi stubs for a C extension, make a package typed, or fix "module is untyped" / Any results downstream.