python-plan-authoring
Author a nontrivial Python implementation contract from intent and inspected facts; exclude isolated trivial edits.
Files5
View on GitHubSKILL.mdskills/python-plan-authoring/SKILL.md
GitHubPurpose
Turn Python implementation intent into a review-ready *.plan.md plus required plan/<topic>/<topic>.step.md that freeze scope, decisions, affected files, tests, and validation commands before any code changes begin. The plan is an executable implementation contract, not a todo list.
Trigger / When to use
Use this skill when:
- a Python feature, refactor, or bug fix needs a frozen contract before coding starts
- the task touches more than one file or module and scope clarity is needed before coding
- multiple interfaces will be modified and the dependency order must be declared
- explicit decision records are required (module placement, API shape, error strategy, typing)
- a reviewer must be able to verify completed work against a written contract
Do not use this skill when:
- the change is trivial and isolated (e.g., fix a typo, rename a single constant)
- the task is to execute or review an existing plan
- no Python code is involved
- the request is for a generic project management or release plan unrelated to Python implementation
Inputs
- the feature, change, or bug fix being planned
- the relevant current codebase context (existing modules, packages, public APIs)
- D1 structured verdict when available:
{ "verdict": "trivial|non-trivial", "reason": "..." } - project evidence and user intent for decision points (module placement, API shape, breaking changes, dependencies, error handling, typing)
- measurable requirements for the change
- relevant Non-goals stating what this change will NOT do
- test strategy signals (expected test categories and test file location)
- the project's existing validation commands or config files (
pyproject.toml,Makefile,README) - async-capable evidence and async baseline inputs when the request changes async boundary, lifecycle, concurrency, failure, or cancellation behavior
- any open questions the author cannot resolve alone
Process
Stop-and-ask conditions
First inspect the relevant code and project configuration and use the user's stated scope. The author supplies executable steps and proposes decisions grounded in that evidence; the user need not prewrite the plan. Ask only when unresolved alternatives would materially change scope, public behavior, breaking-change permission, dependencies, safety, or async ownership. Record supported decisions and sources; never silently choose among conflicting contracts. Missing noncritical details may produce an INCOMPLETE draft with named gaps. Do not hand off a contract-critical TBD for implementation. For triggered async work, gather and freeze the required async baseline before implementation approval.
Authoring steps
Confirm this is a Python implementation planning task. If the request is execution or review, stop and redirect.
Detect whether the request is async-capable and make that decision reviewable in the plan artifact.
- Under
## Decisions, add a required- Async-planning status:line before the seven standard decision bullets. - Use
triggered — cite trigger evidence: ...when the request introduces async boundary, pooled resources, background ownership, external I/O concurrency choice, retry / timeout / cancellation policy, or sync-to-async conversion. - Use
exempt — cite exemption evidence: ...when the topic falls under an allowed exemption such as syntax-only async teaching, a single missingawait, typing-only work, or other cases with no planning-stage async risk. - This repo-visible status line is the contract. Do not treat skill invocation itself as evidence.
- Under
If any stop-and-ask condition is triggered, ask the user for the missing detail before drafting.
Produce a
*.plan.mdwith exactly these 13 sections in order:1. Goal State the single concrete outcome this change achieves. One or two sentences.
2. Non-goals List relevant scope exclusions stating what this change will NOT do. Examples: no full module refactor, no CLI change, no new external dependency, no performance work.
3. Current Context Briefly describe the relevant existing code, module, or system state. Name the files, classes, or functions that provide context for the change.
4. Requirements List measurable requirements. Each item must be verifiable in tests or validation output.
5. Decisions Record the async-routing decision plus answers to all 7 standard decision points before drafting the rest of the plan:
- Async-planning status:
triggeredorexempt, with cited repo-visible trigger or exemption evidence - Module/package placement: which module or package receives the new code
- New public API: yes/no — name and signature if yes
- Interface changes: yes/no — which interfaces and how
- Breaking changes allowed: yes/no — reason if yes
- New dependencies: yes/no — name and version if yes
- Error handling strategy: which exceptions are raised and when
- Typing strategy: fully typed, use of
Any, use ofTypeVarorProtocol, etc.
When
Async-planning statusistriggered, the plan artifact must append these exact subsections under## Decisionsin this exact order:### Async boundary decision### Resource lifecycle decision### Concurrency model### Failure model### Cancellation / timeout policy### Validation plan### Handoff notes for the implementer
When the status is
exempt, keep theAsync-planning statusline and its exemption citation in## Decisions; do not leave exemption reasoning implicit anywhere else.If request, baseline, or review notes conflict on async applicability or on an async decision, add
### Async contradiction lograther than smoothing the conflict over. If the contradiction is discovered in an already-started plan, treat the repair asretrofit required.6. Public Contract / API Changes Describe new or changed public functions, classes, or methods. Include signatures, parameters, return types, exceptions, and backward compatibility notes. If no public API changes, state explicitly.
7. Affected Files / Modules Use the following format:
Likely affected files: - src/xxx/yyy.py - tests/test_yyy.py Candidate files to inspect: - src/...8. Implementation Steps Numbered, executable steps with explicit file references. Each step names a specific file and a specific action. NOT:
"Refactor the validation module."YES:"1. Open src/utils/validation.py. Add validate_email(email: str) -> bool below existing validators."9. Test Plan Name the relevant test files and assess each category below; mark a category N/A with a concrete reason when no affected behavior needs it. Do not add redundant tests solely to fill categories:
- Happy path
- Invalid input
- Edge case
- Regression
- Backward compatibility
For async-capable topics, make the test plan and validation plan consistent with the async-planning subsections. If cancellation, timeout, grouped failure, or resource cleanup are part of the async baseline, name them explicitly here.
10. Validation Commands Either explicit commands:
pytest tests/test_xxx.py -v mypy src/xxx/yyy.py ruff check src/Or reference the project config:
Use existing project validation commands from pyproject.toml / Makefile / README.11. Risks Name at least one concrete risk. Examples:
"may affect existing public API callers","adds a regex that could introduce import-time cost","type annotation changes may break downstream stubs".12. Rollback Plan State how to undo the change. At minimum: name the changed files and how to revert them (e.g.,
"revert via git: src/xxx/yyy.py, tests/test_yyy.py").13. Open Questions List unresolved questions and who can answer them. State
"None"if all questions are resolved.- Async-planning status:
Produce
plan/<topic>/<topic>.step.mdalongside the*.plan.mdusingtemplates/step-template.mdas the canonical scaffold, then mirror every numbered item from## Implementation Stepsas pending- [ ]entries.Keep
plan-step-tracker/reference.mdas the read-only format authority. Do not omit any of the 6 Workflow Stages, and do not use lowercase[x]to mark completed work.If D1 verdict is
non-trivial, produceplan/<topic>/<topic>.spec.mdas a required co-artifact using this 3-part structure:Acceptance CriteriaBehavioral Scenarios(Given/When/Then)Error / Edge Cases
Use
templates/spec-template.mdas the canonical authoring scaffold.Verify the plan before handoff:
- All 13 sections are present in order.
DecisionsincludesAsync-planning statusplus all 7 required standard items.Non-goalslists relevant scope exclusions.Implementation Stepsare executable and reference specific files.plan/<topic>/<topic>.step.mdexists, includestopic,phase: plan-authoring, andcreated, and mirrors every numbered Implementation Step as- [ ].- If D1 verdict is
non-trivial,plan/<topic>/<topic>.spec.mdexists and includes all three required sections. Test Planaddresses applicable test categories and justifies N/A categories.Validation Commandsare present or reference a project config.RisksandRollback Planname concrete items, not placeholders.- If
Async-planning statusistriggered, the exact async-planning subsections and contradiction handling are present in the plan text itself. - If
Async-planning statusisexempt, the exemption citation is explicit in that same line and can be reviewed from plan text alone.
Stop at
review-ready. Do not execute or approve the plan.
Examples
Positive — validate_email() feature plan with all 13 sections present and correctly filled:
Decisionsbegins with- Async-planning status: exempt — cite exemption evidence: synchronous validation helper with no async boundary, lifecycle, timeout, or concurrency change.Decisionsthen namessrc/utils/validation.pyas the target module, states the signaturevalidate_email(email: str) -> bool, confirms no breaking changes, no new dependencies, raisesValueErroron malformed input, and uses fully-typed annotations.Non-goalsstates: no changes to the existingvalidate_url()function, no CLI command added, no external dependency introduced.Implementation Stepssay:"1. Open src/utils/validation.py, add validate_email(email: str) -> bool below existing validators. 2. Raise ValueError('Invalid email format') for malformed input. 3. Add tests/test_validation.py::test_validate_email_happy_path and four additional test cases."
Positive — async-capable orchestration plan:
- The request introduces
AsyncSession,httpx.AsyncClient, and a timeout budget. Decisionsbegins with- Async-planning status: triggered — cite trigger evidence: AsyncSession, httpx.AsyncClient, concurrent upstream I/O, and a 2-second timeout budget.Decisionsstill answers the normal 7 planning questions.- The same
## Decisionssection then appends### Async boundary decision,### Resource lifecycle decision,### Concurrency model,### Failure model,### Cancellation / timeout policy,### Validation plan, and### Handoff notes for the implementerbefore implementation begins.
Negative — plan that triggers needs-rework:
Decisionsis omitted entirely — the plan jumps straight to Implementation Steps without stating where the code lives or what the API is.Non-goalsis absent — scope is unbounded.- Async-capable evidence such as
AsyncClientor a queue worker is present, but the plan omitsAsync-planning status, omits the async-planning subsections, or claims exemption without a cited reason and expects the implementer to decide later.
Outputs
- a
*.plan.mdwith all 13 required sections in order - a required
plan/<topic>/<topic>.step.mdco-artifact with the canonical step-tracking template - when D1 verdict is
non-trivial, a requiredplan/<topic>/<topic>.spec.mdco-artifact with the 3-part spec structure - frozen decisions, affected files, test plan, and validation commands recorded before coding begins
- required async-planning subsections for async-capable topics
- explicit stop-and-ask questions when required information is missing
- a contract that executor can follow step-by-step and reviewer can verify against
Validation
Required Checks
- All 13 required sections are present and in order
plan/<topic>/<topic>.step.mdis produced alongside the plan and containstopic,phase: plan-authoring, andcreated- when D1 verdict is
non-trivial,plan/<topic>/<topic>.spec.mdis produced alongside plan/step artifacts and follows the required 3-part structure Decisionssection addresses all 7 required items (no TBD placeholders in contract-critical fields)Decisionsincludes a reviewableAsync-planning statusline with cited trigger or exemption evidenceNon-goalslists relevant scope exclusionsImplementation Stepsreference specific files and executable actions*.step.mdincludes the executor note, all 6 Workflow Stages, and mirrored## Implementation Stepsentries initialized as- [ ]Test Planassesses applicable categories (or gives a reason for N/A): happy path, invalid input, edge case, regression, backward compatibilityValidation Commandsare present or explicitly reference a project config file- async-capable topics with
Async-planning status: triggeredinclude the exact async-planning subsections - exempt topics still cite the exemption explicitly in
Async-planning status
Quality Checks (best effort)
Risksnames a concrete risk, not a placeholderRollback Plannames specific files and revert methodOpen Questionseither lists items with owners or explicitly statesNone*.step.mdstays format-compatible with the read-only rules inplan-step-tracker/reference.md- Step granularity is sufficient for a reviewer to verify completion without ambiguity
- async-capable topics make cancellation, timeout, resource ownership, and concurrency choices explicit enough for an implementer to follow
On Soft Fail
- mark output plan as INCOMPLETE
- list which section, decision point, or async baseline item is missing or vague
- continue with best-effort draft of all remaining sections
- do not block output if only soft conditions are unmet
Failure Handling
Missing Context
- BLOCKED for unresolved contract-critical choices after inspection; identify the conflicting alternatives and ask. Missing discoverable facts alone are not a reason to require the user to prewrite a plan
- mark any drafted section that relies on missing context as INCOMPLETE
Ambiguous Requirement
- if ambiguity is blocking (would change module placement, API shape, breaking-change decision, or async boundary / lifecycle ownership): stop and ask before proceeding
- if ambiguity is non-blocking: proceed with stated assumption, list it explicitly in the plan's Open Questions section
Execution Limitation
- if codebase context is unavailable: state the limitation explicitly; use placeholder file paths clearly marked as
<to be confirmed> - do not present invented codebase facts as observed; clearly distinguish supported proposals from existing contracts
Boundaries
- Do not execute the plan.
- Do not approve or mark the plan as complete.
- Do not invent existing facts or silently change user-approved contracts; proposals must be grounded in inspection and explicit scope.
- Do not skip required sections or merge sections together.
- Turn intent into concrete Implementation Steps using inspection; ask only about remaining material choices.
- Do not pad Non-goals to meet a count; require explicit, relevant scope exclusions.
- Do not treat this skill as a generic project planning tool for non-Python work.
- Do not treat
*.step.mdas optional when producing a*.plan.md. - Do not treat
*.spec.mdas optional when D1 verdict isnon-trivial. - Do not let async-capable topics skip the triggered async baseline or defer async boundary decisions to the implementer; use
python-async-planningonly as a routing aid when needed. - Do not leave async applicability implicit; every plan must record
Async-planning statusin## Decisions.
Local references
examples.md: complete positive examples, async-capable routing examples, anti-pattern plans, and stop-and-ask casestemplates/python-plan-template.md: blank 13-section template for executor copy-paste use, including the conditional async-planning scaffoldtemplates/spec-template.md: canonical 3-part spec template for mandatory non-trivial co-artifact authoringtemplates/step-template.md: canonical step-tracking template for requiredplan/<topic>/<topic>.step.mdco-artifact