{"slug": "python-skill-pack", "title": "Python Skill Pack", "summary": "A new Python Skill Pack for agentic AI introduces two skills: python-convention-check, a Validator that reviews Python code against project conventions including type hints, docstrings, import ordering, dependency pinning, and mutable default arguments, and python-test-scaffold, a Workflow that generates pytest test file skeletons with TODO stubs. The pack is designed for use in reviewing pull requests and scaffolding tests, and it emphasizes testing against real Python files.", "body_md": "· Agentic AI · 4 min read\n\n### 📋 Prerequisites\n\n- Agent Skills Mastery (companion course)\n\n### 🎯 What You'll Learn\n\n- Build a Validator skill that checks Python code against real project conventions\n- Build a Workflow skill that scaffolds a properly-structured test file\n- Test both skills against real Python files, not toy examples\n\n## What This Pack Covers\n\nTwo skills: one that reviews Python code against real project conventions (a Validator), and one that scaffolds test files correctly (a Workflow). Together they cover the two moments a Python-focused skill earns its keep most: reviewing code someone just wrote, and setting up the boilerplate for code that’s about to be written.\n\n## Skill 1: `python-convention-check`\n\n```\n---\nname: python-convention-check\ndescription: Reviews Python code against project conventions — type hints, docstrings, import ordering, and dependency pinning. Use when reviewing a Python pull request, checking a new module before merge, or when the user asks whether their Python code follows project style.\nmetadata:\n  version: \"1.0.0\"\n---\n\n## Review checklist\n\nCheck the file against these rules, in order, and report every failing rule\n— not just the first one found:\n\n1. **Type hints.** Every function signature has parameter and return type\n   hints, except `__init__` return types (always `None`, may be omitted).\n2. **Docstrings.** Every public function and class has a docstring. Private\n   functions (prefixed `_`) are exempt unless they exceed 15 lines.\n3. **Import ordering.** Standard library imports, then third-party, then\n   local — each group separated by a blank line, alphabetized within\n   each group.\n4. **Dependency pinning.** Any new entry in `pyproject.toml` or\n   `requirements.txt` specifies a version constraint — never a bare\n   package name with no version at all.\n5. **No mutable default arguments.** Flag any `def f(x=[])` or\n   `def f(x={})` — these are a well-known Python foot-gun.\n\nFor each failure, report: the file and line, which rule failed, and a\ncorrected example. If everything passes, confirm explicitly.\n```\n\n**Pattern:** Validator, per [Skill Design Patterns](/courses/production-agent-skills-engineering/skill-design-patterns) — checks against fixed rules and reports specifics, never producing new code itself.\n\n## Skill 2: `python-test-scaffold`\n\n```\n---\nname: python-test-scaffold\ndescription: Generates a pytest test file skeleton for a given Python module, following this project's test conventions. Use when the user asks to write tests, add test coverage, or scaffold a test file for a module that doesn't have one yet.\nmetadata:\n  version: \"1.0.0\"\n---\n\n## Generate a test scaffold\n\n1. Read the target module and identify every public function and class\n   method (skip anything prefixed `_`).\n2. Create `tests/test_<module_name>.py` if it doesn't already exist.\n3. For each public function, add one test stub named\n   `test_<function_name>_<expected_behavior>` — e.g.\n   `test_parse_config_raises_on_missing_file`.\n4. Include a `# TODO: implement` comment in each stub body rather than\n   leaving it empty — an empty `pass` body is easy to forget about.\n5. Add necessary imports (`pytest`, the module under test) at the top,\n   following the import-ordering rule from python-convention-check.\n\nDo not write actual test assertions — this skill's job is the scaffold,\nnot the test logic itself, which needs a human's judgment about what\n\"correct\" behavior actually is for each function.\n```\n\n**Pattern:** Workflow — a fixed sequence producing a consistent structure every time, deliberately stopping short of writing assertions a human needs to author with real judgment.\n\n## Testing Both Skills\n\nBefore trusting either in your own workflow, run the checks from the free course’s [Testing Skills](/courses/agent-skills-mastery/testing-skills) lesson:\n\n— try it against a file with zero violations (should confirm cleanly), a file with exactly one violation (should catch it precisely), and a file with several different violation types at once (should report all of them, not stop at the first).`python-convention-check`\n\n— try it against a module with a mix of public and private functions (should skip the private ones), and against a module that already has a partial test file (decide, and state in the skill, whether it should add missing stubs or leave the existing file alone — as written above, it doesn’t say, which is worth fixing before you rely on it).`python-test-scaffold`\n\nThat last point is deliberate: it’s a small, realistic gap for you to notice and patch, the same kind of gap the [quality checklist](/courses/production-agent-skills-engineering/skill-quality-anti-patterns) is built to catch.\n\n## Customizing for Your Own Project\n\nThe convention checklist above is a reasonable default, not a universal one — your project may use different docstring conventions (Google-style vs. NumPy-style), a different import sorter, or additional rules entirely (a required `CHANGELOG.md`\n\nentry, a specific commit-message format). Treat the five rules here as a starting shape, and add or replace rules to match what your team actually enforces in code review today — a convention-check skill only earns trust once it matches real review comments your team already makes by hand.\n\n## Summary\n\n`python-convention-check`\n\nis a Validator skill catching real, common Python review issues — missing type hints, missing docstrings, import order, unpinned dependencies, mutable default arguments`python-test-scaffold`\n\nis a Workflow skill producing consistent test file structure, deliberately stopping before writing actual assertions- Both need testing against real files with varied violation counts before you’d trust them — not just a single clean-pass check\n- Adjust the rule set to match your own team’s actual review conventions before relying on either skill\n\nNext, the same treatment for SQL — a validator focused on migration safety, and a skill for writing queries that are actually reviewable.", "url": "https://wpnews.pro/news/python-skill-pack", "canonical_source": "https://superml.org/tutorials/python-skill-pack", "published_at": "2026-07-26 00:00:00+00:00", "updated_at": "2026-08-01 05:00:05.322073+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools"], "entities": ["Python", "pytest"], "alternates": {"html": "https://wpnews.pro/news/python-skill-pack", "markdown": "https://wpnews.pro/news/python-skill-pack.md", "text": "https://wpnews.pro/news/python-skill-pack.txt", "jsonld": "https://wpnews.pro/news/python-skill-pack.jsonld"}}