Install the skill above, then run this in your AI tool:
/gravitas-python <your description>
About
Extends the base GRAVITAS skill with Python-specific patterns.
Load `skills/gravitas/SKILL.md` first, then this file.
Source
What gets added to your project
Preview every file this package writes on install before you run the command above.
Summary
>
Skill instructions
GRAVITAS — Python Extension
Extends the base GRAVITAS skill with Python-specific patterns.
Load skills/gravitas/SKILL.md first, then this file.
Python Recon Additions
code
□ pyproject.toml — [tool.mypy], [tool.ruff], [tool.pytest.ini_options]
□ setup.py / setup.cfg — legacy config
□ requirements.txt / requirements-dev.txt — dependency versions
□ conftest.py — pytest fixtures (critical for understanding test patterns)
□ __init__.py — package structure
□ Type stubs — are there py.typed markers? stub packages installed?
Read pyproject.toml for type strictness
bash
cat pyproject.toml | grep -A 10 "\[tool.mypy\]"cat pyproject.toml | grep -A 10 "\[tool.ruff\]"
Python Verification Chain
bash
# Full chain — in this order
mypy . --strict # type correctness
ruff check . # lint (fast, Rust-based)
ruff format --check . # format check
pytest -v --tb=short # all tests# With coverage
pytest --cov=src --cov-report=term-missing -v
# Type coverage
mypy . --strict 2>&1 | tail -5 # summary line shows error count
Python-Specific Anti-Patterns
Never use bare except
python
BAD: except:
GOOD: except ValueError as e:
GOOD: except (TypeError, ValueError) as e:
@pytest.mark.parametrize("input,expected", [
("", ValueError),
(None, TypeError),
("valid@email.com", None),
("not-an-email", ValueError),
])deftest_validate_email(input, expected):
if expected:
with pytest.raises(expected):
validate_email(input)
else:
validate_email(input) # should not raise
Framework-Specific Notes
FastAPI
python
# Always test with TestClient, not raw function callsfrom fastapi.testclient import TestClient
client = TestClient(app)
# Type all path/query params and bodies@router.post("/users", response_model=UserResponse)asyncdefcreate_user(body: CreateUserRequest) -> UserResponse:
...
Django
python
# Use pytest-django# settings for tests@pytest.mark.django_dbdeftest_user_creation():
user = User.objects.create_user(username="test", password="pass")
assert user.idisnotNone
Quick Reference
bash
# Run single test file
pytest src/auth/test_session.py -v
# Run single test
pytest src/auth/test_session.py::TestSession::test_timeout -v
# Run with pdb on failure
pytest --pdb
# Show slowest tests
pytest --durations=10
# Type check single file
mypy src/auth/session.py --strict
Add this badge to a GitHub README so readers can open the package page and install the same version.
[](https://www.aipm-registry.com/skills/udaysharmadev/gravitas-python/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)
This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.
AI assistant context
What this skill is for
@udaysharmadev/gravitas-python@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: >
Run aipm add @udaysharmadev/gravitas-python@1.0.0 in a project that has AIPM initialized.
Supported tools
@udaysharmadev/gravitas-python@1.0.0 supports All tools.
Before installing
AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.