# Improve Python Code Style

Python teams need consistent code style, type hints, and review guidance. This skill applies Google-style Python rules for cleaner imports, docstrings, formatting, and maintainable code.

## Install

```bash
npx skillstore add codingkaiser/python-style-guide
```

## Metadata

- Status: approved
- Slug: codingkaiser-python-style-guide
- Skillstore revision: r1
- Version status: missing
- Tree hash: 9a56223991b06d9f7b9b6fce1e9a06ed1c4f9a3cecdd167ee1d83697c4f6a78c
- Author: CodingKaiser
- GitHub username: CodingKaiser
- License: Complete terms in LICENSE.txt
- Repository: https://github.com/CodingKaiser/claude-kaiser-skills/tree/main/python-style-guide
- Ref: d11af420e07cd866fe39cfa937efef3223896c06
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: scripts, network, external\_commands
- Quality score: 77
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/codingkaiser-python-style-guide
- Manifest: https://skillstore.pages.dev/api/skills/codingkaiser-python-style-guide/manifest

## Capabilities

- Guides import organization, absolute imports, and direct typing imports.
- Explains exception handling, boolean checks, comprehensions, lambdas, and default arguments.
- Defines naming, formatting, line length, indentation, comments, and docstring conventions.
- Provides examples for Google-style function, class, module, and async docstrings.
- Covers advanced typing patterns, including Protocol, TypedDict, Literal, TypeAlias, and ParamSpec.
- Identifies common Python anti-patterns and suggests safer or cleaner alternatives.

## Use Cases

- Review Python Pull Requests: Check imports, names, docstrings, annotations, and common anti-patterns before merging Python changes.
- Refactor Existing Modules: Apply consistent style rules while improving readability, type clarity, and resource handling in older code.
- Teach Team Standards: Create shared Python guidance for contributors who need clear examples and review expectations.

## Prompt Templates

### Check Basic Style

```
Review this Python code against the Python style guide. Focus on naming, imports, formatting, and simple readability issues.
```

### Improve Docstrings

```
Rewrite the docstrings in this Python module using Google-style docstrings. Preserve behavior and mention any missing type information.
```

### Refactor for Type Clarity

```
Refactor this Python code to follow the guide. Improve type annotations, imports, exception handling, and function size without changing behavior.
```

### Audit a Python Module

```
Audit this Python module using the full style guide. Prioritize issues by impact and provide a concise remediation plan.
```

## Limitations

- It gives style guidance but does not run a formatter, linter, or test suite.
- Some rules may conflict with an existing project style and need local adaptation.
- It focuses on Python style, not full application architecture or runtime performance.
- Security examples are educational and do not replace a dedicated security review.

## Best Practices

- Ask for style review after sharing enough surrounding code to preserve local conventions.
- Request prioritized findings when reviewing large modules or pull requests.
- Pair this guide with project linters and tests before accepting refactors.

## Anti Patterns

- Do not apply every rule mechanically when the existing project clearly uses another standard.
- Do not request behavior changes when the goal is only style cleanup.
- Do not use the examples as production code without adapting names, errors, and validation.

## Security Audit

- Audited at: 2026-07-06T07:44:31.555\+00:00
- Summary: All reviewed static findings are false positives caused by Markdown examples, prose, license text, or reference links. The skill is a Python style guide and I found no prompt injection, data exfiltration intent, executable scripts, or unsafe tool behavior in the cited files.

## Stats

- Views: 426
- Downloads: 7
- Favorites: 0
- Popularity score: 0
