Skip to main content
skill CX Codex

python-guidelines — Claude Code skill: what it does, how to install

python-guidelines — a skill that enforces rules for writing and reviewing Python code: fitting new code into existing patterns, blocking premature abstractions, and standardizing docstrings.

Apache-2.0 ★ 1,216 updated 2026-10-24

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add fcakyon/claude-codex-settings
/plugin install python-skills@claude-settings
Open on GitHub

What python-guidelines does

This skill activates whenever an agent writes, reviews, or refactors Python code. It requires new code to match existing naming, import, and signature patterns instead of being appended on top: two-line wrapper functions get inlined, single-use variables move to their call site, and try/except blocks appear only when truly critical.

A separate section enforces YAGNI: abstract base classes for one implementation, unused configuration options, and wrapper classes around a single function are all ruled out, with refactoring deferred until a third real use case shows up. For the environment, the skill calls for uv rather than pip, and it insists on checking assumptions about code behavior by running python -c "..." before proposing a plan.

Docstrings follow Google style: imperative-mood summaries, type unions like int | str, and a Returns section always wrapped in parentheses. The skill ships four reference files covering idiomatic patterns, the Zen of Python, the Google style guide, and tips from *Effective Python*, and the agent is meant to read the matching file before touching the code, not after.

What it helps with

  • fit new code into an existing project's conventions instead of bolting it on
  • strip premature abstractions and unnecessary wrappers out of Python code
  • bring docstrings in line with a single Google-style format
  • verify a hypothesis about a function or package by running python -c
  • trace and read a third-party library's source before editing against it

Example prompts for the agent

  • Refactor this module following python-guidelines
  • Check this Python file for unnecessary abstractions per python-guidelines
  • Rewrite these docstrings in Google style using python-guidelines

How to install python-guidelines

1Plugin marketplace

/plugin marketplace add fcakyon/claude-codex-settings
/plugin install python-skills@claude-settings

This installs the whole python-skills plugin with all its skills

2Skills CLI (Vercel)

npx skills add fcakyon/claude-codex-settings --skill python-guidelines -a claude-code

3Manually: put the files in place

~/.claude/skills/python-guidelines/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/python-guidelines/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about python-guidelines

How do I install python-guidelines in Claude Code?

Run /plugin marketplace add fcakyon/claude-codex-settings, then /plugin install python-skills@claude-settings.

What does the python-guidelines skill do?

It sets rules for writing, reviewing, and refactoring Python code: integrating into existing patterns, avoiding unneeded abstractions, and keeping docstrings in one format. It also requires verifying code behavior with python -c "..." before an agent proposes a plan.

Which package manager does python-guidelines require?

The skill calls for uv instead of pip, with the environment activated via source .venv/bin/activate or uv run python -c "...".

Source text

SKILL.md · Apache-2.0
---
name: python-guidelines
description: This skill should be used when writing, reviewing, or refactoring Python code. Covers code integration, idiomatic patterns, docstring formatting, anti-abstraction rules, and software engineering basics.
---

# Python Guidelines

**Integrate into existing code. Don't append to it.**

> Simple is better than complex. Flat is better than nested.
> Errors should never pass silently. Unless explicitly silenced.
> If the implementation is hard to explain, it's a bad idea.
>
> -- The Zen of Python (PEP 20)

## Code Philosophy

- Match existing naming, importing, and signature patterns. Use existing utilities and data structures.
- Functions have a single purpose. Don't hardcode behavior that makes them less general.
- No trivial wrappers for 2 lines or less. Inline it.
- Inline single-use variables at the usage site.
- No try/except unless critical. Let errors surface.
- No duplicate code.
- Functions handle their own input validation. No if-else checks in main.
- Use pathlib, not os.path.
- Consider API and time costs for MongoDB/Gemini/OpenAI/Claude/Voyage.

Don't do this:

```python
# Generate comment report only if requested
if include_comments:
    comment_report = generate_comments_report(start_date, end_date, team, verbose)
else:
    comment_report = ""
    print("   Skipping comment analysis (disabled)")
```

Do this:

```python
comment_report = generate_comments_report(start_date, end_date, team, verbose) if include_comments else ""
```

Ask yourself: "Am I adding code, or integrating into what exists?"

## Simplicity Over Abstraction

**YAGNI: You Aren't Gonna Need It.**

Don't build for hypothetical future requirements. Add complexity only when the current task demands it.

Avoid:

