Django Outside-In TDD

SkillWeb & browsing

Drive Django features with outside-in and double-loop TDD: user story, Selenium or functional test, focused Django unit/integration tests, minimal implementation, and refactor. Use when starting or changing Django behavior with tests-first workflow, red/green/refactor, working-state-to-working-state refactors, or deciding which layer should own the next test.

Use Django Outside-In TDD in Claude, ChatGPT or Ahel Desktop

Free. Sign in, add Django Outside-In TDD and connect your AI. About a minute.

Also: Claude Code · Cursor · Codex

Then ask your AI: use the Django Outside-In TDD skill

Details

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Django Outside-In TDDStart free

What this skill tells your AI

The instructions your AI receives, as published by hashgraph-online/awesome-codex-plugins in plugins/LVTD-LLC/skills/skills/django-outside-in-tdd/SKILL.md and read by Ahel’s review.

Use this skill when a Django feature should be grown from observable user behavior down into views, forms, models, and helpers. Keep the outer test broad enough to prove user value and the inner tests small enough to keep the red/green loop fast.

Source Traceability

Primary source: Harry Percival, Test-Driven Development with Python, 3rd ed. Guidance is transformed and paraphrased from chapters 1-7, chapter 24, and Appendix A, especially the user-story-to-functional-test flow, double-loop TDD, working-state-to-working-state refactoring, and outside-in development.

Workflow

  1. Start from the user-visible behavior.

    • Write a short user story or acceptance note.
    • Choose one functional test only when the behavior crosses browser, routing, template, persistence, or integration boundaries.
  2. Run the outer test and make the failure useful.

    • Confirm the failure is expected and points to the next missing behavior.
    • Improve failure messages before implementation if the failure is vague.
  3. Drop into the inner loop.

    • Add the smallest Django test for the next missing component: URL, view, template context, form, model, or helper.
    • Use Django's test client, RequestFactory, form instances, or model tests at the narrowest useful boundary.
  4. Make the inner test pass with minimal code.

    • Avoid speculative data models, URLs, fields, and abstractions.
    • Keep a scratchpad of next ideas instead of implementing them early.
  5. Refactor only on green.

    • Refactor production code first, then test code.
    • Preserve behavior through the existing tests.
    • Return to the outer test to choose the next slice.

Read patterns.md for layer choices, refactoring rules, and failure-handling patterns.

Layer Choice

SignalNext Test
User workflow not provenFunctional test
URL or redirect missingURL/view test
Template output changedView/template integration test or HTML parser assertion
Validation rule unclearForm or model test
Domain helper emergingPlain Python unit test
Refactor crosses wiringOne integration test plus focused unit tests

Guardrails

  • Do not write production code before a failing proof unless the task is pure cleanup.
  • Do not keep adding Selenium coverage for every branch; promote detailed cases to faster tests.
  • Do not test constants or implementation details unless they are the public contract.
  • Prefer working state to working state over large rewrites.
  • Use existing green tests as a refactoring safety net before changing structure.

Verification

Before finishing, report:

  • Outer behavior covered or intentionally not needed.
  • Inner tests added, updated, or reused.
  • Red failure or characterization observed before implementation when behavior changed.
  • Focused Django test command and result.
  • Any deliberate no-test exception with replacement verification.

Signals

GitHub stars
1k
Forks
316
Last commit
Oct 2026
Advanced
Item type
skill
Key
django-outside-in-tdd
Source
github.com/hashgraph-online/awesome-codex-plugins