/py-pit:settings-configfrom py-pit
Creates production-ready configuration management for Python backends using pydantic-settings. Centralizes env vars, replaces scattered os.getenv calls, and adds typed .env support.
Ships in py-pit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill creates clean, production-ready application configuration management using pydantic-settings.
It enforces disciplined configuration patterns that prevent common problems such as:
The skill favors minimal, explicit configuration surfaces and ensures configuration is:
Produce a configuration system that:
.env usage in local developmentBefore generating anything:
Check whether a config.py or settings.py already exists. If it
does, extend it rather than creating a parallel one.
Note the existing package layout. If the project was scaffolded with
fastapi-init, config lives at {pkg_name}/core/config.py — use
that path, not app/config.py.
Check whether an env_prefix is already in use anywhere
(env_prefix=, os.getenv("XYZ_, existing .env keys). If one
exists, adopt it.
Check whether .env loading is already part of the project
convention (for example a real .env file used locally, documented
setup instructions, or an explicit user request). If so, adopt
env_file=".env" in the config.
Do not assume that the presence of .env.example alone means .env
should be automatically loaded at runtime.
Only create new files if no config module is present.
Create a dedicated settings module.
Typical layout (adapt to the actual package structure found in Step 0):
project/
{pkg_name}/
core/
config.py ← preferred location for fastapi-init projects
.env
.env.example
Example implementation:
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
app_name: str = "service"
debug: bool = False
database_url: str
model_config = SettingsConfigDict(
env_prefix="APP_",
extra="ignore",
)
settings = Settings()
Usage:
from {pkg_name}.core.config import settings
print(settings.database_url)
Environment variables should follow a consistent prefix convention.
Example:
APP_DATABASE_URL=postgresql+asyncpg://...
APP_DEBUG=true
The prefix prevents collisions with other services or system variables. Database URLs must use an async-compatible driver scheme (e.g. sqlite+aiosqlite://, postgresql+asyncpg://).
Environment variables are the canonical configuration source. .env
support is an optional local-development convenience layer.
To enable it, add env_file to the config:
model_config = SettingsConfigDict(
env_prefix="APP_",
env_file=".env",
extra="ignore",
)
Example .env:
APP_DATABASE_URL=postgresql://localhost/service
APP_DEBUG=true
When .env is in use, commit a .env.example to the repo showing
required variables. The .env file itself must be in .gitignore — it
may contain secrets and should never be committed.
extra="ignore" is intentional here (unlike extra="forbid" in
request schemas). Environment variables from the shell, Docker, or CI
will be present alongside app config — rejecting unknown keys would
break deployment.
Replace patterns like:
import os
DATABASE_URL = os.getenv("DATABASE_URL")
or scattered config usage across modules.
All configuration should flow through the settings object.
These rules are what distinguish this skill from generic AI configuration scaffolding.
Avoid code such as:
if ENV == "production":
...
Configuration differences should come from environment variables, not logic in the settings module.
The settings layer should remain purely declarative.
If the repository already uses a prefix pattern (for example
MY_SERVICE_), the settings model must adopt it.
If no prefix exists, create one derived from the package name.
Consistency is more important than any specific prefix choice.
Instantiate settings once and import the instance everywhere.
Correct:
settings = Settings()
Incorrect:
Settings()
Settings()
Settings()
Multiple instantiations can lead to:
The skill should produce:
config.py with BaseSettingsSettings classsettings instanceos.getenv usage.env.example committed (if using .env).env in .gitignore (if using .env)A good configuration system is:
This skill enforces those properties so configuration never becomes a source of production bugs.
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (robhowley/py-pit-skills) — no native marketplace selected
npx claudepluginhub p/robhowley-py-pit16 skills in this plugin
/alembic-migrationsProduction-safe Alembic migration workflows for SQLAlchemy 2.x projects. Use this skill when adding Alembic, generating migrations, reviewing autogenerate diffs, fixing broken migrations, or establishing a safe schema evolution workflow in a Python backend./background-jobs-boundariesGuardrails for background work in FastAPI and Python services. Prevent misuse of in-process background execution (e.g. FastAPI BackgroundTasks)./click-cliDesign, generate, and improve Python CLIs using the Click library. Focus on idiomatic architecture, command groups, modular layouts, CLI UX conventions, and avoiding common Click anti-patterns./click-cli-linterAudit and improve existing Python Click CLIs by identifying architecture problems, anti-patterns, and CLI UX issues, then proposing minimal, high-value fixes./code-qualityOpinionated code health stack for Python repos using Ruff, pre-commit, and Markdown linting. Prefers consolidation over redundant tooling, preserves working repos unless migration is requested, and provides a simple adoption path for both new and existing projects./dockerize-serviceGenerate a local-development Docker Compose setup for an existing Python project. Produces a multi-stage Dockerfile, Compose file, env config, and dockerignore based on detected project signals.Other plugins' skills for the same job