Agent skill
mastering-python-skill
Modern Python coaching covering language foundations through advanced production patterns. Use when asked to "write Python code", "explain Python concepts", "set up a Python project", "configure Poetry or PDM", "write pytest tests", "create a FastAPI endpoint", "run uvicorn server", "configure alembic migrations", "set up logging", "process data with pandas", or "debug Python errors". Triggers on "Python best practices", "type hints", "async Python", "packaging", "virtual environments", "Pydantic validation", "dependency injection", "SQLAlchemy models".
Install this agent skill to your Project
npx add-skill https://github.com/SpillwaveSolutions/agent-brain/tree/main/.claude/skills/mastering-python-skill
Metadata
Additional technical details for this skill
- domains
-
[ "python", "testing", "packaging", "web-development", "async", "security" ] - version
- 2.2.0
SKILL.md
Mastering Python Skill
Production-ready Python patterns with runnable code examples.
Contents
- Workflow
- Reference Files
- Sample CLI Tools
- When NOT to Use
- Full Table of Contents
Workflow
Phase 1: Setup
-
Verify Python version
bashpython --version # Require 3.10+, prefer 3.12+ -
Create and activate virtual environment
bashpython -m venv .venv && source .venv/bin/activate -
Install dependencies
bashpoetry install # or: pip install -r requirements.txt
Phase 2: Develop
-
Reference appropriate patterns:
- Types → type-systems.md
- Async → async-programming.md
- APIs → fastapi-patterns.md
- DB → database-access.md
-
Follow project structure from project-structure.md
Phase 3: Validate
-
Run quality checks
bashruff check . && ruff format --check . mypy src/ -
Run tests with coverage
bashpytest -v --cov=src --cov-report=term-missing
Phase 4: Deploy
-
Build and verify package
bashpython -m build && twine check dist/* -
Deploy per docker-deployment.md or ci-cd-pipelines.md
Pre-Completion Checklist:
- [ ] All tests pass
- [ ] mypy reports no errors
- [ ] ruff check clean
- [ ] Coverage ≥80%
- [ ] No security warnings in dependencies
Reference Files
| Category | Files | Key Topics |
|---|---|---|
| Foundations | syntax-essentials, type-systems, project-structure, code-quality | Variables, type hints, generics, src layout, ruff, mypy |
| Patterns | async-programming, error-handling, decorators, context-managers, generators | async/await, exceptions, Result type, with statements, yield |
| Testing | pytest-essentials, mocking-strategies, property-testing | Fixtures, parametrize, unittest.mock, Hypothesis |
| Web APIs | fastapi-patterns, pydantic-validation, database-access | Dependencies, middleware, validators, SQLAlchemy async |
| Packaging | poetry-workflow, pyproject-config, docker-deployment | Lock files, PEP 621, multi-stage builds |
| Production | ci-cd-pipelines, monitoring, security | GitHub Actions, OpenTelemetry, OWASP, JWT |
See TOC.md for detailed topic lookup.
Sample CLI Tools
Runnable examples demonstrating production patterns:
| Tool | Demonstrates | Reference |
|---|---|---|
| async_fetcher.py | Async HTTP, rate limiting, error handling | async-programming.md |
| config_loader.py | Pydantic settings, .env files, validation | pydantic-validation.md |
| db_cli.py | SQLAlchemy async CRUD, repository pattern | database-access.md |
| code_validator.py | Run→check→fix with ruff and mypy | code-quality.md |
# Test examples
python sample-cli/async_fetcher.py https://httpbin.org/get
python sample-cli/config_loader.py --show-env
python sample-cli/db_cli.py init --sample-data && python sample-cli/db_cli.py list
python sample-cli/code_validator.py src/
When NOT to Use
- Non-Python languages: Use language-specific skills
- ML/AI model internals: Use PyTorch/TensorFlow skills
- Cloud infrastructure: Use AWS/GCP skills for infra (this covers code)
- Legacy Python 2: Focus is Python 3.10+
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
configuring-agent-brain
Installation and configuration skill for Agent Brain document search system. Use when asked to "install agent brain", "setup agent brain", "configure agent brain", "setting up document search", "installing agent-brain packages", "configuring API keys", "initializing project for search", "troubleshooting agent brain", "pip install agent-brain", "agent brain not working", "agent brain setup error", "configure embeddings provider", "setup ollama for agent brain", or "agent brain environment variables". Covers package installation, provider configuration, project initialization, and server management.
using-agent-brain
Expert Agent Brain skill for document search with BM25 keyword, semantic vector, hybrid, graph, and multi retrieval modes. Use when asked to "search documentation", "query domain", "find in docs", "bm25 search", "hybrid search", "semantic search", "graph search", "multi search", "find dependencies", "code relationships", "searching knowledge base", "querying indexed documents", "finding code references", "exploring codebase", "what calls this function", "find imports", "trace dependencies", "brain search", "brain query", "knowledge base search", "cache management", "clear embedding cache", "cache hit rate", or "cache status". Supports multi-instance architecture with automatic server discovery. GraphRAG mode enables relationship-aware queries for code dependencies and entity connections. Pluggable providers for embeddings (OpenAI, Cohere, Ollama) and summarization (Anthropic, OpenAI, Gemini, Grok, Ollama). Supports multiple runtimes (Claude Code, OpenCode, Gemini CLI) with shared .agent-brain/ data directory.
uat-testing
installing-local
agent-brain-release
using-spacy-nlp
Industrial-strength NLP with spaCy 3.x for text processing and custom classifier training. Use when "installing spaCy", "selecting model for nlp" (en_core_web_sm/md/lg/trf), "tokenization", "POS tagging", "named entity recognition" (NER), "dependency parsing", "training TextCategorizer models", "troubleshooting spaCy errors" (E050/E941 model errors, E927 version mismatch, memory issues), "batch processing with nlp.pipe", or "deploying nlp models to production". Includes data preparation scripts, config templates, and FastAPI serving examples.
Didn't find tool you were looking for?