Files
prompts/src/personal_mcp/docs/prompts/pytest-scaffold/PROMPT.md
T
2026-08-07 21:07:23 -05:00

3.2 KiB

icon, prompt
icon prompt
lucide/messages-square
version description tags arguments
1.0.0 Plan and optionally scaffold pytest file and class structure for selected Python modules.
pytest
testing
scaffolding
prompts
target_modules mode path_strategy naming_style
description required
Target module paths under src/. true
description required choices
Whether to plan only or create scaffold files. true
plan-only
scaffold
description required
Optional src-to-tests path mapping preference. false
description required
Optional concise test naming preference. false

Pytest Scaffold

Use this prompt to consistently plan and scaffold pytest test modules for selected Python source modules.

Supplied Inputs

  • target_modules: {{target_modules}}
  • mode: {{mode}}
  • path_strategy: {{path_strategy}}
  • naming_style: {{naming_style}}

Inputs

  • Required:
    • target_modules: one or more module paths under src/
    • mode: one of plan-only or scaffold
  • Optional:
    • path_strategy: preference for how source paths map into tests/
    • naming_style: preference for concise method naming style

Required References

Load these in order and apply only the relevant sections:

  1. Primary conventions: Pytesting Skill
  2. Hierarchy and naming: Naming and Organization
  3. Marker and fixture defaults: Pytest Docs Notes

Workflow

  1. Inspect the current tests/ layout and infer existing naming and grouping conventions.
  2. Propose a concise hierarchy plan first:
    • test file paths
    • class hierarchy
    • method naming pattern
    • fixture placement choices (tests/conftest.py or subtree conftest.py)
  3. If mode is scaffold, implement only the scaffold structure:
    • create missing test modules
    • create class hierarchy
    • add one-line docstrings to each class and test method
    • keep test method names short and behavior-focused
  4. Treat docstring-only scaffolds as an intentionally stable baseline for later fill-in work.
  5. Validate collection with:
    • uv run pytest --collect-only -q
  6. Report outcomes:
    • files created or updated
    • collection result
    • ambiguities and follow-up choices

Naming Defaults

  • Class naming:
    • Test as a top-level subject class
    • nested Test classes where extra context improves readability
    • Test top-level classes for standalone module functions
  • Method naming:
    • test_<short_outcome>
    • one behavior target per method
    • one-line docstring for full intent

Authoring Rules

  1. Keep scope focused on structure and naming in this prompt.
  2. Do not fill test implementation details unless explicitly requested.
  3. Preserve established repository conventions when they are already present.
  4. If input constraints conflict, ask one concise clarifying question before editing.

Output Contract

Return:

  1. Discovery summary and references used.
  2. Proposed or applied test tree.
  3. Class and method naming map.
  4. Validation command result.
  5. Open questions only when they block completion.