AGENT SKILL

django-outside-in-tdd

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.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 1.6k
Forks
491

01 前言 Front Matter

name
django-outside-in-tdd
license
MIT
metadata
{ "tags": "django,tdd,testing,functional-tests,unit-tests", "version": "0.1.0", "category": "Django", "displayName": "Django Outside-In TDD" }
description
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.
compatibility
Codex, Claude Code, and other Agent Skills-compatible clients.

02 资源文件 3

03 SKILL.md 正文

Django Outside-In TDD

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

Signal Next Test
User workflow not proven Functional test
URL or redirect missing URL/view test
Template output changed View/template integration test or HTML parser assertion
Validation rule unclear Form or model test
Domain helper emerging Plain Python unit test
Refactor crosses wiring One 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.

04 同仓库更多 Skills

hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-review-with-annotations

Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-find-and-synthesize-context

Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-update-docs

Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-manage-records

Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-manage-interactive-html

Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-collaborate-threads

Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.

★ 1.6k