Agent skill · affaan-m

django-tdd

Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs. Use when writing Django or DRF tests with pytest-django, or driving a Django feature test-first.

What it needs

About 7k tokens when loaded.

What this skill does

Django Testing with TDD Test-driven development for Django applications using pytest, factoryboy, 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 Setup pytest Configuration Test Settings conftest.py Factory Boy Factory Setup Using Factories Model Testing Model Tests View Testing Django View Testing DRF API Testing Serializer Testing API ViewSet Testing Mocking and Patching Mocking External Services Mocking Email Sending Integration Testing Full Flow Testing Testing Best Practices DO Use factories: Instead of manual object creation One assertion per test: Keep tests focused Descriptive test names: testusercannotdeleteotherspost Test edge cases: Empty inputs, None values, boundary conditions Mock external services: Don't depend on external APIs Use fixtures: Eliminate duplication Test permissions: Ensure authorization works Keep tests fast: Use --reuse-db and --nomigrations DON'T Don't test Django internals: Trust Django to work Don't test third-party code: Trust libraries to work Don't ignore failing tests: All tests must pass Don't make tests dependent: Tests should run in any order Don't over-mock: Mock only external dependencies Don't test private methods: Test public interface Don't use production database: Always use test database Coverage Coverage Configu

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/django-tdd--b58372

View the source on GitHub

Browse the @skills marketplace