skills/team/pypi-package-scaffold/SKILL.md
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. Triggers on phrases like "create python package", "scaffold pypi", "publish python package", "pyproject.toml setup", "python library scaffold", "python package setup", "pypi publish", "python package metadata".
npx skillsauth add michaelalber/ai-toolkit pypi-package-scaffoldInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
"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."
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:
pytest must pass (the publish job needs: test) before any upload.requires-python = ">=3.10" minimum; test matrix covers 3.10–3.13.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.
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.
<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>
references/output-templates.md.pyproject.toml (metadata, tool config, build-system) — references/pyproject-template.md.references/ci-publish-workflow.md.references/conventions.md.| Skill | Relationship |
|-------|-------------|
| supply-chain-audit | After scaffolding, audit the package's dependencies for CVEs and license compliance. |
| python-security-review | Review the package for security issues before publishing to PyPI. |
| python-architecture-checklist | Ensure the package's internal structure is maintainable. |
| nuget-package-scaffold | Cross-reference for teams publishing both Python and .NET packages — identical philosophy, different tooling. |
development
Federal / government security overlay applied ON TOP OF a base language security review (dotnet/python/php/rust/react). Language-agnostic: adds NIST SP 800-53 control mapping, FIPS 140-2/3 cryptographic compliance (with a per-language crypto table), CUI handling, EO 14028 supply-chain requirements, and DOE Order 205.1B, and emits POA&M-ready findings with FIPS 199 impact levels. Use for federal/DOE/DOD/national-laboratory systems. Triggers on "federal security review", "NIST compliance", "NIST 800-53", "FISMA", "CUI", "FIPS audit", "DOE security", "POA&M", "ATO review". Do NOT use alone — run the matching <lang>-security-review FIRST; this overlay maps and extends it.
tools
OWASP-based security review of React / TypeScript front-end applications. Detects the framework (Vite/CRA/Next), entry points, and data flows, scans against the OWASP Top 10 (2025) mapped to React client-side patterns (XSS via raw HTML, URL/protocol injection, secrets in the bundle, insecure token storage, dependency CVEs, missing CSP, open redirects), and produces a manager-friendly executive summary plus a graded technical findings table. Use to audit React code for vulnerabilities. Triggers on "react security review", "frontend security audit", "audit react for vulnerabilities", "owasp react", "react xss", "react security posture", "npm audit review". For federal / gov / DOE / NIST / FIPS / CUI context, run security-review-federal after this base review. Do NOT use to grade architecture/structure — use react-architecture-checklist.
tools
Analyzes legacy React codebases and produces actionable modernization plans. Primary migration paths include class components to function components + hooks, Create React App to Vite, React 16/17 to 18 to 19, JavaScript to TypeScript, Enzyme to React Testing Library, legacy Redux to Redux Toolkit / Zustand / Context, and deprecated lifecycle/API removal. Does NOT perform the migration — assesses, quantifies risk, and plans. Triggers on phrases like "modernize react", "class to hooks", "upgrade react", "migrate CRA to vite", "react legacy migration", "react 17 to 18", "react js to typescript", "react technical debt", "enzyme to RTL".
development
Scaffolds feature-based React / TypeScript architecture using feature folders, presentational + container components, custom hooks, a typed data layer, and structural CQRS (query hooks vs mutation hooks). React analog of dotnet-vertical-slice and python-feature-slice — no DI framework; uses props/context for dependency injection and a query cache for server state. Use when creating feature-based React projects, adding React features, organizing components by feature rather than by technical type, or scaffolding a feature's data layer. Triggers on phrases like "scaffold react feature", "create react slice", "react feature folder", "react vertical slice", "add react feature", "react feature architecture", "organize react by feature".