django-tdd
Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
npx skills add vibeeval/vibecosystem --skill django-tdd --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Guides the agent to perform test-driven development for Django projects, focusing on pytest-django, factory_boy, and testing DRF APIs. It specifies a Red-Green-Refactor workflow, experimental setup for pytest configuration, test settings, conftest fixtures, and factory patterns for User, Category, Product, plus tests for models, views, serializers, and API endpoints.
How it works
- Activates when writing new Django applications, implementing DRF APIs, or testing models, views, and serializers.
- Provides a Red-Green-Refactor cycle example that shows writing a failing test, making tests pass, and refactoring while keeping tests green.
- Sets up pytest configuration in a pytest.ini snippet and defines test settings, including in-memory SQLite, migrations disabled, faster password hashing, console email backend, and Celery in eager mode.
- Defines conftest.py fixtures for timezone, user creation, authentication, and API clients (regular and authenticated).
- Includes Factory Boy setup for UserFactory, CategoryFactory, ProductFactory with post_generation tags, and example usage in tests for models, views, and API endpoints.
- Demonstrates model tests such as user/product creation, slug generation, validation, and stock management.
- Demonstrates view tests for listing, detail, authentication requirements, and creation via POST.
- Demonstrates DRF serializer tests (serialize/deserialize, price and stock validation).
- Demonstrates DRF API viewset tests for list/retrieve/create/update/delete with authentication, plus filtering and search.
- Shows mocking pattern scaffold under Mocking and Patching with patch and Mock usage.
When to use it
- When starting new Django projects or REST APIs and need a comprehensive testing strategy that includes unit, integration, and API tests.
- When you want to apply TDD methodology (Red-Green-Refactor) to Django models, views, and serializers.
- When you rely on Factory Boy for test data generation and want DRF API coverage including authentication and filtering.
What it can touch
- Tools: claude-code
- Files: pytest.ini configuration, config/settings/test.py, tests/conftest.py, tests/factories.py, tests/test_models.py, tests/test_views.py, tests/test_serializers.py, tests/test_api.py, and related test files and factory definitions.
Caveats
- License: MIT
- Declared to use pytest with Django and Factory Boy; the setup disables migrations for speed and uses in-memory DB, which may affect certain migration-related behaviors.
# Django Testing with TDD Test-driven development for Django applications using pytest, factory_boy, and Django REST Framework. ## When to Activate - Writing new Django applications - Implementing Django REST Framework APIs - Testing Django models, views, and serializers - Setting up testing infrastructure for Django projects ## TDD Workflow for Django ### Red-Green-Refactor Cycle ```python # Step 1: RED - Write failing test def test_user_creation(): user = User.objects.create_user(email='test@example.com', password='testpass123') assert user.email == 'test@example.com' assert user.check_password('testpass123') assert not user.is_staff # Step 2: GREEN - Make test pass # Create User model or factory # Step 3: REFACTOR - Improve while keeping tests green ``` ## Setup ### pytest Configuration ```ini # pytest.ini [pytest] DJANGO_SETTINGS_MODULE = config.settings.test testpaths = tests python_files = test_*.py python_classes = Test* python_functions = test_* addopts = --reuse-db --nomigrations --cov=apps --cov-report=html --cov-report=term-missing --strict-markers markers = slow: marks tests as slow integration: marks tests as integration tests ``` ### Test Settings ```python # config/s
- When to Activate
- TDD Workflow for Django
- Red-Green-Refactor Cycle
- Setup
- pytest Configuration
- Test Settings
- conftest.py
- Factory Boy
- Factory Setup
- Using Factories
- Model Testing
- Model Tests
- View Testing
- Django View Testing
Run tests with coverage pytest --cov=apps --cov-report=html --cov-report=term-missing Generate HTML report open htmlcov/index.html
What does the django-tdd skill do?
Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
How do I install it?
Run `npx skills add vibeeval/vibecosystem --skill django-tdd --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From vibeeval/vibecosystem, a repository with 521 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
