بنقرة واحدة
define-scope
Step 1 — discover requirements through stakeholder interviews and write Gherkin acceptance criteria
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Step 1 — discover requirements through stakeholder interviews and write Gherkin acceptance criteria
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Step 2 — Architecture and domain design, one feature at a time
Generate and update architecture diagrams, living glossary, and system overview from existing project docs
Enforce code quality using ruff, pytest coverage, and static type checking
Create pull requests with conventional commits, proper formatting, and branch workflow
Flow protocol — design and operate state machine workflows with FLOW.md + WORK.md
Create releases with hybrid major.minor.calver versioning and optional custom release naming
استنادا إلى تصنيف SOC المهني
| name | define-scope |
| description | Step 1 — discover requirements through stakeholder interviews and write Gherkin acceptance criteria |
| version | 6.0 |
| author | product-owner |
| audience | product-owner |
| workflow | feature-lifecycle |
This skill guides the PO through Step 1 of the feature lifecycle: interviewing the stakeholder, discovering requirements, and writing Gherkin specifications precise enough for a developer to write tests without asking questions.
When the PO is starting a new project, adding features, or refining an existing feature. The output is a set of .feature files in docs/features/backlog/ ready for development.
Step 1 has two stages:
| Stage | Who | Output |
|---|---|---|
| Stage 1 — Discovery | PO + stakeholder | docs/scope_journal.md (Q&A) + docs/discovery.md (synthesis) + .feature descriptions |
| Stage 2 — Specification | PO alone | Rule: blocks + Example: blocks with @id tags in .feature files |
Stage 1 is iterative and ongoing — sessions happen whenever the PO or stakeholder needs to discover or refine scope. Stage 2 runs per feature, only after that feature has Status: BASELINED.
Three techniques are applied across all interview sessions to surface what stakeholders have not yet said. Use them during every session, not just at the end.
Ask about a specific past event rather than a general description. Schema-based recall ("usually we...") hides edge cases and workarounds. A concrete incident forces actual memory.
Climb from surface feature to underlying consequence to terminal value. The first answer is rarely the real constraint.
Ask the stakeholder to describe the same situation from another actor's point of view. Peripheral details and cross-role concerns surface that the primary perspective conceals.
Three levels of active listening apply throughout every interview session:
Do not introduce topic labels or categories during active listening. The summary must reflect what the stakeholder said, not new framing that prompts reactions to things they haven't considered.
Discovery is a continuous, iterative process. Sessions happen whenever scope needs to be established or refined — for a new project, for a new feature, or when new information emerges. There is no "Phase 1" vs "Phase 2" distinction; every session follows the same structure.
Before asking any questions:
docs/scope_journal.md for the most recent session block.
Status: IN-PROGRESS → the previous session was interrupted. Resume it: check which .feature files need updating (compare journal Q&A against current .feature descriptions), write the discovery.md synthesis block if missing, then mark the block Status: COMPLETE. Only then begin a new session.docs/scope_journal.md does not exist → this is the first session. Create both docs/scope_journal.md and docs/discovery.md using the templates in scope-journal.md.template and discovery.md.template in this skill's directory.## Domain Model section of docs/system.md (if the file exists) to check existing entities. The PO reads this section but never writes to system.md — it is SA-owned. If system.md does not yet have a Domain Model section, the SA will add it at Step 2.docs/scope_journal.md and append a new session header:
## YYYY-MM-DD — Session N
Status: IN-PROGRESS
Write this header before asking any questions. This is the durability marker — if the session is interrupted, the next agent sees IN-PROGRESS and knows writes are pending.Progress declaration (first message): State the session structure upfront:
"This discovery session has 3 question groups:
- General (7 questions) — about users, goals, success/failure
- Cross-cutting — about behavior groups, integrations, lifecycle events
- Feature: — about specific functionality
I will ask one group at a time and summarize before moving on."
Question grouping:
question tool call per question groupheader showing progress, e.g.:
General — Q1/7General — Q2/7Feature: login — Q3/5Input types:
multiple: true): for multi-select answers (e.g., "Which platforms?" "Which user roles?")Defaults:
Questions follow this order. Skip a group only if it was already fully covered in a prior session.
1. General questions (skip entirely if any prior session has covered these)
Ask all 7 at once:
Apply Level 1 active listening per answer. Apply CIT, Laddering, and CI Perspective Change per answer to surface gaps. Add new questions in the moment.
2. Cross-cutting questions
Target behavior groups, bounded contexts, integration points, lifecycle events, and system-wide constraints. Apply Level 2 active listening when transitioning between groups.
3. Feature questions (one feature at a time)
For each feature the session touches:
docs/glossary.md and the ## Domain Model section of docs/system.md (if it exists)Real-time split rule: if, during feature questions, the PO detects >2 distinct concerns OR >8 candidate Examples for a single feature, split immediately:
.feature files for both parts (if they don't already exist)Before writing ANY file: docs/scope_journal.md, .feature files, or docs/discovery.md.
State exactly what will be written:
"I will now append the Q&A from this session to
docs/scope_journal.md."
State exactly which file(s):
"I will create
docs/features/backlog/<feature-stem>.feature."
Ask for explicit confirmation using the question tool:
header: "Ready to write"<path>?"["Yes, write it", "Show me a preview first", "No, I need changes"]Only proceed with write/edit if the answer is confirmation.
This applies to all write operations in this skill, including:
docs/scope_journal.md (session header and Q&A)docs/features/backlog/<feature-stem>.feature (initial description or update)docs/discovery.md (synthesis block)Step A — Write answered Q&A to journal
Append all answered Q&A to docs/scope_journal.md, in groups (general, cross-cutting, then per-feature). Write only answered questions. Unanswered questions are discarded.
Group headers use this format:
### General### <Group Name>### Feature: <feature-stem>Step B — Update glossary and discovery.md
docs/glossary.md after the session closes — batch update, not real-time during the interview. Read glossary.md before the session starts to anchor interview language; update it after all Q&A is complete. New or corrected definitions; edits allowed.docs/discovery.md (use the template in discovery.md.template):
## Session YYYY-MM-DD block per session| Feature | Change | Source questions | Reason | table — one row per .feature file that was created or updated this session. Confirmations (no file change) → no row. Source questions reference journal Q-IDs (e.g. C4, I2).The PO does not write docs/system.md. Entity and domain model updates are SA-owned and happen at Step 2.
Step C — Update .feature descriptions
For each feature touched in this session: rewrite the .feature file description to reflect the current state of understanding. Only touched features are updated; all others remain exactly as-is.
If a feature is new (just created as a stub): write its initial description now. Use the template in feature.md.template.
Step D — Completed feature regression check
If a completed/ feature was touched and its description/rules changed:
backlog/. Description changes always imply behavior changes; cosmetic rewrites are never performed.discovery.md: "Moved <feature-stem> from completed to backlog due to changed requirements."Step E — Mark session complete
Update the session header in docs/scope_journal.md:
## YYYY-MM-DD — Session N
Status: COMPLETE
Commit: feat(discovery): <one-sentence summary of session>
A feature is baselined when the stakeholder has explicitly approved its discovery. The PO writes Status: BASELINED (YYYY-MM-DD) in the .feature file.
Gate: a feature may only be baselined when:
A baselined feature is ready for Stage 2. The PO may baseline features one at a time — not all at once.
Stage 2 runs per feature, after Status: BASELINED. PO works alone. No stakeholder involvement.
If the PO discovers a gap during Stage 2 that requires stakeholder input: stop Stage 2, open a new Stage 1 session, resolve the gap, then return to Stage 2.
Derive Rule: blocks from the baselined feature description. One Rule: per user story.
Each Rule: block contains:
Example: blocks yet): Rule: Menu Display
As a player
I want to see a menu when the game starts
So that I can select game options
Good stories are:
Avoid: "As the system, I want..." (no business value). Break down stories that contain "and" into two Rules.
INVEST Gate — verify every Rule before committing:
| Letter | Question | FAIL action |
|---|---|---|
| Independent | Can this Rule be delivered without other Rules? | Split or reorder dependencies |
| Negotiable | Are details open to discussion with the developer? | Remove over-specification |
| Valuable | Does it deliver something the end user cares about? | Reframe or drop |
| Estimable | Can a developer estimate the effort? | Split or add discovery questions |
| Small | Completable in one feature cycle? | Split into smaller Rules |
| Testable | Can it be verified with a concrete test? | Rewrite with observable outcomes |
Review checklist:
Commit: feat(stories): write user stories for <feature-stem>
Add Example: blocks under each Rule:. PO writes all Examples alone, based on the approved feature description and domain knowledge. No stakeholder review of individual Examples.
Silent pre-mortem per Rule (before writing any Examples):
"What observable behaviors must we prove for this Rule to be complete?"
All Rules must have their pre-mortems completed before any Examples are written.
Example format (mandatory):
Rule: Wall bounce
As a game engine
I want balls to bounce off walls
So that gameplay feels physical
@id:a3f2b1c4
Example: Ball bounces off top wall
Given a ball moving upward reaches y=0
When the physics engine processes the next frame
Then the ball velocity y-component becomes positive
Rules:
Example: keyword (not Scenario:)Given/When/Then in plain EnglishThen must be a single, observable, measurable outcome — no "and"Declarative vs. imperative Gherkin:
| Imperative (wrong) | Declarative (correct) |
|---|---|
| Given I type "bob" in the username field | Given a registered user Bob |
| When I click the Login button | When Bob logs in |
| Then I see "Welcome, Bob" on the dashboard | Then Bob sees a personalized welcome |
MoSCoW triage: For each candidate Example, classify as Must (required for the Rule to be correct), Should (high value but deferrable), or Could (nice-to-have edge case). If Musts alone exceed 8 or the Rule spans >2 concerns, split the Rule.
Common mistakes to avoid:
Review checklist:
Rule: block has at least one ExampleGiven/When/ThenThen is a single, observable, measurable outcomeSelf-Declaration (mandatory before criteria commit)
Communicate verbally to the next agent. Every DISAGREE is a hard blocker — fix before committing. Do not commit until all items are AGREE or have a documented resolution.
As a product-owner I declare that:
Commit: feat(criteria): write acceptance criteria for <feature-stem>
After this commit, Example: blocks are frozen. Any change requires:
@deprecated tag to the old Example@id tag will be assigned automatically)When a defect is reported against a completed or in-progress feature:
PO adds a new Example to the relevant Rule: block in the .feature file:
@bug
Example: <what the bug is>
Given <conditions that trigger the bug>
When <action>
Then <correct behavior>
SE implements the specific test in tests/features/<feature_slug>/ (the @id test).
SE also writes a @given Hypothesis property test in tests/unit/ covering the whole class of inputs that triggered the bug — not just the single case.
Both tests are required — neither is optional.
SE follows the normal TDD loop (Step 3) for the new @id.
Each feature is a single .feature file. The description block contains the feature description and Status. All Q&A belongs in docs/scope_journal.md; all architectural decisions belong in docs/adr/ADR-YYYY-MM-DD-<slug>.md.
See feature.md.template in this skill's directory for the full template.
The Rules (Business) section captures business rules that hold across multiple Examples. Identifying rules first prevents redundant or contradictory Examples.
The Constraints section captures non-functional requirements. Testable constraints should become Example: blocks with @id tags.
What is not in .feature files:
## Domain Model section of docs/system.md (SA-owned)docs/scope_journal.mddocs/adr/ADR-*.mdWhen a stakeholder reports failure after the PO has attempted Step 5 acceptance, the feature does not move to completed/. Instead, the team compiles a compact post-mortem and the feature restarts at Step 2.
Stakeholder reports a feature is wrong after PO acceptance attempt.
in-progress/ (move back if already shifted).# Find the feature's original start commit
git log --all --grep="feat(<feature-stem>)" --oneline
# Or, if the old branch still exists:
git log --reverse main..feat/<feature-stem> --oneline # first line = start commit
# Create fix branch from start commit
git checkout -b fix/<feature-stem> <start-commit-sha>
# Commit post-mortem as first commit on the new branch
git add docs/post-mortem/YYYY-MM-DD-<feature-stem>-<keyword>.md
git commit -m "docs(post-mortem): root cause for <feature-stem> <keyword>"
# Push the fix branch
git push -u origin fix/<feature-stem>
docs/post-mortem/, selects relevant files by <feature-stem> or <failure-keyword> in filename.WORK.md: set @state: STEP-2-ARCH, @branch: fix/<feature-stem>.fix/<feature-stem>, reading relevant post-mortems as input.File: docs/post-mortem/YYYY-MM-DD-<feature-stem>-<failure-keyword>.md
Use the template post-mortem.md.template in this skill's directory.
All templates for files written by this skill live in this skill's directory:
scope-journal.md.template — docs/scope_journal.md structurediscovery.md.template — docs/discovery.md per-session blockfeature.md.template — .feature file structurepost-mortem.md.template — docs/post-mortem/YYYY-MM-DD-<feature-stem>-<keyword>.md structureglossary.md.template — docs/glossary.md initial file (pre-filled with common jargon; PO appends project-specific entries)Base directory for this skill: .opencode/skills/define-scope/
Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.
Note: file list is sampled.
<skill_files> .opencode/skills/define-scope/discovery.md.template .opencode/skills/define-scope/feature.md.template .opencode/skills/define-scope/scope-journal.md.template </skill_files>