{"id":"90a76fa0-7ae1-47a2-8072-41548de4df1d","shortId":"twSYXt","kind":"skill","title":"python","tagline":"Use when a task involves Python project setup or standalone scripts with uv, including dependency management, `uv run`, `uv run --with`, `--no-project`, inline script metadata, quality gates (ruff, ty, pytest, coverage, prek/pre-commit), and package build or publishing workflows.","description":"# Python\n\n## Core Posture\n\nUse uv as the default workflow for Python projects, standalone scripts, dependency management, quality checks, and package release. Prefer the repository's existing configuration and documented commands over introducing new tooling.\n\n## Mode Selection\n\n- Choose project mode when the work has a `pyproject.toml`, shared package code, or lockfile.\n- Treat a brand-new repository created with `uv init` as project mode.\n- Choose standalone-script mode when the work is a single file, stdin snippet, or ad hoc invocation that should not become a full project.\n- Treat a script inside a project as project mode when it imports local package code.\n- Use `--no-project` only when a script must ignore the surrounding project.\n\n## Project Workflow\n\n1. Inspect `pyproject.toml`, lockfiles, repository docs, and existing test/tooling choices before changing dependencies or commands.\n2. For a brand-new project, run `uv init <name>`, then install the default dev toolchain with `uv add --dev ruff ty pytest pytest-cov`.\n3. Use pytest as the default test framework for new projects: function-based `tests/test_*.py` files with plain `assert`.\n4. Add dependencies with `uv add`; remove them with `uv remove`; reconcile external dependency changes with `uv sync`.\n5. Run project Python, tests, and tools through `uv run` unless the repository provides a documented wrapper command.\n6. Run the repository quality gate before finalizing dependency or code changes.\n\n## Standalone Script Workflow\n\n1. Decide whether the script should use project dependencies, one-off `--with` dependencies, or inline metadata.\n2. Use plain `uv run script.py` when no extra dependencies are needed.\n3. Use `uv run --with ... script.py` for disposable per-invocation dependencies.\n4. Use `uv init --script` and `uv add --script` when dependencies should live with the script.\n5. Put `--no-project` before the script name, and never use it for a script that imports local package code.\n6. Use `uv run --python <version>` or `requires-python` in metadata when the script needs a specific Python version.\n7. Read `references/scripts.md` for stdin, heredoc, shebang, alternate indexes, Windows `.pyw`, locking, and reproducibility details.\n\n## Non-Negotiable Rules\n\n- Manage dependencies with `uv add`, `uv remove`, and `uv sync`; do not use `pip install` to mutate a project environment.\n- Run Python, pytest, scripts, and Python tools with `uv run` unless a repository command wraps them.\n- Follow existing repository choices; do not migrate test frameworks, hook runners, or tool configuration unless asked.\n- For a brand-new project, immediately add `ruff`, `ty`, `pytest`, and `pytest-cov`; do not start with `unittest`, `unittest.TestCase`, or class-based `Test*` suites.\n- Do not create a `pyproject.toml` only to run a one-file script.\n- Treat `uv run --with` as disposable; use inline metadata when the script should be shared or reused.\n- Build release artifacts with `uv build --no-sources` so local `[tool.uv.sources]` overrides do not leak into release output.\n- Test installs from the built wheel or published artifact, not only from the source checkout.\n\n## Quality Gate Priority\n\nUse this order before finalizing code, dependency, or packaging changes:\n\n1. The repository's documented aggregate gate.\n2. `prek run -a` when the repo uses prek.\n3. The documented `pre-commit` command when the repo uses pre-commit and provides no prek path.\n4. Individual `uv run ...` commands only when no aggregate gate exists or when narrowing failures.\n\nDo not introduce or switch hook runners only for verification. Read `references/quality.md` for command details, coverage, CI examples, and fallback checks.\n\n## Release Workflow\n\n1. Run the repository quality gate.\n2. Build artifacts in `dist/` with `uv build --no-sources`.\n3. Inspect wheel and sdist contents.\n4. Test install from the built wheel or published artifact in a fresh uv-managed invocation.\n5. Read `references/packaging.md` for publish commands, Test PyPI flow, and artifact inspection details.\n\n## Common Mistakes\n\n- Treating a one-file script as project work when inline metadata or `--no-project` would be smaller and clearer.\n- Using `--no-project` for a script that imports local package code.\n- Keeping reusable script dependencies only in `uv run --with ...` shell history instead of the script metadata.\n- Starting a brand-new project with `unittest` or without the default dev toolchain.\n- Running tools outside uv.\n- Publishing before verifying artifacts.\n\n## References\n\n- `references/quality.md` - Full commands, CI examples, coverage, prek, and pre-commit fallback usage.\n- `references/packaging.md` - Build, inspect, and publish details.\n- `references/scripts.md` - Standalone script patterns, inline metadata, locking, and special cases.","tags":["python","skills","narumiruna","agent-skills"],"capabilities":["skill","source-narumiruna","skill-python","topic-agent-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/narumiruna/skills/python","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add narumiruna/skills","source_repo":"https://github.com/narumiruna/skills","install_from":"skills.sh"}},"qualityScore":"0.453","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (4,812 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:13:47.472Z","embedding":null,"createdAt":"2026-05-18T19:13:47.472Z","updatedAt":"2026-05-18T19:13:47.472Z","lastSeenAt":"2026-05-18T19:13:47.472Z","tsv":"'1':160,272,544,617 '2':175,289,551,623 '3':201,301,560,634 '4':221,313,579,640 '5':239,329,657 '6':257,350 '7':369 'ad':120 'add':193,222,226,320,392,447 'aggreg':549,587 'altern':376 'artifact':499,524,625,649,667,742 'ask':439 'assert':220 'base':214,464 'becom':126 'brand':95,179,443,724 'brand-new':94,178,442,723 'build':38,497,502,624,630,758 'built':520,645 'case':772 'chang':171,235,268,543 'check':59,614 'checkout':530 'choic':169,427 'choos':78,105 'ci':610,747 'class':463 'class-bas':462 'clearer':692 'code':89,144,267,349,539,704 'command':71,174,256,421,566,583,607,662,746 'commit':565,573,754 'common':670 'configur':68,437 'content':639 'core':43 'cov':200,454 'coverag':34,609,749 'creat':98,469 'decid':273 'default':49,188,206,732 'depend':16,56,172,223,234,265,280,285,298,312,323,389,540,708 'detail':383,608,669,762 'dev':189,194,733 'dispos':308,485 'dist':627 'doc':165 'document':70,254,548,562 'environ':407 'exampl':611,748 'exist':67,167,425,589 'extern':233 'extra':297 'failur':593 'fallback':613,755 'file':116,217,478,676 'final':264,538 'flow':665 'follow':424 'framework':208,432 'fresh':652 'full':128,745 'function':213 'function-bas':212 'gate':30,262,532,550,588,622 'heredoc':374 'histori':715 'hoc':121 'hook':433,599 'ignor':154 'immedi':446 'import':141,346,701 'includ':15 'index':377 'individu':580 'init':101,184,316 'inlin':26,287,487,682,767 'insid':133 'inspect':161,635,668,759 'instal':186,402,517,642 'instead':716 'introduc':73,596 'invoc':122,311,656 'involv':6 'keep':705 'leak':512 'live':325 'local':142,347,507,702 'lock':380,769 'lockfil':91,163 'manag':17,57,388,655 'metadata':28,288,360,488,683,720,768 'migrat':430 'mistak':671 'mode':76,80,104,109,138 'must':153 'mutat':404 'name':337 'narrow':592 'need':300,364 'negoti':386 'never':339 'new':74,96,180,210,444,725 'no-project':23,146,331,685,694 'no-sourc':503,631 'non':385 'non-negoti':384 'one':282,477,675 'one-fil':476,674 'one-off':281 'order':536 'output':515 'outsid':737 'overrid':509 'packag':37,61,88,143,348,542,703 'path':578 'pattern':766 'per':310 'per-invoc':309 'pip':401 'plain':219,291 'postur':44 'pre':564,572,753 'pre-commit':563,571,752 'prefer':63 'prek':552,559,577,750 'prek/pre-commit':35 'prioriti':533 'project':8,25,53,79,103,129,135,137,148,157,158,181,211,241,279,333,406,445,679,687,696,726 'provid':252,575 'publish':40,523,648,661,739,761 'put':330 'py':216 'pypi':664 'pyproject.toml':86,162,471 'pytest':33,197,199,203,410,450,453 'pytest-cov':198,452 'python':1,7,42,52,242,354,358,367,409,413 'pyw':379 'qualiti':29,58,261,531,621 'read':370,604,658 'reconcil':232 'refer':743 'references/packaging.md':659,757 'references/quality.md':605,744 'references/scripts.md':371,763 'releas':62,498,514,615 'remov':227,231,394 'repo':557,569 'repositori':65,97,164,251,260,420,426,546,620 'reproduc':382 'requir':357 'requires-python':356 'reus':496 'reusabl':706 'ruff':31,195,448 'rule':387 'run':19,21,182,240,248,258,293,304,353,408,417,474,482,553,582,618,712,735 'runner':434,600 'script':12,27,55,108,132,152,270,276,317,321,328,336,344,363,411,479,491,677,699,707,719,765 'script.py':294,306 'sdist':638 'select':77 'setup':9 'share':87,494 'shebang':375 'shell':714 'singl':115 'skill' 'skill-python' 'smaller':690 'snippet':118 'sourc':505,529,633 'source-narumiruna' 'special':771 'specif':366 'standalon':11,54,107,269,764 'standalone-script':106 'start':457,721 'stdin':117,373 'suit':466 'surround':156 'switch':598 'sync':238,397 'task':5 'test':207,243,431,465,516,641,663 'test/tooling':168 'tests/test_':215 'tool':75,245,414,436,736 'tool.uv.sources':508 'toolchain':190,734 'topic-agent-skills' 'treat':92,130,480,672 'ty':32,196,449 'unittest':459,728 'unittest.testcase':460 'unless':249,418,438 'usag':756 'use':2,45,145,202,278,290,302,314,340,351,400,486,534,558,570,693 'uv':14,18,20,46,100,183,192,225,230,237,247,292,303,315,319,352,391,393,396,416,481,501,581,629,654,711,738 'uv-manag':653 'verif':603 'verifi':741 'version':368 'wheel':521,636,646 'whether':274 'window':378 'without':730 'work':83,112,680 'workflow':41,50,159,271,616 'would':688 'wrap':422 'wrapper':255","prices":[{"id":"5359033e-00e3-44aa-aa6a-6373504e35bf","listingId":"90a76fa0-7ae1-47a2-8072-41548de4df1d","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"narumiruna","category":"skills","install_from":"skills.sh"},"createdAt":"2026-05-18T19:13:47.472Z"}],"sources":[{"listingId":"90a76fa0-7ae1-47a2-8072-41548de4df1d","source":"github","sourceId":"narumiruna/skills/python","sourceUrl":"https://github.com/narumiruna/skills/tree/main/skills/python","isPrimary":false,"firstSeenAt":"2026-05-18T19:13:47.472Z","lastSeenAt":"2026-05-18T19:13:47.472Z"}],"details":{"listingId":"90a76fa0-7ae1-47a2-8072-41548de4df1d","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"narumiruna","slug":"python","github":{"repo":"narumiruna/skills","stars":7,"topics":["agent-skills"],"license":"mit","html_url":"https://github.com/narumiruna/skills","pushed_at":"2026-05-17T11:15:28Z","description":null,"skill_md_sha":"c4130ac141813aa7a1cc079ae51a8b14b0cc1cdd","skill_md_path":"skills/python/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/narumiruna/skills/tree/main/skills/python"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"python","description":"Use when a task involves Python project setup or standalone scripts with uv, including dependency management, `uv run`, `uv run --with`, `--no-project`, inline script metadata, quality gates (ruff, ty, pytest, coverage, prek/pre-commit), and package build or publishing workflows."},"skills_sh_url":"https://skills.sh/narumiruna/skills/python"},"updatedAt":"2026-05-18T19:13:47.472Z"}}