agentleFS
michaelalbermichaelalber/ai-toolkit/skills/pypi-package-scaffold/SKILL.md

pypi-package-scaffold

Skill3 starsChanged 4 months agoMITView on GitHub

Scaffolds production-ready PyPI packages with pyproject.toml, hatch/flit/build tooling, GitHub Actions publish workflow, test harness, and documentation. Python analog of nuget-package-scaffold. Use when creating Python packages, setting up PyPI publishing, configuring package metadata, or building Python libraries.

  • Installs packages

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    NO PUBLISH WITHOUT TESTS — pytest must pass (the publish job needs: test) before any upload.

    line 25

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PyPI Package Scaffold

"A library is only as good as its documentation and its tests. Semantic versioning is a contract with your users — break it and you break trust."

Core Philosophy

A Python package is a contract with its users in three parts: the API surface (what's public), the version (what changes are breaking), and the metadata (who maintains it, license, supported Python versions). Packaging is not an afterthought — a package that cannot be installed reliably, has no tests, ships without type stubs, or lacks documentation is not ready for PyPI. The scaffold establishes all of these before the first publish, using the src/ layout and Trusted Publishing.

Non-Negotiable Constraints:

  1. NO PUBLISH WITHOUT TESTS — pytest must pass (the publish job needs: test) before any upload.
  2. SEMVER IS LAW — breaking changes require a major version bump; no exceptions.
  3. METADATA REQUIRED — name, version, description, license, authors, readme, requires-python, classifiers.
  4. MULTI-VERSION SUPPORT — requires-python = ">=3.10" minimum; test matrix covers 3.10–3.14.
  5. DETERMINISTIC BUILDS — pinned build dependencies; PYTHONHASHSEED=0 in CI; ship both sdist and wheel.

Full principle table, KB lookups, command sequences, anti-patterns, discipline rules, and error recovery live in references/conventions.md.

Workflow

SCAFFOLD   Create the src-layout structure:
             src/<package>/{__init__.py (+__all__), py.typed, _internal/}
             tests/  docs/  pyproject.toml  README.md  LICENSE  CHANGELOG.md
             .github/workflows/{ci.yml, publish.yml}
           (Full pyproject.toml in references/pyproject-template.md.)

CONFIGURE  Set all required metadata + classifiers + [project.urls] (checklist in conventions.md).

TEST       pip install -e ".[dev]"; pytest --cov; mypy --strict; ruff check + format --check.

BUILD      python -m build; twine check dist/*; inspect wheel contents.

PUBLISH    TestPyPI first (upload + install-verify), then PyPI. Use Trusted Publishing (OIDC), no tokens.
           (Automated workflow in references/ci-publish-workflow.md.)

Exit criteria: required metadata complete; pytest, mypy --strict, ruff, and twine check dist/* all pass; sdist + wheel built; TestPyPI install verified; publish workflow gated on the test matrix via needs: test.

State Block

<pypi-package-state>
phase: SCAFFOLD | CONFIGURE | TEST | BUILD | PUBLISH | COMPLETE
package_name: [name]
version: [semver]
python_requires: [version]
build_tool: hatchling | flit | setuptools | build
type_stubs: true | false
ci_configured: true | false
testpypi_published: true | false
pypi_published: true | false
last_action: [description]
next_action: [description]
</pypi-package-state>

Output Template

  • Package scaffold checklist — references/output-templates.md.
  • Complete pyproject.toml (metadata, tool config, build-system) — references/pyproject-template.md.
  • GitHub Actions test matrix + Trusted-Publishing workflow — references/ci-publish-workflow.md.
  • Principle table, KB lookups, command sequences, anti-patterns, discipline rules, error recovery — references/conventions.md.

Integration with Other Skills

SkillRelationship
supply-chain-auditAfter scaffolding, audit the package's dependencies for CVEs and license compliance.
python-security-reviewReview the package for security issues before publishing to PyPI.
python-architecture-checklistEnsure the package's internal structure is maintainable.
nuget-package-scaffoldCross-reference for teams publishing both Python and .NET packages — identical philosophy, different tooling.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.