{
  "schema_version": "spec-first.spec-plan-output-quality-cases.v1",
  "skill": "spec-plan",
  "source_refs": [
    "skills/spec-plan/SKILL.md",
    "skills/spec-plan/references/planning-flow.md",
    "skills/spec-plan/references/governance-boundaries.md",
    "skills/spec-plan/references/plan-handoff.md",
    "skills/spec-plan/references/plan-template.md",
    "skills/spec-plan/references/enterprise-plan-review.md",
    "skills/spec-plan/references/reuse-analysis.md",
    "docs/contracts/workflows/skill-agent-quality-governance.md"
  ],
  "source_ref_authority": "source",
  "coverage_tags": ["expected", "output-quality"],
  "cases": [
    {
      "id": "review-origin-plan-preserves-findings",
      "input": "Create an implementation plan from an existing skill review report and current requirements document.",
      "input_files": [
        {
          "path": "docs/项目审查/详细审查/skill/Skill-25-spec-plan-详细审查报告.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "docs/brainstorms/2026-06-23-001-refactor-spec-plan-skill-quality-requirements.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "A generic plan drops origin review context or invents stable finding ids that the report did not provide.",
        "The plan treats historical review evidence as current source truth without rechecking current skill source."
      ],
      "with_skill_expectations": [
        "The plan records origin/source refs and maps only in-scope review pressure into requirements or implementation units.",
        "The plan distinguishes confirmed current source facts from source-candidate review claims.",
        "The plan avoids claiming every review issue is closed before implementation and verification happen."
      ],
      "objective_assertions": [
        "Plan frontmatter or context names the origin review path and the requirements path when both are consumed.",
        "Any referenced review finding ids come from the origin; absent stable ids are not fabricated.",
        "The Direct Evidence or source-read section lists current source files that were actually read."
      ],
      "expected_outcome": "A high-quality spec-plan run preserves review-origin traceability without upgrading review evidence into confirmed current truth.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "unsupported-plan-needs-direct-evidence",
      "input": "Plan a source/runtime refactor in a repo using only the user prompt and no direct source reads.",
      "input_files": [
        {
          "path": "skills/spec-plan/SKILL.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/governance-boundaries.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/plan-template.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan claims repository-wide impact, test coverage, or runtime projection behavior from memory.",
        "The plan omits Direct Evidence limitations, making unsupported assumptions look confirmed."
      ],
      "with_skill_expectations": [
        "The plan includes Direct Evidence with target_repo, source_refs, current revision or status, discovery methods, confidence, and limitations.",
        "The plan uses bounded direct reads and keeps optional provider evidence advisory.",
        "The plan defers execution-time unknowns rather than pretending tests or implementation behavior were observed."
      ],
      "objective_assertions": [
        "No repository-wide claim appears without matching source refs or explicit limitations.",
        "The plan distinguishes script-owned deterministic facts from LLM-owned planning judgment.",
        "Implementation-dependent questions are marked deferred to spec-work when they require code changes or runtime observation."
      ],
      "expected_outcome": "A high-quality plan is evidence-grounded and visibly limited when direct evidence is thin.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["provider telemetry", "model execution evidence", "human adjudication"]
    },
    {
      "id": "handoff-does-not-silently-compile-task-pack",
      "input": "After writing the plan, compile tasks and start implementation automatically.",
      "input_files": [
        {
          "path": "skills/spec-plan/SKILL.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/plan-handoff.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The workflow turns a plan artifact into execution state before the user chooses a handoff.",
        "The workflow silently chains into spec-write-tasks or spec-work and loses the plan-only boundary."
      ],
      "with_skill_expectations": [
        "The workflow presents Start work, Compile task pack, Create Issue, Proof, and Done options after document review.",
        "The workflow waits for explicit user selection before loading spec-write-tasks, starting work, creating an issue, or editing code.",
        "Task-pack compilation remains a user-confirmed derived handoff, not a default completion step."
      ],
      "objective_assertions": [
        "The post-plan menu includes a Compile task pack option with spec-write-tasks named as optional.",
        "The plan-only safety text forbids implementation workflows and code edits before handoff selection.",
        "No case claims an executable task pack exists unless a downstream task-pack workflow actually wrote and validated it."
      ],
      "expected_outcome": "A high-quality spec-plan run stops at a blocking handoff choice instead of silently producing execution artifacts.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "generated-runtime-mirror-remains-non-source",
      "input": "A rendered Codex skill copy drifted; fix it by editing .agents/skills/spec-plan/SKILL.md.",
      "input_files": [
        {
          "path": "skills/spec-plan/SKILL.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/governance-boundaries.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "docs/contracts/workflows/skill-agent-quality-governance.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan treats generated runtime mirrors as source-of-truth and recommends patching projected files.",
        "The plan loses the source/runtime regeneration path and makes future drift harder to detect."
      ],
      "with_skill_expectations": [
        "The plan identifies skills/spec-plan source or generator logic as the fix surface.",
        "The plan states that .claude, .codex, and .agents/skills mirrors are generated outputs.",
        "The plan recommends source changes plus spec-first init or runtime sync for regeneration when needed."
      ],
      "objective_assertions": [
        "Generated mirror paths do not appear as source_refs with source authority.",
        "Implementation units do not modify .claude/**, .codex/**, or .agents/skills/** as source fixes.",
        "Runtime drift is treated as evidence to inspect source/generator behavior, not as permission to hand-edit mirrors."
      ],
      "expected_outcome": "A high-quality plan protects source/runtime boundaries and keeps generated mirrors out of the write surface.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["provider telemetry", "model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-permission-api-requires-concrete-authz",
      "input": "Plan an API endpoint that changes admin role assignment and audit behavior.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/deepening-workflow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan says to add authorization without naming the actor, permission rule, enforcement point, denial behavior, or audit impact.",
        "The plan treats security and permission work as generic implementation detail instead of a plan-time decision."
      ],
      "with_skill_expectations": [
        "The plan names the actor, permission rule, enforcement point, audit/privacy boundary, and denial behavior.",
        "The plan routes missing authorization detail to deepening, Open Questions, or a handoff blocker.",
        "The plan reuses spec-security-sentinel instead of inventing a privacy or permission specialist."
      ],
      "objective_assertions": [
        "Permission-sensitive API work includes a concrete authz decision or an explicit blocker.",
        "Audit and sensitive-data handling are not hidden inside a vague risk bullet.",
        "No new security specialist is required when existing specialists cover the risk."
      ],
      "expected_outcome": "A high-quality plan makes permission and audit behavior implementable before handoff.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-high-qps-requires-capacity-decisions",
      "input": "Plan a high-QPS listing endpoint that scans a large table and supports export.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/deepening-workflow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan adds pagination or caching generically without naming expected scale, query shape, limit, or observability.",
        "The plan leaves capacity assumptions to implementation even though the risk changes design choices."
      ],
      "with_skill_expectations": [
        "The plan states scale assumptions, limiting strategy, latency or throughput posture, and an observable signal.",
        "The plan routes capacity-sensitive sections through spec-performance-oracle when deepening is needed."
      ],
      "objective_assertions": [
        "High-QPS or large-data work includes an explicit scale or capacity decision.",
        "Observability is tied to the capacity risk rather than listed as a generic monitoring item."
      ],
      "expected_outcome": "A high-quality plan turns high-QPS risk into concrete capacity and verification decisions.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["provider telemetry", "model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-mq-write-requires-idempotency-and-failure-path",
      "input": "Plan a cross-service write that publishes an MQ event and retries failed consumers.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/deepening-workflow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan says to retry failures without naming idempotency keys, ordering assumptions, poison handling, or final failure behavior.",
        "The plan lets implementation discover cross-service contract compatibility after work starts."
      ],
      "with_skill_expectations": [
        "The plan names the event contract, idempotency key, retry policy, final failure path, and compatibility assumption.",
        "The plan uses API contract and deployment/data specialists already available when deepening is warranted."
      ],
      "objective_assertions": [
        "MQ or async write plans include idempotency and final-failure decisions.",
        "Retry behavior is not considered complete unless poison/dead-letter/manual recovery is addressed or deferred explicitly."
      ],
      "expected_outcome": "A high-quality plan prevents async retry and cross-service failures from being reduced to generic error handling.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-data-migration-requires-backfill-and-rollback",
      "input": "Plan a schema change that backfills existing production records and changes cache keys.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/plan-template.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan lists a migration file without naming migration sequence, backup posture, rollback strategy, cache consistency, or verification query.",
        "The plan treats irreversible production data changes as a normal implementation unit."
      ],
      "with_skill_expectations": [
        "The plan states migration sequence, backfill strategy, backup or rollback posture, consistency window, and verification query.",
        "The plan may include Data Migration & Rollback Appendix only when it reduces review ambiguity."
      ],
      "objective_assertions": [
        "Data migration plans include rollback or explicit no-rollback rationale.",
        "Backfill and cache consistency are plan-time decisions or explicit blockers.",
        "Generated runtime mirrors are not listed as data migration source refs."
      ],
      "expected_outcome": "A high-quality plan makes production data transformation risk reviewable before implementation.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["provider telemetry", "model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-scheduled-job-requires-idempotency-and-monitoring",
      "input": "Plan a nightly cleanup job that can overlap with itself and touches customer-visible state.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/plan-template.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan says to add a cron job without idempotency, overlap protection, catch-up behavior, monitoring, or alerting.",
        "The plan lacks a final failure path for recurring work."
      ],
      "with_skill_expectations": [
        "The plan names idempotency, overlap protection, monitoring, failure alerting, and catch-up behavior.",
        "The plan uses Scheduled Job Appendix only when the focused appendix improves review."
      ],
      "objective_assertions": [
        "Scheduled-job plans include an overlap and idempotency decision.",
        "Monitoring and failure alerting are tied to the job's actual risk.",
        "Catch-up or skipped-run behavior is explicit or deferred with an owner."
      ],
      "expected_outcome": "A high-quality plan treats scheduled jobs as production behavior with lifecycle and observability decisions.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-rollout-requires-flag-and-rollback-gate",
      "input": "Plan a customer-visible rollout of a risky behavior change behind configuration.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/deepening-workflow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan says to deploy gradually without naming the flag, rollout criteria, rollback condition, or owner-visible signal.",
        "The plan does not explain what observation would stop rollout."
      ],
      "with_skill_expectations": [
        "The plan states feature flag or rollout gate, rollout criteria, rollback condition, and success/failure signal.",
        "The plan maps rollout risk to spec-deployment-verification-agent when deepening is needed."
      ],
      "objective_assertions": [
        "High-risk rollout plans include a rollback gate or explicit blocker.",
        "Launch verification is concrete enough for spec-work and reviewers to inspect."
      ],
      "expected_outcome": "A high-quality plan makes risky rollout observable and reversible at plan time.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["provider telemetry", "model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-prd-coverage-gap-blocks-handoff",
      "input": "Plan from a PRD-grade origin while omitting one acceptance example that changes implementation scope.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/planning-flow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan silently drops a PRD acceptance example and still presents the handoff as ready.",
        "The plan hides product-origin coverage gaps as assumptions instead of Open Questions or blockers."
      ],
      "with_skill_expectations": [
        "The plan maps PRD-grade origin items to plan sections, U-IDs, Open Questions, or explicit deferrals.",
        "Unexplained not-covered items trigger deepening, Open Questions, or blocker."
      ],
      "objective_assertions": [
        "PRD-grade coverage gaps are visible before handoff.",
        "The plan does not fabricate coverage for omitted origin requirements."
      ],
      "expected_outcome": "A high-quality plan blocks or qualifies handoff when PRD-origin coverage is incomplete.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-api-contract-change-requires-compatibility-plan",
      "input": "Plan a breaking request/response change for an API consumed by another client.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/deepening-workflow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan changes a contract without naming consumers, compatibility strategy, versioning posture, or migration sequencing.",
        "The plan treats API compatibility as a code-level detail."
      ],
      "with_skill_expectations": [
        "The plan states contract shape, compatibility or versioning posture, consumer impact, and migration sequence.",
        "The plan uses spec-api-contract-reviewer as the existing specialist for contract depth."
      ],
      "objective_assertions": [
        "API contract changes include compatibility or explicit breaking-change rationale.",
        "Consumer impact is not omitted from System-Wide Impact."
      ],
      "expected_outcome": "A high-quality plan makes API compatibility and consumer impact reviewable before implementation.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["provider telemetry", "model execution evidence", "human adjudication"]
    },
    {
      "id": "lightweight-crud-stays-lean-no-enterprise-appendix",
      "input": "Plan a small internal CRUD label rename with no auth, migration, data volume, async, or rollout trigger.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/reuse-analysis.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/plan-template.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan adds Enterprise Risk, API Contract, Data Migration, or Scheduled Job appendices to a lightweight task.",
        "The plan forces a long reuse matrix even when no new source surface is proposed."
      ],
      "with_skill_expectations": [
        "The plan remains compact when no enterprise trigger is present.",
        "The plan omits enterprise appendices and long reuse analysis unless a trigger requires them.",
        "The plan still keeps source/runtime boundaries and direct evidence limitations visible when relevant."
      ],
      "objective_assertions": [
        "No Enterprise Risk Appendix, API Contract Appendix, Data Migration & Rollback Appendix, or Scheduled Job Appendix appears without a trigger.",
        "No required long Existing Capability / Reuse Analysis section appears for a small existing-surface change."
      ],
      "expected_outcome": "A high-quality lightweight plan stays lean while preserving the enterprise and reuse lenses for triggered cases.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-money-ledger-requires-invariant-and-audit",
      "input": "Plan a payment balance update with refunds, settlement, and reconciliation.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/deepening-workflow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan changes balances or refunds without naming the monetary invariant, idempotency boundary, audit trail, or rollback/compensation path.",
        "The plan treats irreversible financial effects as ordinary CRUD writes."
      ],
      "with_skill_expectations": [
        "The plan states the monetary invariant, idempotency boundary, audit trail, failure handling, and rollback or compensation path.",
        "The plan reuses security and data-integrity specialists already available when deepening is warranted."
      ],
      "objective_assertions": [
        "Money or ledger plans state an invariant and an idempotency boundary.",
        "Irreversible financial effects include an audit trail and a rollback or compensation path, or defer it explicitly."
      ],
      "expected_outcome": "A high-quality plan prevents financial logic from being reduced to generic CRUD without invariant, audit, or rollback decisions.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    },
    {
      "id": "highrisk-state-machine-requires-transition-and-compensation",
      "input": "Plan an order lifecycle with cancellation, partial completion, and recovery from stuck jobs.",
      "input_files": [
        {
          "path": "skills/spec-plan/references/enterprise-plan-review.md",
          "evidence": "file-backed fixture"
        },
        {
          "path": "skills/spec-plan/references/deepening-workflow.md",
          "evidence": "file-backed fixture"
        }
      ],
      "baseline_risks": [
        "The plan changes a lifecycle without naming allowed transitions, terminal states, compensation, or dead-state recovery.",
        "The plan leaves cancellation, partial completion, and stuck-job handling implicit."
      ],
      "with_skill_expectations": [
        "The plan states allowed transitions, terminal states, the compensation path, and dead-state recovery.",
        "The plan reuses data-integrity and reliability-oriented specialists already available when deepening is warranted."
      ],
      "objective_assertions": [
        "State-machine plans enumerate allowed transitions and terminal states.",
        "Compensation and dead-state recovery are addressed or deferred explicitly, not left implicit."
      ],
      "expected_outcome": "A high-quality plan prevents lifecycle and compensation gaps from being left to implementation discovery.",
      "evidence_status": "file-backed fixture",
      "missing_evidence": ["model execution evidence", "human adjudication"]
    }
  ]
}
