gravitas-python
Skill445 starsChanged 56 days agoMITView on GitHub
GRAVITAS extension for Python projects. Adds Python-specific recon, type checking with mypy/pyright, ruff/flake8 lint, pytest patterns, and common Python failure modes. Load in addition to the base GRAVITAS skill.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- sid-lakhani/agents-configword for word, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 1
- sid-lakhani/agents-config★ 3100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- gravitas-highstakesSkill
- gravitasSkill
- gravitas-typescriptSkill
The file
Files
GRAVITAS — Python Extension
Extends the base GRAVITAS skill with Python-specific patterns.
Load skills/gravitas/SKILL.md first, then this file.
Python Recon Additions
□ 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
cat pyproject.toml | grep -A 10 "\[tool.mypy\]"
cat pyproject.toml | grep -A 10 "\[tool.ruff\]"Python Verification Chain
# 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 countPython-Specific Anti-Patterns
Never use bare except
BAD: except:
GOOD: except ValueError as e:
GOOD: except (TypeError, ValueError) as e:Never shadow builtins
BAD: list = [1, 2, 3] # shadows list()
BAD: id = user.id # shadows id()
GOOD: items = [1, 2, 3]
GOOD: user_id = user.idType annotations required (with mypy strict)
BAD: def process(data):
GOOD: def process(data: dict[str, Any]) -> ProcessResult:Use dataclasses or Pydantic over dicts for structured data
BAD: return {"user_id": 1, "name": "Alice"} # no type safety
GOOD: return UserResponse(user_id=1, name="Alice")Common Python Failure Modes
| Failure | Root Cause | Fix |
Optional[X] has no attribute Y | None not handled | Add if x is not None: guard |
Incompatible return value type | Wrong return type | Check function signature |
Missing return statement | Not all paths return | Add explicit return |
Module has no attribute X | Wrong import | Check module with dir(module) |
Cannot find implementation for X | Missing stub | Install types-X package |
| Circular import | Import at module level | Move to function level or restructure |
Test Patterns (pytest)
Fixture pattern
# conftest.py
import pytest
from myapp.db import get_db
@pytest.fixture
def db():
conn = get_db(":memory:")
yield conn
conn.close()
@pytest.fixture
def client(db):
from myapp import create_app
app = create_app({"TESTING": True})
with app.test_client() as c:
yield cStandard test structure
class TestUserAuth:
def test_login_success(self, client, db):
# Arrange
db.execute("INSERT INTO users VALUES (1, 'alice', 'hash')")
# Act
response = client.post("/login", json={"username": "alice", "password": "pw"})
# Assert
assert response.status_code == 200
assert response.json["token"] is not None
def test_login_wrong_password(self, client, db):
response = client.post("/login", json={"username": "alice", "password": "wrong"})
assert response.status_code == 401Parametrize for edge cases
@pytest.mark.parametrize("input,expected", [
("", ValueError),
(None, TypeError),
("valid@email.com", None),
("not-an-email", ValueError),
])
def test_validate_email(input, expected):
if expected:
with pytest.raises(expected):
validate_email(input)
else:
validate_email(input) # should not raiseFramework-Specific Notes
FastAPI
# Always test with TestClient, not raw function calls
from fastapi.testclient import TestClient
client = TestClient(app)
# Type all path/query params and bodies
@router.post("/users", response_model=UserResponse)
async def create_user(body: CreateUserRequest) -> UserResponse:
...Django
# Use pytest-django
# settings for tests
@pytest.mark.django_db
def test_user_creation():
user = User.objects.create_user(username="test", password="pass")
assert user.id is not NoneQuick Reference
# 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 --strictDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

