Agent skill
setup-python-lib
Sets up a new Python library project using uv in the current directory. Creates project structure, installs dev dependencies, and optionally configures git remote. Use when the user wants to initialise a Python library, package, or project with uv.
Install this agent skill to your Project
npx add-skill https://github.com/josh-gree/my-claude-skills/tree/main/skills/setup-python-lib
SKILL.md
Setting Up a Python Library with uv
Overview
This skill scaffolds a Python library project using uv in the current working directory.
Workflow
Step 1: Gather Project Details
Ask the user for:
- Python version - default to 3.12 if not specified
- Project description (optional) - for pyproject.toml and README
Step 2: Initialise the Project
Run from the current directory (user has already created and cd'd into it):
uv init --lib . --python <version>
Step 3: Add Dev Dependencies
uv add --dev ipython jupyterlab ruff pytest pytest-cov
Step 4: Create Project Structure
Create directories:
mkdir -p tests
mkdir -p nbs
mkdir -p scratch/scripts
mkdir -p scratch/nbs
touch tests/__init__.py
tests/- test filesnbs/- notebooks (tracked in git)scratch/scripts/- throwaway scripts (ignored)scratch/nbs/- throwaway notebooks (ignored)
Add scratch/ to .gitignore:
echo "scratch/" >> .gitignore
Create a minimal test file tests/test_placeholder.py:
def test_placeholder():
"""Placeholder test to verify pytest works."""
assert True
Step 5: Create README.md
Create a minimal README using the directory name as the project name:
# <directory-name>
<description if provided>
Step 6: Create CLAUDE.md
Create a CLAUDE.md with project context:
# <project-name>
Python library using uv for dependency management.
## Commands
Run `just` to see available commands (test, lint, format, shell, jupyter).
## Project Structure
- `src/<package>/` - library source code
- `tests/` - test files
- `nbs/` - notebooks (tracked)
- `scratch/` - throwaway scripts and notebooks (gitignored)
## Dependencies
- Add runtime deps: `uv add <package>`
- Add dev deps: `uv add --dev <package>`
- Run anything: `uv run <command>`
Step 7: Create justfile
Create a justfile with common development commands:
# List available commands
default:
@just --list
# Run tests
test *args:
uv run pytest {{args}}
# Run tests with coverage
test-cov:
uv run pytest --cov
# Format code
fmt:
uv run ruff format .
# Lint code
lint:
uv run ruff check .
# Lint and fix
lint-fix:
uv run ruff check . --fix
# Format and lint
check: fmt lint
# Start IPython shell with autoreload
shell:
uv run ipython -i -c "get_ipython().run_line_magic('load_ext', 'autoreload'); get_ipython().run_line_magic('autoreload', '2')"
# Start Jupyter Lab
jupyter:
uv run jupyter lab
Step 8: Git Repository Setup
First, discover available GitHub organisations:
gh org list
Then ask the user using AskUserQuestion with these options:
- No remote - Keep it local only
- Public repository (personal) - Create public repo in personal account
- Private repository (personal) - Create private repo in personal account
- Organisation repository - Show list of orgs from
gh org listand let user pick, then ask public/private
If user selects organisation, present the orgs discovered and ask which one, then ask public or private.
Creating the repository:
For personal repos:
gh repo create <repo-name> --public|--private --source . --push
For organisation repos:
gh repo create <org-name>/<repo-name> --public|--private --source . --push
If no remote wanted:
git init
git add .
git commit -m "Initial commit: scaffold Python library with uv"
Checklist
- Confirm Python version (default 3.12)
- Get optional project description
- Run
uv init --lib . - Add dev dependencies (ipython, jupyterlab, ruff, pytest, pytest-cov)
- Create directories (tests/, nbs/, scratch/scripts/, scratch/nbs/)
- Add scratch/ to .gitignore
- Create placeholder test
- Create README.md
- Create CLAUDE.md
- Create justfile with dev commands
- Fetch available GitHub orgs with
gh org list - Ask about git remote setup
- Initialise git and optionally create remote
Notes
- Always use
uv init --lib .for library projects (creates proper src layout) - The project name is derived from the current directory name
- Verify uv and gh are installed before starting
- Use
gh auth statusto check GitHub authentication if needed
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
implement-ticket
Implements a planned GitHub issue by following the implementation plan. Takes a GitHub issue number. Use when the user wants to implement a ticket, work on an issue, or says "implement ticket X" or "do issue
address-pr-comments
Addresses PR review comments by making code changes and posting replies. Takes a PR number or auto-detects from current branch. Use when the user wants to address review feedback, respond to PR comments, fix PR feedback, or says "address comments on PR X".
create-ticket
Creates GitHub issues to capture work that needs to be done. Records intent with context about the codebase, not implementation plans. Use when the user wants to track work, create a ticket, log a task, or says "we want to do X" or "we need to X".
review
Review code using Google's code review principles. Use for ad-hoc file review or as the foundation for PR and codebase reviews.
refine-plan
Refines an existing implementation plan through discussion with the user. Takes a GitHub issue number. Use when the user wants to refine a plan, discuss a plan, change a plan, or says "refine plan X" or "let's discuss the plan for issue
review-pr
Review a pull request using Google's code review principles. Takes a PR number or auto-detects from current branch. Use when the user wants to review a PR, check PR changes, or says "/review-pr 123".
Didn't find tool you were looking for?