name: order-of-operations
description: Use for reordering requested steps into dependency-correct execution order, ensuring optimal and safe operations regardless of the order instructions were provided.
Order of Operations
Quick Index (Action-Routed)
Read First (All Actions)
MissionCore PrincipleScope BoundaryHard RuleTrigger Examples
Action Modules (Read As Needed)
- Building execution graph:
Sequencing ModelIdeal Execution PhasesReordering Rules
- Safety gating:
Safety-First OverridesValidation Ordering Rules
- Concurrency decisions:
- Conflict and edge handling:
Conflict ResolutionOperational Decision MatrixDocumentation SequencingEscalation Conditions
Output
Deliverable FormatAnti-Patterns
Mission
Execute work in the correct operational sequence, even when user instructions are listed in a non-optimal order.
Core Principle
Instruction order in a prompt is not automatically execution order. Execution order must follow:
- dependencies
- safety constraints
- validation prerequisites
- rollback/recovery readiness
Scope Boundary
Use this skill for explicit multi-step dependency sequencing and risk-aware reordering.
Do not invoke solely for trivial single-step tasks where baseline execution ordering is obvious.
Cross-skill handoff rule:
- when sequence step N triggers another skill, consult
docs/skill-index.md before adding it to execution order
Hard Rule
Always follow the ideal order of operations when instruction order conflicts with required sequencing.
If explicit user ordering is unsafe or dependency-invalid:
- reorder to safe sequence
- explain why briefly
- continue unless user explicitly requests a pause
Trigger Examples
Use this skill when requests contain:
- multi-step tasks in mixed order
- parallel asks with hidden dependencies
- risky changes before safeguards
- “do X then Y” where Y is a prerequisite for X
Sequencing Model
For each requested action, classify:
- prerequisites
- side effects
- verification requirements
- rollback impact
Then build execution graph:
- nodes = actions
- edges = dependencies
- critical path = must-run sequence
- parallel path = independent actions safe to run concurrently
Ideal Execution Phases
Use this default phase order unless context requires variation:
- Clarify scope and constraints
- Run new-project intake (if model has not worked on project: ask test/build ownership preference and index metadata)
- Establish safety rails (backup, rollback, environment checks)
- Gather required context/artifacts
- Apply foundational changes (schema/config/primitives)
- Apply dependent changes (features/integrations/UI)
- Run validation layers (static/unit/integration/E2E as needed)
- Update documentation and operational notes
- Final verification + handoff summary
Reordering Rules
- If user order is valid and safe, keep it.
- If user order violates dependency/safety constraints, reorder and state why briefly.
- If two steps conflict, prioritize data integrity and reversibility.
- If ambiguous dependency exists, resolve with minimal clarifying question or safest assumption.
- If user explicitly insists on unsafe order, escalate and require explicit risk acceptance.
Safety-First Overrides
These operations must occur before risky mutation:
- backup gate for high-risk changes
- environment/credential verification
- migration plan review for schema changes
- rollback path identification
- deployment confirmation gate (explicit user request required)
Never execute destructive or irreversible steps before safeguards. Never deploy by default.
Validation Ordering Rules
Pre-validation dependency probe (required for expensive layers):
- verify layer prerequisites first (runtime binaries, browsers, system libraries, network access)
- if prerequisite is missing, switch to constrained verification protocol rather than repeatedly re-running blocked commands
- run fast, cheap checks early
- block expensive end-to-end tests when foundational checks fail
- only proceed to next stage when prior gate passes or risk is explicitly accepted
Recommended validation sequence:
- lint/type/static checks
- unit tests
- integration/contract checks
- E2E/smoke checks
- post-change runtime sanity checks
Constrained verification branch:
- static checks
- test discovery/listing for blocked layers
- targeted non-blocked checks
- explicit residual-risk evidence
Parallelization Rules
Parallelize only independent actions.
Can parallelize:
- independent file reads
- independent non-mutating diagnostics
- unrelated test subsets
Do not parallelize:
- steps sharing mutable state
- steps with ordering dependencies
- operations whose outputs feed each other
Parallelization gate:
- confirm no shared mutable state
- confirm deterministic merge of outputs
- confirm rollback isolation per parallel branch
Conflict Resolution
When explicit instructions conflict with ideal sequence:
- preserve user intent
- reorder execution
- explain succinctly: "reordered for dependency/safety correctness"
- continue without unnecessary delay
Operational Decision Matrix
If request includes:
- schema changes + feature changes:
- schema prep first, feature updates second
- dependency upgrades + bug fixes:
- dependency compatibility gate first, bug fix implementation after
- auth/session changes + UI updates:
- backend/auth contract first, UI adaptation second
- backup setup + risky refactor:
- backup and restore checks first, refactor after
Documentation Sequencing
Doc updates should follow validated implementation state. Order:
- critical runbooks during/after risky changes
- README and usage docs after command/workflow changes
- architecture docs after stable implementation is confirmed
If documentation is prerequisite for safe operation (for example runbook execution), update before risky steps.
Escalation Conditions
Pause and escalate when:
- prerequisites cannot be satisfied
- execution graph contains unresolved circular dependency
- rollback path is unknown for high-risk step
- required validation cannot run
- user-mandated order conflicts with irreversible-risk constraints
Anti-Patterns
- blindly executing user-listed order with dependency violations
- running expensive validations before basic gates
- performing doc updates before final behavior is known
- treating all tasks as parallel when shared state exists
- skipping reorder explanation when sequence changed
When applying this skill, provide:
- requested steps (normalized)
- dependency-correct execution order
- what was reordered and why
- validation gates and outcomes
- remaining risks/blockers