django-tdd

Run a TDD workflow for Django models, views, and DRF APIs with pytest-django.

1.8k|303|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/xu-xiang/everything-claude-code-zh --skill django-tdd-xu-xiang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-tdd
Source: https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/django-tdd
Command: npx skills add https://github.com/xu-xiang/everything-claude-code-zh --skill django-tdd-xu-xiang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Django projects often struggle to implement consistent, maintainable testing practices. This Skill provides a ready-to-run TDD workflow using pytest-django, factory_boy, mocks, and Django REST Framework to improve test reliability and development speed.

Core Features & Use Cases

  • Red-Green-Refactor workflow for Django apps to drive code quality.
  • Comprehensive test suites for models, views, serializers, and DRF APIs with fixtures and factories.
  • Guidance for integrating mocks, coverage tooling, and realistic data generation in tests.
  • Use Case: add unit and API tests to an existing Django project to ensure changes do not break behavior.

Quick Start

Install required Python packages (pytest-django, factory_boy, djangorestframework), configure a Django settings module for tests, and run the test suite (e.g., pytest).

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 a TDD workflow for Django and DRF?

You can test DRF APIs using pytest-django by writing comprehensive test suites for serializers and views, utilizing fixtures and factory_boy for realistic data generation to validate authentication and serialization workflows.

How do I use factory_boy and mocks to generate realistic data for Django tests?

You use factory_boy and mocks to generate realistic data for Django tests by defining model factories and substituting external dependencies, ensuring reliable and isolated test coverage for your applications.

Does this TDD workflow apply to existing Django projects needing API test coverage?

Yes, this TDD workflow applies to existing Django projects needing API test coverage, providing ready-to-run configurations to add unit and API tests that ensure code changes do not break existing behavior.

What is the best way to measure test coverage when using pytest-django?

The best way to measure test coverage when using pytest-django is to integrate coverage tooling directly into your test configuration, allowing you to track and improve code quality during the Refactor phase.