Skip to content
Back to skills

Django Tdd

ASecurity

Use when django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs. Only for Django — not for other frameworks. Triggers on \"django-tdd\", \"django tdd\".

  • 2 stars
  • 0 votes
  • 2 copies
  • 4 views
  • Added September 19, 2026
ai-agentsrustgobashdjangospringtestingapidatabase

Works with

  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add majinmagros/magros.ai-skills --skill django-tdd --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Django Tdd?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Django Tdd
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majinmagros-django-tdd/badge)](https://www.skillsdirectory.com/skills/majinmagros-django-tdd)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: django-tdd
description: "Use when django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs. Only for Django — not for other frameworks. Triggers on \"django-tdd\", \"django tdd\"."
metadata:
  origin: ECC
---

# Django Testing with TDD

Test-driven development for Django applications using pytest, factory_boy, 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

## When NOT to Use

- Other frameworks (use `laravel-tdd`, `quarkus-tdd`, `springboot-tdd`, etc.)
- Django architecture in general (use `django-patterns`)
- Django verification loop (use `django-verification`)

## Contents

| Topic | Reference |
|---|---|
| TDD cycle, pytest config, conftest | `references/tdd-setup.md` |
| Factories, model tests | `references/factories-models.md` |
| View tests, DRF serializer/API tests | `references/views-drf.md` |
| Mocking, integration tests | `references/mocking-integration.md` |

## Testing Best Practices

### DO

- **Use factories**: Instead of manual object creation
- **One assertion per test**: Keep tests focused
- **Descriptive test names**: `test_user_cannot_delete_others_post`
- **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 Configuration

```bash
# Run tests with coverage
pytest --cov=apps --cov-report=html --cov-report=term-missing

# Generate HTML report

Files in this skill

  • SKILL.md2.2 KB
  • references/factories-models.md4.7 KB
  • references/mocking-integration.md3.5 KB
  • references/tdd-setup.md2.7 KB
  • references/views-drf.md7.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.