Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Python

ASecurity

Python 3.10-3.14 scripting and IT automation: file operations (pathlib, shutil, csv, json, yaml, toml), subprocess management, HTTP/API interaction (requests with retry/pagination), logging (basicConfig, handlers, JSON), argument parsing (argparse, click), regex, error handling patterns, system administration (psutil, platform), SSH (paramiko, fabric), email (smtplib), scheduling, and data processing (pandas). WHEN: \"Python\", \"python\", \"python script\", \"pip\", \"venv\", \"pathlib\", \"...

4 stars
0 votes
0 copies
0 views
Added 9/24/2026
developmentpythongoshellexpressfastapidjangoflaskgitapidatabase

Works with

cliapi

Security Analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned 9/24/2026

$npx -y skills add chrishuffman5/domain-expert --skill python --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Python
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/chrishuffman5-python/badge)](https://www.skillsdirectory.com/skills/chrishuffman5-python)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: python
description: "Python 3.10-3.14 scripting and IT automation: file operations (pathlib, shutil, csv, json, yaml, toml), subprocess management, HTTP/API interaction (requests with retry/pagination), logging (basicConfig, handlers, JSON), argument parsing (argparse, click), regex, error handling patterns, system administration (psutil, platform), SSH (paramiko, fabric), email (smtplib), scheduling, and data processing (pandas). WHEN: \"Python\", \"python\", \"python script\", \"pip\", \"venv\", \"pathlib\", \"argparse\", \"requests\", \"subprocess\", \"psutil\", \"shutil\", \"csv\", \"json\", \"yaml\", \"toml\", \"paramiko\", \"fabric\", \"logging\", \"schedule\", \"click\", \"typer\", \".py\", \"python automation\". Do NOT use for Django/Flask/FastAPI web-framework questions — that's the `backend` plugin. This skill covers Python for scripting and automation, not web-service development."
license: MIT
---

# Python Scripting & Automation Expert

This skill covers Python 3.10-3.14 for scripting, IT automation, and system administration. It has deep coverage of:

- File operations: pathlib (preferred over os.path), shutil (copy/move/archive), tempfile, os module
- Data formats: csv, json, yaml (PyYAML), toml (tomllib 3.11+), XML
- Subprocess: subprocess.run, Popen for streaming, shlex for safe command building
- HTTP/API: requests (sessions, retry, pagination), httpx (async)
- Logging: basicConfig, handlers (rotating, timed), JSON formatter, LoggerAdapter
- Argument parsing: argparse (positional, optional, subcommands, mutually exclusive), click
- Regular expressions: re module (search, findall, sub, compile, named groups, flags)
- Error handling: try/except/else/finally, custom exceptions, exception chaining, contextlib.suppress
- System admin: platform, socket, psutil (CPU, memory, disk, network, processes)
- SSH/Remote: paramiko (SSHClient, SFTP), fabric (Connection, SerialGroup)
- Email: smtplib, email.mime (text, multipart, attachments)
- Scheduling: schedule, APScheduler, cron integration
- Data processing: pandas (read/write CSV/Excel/JSON, filter, groupby, merge, pivot)

## How to Approach Tasks

1. **Classify** the request:
   - **File/data processing** -- Load `references/patterns.md`
   - **System admin/SSH/email** -- Load `references/automation.md`
   - **Version-specific features** -- Check the Version-specific guidance table below

2. **Choose the right abstraction:**
   - Use `pathlib.Path` over `os.path` for all path operations
   - Use `subprocess.run()` with a list (not string) for shell commands
   - Use `requests.Session()` for multiple API calls
   - Use `argparse` for scripts, `click` for complex CLI tools

3. **Apply Python idioms:**
   - Type hints on function signatures
   - Context managers (`with`) for file/resource management
   - f-strings for formatting
   - `logging` module over `print()` for operational output

4. **Always include:**
   - Proper error handling with specific exception types
   - A `main()` function with `if __name__ == "__main__"`
   - `argparse` for any script that accepts parameters
   - `logging` setup for any script longer than 20 lines

## Core Expertise Overview

### File Operations

```python
from pathlib import Path
import shutil

p = Path.home() / ".config" / "myapp" / "settings.json"
text = p.read_text(encoding="utf-8")
p.mkdir(parents=True, exist_ok=True)
for f in Path("./data").rglob("**/*.csv"): print(f)

shutil.copytree(src, dst, dirs_exist_ok=True)
shutil.make_archive("backup", "zip", root_dir="./data")
```

### Subprocess

```python
import subprocess
result = subprocess.run(
    ["git", "status", "--short"],
    capture_output=True, text=True, check=True, timeout=30,
)
```

### HTTP/API

```python
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

session = requests.Session()
retry = Retry(total=3, backoff_factor=1, status_forcelist=[429, 500, 502, 503])
session.mount("https://", HTTPAdapter(max_retries=retry))
resp = session.get(url, timeout=10)
resp.raise_for_status()
```

### Argument Parsing

```python
import argparse
parser = argparse.ArgumentParser(description="Process files")
parser.add_argument("input", type=Path, help="Input file")
parser.add_argument("-f", "--format", choices=["json", "csv"], default="json")
parser.add_argument("-v", "--verbose", action="store_true")
args = parser.parse_args()
```

## Common Pitfalls

**1. Using `os.path` instead of `pathlib`**
`pathlib.Path` is more readable and supports `/` operator for path joining. Prefer it for all new code.

**2. Using `subprocess.run()` with `shell=True`**
Command injection risk. Pass a list: `subprocess.run(["git", "status"])`, not a string.

**3. Not specifying `encoding="utf-8"` for file operations**
Default encoding varies by platform. Always explicit: `open(f, encoding="utf-8")`.

**4. Bare `except:` clauses**
Never use `except:` or `except Exception:` without logging the error. Catch specific exceptions.

**5. Using `print()` instead of `logging`**
`print()` goes to stdout and cannot be configured. Use `logging` for operational output.

**6. Not using `timeout` with `requests`**
Without timeout, HTTP calls can hang indefinitely. Always set `timeout=10` or similar.

**7. Mutable default arguments**
`def f(items=[])` shares the list across calls. Use `def f(items=None): items = items or []`.

**8. Not closing resources**
Always use `with` statements for files, HTTP sessions, database connections.

## Version-specific guidance

| Version | Reference | What's version-specific |
|---|---|---|
| 3.10 | `references/versions/3.10.md` | match/case structural pattern matching, type union `X \| Y`, parenthesized context managers |
| 3.12 | `references/versions/3.12.md` | Type parameter syntax `[T]`, `type` keyword, f-string improvements (nested quotes, backslashes) |
| 3.14 | `references/versions/3.14.md` | Template strings `t"..."`, deferred annotation evaluation |

## Reference Files

- `references/patterns.md` -- File ops, subprocess, HTTP/API, logging, argparse, regex. Dense with examples.
- `references/automation.md` -- System admin (psutil, platform), SSH (paramiko, fabric), email, scheduling, data processing (pandas).

## Example Scripts

- `scripts/01-system-report.py` -- Cross-platform system report with psutil
- `scripts/02-api-client.py` -- REST API client class with retry/pagination
- `scripts/03-csv-processor.py` -- CSV/JSON processor with argparse and filtering
- `scripts/04-file-organizer.py` -- File organizer by date/type with undo support

Attribution

chrishuffman5chrishuffman5
View sourceSee grades on GitHubMore from chrishuffman5 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

286712 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Writing Plans

Use when you have a spec or requirements for a multi-step task, before touching code

2927051 votes
View all in development →