python

Guides production-grade Python development covering typing, concurrency, packaging, security, and testing.

5|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/nuggocto/dotfiles --skill python-nuggocto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python
Source: https://github.com/nuggocto/dotfiles/tree/main/opencode/skills/python
Command: npx skills add https://github.com/nuggocto/dotfiles --skill python-nuggocto

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing Python that survives production requires consistent decisions about typing, exception handling, resource lifecycles, async task ownership, packaging, and security boundaries. This Skill encodes those decisions as explicit guidance so AI-assisted Python work stays correct, maintainable, and compatible with the repository's supported interpreter range. ## Core Features & Use Cases - Lifecycle and concurrency discipline: Enforces deterministic resource cleanup with context managers, structured concurrency with asyncio.TaskGroup, and explicit ownership for tasks, threads, and processes. - Packaging and toolchain guidance: Covers pyproject.toml metadata, dependency groups, lockfile policy, and the uv/Ruff/ty toolchain, with dedicated references for Astral tooling and runtime upgrades. - Security and testing boundaries: Defines rules for untrusted input, subprocess usage, pickling, secrets handling, deterministic tests, and warning-as-failure CI policy. - Use Case: When asked to add an async feature to a Python service, the Skill ensures the change resolves the supported Python range first, owns every created task, preserves public API contracts, and ends with the exact lint, type-check, and test commands to run. ## Quick Start Use the python skill to review and extend this Python service while preserving its supported interpreter range and existing tooling.

Frequently Asked Questions about python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure async Python code with proper task ownership?

Use asyncio.TaskGroup for related work so the scope owns completion and failure, and ensure every created task has an owner that retains it, observes exceptions, and handles cancellation. Avoid untracked fire-and-forget tasks and never swallow CancelledError.

What Python toolchain should I use for a new project?

Prefer uv for environments, dependencies, locking, and execution, Ruff for formatting and linting, and ty for type checking. Commit uv.lock for applications, and keep rule selection explicit with target-version matching the minimum supported Python.

Should I use threads, processes, or asyncio for concurrency in Python?

Use asyncio for I/O-bound structured concurrency, threads for blocking I/O or GIL-releasing native code, and processes for isolation or CPU parallelism. Never treat the GIL as synchronization, and guard multiprocessing entrypoints with if __name__ == "__main__".

Does free-threaded CPython change how I should write Python?

Yes. Free-threaded builds change context inheritance and warning-filter defaults, typically use more memory, and extensions may re-enable the GIL. Verify sys._is_gil_enabled() after loading production dependencies and test the full native dependency set before claiming support.

Why should I avoid unpickling data from external sources?

Pickle deserialization can execute arbitrary code, so untrusted or tamperable data must never be unpickled, including through shelve, multiprocessing, caches, or socket logging. Use safe serialization formats and validate external input at trust boundaries.

When should I migrate an existing project to uv and Ruff?

Only when a migration is explicitly requested. During scoped maintenance, preserve the existing package manager, formatter, linter, and type checker; a code fix does not authorize replacing the established toolchain.