plugins/python-engineering/skills/shebangpython/SKILL.md
Validates and corrects Python shebangs and PEP 723 inline script metadata by applying four shebang-selection rules. Use when auditing or fixing shebangs in Python files — choosing between plain python3 and the uv shebang for standalone scripts with external dependencies, enforcing correct uv flag ordering (--quiet before run subcommand), adding or removing PEP 723 metadata blocks to match actual import requirements, checking execute bit presence, or avoiding redundant transitive dependencies when typer is declared (typer bundles rich and shellingham automatically).
npx skillsauth add jamie-bitflight/claude_skills shebangpythonInstall 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.
<file_paths>$ARGUMENTS</file_paths>
The model validates Python shebangs against dependency requirements and ensures correct PEP 723 inline script metadata.
<file_paths/>
If file paths provided above:
If no arguments provided:
Pattern: #!/usr/bin/env python3
Conditions:
Reasoning: No dependency installation required, standard Python interpreter sufficient.
Pattern: #!/usr/bin/env python3
Conditions:
Reasoning: Dependencies installed via package manager, not script metadata.
Pattern: #!/usr/bin/env -S uv --quiet run --active --script
Conditions:
Reasoning: PEP 723 inline metadata declares dependencies, uv installs them automatically.
Pattern: No shebang line
Conditions:
Reasoning: Not intended for direct execution.
The shebang: #!/usr/bin/env -S uv --quiet run --active --script
| Component | Position | Purpose |
| ------------------- | ------------------------------- | ------------------------------------------------------------- |
| #!/usr/bin/env -S | Prefix | Shebang invoking env with -S flag for multiple arguments |
| uv | Command | The uv binary on PATH |
| --quiet | GLOBAL flag (before subcommand) | Suppresses progress output from uv |
| run | Subcommand | Executes Python scripts with automatic environment management |
| --active | run flag (after subcommand) | Prefer active virtual environment over isolated environment |
| --script | run flag (after subcommand) | Indicates file contains PEP 723 inline script metadata |
uv [GLOBAL_FLAGS] SUBCOMMAND [SUBCOMMAND_FLAGS] [ARGS]
Global flags modify the uv binary behavior and MUST appear before the subcommand. Subcommand flags modify that specific subcommand's behavior and MUST appear after the subcommand.
Valid: uv --quiet run --active --script
Invalid: uv run --quiet --active --script (--quiet is global flag)
The model MUST reject these malformed shebangs:
#!/usr/bin/env -S uv run --quiet --active --script (--quiet in wrong position)#!/usr/bin/env -S uv --quiet run --script (missing --active)#!/usr/bin/env -S uv run --active --script (missing --quiet)#!/usr/bin/env -S uv --quiet --active run --script (--active in wrong position)All files with shebangs MUST have execute permission set.
chmod +x filename
Without execute bit, the shebang is ignored by the kernel.
For each file, output in this exact order:
Before (invalid - no external dependencies):
#!/usr/bin/env -S uv --quiet run --active --script
# /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
from __future__ import annotations
import re
from pathlib import Path
After (corrected):
#!/usr/bin/env python3
from __future__ import annotations
import re
from pathlib import Path
typer>=0.12.0 ships with rich and shellingham as bundled transitive dependencies. When typer appears in a PEP 723 dependencies block, the model MUST NOT add rich or shellingham as separate entries.
# WRONG — rich is transitively installed by typer
# dependencies = [
# "typer>=0.21.2",
# "rich>=13.0.0", # redundant, DO NOT ADD
# ]
# CORRECT — typer only; rich and shellingham arrive automatically
# dependencies = [
# "typer>=0.21.2",
# ]
This rule applies regardless of how much rich API surface the script uses (Console, Panel, Progress, Table, etc.). The import works because typer guarantees rich's presence.
SOURCE: "By default, typer comes with rich and shellingham." — https://typer.tiangolo.com/#installation (accessed 2026-02-22)
Before (invalid - missing PEP 723):
#!/usr/bin/env python
from __future__ import annotations
from pathlib import Path
from typing import Annotated
import typer
from rich.console import Console
from rich.panel import Panel
After (corrected):
#!/usr/bin/env -S uv --quiet run --active --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "typer>=0.21.2",
# ]
# ///
from __future__ import annotations
from pathlib import Path
from typing import Annotated
import typer
from rich.console import Console
from rich.panel import Panel
development
When an application needs to store config, data, cache, or state files. When designing where user-specific files should live. When code writes to ~/.appname or hardcoded home paths. When implementing cross-platform file storage with platformdirs.
testing
Enforce mandatory pre-action verification checkpoints to prevent pattern-matching from overriding explicit reasoning. Use this skill when about to execute implementation actions (Bash, Write, Edit) to verify hypothesis-action alignment. Blocks execution when hypothesis unverified or action targets different system than hypothesis identified. Critical for preventing cognitive dissonance where correct diagnosis leads to wrong implementation.
tools
Reference guide for the Twelve-Factor App methodology — 15 principles (12 original + 3 modern extensions) for building portable, resilient, cloud-native applications. Use when evaluating application architecture, designing cloud-native services, reviewing codebases for methodology compliance, advising on configuration, scaling, observability, security, and deployment patterns. Incorporates the 2025 open-source community evolution and cloud-native reinterpretations of each factor.
tools
Converts user-facing documentation (how-to guides, tutorials, API references, examples) in any format — Markdown, PDF, DOCX, PPTX, XLSX, AsciiDoc, RST, HTML, Jupyter notebooks, man pages, TOML/YAML/JSON configs, and plain text — into Claude Code skill directories with SKILL.md plus thematically grouped references/*.md files. Use when given a docs directory or mixed-format documentation to transform into an AI skill. Uses MCP file-reader server for binary formats.