
Python Ultimate
Enforce python-ultimate file, directory, and path variable naming rules across a codebase before merge or release.
Overview
python-ultimate is an agent skill most often used in Ship (also Build/backend) that validates Python path variable names and forbidden style patterns via an included check_path_naming.py script.
Install
npx skills add https://github.com/jr2804/prompts --skill python-ultimateWhat is this skill?
- CLI validator: single-name check plus --check-files and --check-forbidden directory scans
- PathValidity enum classifies variables as is_file, is_dir, is_path_exceptional, or invalid
- Forbids TYPE_CHECKING guards, Optional[T], os.path, and noqa suppressions per reference docs
- Uses ast + tokenize over Python sources (Python ≥3.10, uv-run script)
- Encourages pathlib.Path and pipe unions (T | None) for modern typing style
- Four PathValidity outcomes: is_file, is_dir, is_path_exceptional, invalid
- Requires Python >=3.10 per script metadata
Adoption & trust: 1 installs on skills.sh; trending (+100% hot-view momentum).
What problem does it solve?
Your agent keeps introducing ambiguous path variables and forbidden typing/import shortcuts that slip past casual review.
Who is it for?
Indie Python maintainers who want deterministic naming enforcement on a src/ tree with uv and Python 3.10+.
Skip if: Projects that rely on blanket noqa fixes or are not Python; it will force refactors away from those escape hatches.
When should I use this skill?
When enforcing python-ultimate naming on new symbols or auditing a tree with --check-files / --check-forbidden.
What do I get? / Deliverables
You get a concrete violation list and naming classification (file vs dir) so refactors land before merge instead of after CI noise.
- Per-name PathValidity label
- Directory violation report from --check-files
- Forbidden-pattern report from --check-forbidden
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Naming and import hygiene gates quality right before code ships, even though the same checks help while building new modules. Review is the canonical shelf because the bundled validator scans trees for forbidden patterns (TYPE_CHECKING guards, os.path, Optional[], noqa) like a pre-merge lint pass.
Where it fits
Name new storage paths as output_file or cache_dir before wiring FastAPI handlers.
Scan src/ for forbidden Optional[] and noqa before tagging a release.
Keep a throwaway script’s path variables valid while proving an integration spike.
How it compares
Use instead of ad-hoc Ruff-only chats when you need opinionated path semantics and explicit forbidden-pattern gates beyond generic PEP 8.
Common Questions / FAQ
Who is python-ultimate for?
It is for solo Python builders and small teams who want agent-generated code to follow strict path naming and documented anti-patterns before shipping.
When should I use python-ultimate?
Run it during Ship/review before merging, while scaffolding Build/backend modules, or when validating a Validate/prototype spike so path variables and imports match house rules early.
Is python-ultimate safe to install?
The skill is a local AST/tokenize scanner without network calls; still review the Security Audits panel on this Prism page before running --check-forbidden on untrusted repositories.
SKILL.md
READMESKILL.md - Python Ultimate
# /// script # requires-python = ">=3.10" # dependencies = [] # /// """Validate file/directory variable naming conventions. This script checks if a given variable name follows the python-ultimate naming conventions for files, directories, and paths. Usage: uv run check_path_naming.py <name> uv run check_path_naming.py --check-files <python-file-or-directory> uv run check_path_naming.py --check-forbidden <python-file-or-directory> Examples: uv run check_path_naming.py output_file # Output: is_file uv run check_path_naming.py cache_dir # Output: is_dir uv run check_path_naming.py --check-files src/ # Output: List of violations in Python files uv run check_path_naming.py --check-forbidden src/ # Output: List of forbidden pattern matches in Python files """ from __future__ import annotations import argparse import ast import enum import io import re import sys import tokenize from pathlib import Path class PathValidity(enum.StrEnum): """Validation results for path variable naming.""" FILE = "is_file" DIR = "is_dir" PATH = "is_path_exceptional" INVALID = "invalid" FORBIDDEN_REASON: dict[str, str] = { "TYPE_CHECKING guard": "Avoid TYPE_CHECKING guards. Refactor imports/types as described in references/type-checking.md.", "Optional[T]": "Use pipe syntax (T | None) instead of Optional[T].", "os.path usage": "Use pathlib.Path instead of os.path.", "noqa suppression": "Fix the underlying lint issue instead of suppressing with # noqa.", "sys.path manipulation": "Avoid sys.path manipulation. Use proper package/module layout and imports.", "defensive required import": "Check whether this ImportError guard is wrapping a required dependency import.", } def check_path_naming(name: str | Path) -> PathValidity: """Check if a variable name follows file/directory naming conventions. Naming conventions: - Variables for files must end with "_file" suffix - Variables for directories must end with "_dir" suffix - "_path" suffix is only allowed in exceptional cases when the type cannot be clearly determined - Anti-patterns like "path", "dir_output", "file_output" are invalid - Bare generic names (path, file, folder, dir, directory, etc.) are invalid when they represent file system paths Args: name: Variable name to check (string or Path object) Returns: PathValidity enum indicating the naming validity Examples: >>> check_path_naming("output_file") <PathValidity.FILE: 'is_file'> >>> check_path_naming("cache_dir") <PathValidity.DIR: 'is_dir'> >>> check_path_naming("data_path") <PathValidity.PATH: 'is_path_exceptional'> >>> check_path_naming("path") <PathValidity.INVALID: 'invalid'> >>> check_path_naming("folder") <PathValidity.INVALID: 'invalid'> """ # Convert Path to string if needed var_name = str(name) # Strip any Path parent components, get just the name var_name = Path(var_name).name if "/" in var_name or "\\" in var_name else var_name # Anti-patterns - bare generic names for path-related variables # These are always invalid when representing file system paths generic_path_names = { "path", "file", "folder", "dir", "directory", "output", "input", "source", "target", "dest", "destination", } if var_name in generic_path_names: return PathValidity.INVALID # "dir" or "file" as prefix instead of suffix if var_name.startswith("dir_") or var_name.startswith("file_"): return PathValidity.INVALID # Check for valid suffixes (in order of specificity) if var_name.endswith("_file"): return PathValidity.FILE if var_name.endswith("_dir"): return PathValidity.DIR if var_name.endswith("_path"): return PathValidity.PATH