$npx skillfedfor your agent

django-tdd

Learn test-driven development for Django applications using pytest and factory_boy. This skill covers the red-green-refactor workflow, test configuration, fixture setup, and testing Django models, views, and REST Framework APIs with practical examples.

django-tdd teaches test-driven development with pytest, factory_boy, and Django REST Framework using the red-green-refactor cycle.

AI-generated summary based on this skill's SKILL.md

1,767 298 MITupdated by xu-xiang

Decision gist · record as of 2026-03-05

django-tdd teaches test-driven development with pytest, factory_boy, and Django REST Framework using the red-green-refactor cycle. Learn test-driven development for Django applications using pytest and factory_boy. This skill covers the red-green-refactor workflow, test configuration, fixture setup, and testing Django models, views, and REST Framework APIs with practical examples.

manual: git clone https://github.com/xu-xiang/everything-claude-code-zh → cp -r everything-claude-code-zh/skills/django-tdd ~/.claude/skills/django-tdd
skills/django-tdd/SKILL.md · version 45bc0d17

Use it when

  • django-tdd teaches pytest and factory_boy setup for Django testing.
  • django-tdd covers testing Django REST Framework APIs with serializers and viewsets.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

xu-xiang/everything-claude-code-zh/django-tdd · repository language: JavaScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is django-tdd and what testing approach does it teach?

django-tdd is a skill for learning test-driven development in Django applications using pytest and factory_boy. It covers the red-green-refactor workflow, test configuration, fixture setup, and testing Django models, views, and REST Framework APIs with practical examples. The skill emphasizes writing tests first, then implementing code to pass those tests.

How do I set up pytest and factory_boy for Django model and view testing?

django-tdd teaches pytest and factory_boy setup for Django testing. You'll learn to configure pytest-django, create factories for generating test data, and write unit tests for models and views. The skill covers fixture setup, test organization, and best practices for isolating components during testing.

How can I test Django REST Framework API endpoints and serializers?

django-tdd covers testing Django REST Framework APIs with serializers and viewsets. You'll learn to test API endpoints, validate serializer behavior, test viewset actions, and verify authentication and permissions. The skill includes practical examples for testing complete API workflows and client authentication scenarios.

What does the TDD test driven development django workflow involve?

django-tdd teaches the red-green-refactor cycle: write a failing test (red), implement minimal code to pass it (green), then refactor for quality. This methodology ensures comprehensive test coverage from the start and drives better design decisions. The skill demonstrates this cycle across models, views, and API endpoints.

How do I mock external services and measure code coverage in django-tdd?

django-tdd covers mocking external services like payment processors and email systems, plus setting up code coverage measurement. You'll learn to isolate dependencies, verify mock interactions, and configure coverage tools to identify untested code paths in your Django applications.

Can django-tdd help me write integration tests for complete workflows?

Yes, django-tdd includes integration testing for complete Django application workflows. You'll learn to test end-to-end scenarios combining models, views, and APIs, verify data persistence across components, and test real user interactions. This complements unit tests for comprehensive application validation.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

使用 TDD 进行 Django 测试

使用 pytest、factory_boy 和 Django REST Framework 对 Django 应用程序进行测试驱动开发(TDD)。

何时激活

  • 编写新的 Django 应用程序时
  • 实现 Django REST Framework API 时
  • 测试 Django 模型(Models)、视图(Views)和序列化器(Serializers)时
  • 为 Django 项目搭建测试基础设施时

Django 的 TDD 工作流

红-绿-重构(Red-Green-Refactor)周期
# 步骤 1: 红(RED) - 编写失败的测试
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

# 步骤 2: 绿(GREEN) - 使测试通过
# 创建 User 模型或工厂

# 步骤 3: 重构(REFACTOR) - 在保持测试通过的同时改进代码

配置

pytest 配置
# 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: 标记为慢速测试
    integration: 标记为集成测试

(truncated - see the full file via the links below)

File tree — 1 file
skills/django-tdd/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Learn TDD methodology and red-green-refactor cycle for Django development”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

django-tdd
by affaan-m · affaan-m/ECC

Master test-driven development for Django projects using pytest and factory_boy to build reliable models, views, and APIs. This skill covers the red-green-refactor cycle, test fixtures, factory patterns, and Django REST Framework testing.

MITupdated Jul 2026
★ 234,207repo stars
Pytest Patterns
by hieutrtr · hieutrtr/ai1-skills

Pytest Patterns teaches structured testing for Python backends using pytest, httpx, and factory_boy. Learn to organize tests across unit and integration layers, build reusable fixtures with proper scoping, seed test data with factories, and test async FastAPI endpoints. Covers mocking, parametrization, and conftest hierarchy—but skips frontend and E2E testing.

no license declared → metadata onlyupdated Feb 2026
★ 8repo stars
django-drf
by Gentleman-Programming · Gentleman-Programming/Gentleman-Skills

Learn proven Django REST Framework patterns for building scalable APIs. This skill covers ViewSets, Serializers for different operations, filtering strategies, custom permissions, pagination setup, and routing conventions. Includes testing patterns and common management commands.

MITupdated Mar 2026
★ 604repo stars
pytest
by bobmatnyc · bobmatnyc/claude-mpm-skills

pytest is Python's standard testing framework, enabling developers to write organized unit and integration tests through fixtures for dependency injection and parametrization for data-driven test cases. It supports async code, multiple test discovery patterns, and integrates seamlessly with FastAPI, Django, and Flask, plus a rich plugin ecosystem for coverage, mocking, and parallel execution.

MITupdated Jul 2026
★ 62repo stars
Pytest Patterns
by manutej · manutej/luxor-claude-marketplace

Pytest Patterns teaches you to write reliable Python tests using pytest's core features—fixtures for setup and teardown, parametrization to run tests with multiple inputs, and mocking to isolate dependencies. Learn test organization, coverage analysis, and CI/CD integration to scale from simple unit tests to complex test suites.

no license declared → metadata onlyupdated Jun 2026
★ 61repo stars
python-testing
by xu-xiang · xu-xiang/everything-claude-code-zh

Learn to build robust Python tests using pytest with test-driven development principles. This skill covers fixtures for setup and teardown, parametrization for running tests across multiple inputs, mocking to isolate dependencies, and achieving meaningful code coverage targets.

MITdocs in Chineseupdated Mar 2026
★ 1,767repo stars

More skills Pytest Async Testing (unlicensed)

Tags
unit-testingtest-automationquality-assurancecontinuous-integrationcode-coveragered-green-refactorapi-validationmock-patchingtest-fixturesintegration-testing