django-tdd
- Repo stars 0
- Author updated Live
- Author repo skills-registry
- Domain
- AI
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @tomevault-io · no license declared
- Token usage
- Lean
- Setup complexity
- Plug-and-play
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- Python
- Permissions
-
- Read-only
- Write / modify
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: django-tdd
description: Applies Django testing strategies with pytest-django, TDD, factory_boy, mocking, coverage, and D…
category: ai
runtime: Python
---
# django-tdd output preview
## PART A: Task fit
- Use case: Applies Django testing strategies with pytest-django, TDD, factory_boy, mocking, coverage, and DRF test patterns. Use when this capability is needed. RED → Write failing test first runs entirely locally; runs on Python. Works with Claude Code, Cursor, Cline and 23 more..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Contents / When to Use / TDD Workflow” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Applies Django testing strategies with pytest-django, TDD, factory_boy, mocking, coverage, and DRF test patterns. Use when this capability is needed. RED → Write failing test first runs entirely locally; runs on Python. Works with Claude Code, Cursor, Cline and 23 more.”.
- **02** When the source has headings, the agent prioritizes “Contents / When to Use / TDD Workflow” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files.
Start with a small task and check whether the result follows “Contents / When to Use / TDD Workflow”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: django-tdd
description: Applies Django testing strategies with pytest-django, TDD, factory_boy, mocking, coverage, and D…
category: ai
source: tomevault-io/skills-registry
---
# django-tdd
## When to use
- Applies Django testing strategies with pytest-django, TDD, factory_boy, mocking, coverage, and DRF test patterns. Use…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Contents / When to Use / TDD Workflow” and keep inference separate from source facts.
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "django-tdd" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Contents / When to Use / TDD Workflow
rules -> SKILL.md triggers / order / output contract
runtime -> Python | read files, write/modify files | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} Django Testing with TDD
Contents
When to Use
- Writing new Django applications
- Implementing Django REST Framework APIs
- Testing Django models, views, and serializers
- Setting up testing infrastructure for Django projects
TDD Workflow
Red-Green-Refactor Cycle
RED → Write failing test first
GREEN → Write minimal code to pass
REFACTOR → Improve while keeping tests green
REPEAT → Continue with next requirement
Example
# Step 1: RED - Write failing test
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')
# Step 2: GREEN - Make test pass (implement User model)
# Step 3: REFACTOR - Improve while keeping tests green
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-dband--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
Running Coverage
# Run tests with coverage
pytest --cov=apps --cov-report=html --cov-report=term-missing
# Generate HTML report
open htmlcov/index.html
Coverage Targets
| Component | Target |
|---|---|
| Models | 90%+ |
| Serializers | 85%+ |
| Views | 80%+ |
| Services | 90%+ |
| Utilities | 80%+ |
| Overall | 80%+ |
Quick Reference
| Pattern | Usage |
|---|---|
@pytest.mark.django_db |
Enable database access |
client |
Django test client |
api_client |
DRF API client |
factory.create_batch(n) |
Create multiple objects |
patch('module.function') |
Mock external dependencies |
override_settings |
Temporarily change settings |
force_authenticate() |
Bypass authentication |
mail.outbox |
Check sent emails |
Common Test Patterns
# Test with factory
def test_product_creation():
product = ProductFactory(price=100.00)
assert product.price == 100.00
def test_product_validation():
product = ProductFactory.build(price=-1)
with pytest.raises(ValidationError):
product.full_clean()
def test_payment(mock_stripe, client, user):
mock_stripe.Charge.create.return_value = {'status': 'succeeded'}
# ... test payment flow
References
- Setup — pytest config, test settings, conftest
- Factory Examples — Factory Boy patterns
- Test Examples — Model, view, serializer, API tests
- Mocking & Integration — Mocking patterns and integration tests
Source: basidiocarp/lamella — distributed by TomeVault.
Decide Fit First
Design Intent
How To Use It
Boundaries And Review