django-tdd

Establish TDD workflows for Django apps and DRF APIs using pytest, factories, and mocked dependencies.

1|Updated May 11, 2026
One-click install
npx skills add https://github.com/skalanux/puntofiles --skill django-tdd-skalanux
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-tdd
Source: https://github.com/skalanux/puntofiles/tree/main/dot_agents/skills/django-tdd
Command: npx skills add https://github.com/skalanux/puntofiles --skill django-tdd-skalanux

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps developers prevent regressions and reduce debugging time by establishing a consistent test-first workflow for Django and Django REST Framework projects.

Core Features & Use Cases

  • TDD with a Red-Green-Refactor loop: Write failing tests first, implement the minimal code to pass, then refactor while keeping confidence high (e.g., adding a new model method or endpoint behavior).
  • pytest-django test infrastructure: Configure fast, deterministic test runs using in-memory SQLite, disabled migrations, and useful markers for slow/integration tests.
  • Factories, mocking, and DRF API tests: Use factory_boy for realistic test data, patch external services (like payment providers), and validate DRF serializers/viewsets through authenticated and unauthenticated request flows.
  • Coverage guidance: Define coverage goals for models, serializers, views, services, and overall code health.

Quick Start

Ask the AI to generate a complete pytest-django TDD scaffold for a Django REST API that includes settings for fast tests, factory_boy fixtures, and example model/view/DRF tests with mocking.

Frequently Asked Questions about django-tdd

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

FAQPage Schema
How do I set up pytest-django for test-driven development with a REST API?

To set up pytest-django for test-driven development, configure fast, deterministic test runs using in-memory SQLite, disabled migrations, and useful markers for slow or integration tests to support a structured Red-Green-Refactor workflow for DRF API endpoints.

What is the best way to generate realistic test data for Django models and DRF serializers?

The best way to generate realistic test data for Django and DRF serializers is using factory_boy. It provides robust fixtures for deterministic data generation, essential for validating authenticated and unauthenticated request flows in API tests.

How do I mock external services like payment providers in Django REST Framework tests?

To mock external services like payment providers in Django REST Framework tests, patch external dependencies within your test suite. This isolates DRF viewsets and serializers, ensuring deterministic test runs without relying on live third-party API responses.

Can I use test-driven development to define coverage goals for Django views and serializers?

Yes, you can use test-driven development to define coverage goals for Django views and serializers. A test-first workflow includes setting specific coverage targets for models, serializers, views, services, and overall code health to catch regressions early.

Why does my TDD Red-Green-Refactor loop fail when extending Django models?

Your TDD Red-Green-Refactor loop may fail when extending Django models if the test infrastructure lacks deterministic setups. Ensure you use factory-generated data, proper pytest fixtures, and mocked external dependencies to maintain high confidence during refactoring.