Agent skill · Testing & QA

django-tdd

Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.

mturacgithub.com/mturacGitHub ↗
codexcopilotcursorMIT
Install
npx skills add mturac/everything-openai-codex --skill django-tdd --agent codex

Same command for any agent — swap --agent for claude-code, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 20 KB
Bundled scripts: none
Path: skills/django-tdd/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 84
Language: JavaScript

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Guides an AI agent to apply test-driven development practices to Django projects, covering pytest-django setup, Django REST Framework testing, and factory-based test data creation. It outlines a Red-Green-Refactor workflow, infrastructure setup, fixtures, factories, and test patterns for models, views, and DRF APIs, plus examples for mocking external services.

How it works

  • When to Activate lists scenarios like writing new Django apps, implementing DRF APIs, testing models/views/serializers, and setting up testing infra.
  • Provides a Red-Green-Refactor cycle with example code illustrating failing tests, creating models or factories, and refactoring while keeping tests green.
  • Setup section includes pytest configuration (pytest.ini), test settings (config/settings/test.py), and conftest.py with fixtures for timezone, users, authenticated clients, and API clients.
  • Factory Boy section shows factories for User, Category, Product, and a post-generation hook for tags, plus usage examples for creating products and batches.
  • Model Testing includes tests for User and Product models, slug generation, validation, active manager, stock management, and error handling.
  • View Testing covers Django view tests for listing, detail, login requirements, authenticated creation, and POST creation flow.
  • DRF API Testing includes serializer tests and API viewset tests for listing, retrieving, creating (auth required), updating, deleting, filtering by price, and search.
  • Mocking and Patching demonstrates mocking external services (e.g., Stripe) in view tests to simulate successful payments.

When to use it

  • Triggered when starting new Django projects or adding DRF APIs.
  • Use to set up a comprehensive testing strategy, from unit models to API endpoints, including test data factories and fixtures.

What it can touch

  • Files: pytest.ini configuration, DRF serializers, views, and API endpoints under apps.*, tests/, and factories under tests/factories.py.
  • Tools declared: codex, copilot, cursor

Caveats

  • License noted as MIT.
  • The content includes code examples and fixtures that assume specific project structure (e.g., apps.products, config.settings.test) and may require adaptation for a given codebase.
From the SKILL.md

# 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

What's inside
Steps it walks through
  1. When to Activate
  2. TDD Workflow for Django
  3. Red-Green-Refactor Cycle
  4. Setup
  5. pytest Configuration
  6. Test Settings
  7. conftest.py
  8. Factory Boy
  9. Factory Setup
  10. Using Factories
  11. Model Testing
  12. Model Tests
  13. View Testing
  14. Django View Testing
Commands it runs
Run tests with coverage
pytest --cov=apps --cov-report=html --cov-report=term-missing
Generate HTML report
open htmlcov/index.html
More from everything-openai-codex
All skills →
About this skill
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 mturac/everything-openai-codex --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 mturac/everything-openai-codex, a repository with 84 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.

Keep going