django-tdd

Automates TDD workflows for Django apps using pytest and DRF.

1|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/riftzen-bit/gemini-setup --skill django-tdd-riftzen-bit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-tdd
Source: https://github.com/riftzen-bit/gemini-setup/tree/main/skills/django-tdd
Command: npx skills add https://github.com/riftzen-bit/gemini-setup --skill django-tdd-riftzen-bit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill reduces fragile, slow, or missing tests in Django projects by providing a clear test-driven development workflow and practical patterns to write fast, maintainable tests that catch regressions early.

Core Features & Use Cases

  • Red-Green-Refactor TDD Workflow: Write failing tests first, implement minimal code, then refactor while keeping tests green.
  • pytest & pytest-django Configuration: Reuse-db, nomigrations, coverage reporting, and fast test settings for CI and local runs.
  • Factories, Fixtures & Mocking: Examples using factory_boy, fixtures for users/clients, DRF APIClient usage, and patching external services for integration tests.
  • Use Case: Validate a Django REST Framework Product API end-to-end with serializer, viewset, and permission tests, while ensuring >80% coverage for critical services.

Quick Start

Use the django-tdd skill to write a failing pytest for a DRF Product endpoint, implement the minimal serializer and viewset to make it pass, and run tests with coverage.

Frequently Asked Questions about django-tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Django REST Framework API tests using pytest?

Django REST Framework API tests using pytest validate endpoints end-to-end by testing serializers, viewsets, and permissions. You use the DRF APIClient to simulate requests and ensure your Product API behaves correctly.

What is the best way to configure pytest-django for fast test runs in CI?

Configuring pytest-django for fast test runs involves using reuse-db, nomigrations, and in-memory SQLite test settings. This setup minimizes database overhead during CI pipelines while maintaining reliable automated test execution for your Django project.

How do I use factory_boy to create test fixtures for Django models?

Factory_boy creates test fixtures for Django models by generating model instances with default or overridden attributes. This streamlines test data generation for models and serializers without manual fixture creation.

Can I mock external services in Django integration tests with pytest?

You can mock external services in Django integration tests by patching service calls within your pytest test functions. This isolates external dependencies, allowing you to validate internal business logic and API endpoints without relying on live third-party services.

Does test-driven development with pytest work for existing Django projects?

Test-driven development with pytest works for existing Django projects by applying the Red-Green-Refactor workflow to new features. You write failing tests first, implement minimal code to pass, and refactor while keeping tests green to catch regressions early.

How do I generate coverage reports for Django tests using pytest?

Generating coverage reports for Django tests using pytest involves configuring pytest-django with coverage reporting settings. This ensures you track test coverage percentages, helping you maintain over 80% coverage for critical services during feature development.