Instruction file imported from nestorrd/python-ai-assisted-dev-sample (
.github/instructions/app.instructions.md). Copyright stays with the author.
applyTo: "app/*.py"
Development Workflow for App Code
When adding or modifying any code in app/, always follow the TDD (Test-Driven Development) workflow using the tdd-python skill.
Mandatory TDD Requirement
No production code may be written without a failing test first. For every new function, class, or behaviour:
- Invoke the
tdd-pythonskill and follow its Red-Green-Refactor cycle exactly. - Write the failing test in
tests/before touching any file inapp/. - Only write the minimum production code needed to make the test pass.
- Refactor only when all tests are green.
Coverage Goals
- Aim for 100% line and branch coverage of all code in
app/. - Every public function and every code branch (including error paths, edge cases, and guard clauses) must have at least one dedicated test.
- After implementing a feature, run
pytest --cov=app --cov-branch --cov-report=term-missingand address any uncovered lines before considering the work done.
What Must Be Tested
- Happy paths: typical valid inputs producing expected outputs.
- Error paths: invalid inputs, missing files, malformed data — anything that raises an exception or returns an error.
- Edge cases: empty inputs, zero values, boundary conditions.
- All branches: every
if/elif/elseandtry/exceptblock.
Workflow Summary
1. Read the requirement.
2. List all behaviours as bullet points.
3. For each behaviour → run one full Red-Green-Refactor cycle (tdd-python skill).
4. After all cycles → run pytest --cov=app --cov-branch --cov-report=term-missing.
5. For any uncovered line → add a test and repeat the cycle.