Treatment Backend Planner
This is a planning skill, shared across Codex, OpenCode, and Claude Code. Produce an actionable design based on verified repository evidence; do not modify application code or execute migrations in planning mode unless explicitly requested.
Discover and verify context
- Identify the requested outcome, acceptance criteria, working branch, target branch (if relevant), and intended deployment environment. Do not assume
productionordevelopmentbranch names. Checkgit statusand refs before comparing. Never overwrite uncommitted work. - Read the relevant existing product/business documents (Persian) and technical/quality documents (English) when available. If missing, flag exactly which documentation is missing; do not invent business requirements.
- If Graphify is installed and an applicable current graph is available, optionally use
graphify query,path, orexplainto orient; never require Graphify. If unavailable or stale, search the relevant source, migrations, settings and tests directly. Treat graphs as hints, not evidence. - Verify classes, call sites, permissions, data flows, configuration, database constraints and external dependencies in actual source code.
- Determine Python/Django/runtime versions from active project configuration and lock files. Report inconsistencies; do not hard-code historical framework versions.
- For branch comparisons use the actual user-specified source and destination refs; distinguish commit history from working-tree changes. Do not fetch remote refs without considering user authorization/network availability.
Architecture and change-impact review
- Identify owning app and boundaries; avoid unnecessary abstractions or cross-app coupling. Apply SOLID and clean layering pragmatically, not mechanically.
- Verify public API contracts (routes, serializers, field types, status/error formats, pagination, filtering), compatibility with frontend/PWA, and authentication/authorization/tenant isolation.
- Analyze ORM query costs, N+1, transactions and locks, constraints, concurrency, data consistency, migration ordering, and reversibility.
- Include async and external effects (Celery retries and idempotency,
transaction.on_commit, cache invalidation, Elasticsearch/index synchronisation, HTTP timeouts and errors, SMS gateways). - Analyze observability, security and secrets, operations, rollout, rollback, feature flags and deployment sequencing as relevant.
- Separate verified current behavior, documented intended behavior, proposed change, and open questions. Clearly identify any mismatch.
- Consider testability and existing testing infrastructure; no real third-party/SMS/Celery dispatch in routine automated tests.
Required output
Produce a decision-complete plan with:
- Scope, objective, constraints and acceptance criteria.
- Evidence and relevant source paths, plus source/target revision when used.
- Current architecture/data flow and proposed architecture/data flow, with ownership of components.
- Ordered implementation steps, affected public interfaces, and compatibility measures.
- Migration/backfill strategy, failure handling, observability, rollout and rollback (if applicable).
- Explicit Unit/Integration/API/E2E/Smoke (FireTest), migration, security and performance scenarios proportional to risk.
- Documentation updates needed and affected documentation pages.
- Uncertainties, assumptions, trade-offs and blocked decisions; ask targeted questions only when necessary.
Skill collaboration
- When
treatment-django-engineerinvokes this skill, return the plan first; the engineer owns implementation, integration and final reporting. - Recommend
django-product-documentationto update impacted documentation andtreatment-backend-testingto implement tests, but do not claim these skills ran unless found and actually invoked/read. - If a dependent skill is absent, record the missing dependency and provide a usable fallback plan without fabricating its rules.
- This skill does not automatically run on every trivial typo or formatting change; tailor planning effort to impact.
Non-negotiable safeguards
Never invent domain policies, data models, undocumented API behavior, or test results. No silent destructive database operations, commits, deployment, or changes to unrelated files. Do not claim coverage, build, migration, or integration success without executing and measuring it.