Back to list
jr2804

python-pathlib

by jr2804

This project converts MCP server configurations from any format into the one for your coding agent of choice - just by using any available LLM!

2🍴 0📅 Jan 21, 2026

SKILL.md


Python Pathlib

What I Do

Provide guidelines for using Python's pathlib module for all file system paths.

Path Rules

Always Use Pathlib

# GOOD - Use pathlib for all paths
from pathlib import Path

config_path = Path("config/settings.json")
data_dir = Path("data/output")
file_path = data_dir / "results.csv"

# BAD - Never store paths as strings
config_path = "config/settings.json"  # WRONG
data_dir = "data/output"              # WRONG

# BAD - Never use os.path
import os.path
path = os.path.join("data", "output")  # WRONG

Path Operations

from pathlib import Path

# Create paths with / operator
base = Path("data")
output_file = base / "results.csv"
subdir_file = base / "processed" / "output.json"

# Check path types
path.is_file()      # True if file
path.is_dir()       # True if directory
path.exists()       # True if exists

# File operations
path.read_text()        # Read as string
path.read_bytes()       # Read as bytes
path.write_text(content)  # Write string
path.write_bytes(data)    # Write bytes

# Directory operations
path.mkdir(parents=True, exist_ok=True)
path.iterdir()          # List directory contents
path.rglob("*.py")      # Recursive glob

Context Managers

from pathlib import Path

# Always use with statements for file handling
input_file = Path("input.txt")

with input_file.open("r") as f:
    data = f.read()

# Or use pathlib's read methods for simple cases
content = Path("config.json").read_text()

When to Use Me

Use this skill when:

  • Handling file paths
  • Managing directory operations
  • Reading or writing files
  • Any Path-related work

Key Rules

  1. Never use strings for paths - Always use Path objects
  2. Never use os.path - Use pathlib instead
  3. Use / operator - For path concatenation
  4. Use with statements - For file I/O
  5. Type annotate as Path - path: Path

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon