format-python

star 27

Format Python code with Black

y1feng200156 By y1feng200156 schedule Updated 2/10/2026

name: format-python description: Format Python code with Black

Python Format Skill

๐Ÿ“‹ Overview

Use Black to automatically format Python code, an uncompromising code formatter:

  • ๐ŸŽจ Unified style: Automatic team code style consistency
  • โšก Fast execution: Extremely fast formatting speed
  • ๐Ÿ”’ Deterministic: Same code always produces same result
  • ๐Ÿ”ง Zero config: Works out of the box

๐Ÿ”ง Prerequisites

Tool Min Version Check Command Installation
Python 3.8+ python --version python.org
Black 22.0+ black --version pip install black

๐Ÿš€ Usage

Method 1: AI Assistant

"Use format-python to format my code"

Method 2: Run Script Directly

# Windows
.\.agent\skills\format-python\scripts\format.ps1

# Linux/Mac
./.agent/skills/format-python/scripts/format.sh

Method 3: With Parameters

# Check without modifying (preview mode)
.\.agent\skills\format-python\scripts\format.ps1 -Check

# Specify directory
.\.agent\skills\format-python\scripts\format.ps1 -Path ".\src"

๐ŸŽฏ What It Formats

  • โœ… Indentation standardization (4 spaces)
  • โœ… Line length limit (default 88 characters)
  • โœ… String quote unification
  • โœ… Bracket and comma normalization
  • โœ… Import statement formatting

โš™๏ธ Configuration

# pyproject.toml
[tool.black]
line-length = 88
target-version = ['py38']
include = '\.pyi?$'
extend-exclude = '''
/(
  \.git
  | \.venv
  | build
  | dist
)/
'''

๐Ÿ”— Related Resources

Install via CLI
npx skills add https://github.com/y1feng200156/ham-study --skill format-python
Repository Details
star Stars 27
call_split Forks 5
navigation Branch main
article Path SKILL.md
More from Creator
y1feng200156
y1feng200156 Explore all skills →