- Abstract base classes for a single implementation
- Configuration options nobody asked for
- Error handling for impossible scenarios
- Wrapper classes around a single function
- Dependency injection when direct calls work
- Generic type parameters for one concrete type

Three similar lines of code is better than a premature abstraction. Refactor when the third real use case appears, not before.

But simplicity does not mean chaos. Always maintain:

- Clear function names that describe what they do
- Logical grouping of related code into modules
- Consistent naming conventions across the project
- Clean separation between I/O and logic
- Explicit parameters over global state or side effects

Ask yourself: "Is this abstraction solving a problem I have right now, or one I'm imagining?"

## Environment

- **Package manager**: uv (NOT pip)
- **Virtual env**: `source .venv/bin/activate` or `uv run python -c "..."`
- **3rd party packages**: Find source with `python -c "import pkg; print(pkg.__file__)"`, then Read.

## Testing Discipline

Never assume anything. Run `python -c "..."` to verify hypotheses about code behavior, package functions, or data structures before suggesting a plan or exiting plan mode.

Ask yourself: "Did I verify this with `python -c` before building on it?"

## Google-Style Docstrings

- **Summary**: Imperative mood ("Calculate", not "Calculates")
- **Args**: All parameters with types and descriptions. No default values. Indent 4 spaces.
- **Types**: `int | str` unions, uppercase shapes `(N, M)`, lowercase builtins `list`/`dict`/`tuple`, capitalize `Any`/`Path`
- **Optional**: `name (type, optional): Description`
- **Returns**: Always `(type)` in parentheses. Never tuple types. Separate named values for multiple returns.
- **Sections**: Examples (>>>), Notes, References (plaintext only). Section titles at 0 indent.
- **Omit**: "Returns:" if nothing returned, "Args:" if no args, "Raises:" unless critical
- **Classes**: Attributes section only, omit Methods/Args. Don't convert single-line to multiline.
- **`__init__`**: Args only. No Examples/Notes/Methods/References.
- **Tests**: Single-line docstrings only.
- Erase default values from existing arg descriptions. Optionally include minimal Examples.

Ask yourself: "Would a new developer understand this function from the docstring alone?"

## Reference Files

Read the matching file before you write the code, not after:

- [`references/idiomatic-patterns.md`](references/idiomatic-patterns.md) -- read when writing loops, comprehensions, unpacking, context managers, or dataclasses. 18 idioms with before/after code
- [`references/zen-of-python.md`](references/zen-of-python.md) -- read when choosing between two designs or judging whether an abstraction earns its place. PEP 20 with annotations
- [`references/google-style-guide.md`](references/google-style-guide.md) -- read when deciding on exceptions, mutable defaults, import style, naming, or comments
- [`references/effective-python-tips.md`](references/effective-python-tips.md) -- read when reviewing or refactoring existing code. Key tips from "Effective Python" (Brett Slatkin)

© fcakyon · Apache-2.0 · fcakyon/claude-codex-settings

Similar skills

All skills for Programming languages →

From the same set113

The whole set →
server-hoist-static-io The server-hoist-static-io rule for Claude Code and Codex moves static asset I/O to module scope, loading files once instead of on every server-function request. CX Codex +1 ★ 1,216repo stars slides slides assembles PowerPoint decks with PptxGenJS, layout helpers, PNG rendering, and overflow detection for slide content. CX Codex +1 ★ 1,216repo stars ui-menus ui-menus — a rule for Claude Code and Codex that switches menu generation from custom JS components to native platform elements via zeego. Triggered when creating dropdowns or context menus. CX Codex +1 ★ 1,216repo stars schema A skill for Claude Code and Codex reviews and fixes JSON-LD structured data. It helps choose schema types and trace why a page is not getting a rich result. CX Codex +1 ★ 1,216repo stars simplify simplify runs four parallel agents to inspect and clean up recent diffs across reuse, complexity, and performance before committing. CX Codex +1 ★ 1,216repo stars navigation-native-navigators navigation-native-navigators is a Claude Code rule that steers React Native navigation toward native components. It covers stacks, tabs, and screen headers. CX Codex +1 ★ 1,216repo stars frontend-testing-debugging frontend-testing-debugging guides an agent through visual debugging: reproduce the interaction, inspect console and layout, fix the root rule, rerun the journey that broke. CX Codex +1 ★ 1,216repo stars programmatic-seo programmatic-seo plans scalable template-driven page generation from data sets and protects your project from thin-content deindexing penalties. CX Codex +1 ★ 1,216repo stars

Project sponsors

Companies that keep this analytics open