npx claudepluginhub pknull/asha-marketplace --plugin codeThis skill uses the workspace's default tool permissions.
Modern Python (3.10+) patterns for readable, maintainable code.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Modern Python (3.10+) patterns for readable, maintainable code.
def greet(name: str, times: int = 1) -> str:
return f"Hello, {name}! " * times
def process_items(items: list[str]) -> dict[str, int]:
return {item: len(item) for item in items}
from typing import Optional
def find_user(user_id: int) -> Optional[User]:
# Returns User or None
...
# Python 3.10+ union syntax
def parse(data: str | bytes) -> dict:
...
from typing import Protocol
class Readable(Protocol):
def read(self) -> str: ...
def process(source: Readable) -> str:
return source.read().upper()
# Any class with read() method works
# BAD
try:
process()
except:
pass
# GOOD
try:
process()
except ValueError as e:
logger.warning(f"Invalid value: {e}")
except IOError as e:
logger.error(f"IO failed: {e}")
raise
try:
data = fetch_data()
except HTTPError as e:
raise DataFetchError("Failed to fetch") from e
class AppError(Exception):
"""Base application error."""
pass
class ValidationError(AppError):
def __init__(self, field: str, message: str):
self.field = field
self.message = message
super().__init__(f"{field}: {message}")
from dataclasses import dataclass, field
@dataclass
class User:
name: str
email: str
roles: list[str] = field(default_factory=list)
def is_admin(self) -> bool:
return "admin" in self.roles
@dataclass(frozen=True)
class Point:
x: float
y: float
from typing import NamedTuple
class Coordinate(NamedTuple):
lat: float
lon: float
def distance_to(self, other: "Coordinate") -> float:
...
with open("file.txt") as f:
data = f.read()
# File automatically closed
# Multiple contexts
with open("in.txt") as src, open("out.txt", "w") as dst:
dst.write(src.read())
from contextlib import contextmanager
@contextmanager
def timer(name: str):
start = time.perf_counter()
try:
yield
finally:
elapsed = time.perf_counter() - start
print(f"{name}: {elapsed:.2f}s")
with timer("processing"):
heavy_computation()
from concurrent.futures import ThreadPoolExecutor
def fetch_all(urls: list[str]) -> list[Response]:
with ThreadPoolExecutor(max_workers=10) as executor:
return list(executor.map(fetch, urls))
from concurrent.futures import ProcessPoolExecutor
def compute_all(items: list[Data]) -> list[Result]:
with ProcessPoolExecutor() as executor:
return list(executor.map(heavy_compute, items))
import asyncio
import aiohttp
async def fetch(session: aiohttp.ClientSession, url: str) -> str:
async with session.get(url) as response:
return await response.text()
async def fetch_all(urls: list[str]) -> list[str]:
async with aiohttp.ClientSession() as session:
tasks = [fetch(session, url) for url in urls]
return await asyncio.gather(*tasks)
# Run
results = asyncio.run(fetch_all(urls))
def read_large_file(path: str):
with open(path) as f:
for line in f:
yield line.strip()
# Process without loading entire file
for line in read_large_file("huge.txt"):
process(line)
# List (loads all into memory)
squares = [x**2 for x in range(1_000_000)]
# Generator (lazy, memory efficient)
squares = (x**2 for x in range(1_000_000))
class Point:
__slots__ = ("x", "y")
def __init__(self, x: float, y: float):
self.x = x
self.y = y
# ~40% less memory, faster attribute access
# BAD - O(n²)
result = ""
for s in strings:
result += s
# GOOD - O(n)
result = "".join(strings)
from functools import lru_cache
@lru_cache(maxsize=128)
def expensive_computation(n: int) -> int:
# Cached by arguments
...
project/
├── src/
│ └── package/
│ ├── __init__.py
│ ├── models.py
│ └── services.py
├── tests/
│ └── test_services.py
├── pyproject.toml
└── README.md
black . # Formatting
isort . # Import sorting
ruff check . # Fast linting
mypy . # Type checking
pytest --cov # Testing with coverage
bandit -r src/ # Security scanning
| Avoid | Instead |
|---|---|
def f(items=[]) | def f(items=None) |
type(x) == str | isinstance(x, str) |
x == None | x is None |
from x import * | Explicit imports |
Bare except: | except Exception: |
eval(user_input) | Never |