Claude Cursor Skill

ba

Business Analyst agent. Use when starting a new feature requiring requirements elicitation BEFORE plan or cook. Asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document that plan and cook

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download rune-kit-rune-skills_ba-66ab37d.zip · 37 KB

Install

skills CLI npx skills add https://github.com/Rune-kit/rune/tree/master/skills/ba
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install rune-kit-rune@llmmart
Git git clone https://github.com/Rune-kit/rune.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole rune-kit/rune collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

ba

Purpose

Business Analyst agent — the ROOT FIX for "Claude works a lot but produces nothing." BA forces deep understanding of WHAT to build before any code is written. It asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document.

Wrong requirements shipped correctly is the most expensive bug. BA's job is to prevent it — measure clarity (Step 2.5), measure completeness (Step 3.5), and measure cross-dimension consistency (Step 3.6) before handoff.

Goal-first (advisory, 2026). The Requirements Document is the goal spec current models want up front. Where the platform has a native goal/outcome command — Claude Code /goal, Managed Agents Outcomes (rubric) — seed it from this document's scope boundaries + acceptance criteria so the whole run stays anchored to the agreed WHAT.

Triggers

  • Called by cook Phase 1 when task is product-oriented (not a simple bug fix)
  • Called by scaffold Phase 1 before any project generation
  • /rune ba <requirement> — manual invocation
  • Auto-trigger: when user description is > 50 words OR contains business terms (users, revenue, workflow, integration)

Calls (outbound)

  • scout (L2): scan existing codebase for context
  • research (L3): look up similar products, APIs, integrations
  • plan (L2): hand off Requirements Document for implementation planning
  • brainstorm (L2): when multiple approaches exist for a requirement
  • design (L2): when requirements include UI/UX components — hand off visual requirements

Called By (inbound)

  • cook (L1): before Phase 2 PLAN, when task is non-trivial
  • scaffold (L1): Phase 1, before any project generation
  • plan (L2): when plan receives vague requirements
  • brainstorm (L2): standalone ideation that picked an approach for a new feature with no spec — hands the chosen approach to ba for requirements before plan
  • mcp-builder (L2): requirements elicitation before MCP server design
  • User: /rune ba direct invocation

Cross-Hub Connections

  • ba → plan — ba produces requirements, plan produces implementation steps
  • ba → brainstorm — ba calls brainstorm when multiple requirement approaches exist
  • ba ↔ cook — cook calls ba for non-trivial tasks, ba feeds requirements into cook's pipeline
  • ba → scaffold — scaffold requires ba output before project generation

Executable Steps

Step 1 — Intake & Classify

Read the user's request. Classify the requirement type:

Type Signal Depth
Feature Request "add X", "build Y", "I want Z" Full BA cycle (Steps 1-7)
Bug Fix "broken", "error", "doesn't work" Skip BA → direct to debug
Refactor "clean up", "refactor", "restructure" Light BA (Step 1 + Step 4 only)
Integration "connect X to Y", "integrate with Z" Full BA + API research
Greenfield "new project", "build from scratch" Full BA + market context

If Bug Fix → skip BA, route to cook/debug directly. If Refactor → light version (Step 1 + Step 4 only). Skip Steps 2, 2.5, 3, 5, 6.

If existing codebase → invoke rune:scout for context before proceeding.

Step 1.4 — Synthesis Trigger Check

Full detail moved to references/synthesis-trigger.md (progressive disclosure). Read that file before executing this section.

Step 1.5 — Out-of-Scope Match Check (READ)

Before any elicitation, check whether the request matches a concept previously rejected.

  1. Glob .out-of-scope/*.md — if directory absent, skip silently.
  2. For each file, parse YAML frontmatter (concept, aliases).
  3. Build a token map (lowercased, split on - and whitespace).
  4. Tokenize the user's request the same way.
  5. Compute lexical overlap per concept; keep the top match's confidence (0.0–1.0).

Action by confidence:

Confidence Verdict Action
≥ 0.8 exact-match Surface to user: "This matches a prior rejection (.out-of-scope/<slug>.md) — closed because [body's "Why out of scope" first sentence]. Do you still feel the same way?" Pause for user response before continuing.
0.5 – 0.79 similar Mention inline: "This is similar to a prior rejection (<slug>). Would you like to review it before we proceed?" Continue regardless of answer.
< 0.5 no-match Continue silently, no user-facing mention.

Emit outofscope.match signal with {concept, confidence, verdict} so downstream skills (cook, plan) inherit the context.

If verdict is exact-match AND user says "yes I still want it" → record their override reason in the Requirements Document ## Risks section AND mark priority_to_revisit: high in the existing .out-of-scope/<slug>.md (do NOT delete the file). The override forces the candidate up the revisit ladder; it doesn't erase the prior decision.

If verdict is exact-match AND user accepts the prior rejection → end the BA session with a one-line summary referencing the file. No further questions.

Format reference: references/out-of-scope-format.md.

Step 1.6 — Mid-Elicitation Reject WRITE Path

Full detail moved to references/reject-write-path.md (progressive disclosure). Read that file before executing this section.

Step 2.0 — Explore-First Pre-Check (HARD-GATE)

Before emitting ANY of the 5 elicitation questions, run the 4-item pre-check on each intended question:

  1. Is the answer in package.json / pyproject.toml / Cargo.toml / go.mod / pom.xml?
  2. Is the answer in README.md / CLAUDE.md / docs/?
  3. Is it inferable from file extensions, directory structure, or config files?
  4. Has the user answered it earlier in this conversation?

The gate is "tried to infer" — not "must succeed in inferring." If the file genuinely doesn't have the answer, the attempt itself is the gate.

Cache inferred answers in the requirements doc:

**Inferred from package.json**: TypeScript 5.4, Next.js 14.2, React 18.3
**Inferred from .github/workflows/**: CI runs on PRs targeting main

Worked examples + edge cases: references/explore-first.md.

Step 2 — Requirement Elicitation (the "5 Questions")

Ask exactly 5 probing questions, ONE AT A TIME (not all at once):

  1. WHO — "Who is the end user? What's their technical level? What are they doing right before and after using this feature?"
  2. WHAT — "What specific outcome do they need? What does 'done' look like from the user's perspective?"
  3. WHY — "Why do they need this? What problem does this solve? What happens if we don't build it?"
  4. BOUNDARIES — "What should this NOT do? What's explicitly out of scope?"
  5. CONSTRAINTS — "Any technical constraints? (existing APIs, performance requirements, security needs, deadlines)"

Question Discipline (MANDATORY)

Every question the user answers burns attention you don't get back. Protect it.

  1. Max 5 questions total across the whole BA session. If you find yourself wanting a 6th, the answer is in the first 5 or you're stalling — re-read, don't re-ask.
  2. Prefer yes/no or multiple-choice over open-ended. An open-ended question is a last resort when no reasonable option set exists.
    • BAD: "What auth strategy do you want?"
    • GOOD: "Auth: (a) email+password with JWT, (b) OAuth (Google/GitHub), (c) magic link, (d) I'll decide — pick one."
  3. Never ask what you can infer. If the answer is in the repo, the user's message, or the classification from Step 1 — don't ask it.
    • Wrong stack? → read package.json, don't ask.
    • Wrong audience? → check the README, don't ask.
    • Wrong framework? → check config files, don't ask.
  4. Cache the answer. Write each Q→A pair into the Requirements Document verbatim. If the user restarts the BA session on the same feature, reuse the cached answers — never re-ask what was already answered.
  5. Bundle yes/no questions after Q1 if the user is concise. A user who replies "y" / "n" / "skip" in 1-2 words tolerates a bundle. A user who replies with paragraphs wants the slow pace — keep one-at-a-time.

Every Q should earn its slot: removing it must leave the Requirements Document materially worse. If it wouldn't, cut the question.

Structured Elicitation Frameworks

Full detail moved to references/elicitation-frameworks.md (progressive disclosure). Read that file before executing this section.

Step 2.5 — Ambiguity Scoring (Execution Gate)

After each question round, compute an Ambiguity Score to determine if requirements are clear enough to proceed. This prevents premature handoff to plan with vague inputs.

Scoring Formula

Full detail moved to references/ambiguity-scoring.md (progressive disclosure). Read that file before executing this section.

Dimension Scoring (0.0 – 1.0)

Full detail moved to references/ambiguity-scoring.md (progressive disclosure). Read that file before executing this section.

Threshold Gate

Ambiguity Level Action
< 15% Crystal Clear Proceed to Step 3 immediately
15-25% Acceptable Proceed with noted assumptions — flag gaps in Requirements Doc
25-40% Unclear Ask 1-2 targeted follow-up questions on weakest dimension
> 40% Blocked Do NOT proceed. Re-ask the weakest dimension question with examples

Scoring After Each Question

Full detail moved to references/ambiguity-scoring.md (progressive disclosure). Read that file before executing this section.

Display Format

Full detail moved to references/ambiguity-scoring.md (progressive disclosure). Read that file before executing this section.

Step 2.6 — CONTEXT.md Cross-Reference Gate

After elicitation, before hidden-requirement discovery, scan the user's answers for assertions about current behavior — phrasings like "the system X", "the code does X", "we already X", "right now it X".

For each such assertion:

  1. Grep the codebase for evidence (function names, route handlers, schema definitions matching the asserted behavior).
  2. Compare grep results to the user's claim.
Outcome Action
Grep confirms claim Proceed; record term in CONTEXT.md if domain-relevant
Grep contradicts claim
Grep returns nothing Note as unverified; ask user for the file/function name; do not record in CONTEXT.md until verified

This gate prevents the agent from silently transcribing user-asserted behavior that contradicts code — a common source of "the docs say X but the code does Y" drift.

Step 3 — Hidden Requirement Discovery

After the 5 questions, analyze for requirements the user DIDN'T mention:

Technical hidden requirements:

  • Authentication/authorization needed?
  • Rate limiting needed?
  • Data persistence needed? (what DB, what schema)
  • Error handling strategy?
  • Offline/fallback behavior?
  • Mobile responsiveness?
  • Accessibility requirements?
  • Internationalization?

Business hidden requirements:

  • What happens on failure? (graceful degradation)
  • What data needs to be tracked? (analytics events)
  • Who else is affected? (other teams, other systems)
  • What are the edge cases? (empty state, max limits, concurrent access)
  • Regulatory/compliance needs? (GDPR, PCI, HIPAA)

Present discovered hidden requirements to user: "I found N additional requirements you may not have considered: [list]. Which are relevant?"

Step 3.5 — Completeness Scoring (Options & Alternatives)

Full detail moved to references/completeness-scoring.md (progressive disclosure). Read that file before executing this section.

Step 3.6 — Logic Consistency Check

After ambiguity + completeness pass, scan for cross-dimension contradictions. Ambiguity measures CLARITY of each dimension in isolation; this step measures CONSISTENCY across dimensions. A perfectly clear requirement can still contradict itself.

Checks

Run each, label verdict 🟢 pass / 🟡 warn / 🔴 fail:

# Check 🔴 Fail 🟢 Pass
1 Every Acceptance Criterion traces to a User Story AC orphaned 1:N mapping clear
1b Every EARS FR-n (Step 4.5) traces up to a User Story AND down to an AC FR has no AC (untested promise) or no story (orphan behavior) FR → story + AC both present
2 Every Business Rule (Q5) is enforced in an AC or Exception Flow Rule has no enforcement path Rule → specific AC or exception
3 Scope IN ∩ Scope OUT = ∅ Direct overlap in phrasing Sets disjoint
4 Every user-story flow has a terminal state State loop without exit condition Terminal state explicit
5 Dependencies (Step 4) ⊂ Constraints acknowledged (Q5) Dependency never mentioned in constraints All deps covered
6 NFRs measurable against at least one AC NFR has no test hook Every NFR → testable AC
7 Hidden requirements (Step 3) resolved in/out Silent inclusion User confirmed inclusion or exclusion
0 Prior rejection check (Step 1.5) — exact-match resolved with explicit override or session ended Silent re-litigation of rejected concept User chose: override (priority bumped) OR accept prior decision (session ends)

Output Format

Full detail moved to references/completeness-scoring.md (progressive disclosure). Read that file before executing this section.

Gate Rule

Result Action
0 🔴 Proceed to Step 4 — 🟡 warnings become "Risks" in Requirements Doc
1-2 🔴 BLOCK — ask targeted question or re-scope to resolve each 🔴
3+ 🔴 Scrap Steps 2-3 and restart — requirements structurally incoherent

Step 4 — Scope Definition

Based on all gathered information, produce:

In-Scope (explicitly included):

  • [list of features/behaviors that WILL be built]

Out-of-Scope (explicitly excluded):

  • [list of things we WON'T build — prevents scope creep]

Assumptions (things we're assuming without proof):

  • [each assumption is a risk if wrong]

Dependencies (things that must exist before we can build):

  • [APIs, services, libraries, access, existing code]

Step 4.5 — Functional Requirements (EARS)

Full detail moved to references/ears-requirements.md (progressive disclosure). Read that file before executing this section.

Step 5 — User Stories & Acceptance Criteria

For each in-scope feature, generate:

US-1 [P1]: As a [persona], I want to [action] so that [benefit]
  Independent Test: [specific action proving this story works end-to-end on its own —
                     e.g., "submit the form with valid data and see the saved record listed"]
  AC-1.1: GIVEN [context] WHEN [action] THEN [result]
  AC-1.2: GIVEN [error case] WHEN [action] THEN [error handling]
  AC-1.3: GIVEN [edge case] WHEN [action] THEN [graceful behavior]

Rules:

  • Primary user story first, then edge cases
  • Every story carries a priority: P1 = MVP-critical (the P1 set alone must be a viable, demoable product), P2 = important, P3 = nice-to-have. Implementing ONLY the P1 stories must still yield a working feature
  • Every story carries an Independent Test — one concrete user action that proves the story end-to-end (through UI, logic, AND data if the story touches them). If no single action can prove it, the story is sliced wrong — split or merge until it can. This field is what downstream verification gates (plan's Coverage Gate, converge's gap scan, completion-gate's evidence trail) trace against
  • Every user story has at least 2 acceptance criteria (happy path + error)
  • Acceptance criteria are TESTABLE — they become test cases in Phase 3
  • Each AC proves a specific FR-n from Step 4.5 — cite it (AC-1.2 → FR-3). Every unwanted-behavior FR (the If … lines) needs an error-path AC; that's where EARS earns its keep
  • An AC whose THEN clause stops at the UI ("THEN the button shows a spinner") for a story that persists or fetches data is INCOMPLETE — the THEN must name the observable outcome ("THEN the order appears in the list / the record is persisted")

Step 5.5 — Key Entities (mandatory if feature involves data)

Full detail moved to references/key-entities.md (progressive disclosure). Read that file before executing this section.

Step 6 — Non-Functional Requirements (NFRs)

Assess and document ONLY relevant NFRs:

NFR Requirement Measurement
Performance Page load < Xs, API response < Yms Lighthouse, k6
Security Auth required, input validation, OWASP top 10 sentinel scan
Scalability Expected users, data volume Load test target
Reliability Uptime target, error budget Monitoring threshold
Accessibility WCAG 2.2 AA Axe audit

Only include NFRs relevant to this specific task. Don't generate a generic checklist.

Step 6.5 — Tiered Recommendations

Full detail moved to references/tiered-recommendations.md (progressive disclosure). Read that file before executing this section.

Step 7 — Artifact Triad

Full detail moved to references/artifact-triad.md (progressive disclosure). Read that file before executing this section. Mesh links used there: rune:plan.

Step 7.5 — Glossary Sharpen (CONTEXT.md update)

Full detail moved to references/artifact-triad.md (progressive disclosure). Read that file before executing this section.

Output Format

Triad of artifacts under .rune/features/<feature-name>/:

File Template Reference
requirements.md Step 7 Artifact 1
requirements.mermaid Step 7 Artifact 2 (sequence + optional state machine)
tasks.md Step 7 Artifact 3 (Data / Logic / Interface / Test / NFR layers)

Inside requirements.md the Decision Classification table MUST appear verbatim — plan gates on Decision compliance, Discretion items skip approval:

Category Meaning Example
Decisions (locked) User confirmed — agent MUST follow "Use PostgreSQL, not MongoDB"
Discretion (agent decides) User trusts agent judgment "Pick the best validation library"
Deferred (out of scope) Explicitly NOT this task "Mobile app — future phase"

Constraints

  1. MUST ask up to 5 probing questions before producing requirements — never more, skip any you can infer from context
  2. MUST prefer yes/no or multiple-choice questions — open-ended only when no reasonable option set exists
  3. MUST NOT ask for information already present in the user's message, the repo, or classification — read/grep first, ask second
  4. MUST cache each Q→A pair in the Requirements Document and reuse on subsequent BA sessions for the same feature
  5. MUST identify hidden requirements — the obvious ones are never the full picture
  6. MUST define out-of-scope explicitly — prevents scope creep
  7. MUST produce testable acceptance criteria — they become test cases
  8. MUST NOT write code or plan implementation — BA produces WHAT, plan produces HOW
  9. MUST ask ONE question at a time by default; bundle yes/no batches only after user shows concise replies
  10. MUST NOT skip BA for non-trivial tasks — "just build it" gets redirected to Question 1
  11. MUST assign [P1|P2|P3] priority to every user story — the P1 set alone must be a viable, demoable product
  12. MUST give every user story an Independent Test — one concrete action proving it end-to-end
  13. MUST list Key Entities when any story touches data (Step 5.5) — a data-touching story with no entity is a spec gap
  14. MUST group tasks.md by user story (vertical slices), never by layer

Returns

Artifact Format Location
Requirements document Markdown .rune/features/<feature-name>/requirements.md
Visual model Mermaid (sequence + optional state machine) .rune/features/<feature-name>/requirements.mermaid
Implementation task backbone Markdown checklist by user story (vertical slices — Data→Logic→Endpoint→UI→Test per US-n) .rune/features/<feature-name>/tasks.md
Logic Consistency Report Markdown section Embedded in requirements.md
Ambiguity + Completeness scores Markdown display blocks Embedded in requirements.md

Sharp Edges

Known failure modes for this skill. Check these before declaring done.

Failure Mode Severity Mitigation
Skipping questions because "requirements are obvious" CRITICAL HARD-GATE: 5 questions mandatory, even for "simple" tasks
Answering own questions instead of asking user HIGH Questions require USER input — BA doesn't guess
Producing implementation details (HOW) instead of requirements (WHAT) HIGH BA outputs requirements doc → plan outputs implementation
All-at-once question dump (asking 5 questions in one message) MEDIUM One question at a time, wait for answer before next
Asking open-ended questions when yes/no or multiple-choice would work HIGH Question Discipline rule 2 — option sets are faster to answer and easier to cache
Asking for info already in the repo/message (stack, framework, audience) HIGH Question Discipline rule 3 — read package.json/README/config first, ask only what you genuinely can't find
Exceeding 5 questions when the user seems "engaged" MEDIUM Question Discipline rule 1 — hard cap at 5. A 6th question is a sign of stalling, not thoroughness
Re-asking on session restart when answers were cached MEDIUM Question Discipline rule 4 — load .rune/features/<name>/requirements.md and reuse cached Q→A pairs
Missing hidden requirements (auth, error handling, edge cases) HIGH Step 3 checklist is mandatory scan
Requirements doc too verbose (>500 lines) MEDIUM Max 200 lines — concise, actionable, testable
Skipping BA for "simple" features that turn out complex HIGH Let cook's complexity detection trigger BA, not user judgment
Recommending shortcuts without Completeness Score MEDIUM Step 3.5: every option needs X/10 score + dual effort estimate (human vs AI). "90% coverage" is a red flag when 100% costs 15 min more
Handing off to plan with ambiguity > 40% CRITICAL Step 2.5 HARD-GATE: compute ambiguity score after elicitation, block handoff if > 40%, ask targeted follow-up on weakest dimension
Skipping ambiguity scoring because "user seems clear" HIGH Always compute the score — perceived clarity ≠ measured clarity. The formula catches gaps humans miss
Tiered recommendations too vague ("improve things") MEDIUM Each tier needs specific Action + measurable Expected Impact. "Build better UX" → "Reduce checkout steps from 5 to 3, targeting 15% conversion lift"
All three tiers have same resources/effort MEDIUM Quick Win should be low-effort. If all tiers need "2 engineers, 3 months" → re-scope Quick Win to something achievable in 1 sprint
Skipping Logic Consistency check because ambiguity is low CRITICAL Step 3.6 HARD-GATE: clarity ≠ consistency. A 90% clarity spec can still contain pairwise contradictions (scope IN/OUT overlap, rules with no enforcement, orphan ACs)
Handing off to plan with unresolved 🔴 consistency fails CRITICAL Step 3.6 gate: 1+ 🔴 = BLOCK. 🟡 allowed only when logged as Risk in requirements.md
Vague functional requirements ("system shall be fast/user-friendly") instead of EARS MEDIUM Step 4.5: every FR uses an EARS template with a named subject + testable response; vague targets move to NFRs (Step 6)
Compound EARS requirement ("shall do A and B and C") hiding untested behavior MEDIUM Step 4.5: one shall per FR-n — split compounds so each behavior gets its own AC
EARS FR-n with no acceptance criterion (untested promise) MEDIUM Step 3.6 check 1b: every FR traces down to an AC and up to a User Story
Manufacturing EARS requirements for a bug fix or refactor LOW Step 4.5: skip EARS when there's no new behavior to specify — format recommendation, not ceremony
Producing only requirements.md, skipping mermaid and tasks.md HIGH Step 7 is a triad — plan's contract expects all 3. Sequence diagram is always produced; state machine only if stateful; tasks.md always produced
Mermaid diagram unrelated to actual user stories (decorative only) MEDIUM Sequence must trace AC-1.1 of US-1; state machine nodes must map to state-bearing ACs. Auditable by pattern-match
tasks.md grouped by layer instead of by story HIGH Story-grouped derivation: 1 US → 1 section with ALL its layers (Data→Logic→Interface→Test). Layer-grouped backbones invite "finish the UI layer and stop" — the dead-button root cause
Story with UI tasks but no Logic/Data/Test tasks (broken slice) HIGH Step 7 Artifact 3 rule: a ## US-n section containing only UI/Endpoint tasks is invalid — the UI element and the endpoint it calls belong to the SAME story
Story without an Independent Test (unprovable slice) HIGH Step 5 rule: every story names one concrete action proving it end-to-end. Can't name one → story is sliced wrong
AC whose THEN stops at the UI for a data-touching story HIGH Step 5 rule: THEN must name the observable outcome (record persisted / data returned), not just the widget state
Data-touching story with no Key Entity listed MEDIUM Step 5.5: plan bounces specs where a story touches data absent from Key Entities
Re-litigating a previously rejected concept without surfacing it HIGH Step 1.5 HARD-GATE: scan .out-of-scope/ first; exact match (≥0.8) MUST be surfaced before elicitation begins
Skipping Step 1.5 because .out-of-scope/ directory looks empty MEDIUM Empty directory is silent-skip OK; directory absent entirely is silent-skip OK; never skip due to "I don't think this matches anything" — let the matcher decide
User asserts behavior; agent records user's version without grep verification HIGH Step 2.6 HARD-GATE: every "the system does X" assertion gets grep'd; conflicts surface to user before recording
Silently re-defining an existing CONTEXT.md term HIGH Step 7.5 conflict gate: ≥0.7 overlap → user chooses merge/rename/keep-distinct
Auto-creating an empty CONTEXT.md when no terms emerged LOW Lazy creation rule: only write when there's a non-trivial term to record
Mid-elicitation rejection ("scrap it") that ends the session without writing .out-of-scope/ CRITICAL Step 1.6 HARD-GATE: explicit rejection MUST produce .out-of-scope/<slug>.md before session end — oral rejections vanish, force re-litigation next session
Writing .out-of-scope/ for a deferral instead of routing to backlog MEDIUM Step 1.6 procedure step 1: confirm "out of scope" vs "deferred" — temporary reasons go to backlog, not the rejection KB
Running 5-question elicitation when conversation already contains rich context HIGH Step 1.4: synthesis-trigger check fires before Step 2 — pasted spec / >1000 words / continuation / explicit "synthesize" → switch to Synthesis Mode (extract + cite + confirm), don't re-interview
Synthesizing requirements without source citations HIGH Synthesis Mode requires citing source for every dimension (user message N, pasted doc, continuation file). User cannot verify interpretation without citations
Auto-handoff to plan after synthesis without explicit user "go"/"locked" confirmation HIGH Synthesis is interpretation, not transcription. Without explicit confirmation, drift becomes a downstream bug
Asking inferable questions ("what stack are you using?") without first checking package.json HIGH Step 2.0 HARD-GATE — every question requires prior tool-call evidence (Read/Glob/Grep) or explicit unavailability declaration
Re-asking a question already answered earlier in the conversation MEDIUM Step 2.0 check 4 — cache and reuse, never re-ask

Done When

  • Requirement type classified (feature/refactor/integration/greenfield)
  • 5 probing questions asked and answered (or extracted from spec/PRD)
  • Ambiguity Score computed and displayed — must be ≤ 40% before proceeding (≤ 25% preferred)
  • Hidden requirements discovered and confirmed with user
  • Scope defined (in/out/assumptions/dependencies)
  • Functional requirements written in EARS format (FR-n) — skip for Bug Fix/Refactor
  • User stories with testable acceptance criteria produced, each AC citing the FR-n it proves
  • Every story has a [P1|P2|P3] priority and an Independent Test; P1 set alone = viable MVP
  • Key Entities listed (if feature involves data) — seeds plan's data-model.md
  • tasks.md grouped by user story (vertical slices), Foundational section minimal
  • Non-functional requirements assessed (relevant ones only)
  • Logic Consistency Report produced — 0 🔴 before handoff (🟡 logged as Risks)
  • Tiered recommendations generated (Quick Win / Differentiation / Moat) — skip for Bug Fix/Refactor
  • Artifact triad saved: requirements.md + requirements.mermaid + tasks.md
  • Out-of-scope match check completed (verdict logged: no-match | similar | exact-match-overridden | exact-match-accepted)
  • Handed off to plan for implementation planning

Cost Profile

~3000-6000 tokens input, ~1500-3000 tokens output. Opus for deep requirement analysis — understanding WHAT to build is the most expensive mistake to get wrong.

Files (rune)
  • references
    • ambiguity-scoring.md 2.2 KB
      Loading…
    • artifact-templates.md 4.4 KB
      Loading…
    • artifact-triad.md 2.4 KB
      Loading…
    • completeness-scoring.md 2.1 KB
      Loading…
    • context-md-format.md 5.8 KB
      Loading…
    • ears-format.md 5.3 KB
      Loading…
    • ears-requirements.md 2.2 KB
      Loading…
    • elicitation-frameworks.md 1.4 KB
      Loading…
    • explore-first.md 4.8 KB
      Loading…
    • key-entities.md 1.1 KB
      Loading…
    • out-of-scope-format.md 5.9 KB
      Loading…
    • reject-write-path.md 3.3 KB
      Loading…
    • synthesis-mode.md 5 KB
      Loading…
    • synthesis-trigger.md 1.6 KB
      Loading…
    • tiered-recommendations.md 1.7 KB
      Loading…
  • SKILL.md 31.8 KB
    ---
    name: ba
    description: "Business Analyst agent. Use when starting a new feature requiring requirements elicitation BEFORE plan or cook. Asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document that plan and cook consume."
    metadata:
      author: runedev
      version: "1.2.1"
      layer: L2
      model: opus
      group: creation
      tools: "Read, Write, Glob, Grep"
      emit: outofscope.match, outofscope.recorded
    ---
    
    # ba
    
    ## Purpose
    
    Business Analyst agent — the ROOT FIX for "Claude works a lot but produces nothing." BA forces deep understanding of WHAT to build before any code is written. It asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document.
    
    > Wrong requirements shipped correctly is the most expensive bug. BA's job is to prevent it — measure clarity (Step 2.5), measure completeness (Step 3.5), and measure cross-dimension consistency (Step 3.6) before handoff.
    
    > **Goal-first (advisory, 2026).** The Requirements Document is the goal spec current
    > models want up front. Where the platform has a native goal/outcome command — Claude
    > Code `/goal`, Managed Agents Outcomes (rubric) — seed it from this document's scope
    > boundaries + acceptance criteria so the whole run stays anchored to the agreed WHAT.
    
    <HARD-GATE>
    BA produces WHAT, not HOW. Never write code. Never plan implementation.
    Output is a Requirements Document → hand off to rune:plan for implementation planning.
    </HARD-GATE>
    
    ## Triggers
    
    - Called by `cook` Phase 1 when task is product-oriented (not a simple bug fix)
    - Called by `scaffold` Phase 1 before any project generation
    - `/rune ba <requirement>` — manual invocation
    - Auto-trigger: when user description is > 50 words OR contains business terms (users, revenue, workflow, integration)
    
    ## Calls (outbound)
    
    - `scout` (L2): scan existing codebase for context
    - `research` (L3): look up similar products, APIs, integrations
    - `plan` (L2): hand off Requirements Document for implementation planning
    - `brainstorm` (L2): when multiple approaches exist for a requirement
    - `design` (L2): when requirements include UI/UX components — hand off visual requirements
    
    ## Called By (inbound)
    
    - `cook` (L1): before Phase 2 PLAN, when task is non-trivial
    - `scaffold` (L1): Phase 1, before any project generation
    - `plan` (L2): when plan receives vague requirements
    - `brainstorm` (L2): standalone ideation that picked an approach for a new feature with no spec — hands the chosen approach to `ba` for requirements before `plan`
    - `mcp-builder` (L2): requirements elicitation before MCP server design
    - User: `/rune ba` direct invocation
    
    ## Cross-Hub Connections
    
    - `ba` → `plan` — ba produces requirements, plan produces implementation steps
    - `ba` → `brainstorm` — ba calls brainstorm when multiple requirement approaches exist
    - `ba` ↔ `cook` — cook calls ba for non-trivial tasks, ba feeds requirements into cook's pipeline
    - `ba` → `scaffold` — scaffold requires ba output before project generation
    
    ## Executable Steps
    
    ### Step 1 — Intake & Classify
    
    Read the user's request. Classify the requirement type:
    
    | Type | Signal | Depth |
    |------|--------|-------|
    | Feature Request | "add X", "build Y", "I want Z" | Full BA cycle (Steps 1-7) |
    | Bug Fix | "broken", "error", "doesn't work" | Skip BA → direct to debug |
    | Refactor | "clean up", "refactor", "restructure" | Light BA (Step 1 + Step 4 only) |
    | Integration | "connect X to Y", "integrate with Z" | Full BA + API research |
    | Greenfield | "new project", "build from scratch" | Full BA + market context |
    
    If Bug Fix → skip BA, route to cook/debug directly.
    If Refactor → light version (Step 1 + Step 4 only). Skip Steps 2, 2.5, 3, 5, 6.
    
    If existing codebase → invoke `rune:scout` for context before proceeding.
    
    ### Step 1.4 — Synthesis Trigger Check
    
    > Full detail moved to [`references/synthesis-trigger.md`](references/synthesis-trigger.md) (progressive disclosure). **Read that file before executing this section.**
    
    ### Step 1.5 — Out-of-Scope Match Check (READ)
    
    Before any elicitation, check whether the request matches a concept previously rejected.
    
    1. `Glob` `.out-of-scope/*.md` — if directory absent, skip silently.
    2. For each file, parse YAML frontmatter (`concept`, `aliases`).
    3. Build a token map (lowercased, split on `-` and whitespace).
    4. Tokenize the user's request the same way.
    5. Compute lexical overlap per concept; keep the top match's `confidence` (0.0–1.0).
    
    **Action by confidence**:
    
    | Confidence | Verdict | Action |
    |------------|---------|--------|
    | ≥ 0.8 | exact-match | Surface to user: *"This matches a prior rejection (`.out-of-scope/<slug>.md`) — closed because [body's "Why out of scope" first sentence]. Do you still feel the same way?"* Pause for user response before continuing. |
    | 0.5 – 0.79 | similar | Mention inline: *"This is similar to a prior rejection (`<slug>`). Would you like to review it before we proceed?"* Continue regardless of answer. |
    | < 0.5 | no-match | Continue silently, no user-facing mention. |
    
    Emit `outofscope.match` signal with `{concept, confidence, verdict}` so downstream skills (cook, plan) inherit the context.
    
    If verdict is exact-match AND user says "yes I still want it" → record their override reason in the Requirements Document `## Risks` section AND mark `priority_to_revisit: high` in the existing `.out-of-scope/<slug>.md` (do NOT delete the file). The override forces the candidate up the revisit ladder; it doesn't erase the prior decision.
    
    If verdict is exact-match AND user accepts the prior rejection → end the BA session with a one-line summary referencing the file. No further questions.
    
    Format reference: [references/out-of-scope-format.md](references/out-of-scope-format.md).
    
    ### Step 1.6 — Mid-Elicitation Reject WRITE Path
    
    > Full detail moved to [`references/reject-write-path.md`](references/reject-write-path.md) (progressive disclosure). **Read that file before executing this section.**
    
    <HARD-GATE>
    Mid-elicitation rejection MUST produce a `.out-of-scope/<slug>.md` file before session end.
    A rejection without a written record is a rejection that didn't happen.
    </HARD-GATE>
    
    ### Step 2.0 — Explore-First Pre-Check (HARD-GATE)
    
    Before emitting ANY of the 5 elicitation questions, run the 4-item pre-check on each intended question:
    
    1. Is the answer in `package.json` / `pyproject.toml` / `Cargo.toml` / `go.mod` / `pom.xml`?
    2. Is the answer in `README.md` / `CLAUDE.md` / `docs/`?
    3. Is it inferable from file extensions, directory structure, or config files?
    4. Has the user answered it earlier in this conversation?
    
    <HARD-GATE>
    For every question Q the agent intends to ask, there MUST be prior tool-call evidence in the same session:
    - At least 1 Read / Glob / Grep related to Q's domain, OR
    - Explicit declaration: "Q cannot be answered from project artifacts because [specific reason]."
    Without one of these, Q is BLOCKED — re-route to inference.
    </HARD-GATE>
    
    The gate is "tried to infer" — not "must succeed in inferring." If the file genuinely doesn't have the answer, the attempt itself is the gate.
    
    Cache inferred answers in the requirements doc:
    ```
    **Inferred from package.json**: TypeScript 5.4, Next.js 14.2, React 18.3
    **Inferred from .github/workflows/**: CI runs on PRs targeting main
    ```
    
    Worked examples + edge cases: [references/explore-first.md](references/explore-first.md).
    
    ### Step 2 — Requirement Elicitation (the "5 Questions")
    
    Ask exactly 5 probing questions, ONE AT A TIME (not all at once):
    
    1. **WHO** — "Who is the end user? What's their technical level? What are they doing right before and after using this feature?"
    2. **WHAT** — "What specific outcome do they need? What does 'done' look like from the user's perspective?"
    3. **WHY** — "Why do they need this? What problem does this solve? What happens if we don't build it?"
    4. **BOUNDARIES** — "What should this NOT do? What's explicitly out of scope?"
    5. **CONSTRAINTS** — "Any technical constraints? (existing APIs, performance requirements, security needs, deadlines)"
    
    <HARD-GATE>
    Do NOT skip questions. Do NOT answer your own questions.
    If user says "just build it" → respond with: "I'll build it better with 2 minutes of context. Question 1: [WHO]"
    Each question must be asked separately, wait for answer before next.
    Exception: if user provides a detailed spec/PRD → extract answers from it, confirm with user.
    </HARD-GATE>
    
    #### Question Discipline (MANDATORY)
    
    Every question the user answers burns attention you don't get back. Protect it.
    
    1. **Max 5 questions total across the whole BA session.** If you find yourself wanting a 6th, the answer is in the first 5 or you're stalling — re-read, don't re-ask.
    2. **Prefer yes/no or multiple-choice over open-ended.** An open-ended question is a last resort when no reasonable option set exists.
       - BAD: "What auth strategy do you want?"
       - GOOD: "Auth: **(a)** email+password with JWT, **(b)** OAuth (Google/GitHub), **(c)** magic link, **(d)** I'll decide — pick one."
    3. **Never ask what you can infer.** If the answer is in the repo, the user's message, or the classification from Step 1 — don't ask it.
       - Wrong stack? → read `package.json`, don't ask.
       - Wrong audience? → check the `README`, don't ask.
       - Wrong framework? → check config files, don't ask.
    4. **Cache the answer.** Write each Q→A pair into the Requirements Document verbatim. If the user restarts the BA session on the same feature, reuse the cached answers — never re-ask what was already answered.
    5. **Bundle yes/no questions after Q1 if the user is concise.** A user who replies "y" / "n" / "skip" in 1-2 words tolerates a bundle. A user who replies with paragraphs wants the slow pace — keep one-at-a-time.
    
    Every Q should earn its slot: removing it must leave the Requirements Document materially worse. If it wouldn't, cut the question.
    
    #### Structured Elicitation Frameworks
    
    > Full detail moved to [`references/elicitation-frameworks.md`](references/elicitation-frameworks.md) (progressive disclosure). **Read that file before executing this section.**
    
    ### Step 2.5 — Ambiguity Scoring (Execution Gate)
    
    After each question round, compute an **Ambiguity Score** to determine if requirements are clear enough to proceed. This prevents premature handoff to `plan` with vague inputs.
    
    #### Scoring Formula
    
    > Full detail moved to [`references/ambiguity-scoring.md`](references/ambiguity-scoring.md) (progressive disclosure). **Read that file before executing this section.**
    
    #### Dimension Scoring (0.0 – 1.0)
    
    > Full detail moved to [`references/ambiguity-scoring.md`](references/ambiguity-scoring.md) (progressive disclosure). **Read that file before executing this section.**
    
    #### Threshold Gate
    
    | Ambiguity | Level | Action |
    |-----------|-------|--------|
    | **< 15%** | Crystal Clear | Proceed to Step 3 immediately |
    | **15-25%** | Acceptable | Proceed with noted assumptions — flag gaps in Requirements Doc |
    | **25-40%** | Unclear | Ask 1-2 targeted follow-up questions on weakest dimension |
    | **> 40%** | Blocked | Do NOT proceed. Re-ask the weakest dimension question with examples |
    
    <HARD-GATE>
    NEVER hand off to plan with Ambiguity > 40%.
    If user insists "just build it" at > 40%, respond:
    "Ambiguity is [X]% — the weakest area is [dimension]. One more answer cuts this in half: [targeted question]"
    </HARD-GATE>
    
    #### Scoring After Each Question
    
    > Full detail moved to [`references/ambiguity-scoring.md`](references/ambiguity-scoring.md) (progressive disclosure). **Read that file before executing this section.**
    
    #### Display Format
    
    > Full detail moved to [`references/ambiguity-scoring.md`](references/ambiguity-scoring.md) (progressive disclosure). **Read that file before executing this section.**
    
    ### Step 2.6 — CONTEXT.md Cross-Reference Gate
    
    After elicitation, before hidden-requirement discovery, scan the user's answers for assertions about *current behavior* — phrasings like "the system X", "the code does X", "we already X", "right now it X".
    
    For each such assertion:
    
    1. `Grep` the codebase for evidence (function names, route handlers, schema definitions matching the asserted behavior).
    2. Compare grep results to the user's claim.
    
    | Outcome | Action |
    |---------|--------|
    | Grep confirms claim | Proceed; record term in CONTEXT.md if domain-relevant |
    | Grep contradicts claim | <HARD-GATE>Surface the conflict immediately. *"You said the system does X, but the code path I see does Y. Which is canonical?"* Pause until resolved.</HARD-GATE> |
    | Grep returns nothing | Note as unverified; ask user for the file/function name; do not record in CONTEXT.md until verified |
    
    This gate prevents the agent from silently transcribing user-asserted behavior that contradicts code — a common source of "the docs say X but the code does Y" drift.
    
    ### Step 3 — Hidden Requirement Discovery
    
    After the 5 questions, analyze for requirements the user DIDN'T mention:
    
    **Technical hidden requirements:**
    - Authentication/authorization needed?
    - Rate limiting needed?
    - Data persistence needed? (what DB, what schema)
    - Error handling strategy?
    - Offline/fallback behavior?
    - Mobile responsiveness?
    - Accessibility requirements?
    - Internationalization?
    
    **Business hidden requirements:**
    - What happens on failure? (graceful degradation)
    - What data needs to be tracked? (analytics events)
    - Who else is affected? (other teams, other systems)
    - What are the edge cases? (empty state, max limits, concurrent access)
    - Regulatory/compliance needs? (GDPR, PCI, HIPAA)
    
    Present discovered hidden requirements to user: "I found N additional requirements you may not have considered: [list]. Which are relevant?"
    
    ### Step 3.5 — Completeness Scoring (Options & Alternatives)
    
    > Full detail moved to [`references/completeness-scoring.md`](references/completeness-scoring.md) (progressive disclosure). **Read that file before executing this section.**
    
    
    ### Step 3.6 — Logic Consistency Check
    
    After ambiguity + completeness pass, scan for **cross-dimension contradictions**. Ambiguity measures CLARITY of each dimension in isolation; this step measures CONSISTENCY across dimensions. A perfectly clear requirement can still contradict itself.
    
    #### Checks
    
    Run each, label verdict 🟢 pass / 🟡 warn / 🔴 fail:
    
    | # | Check | 🔴 Fail | 🟢 Pass |
    |---|-------|---------|---------|
    | 1 | Every Acceptance Criterion traces to a User Story | AC orphaned | 1:N mapping clear |
    | 1b | Every EARS `FR-n` (Step 4.5) traces up to a User Story AND down to an AC | FR has no AC (untested promise) or no story (orphan behavior) | FR → story + AC both present |
    | 2 | Every Business Rule (Q5) is enforced in an AC or Exception Flow | Rule has no enforcement path | Rule → specific AC or exception |
    | 3 | Scope IN ∩ Scope OUT = ∅ | Direct overlap in phrasing | Sets disjoint |
    | 4 | Every user-story flow has a terminal state | State loop without exit condition | Terminal state explicit |
    | 5 | Dependencies (Step 4) ⊂ Constraints acknowledged (Q5) | Dependency never mentioned in constraints | All deps covered |
    | 6 | NFRs measurable against at least one AC | NFR has no test hook | Every NFR → testable AC |
    | 7 | Hidden requirements (Step 3) resolved in/out | Silent inclusion | User confirmed inclusion or exclusion |
    | 0 | Prior rejection check (Step 1.5) — exact-match resolved with explicit override or session ended | Silent re-litigation of rejected concept | User chose: override (priority bumped) OR accept prior decision (session ends) |
    
    #### Output Format
    
    > Full detail moved to [`references/completeness-scoring.md`](references/completeness-scoring.md) (progressive disclosure). **Read that file before executing this section.**
    
    #### Gate Rule
    
    | Result | Action |
    |--------|--------|
    | 0 🔴 | Proceed to Step 4 — 🟡 warnings become "Risks" in Requirements Doc |
    | 1-2 🔴 | BLOCK — ask targeted question or re-scope to resolve each 🔴 |
    | 3+ 🔴 | Scrap Steps 2-3 and restart — requirements structurally incoherent |
    
    <HARD-GATE>
    NEVER hand off to plan with unresolved 🔴. Ambiguity ≤ 40% does not imply consistency — they are orthogonal gates.
    If user pushes "just build it" with 🔴 present, respond: "Contradiction in [dimension]: [specific conflict]. One clarification fixes this: [targeted question]"
    </HARD-GATE>
    
    ### Step 4 — Scope Definition
    
    Based on all gathered information, produce:
    
    **In-Scope** (explicitly included):
    - [list of features/behaviors that WILL be built]
    
    **Out-of-Scope** (explicitly excluded):
    - [list of things we WON'T build — prevents scope creep]
    
    **Assumptions** (things we're assuming without proof):
    - [each assumption is a risk if wrong]
    
    **Dependencies** (things that must exist before we can build):
    - [APIs, services, libraries, access, existing code]
    
    ### Step 4.5 — Functional Requirements (EARS)
    
    > Full detail moved to [`references/ears-requirements.md`](references/ears-requirements.md) (progressive disclosure). **Read that file before executing this section.**
    
    ### Step 5 — User Stories & Acceptance Criteria
    
    For each in-scope feature, generate:
    
    ```
    US-1 [P1]: As a [persona], I want to [action] so that [benefit]
      Independent Test: [specific action proving this story works end-to-end on its own —
                         e.g., "submit the form with valid data and see the saved record listed"]
      AC-1.1: GIVEN [context] WHEN [action] THEN [result]
      AC-1.2: GIVEN [error case] WHEN [action] THEN [error handling]
      AC-1.3: GIVEN [edge case] WHEN [action] THEN [graceful behavior]
    ```
    
    Rules:
    - Primary user story first, then edge cases
    - **Every story carries a priority**: `P1` = MVP-critical (the P1 set alone must be a viable, demoable product), `P2` = important, `P3` = nice-to-have. Implementing ONLY the P1 stories must still yield a working feature
    - **Every story carries an Independent Test** — one concrete user action that proves the story end-to-end (through UI, logic, AND data if the story touches them). If no single action can prove it, the story is sliced wrong — split or merge until it can. This field is what downstream verification gates (plan's Coverage Gate, `converge`'s gap scan, completion-gate's evidence trail) trace against
    - Every user story has at least 2 acceptance criteria (happy path + error)
    - Acceptance criteria are TESTABLE — they become test cases in Phase 3
    - Each AC proves a specific `FR-n` from Step 4.5 — cite it (`AC-1.2 → FR-3`). Every unwanted-behavior `FR` (the `If …` lines) needs an error-path AC; that's where EARS earns its keep
    - An AC whose THEN clause stops at the UI ("THEN the button shows a spinner") for a story that persists or fetches data is INCOMPLETE — the THEN must name the observable outcome ("THEN the order appears in the list / the record is persisted")
    
    ### Step 5.5 — Key Entities (mandatory if feature involves data)
    
    > Full detail moved to [`references/key-entities.md`](references/key-entities.md) (progressive disclosure). **Read that file before executing this section.**
    
    ### Step 6 — Non-Functional Requirements (NFRs)
    
    Assess and document ONLY relevant NFRs:
    
    | NFR | Requirement | Measurement |
    |-----|-------------|-------------|
    | Performance | Page load < Xs, API response < Yms | Lighthouse, k6 |
    | Security | Auth required, input validation, OWASP top 10 | sentinel scan |
    | Scalability | Expected users, data volume | Load test target |
    | Reliability | Uptime target, error budget | Monitoring threshold |
    | Accessibility | WCAG 2.2 AA | Axe audit |
    
    Only include NFRs relevant to this specific task. Don't generate a generic checklist.
    
    ### Step 6.5 — Tiered Recommendations
    
    > Full detail moved to [`references/tiered-recommendations.md`](references/tiered-recommendations.md) (progressive disclosure). **Read that file before executing this section.**
    
    ### Step 7 — Artifact Triad
    
    > Full detail moved to [`references/artifact-triad.md`](references/artifact-triad.md) (progressive disclosure). **Read that file before executing this section.** Mesh links used there: `rune:plan`.
    
    ### Step 7.5 — Glossary Sharpen (CONTEXT.md update)
    
    > Full detail moved to [`references/artifact-triad.md`](references/artifact-triad.md) (progressive disclosure). **Read that file before executing this section.**
    
    ## Output Format
    
    Triad of artifacts under `.rune/features/<feature-name>/`:
    
    | File | Template Reference |
    |------|-------------------|
    | `requirements.md` | Step 7 Artifact 1 |
    | `requirements.mermaid` | Step 7 Artifact 2 (sequence + optional state machine) |
    | `tasks.md` | Step 7 Artifact 3 (Data / Logic / Interface / Test / NFR layers) |
    
    Inside `requirements.md` the **Decision Classification** table MUST appear verbatim — plan gates on Decision compliance, Discretion items skip approval:
    
    | Category | Meaning | Example |
    |----------|---------|---------|
    | **Decisions** (locked) | User confirmed — agent MUST follow | "Use PostgreSQL, not MongoDB" |
    | **Discretion** (agent decides) | User trusts agent judgment | "Pick the best validation library" |
    | **Deferred** (out of scope) | Explicitly NOT this task | "Mobile app — future phase" |
    
    ## Constraints
    
    1. MUST ask up to 5 probing questions before producing requirements — never more, skip any you can infer from context
    2. MUST prefer yes/no or multiple-choice questions — open-ended only when no reasonable option set exists
    3. MUST NOT ask for information already present in the user's message, the repo, or classification — read/grep first, ask second
    4. MUST cache each Q→A pair in the Requirements Document and reuse on subsequent BA sessions for the same feature
    5. MUST identify hidden requirements — the obvious ones are never the full picture
    6. MUST define out-of-scope explicitly — prevents scope creep
    7. MUST produce testable acceptance criteria — they become test cases
    8. MUST NOT write code or plan implementation — BA produces WHAT, plan produces HOW
    9. MUST ask ONE question at a time by default; bundle yes/no batches only after user shows concise replies
    10. MUST NOT skip BA for non-trivial tasks — "just build it" gets redirected to Question 1
    11. MUST assign [P1|P2|P3] priority to every user story — the P1 set alone must be a viable, demoable product
    12. MUST give every user story an Independent Test — one concrete action proving it end-to-end
    13. MUST list Key Entities when any story touches data (Step 5.5) — a data-touching story with no entity is a spec gap
    14. MUST group tasks.md by user story (vertical slices), never by layer
    
    ## Returns
    
    | Artifact | Format | Location |
    |----------|--------|----------|
    | Requirements document | Markdown | `.rune/features/<feature-name>/requirements.md` |
    | Visual model | Mermaid (sequence + optional state machine) | `.rune/features/<feature-name>/requirements.mermaid` |
    | Implementation task backbone | Markdown checklist by user story (vertical slices — Data→Logic→Endpoint→UI→Test per US-n) | `.rune/features/<feature-name>/tasks.md` |
    | Logic Consistency Report | Markdown section | Embedded in requirements.md |
    | Ambiguity + Completeness scores | Markdown display blocks | Embedded in requirements.md |
    
    ## Sharp Edges
    
    Known failure modes for this skill. Check these before declaring done.
    
    | Failure Mode | Severity | Mitigation |
    |---|---|---|
    | Skipping questions because "requirements are obvious" | CRITICAL | HARD-GATE: 5 questions mandatory, even for "simple" tasks |
    | Answering own questions instead of asking user | HIGH | Questions require USER input — BA doesn't guess |
    | Producing implementation details (HOW) instead of requirements (WHAT) | HIGH | BA outputs requirements doc → plan outputs implementation |
    | All-at-once question dump (asking 5 questions in one message) | MEDIUM | One question at a time, wait for answer before next |
    | Asking open-ended questions when yes/no or multiple-choice would work | HIGH | Question Discipline rule 2 — option sets are faster to answer and easier to cache |
    | Asking for info already in the repo/message (stack, framework, audience) | HIGH | Question Discipline rule 3 — read `package.json`/README/config first, ask only what you genuinely can't find |
    | Exceeding 5 questions when the user seems "engaged" | MEDIUM | Question Discipline rule 1 — hard cap at 5. A 6th question is a sign of stalling, not thoroughness |
    | Re-asking on session restart when answers were cached | MEDIUM | Question Discipline rule 4 — load `.rune/features/<name>/requirements.md` and reuse cached Q→A pairs |
    | Missing hidden requirements (auth, error handling, edge cases) | HIGH | Step 3 checklist is mandatory scan |
    | Requirements doc too verbose (>500 lines) | MEDIUM | Max 200 lines — concise, actionable, testable |
    | Skipping BA for "simple" features that turn out complex | HIGH | Let cook's complexity detection trigger BA, not user judgment |
    | Recommending shortcuts without Completeness Score | MEDIUM | Step 3.5: every option needs X/10 score + dual effort estimate (human vs AI). "90% coverage" is a red flag when 100% costs 15 min more |
    | Handing off to plan with ambiguity > 40% | CRITICAL | Step 2.5 HARD-GATE: compute ambiguity score after elicitation, block handoff if > 40%, ask targeted follow-up on weakest dimension |
    | Skipping ambiguity scoring because "user seems clear" | HIGH | Always compute the score — perceived clarity ≠ measured clarity. The formula catches gaps humans miss |
    | Tiered recommendations too vague ("improve things") | MEDIUM | Each tier needs specific Action + measurable Expected Impact. "Build better UX" → "Reduce checkout steps from 5 to 3, targeting 15% conversion lift" |
    | All three tiers have same resources/effort | MEDIUM | Quick Win should be low-effort. If all tiers need "2 engineers, 3 months" → re-scope Quick Win to something achievable in 1 sprint |
    | Skipping Logic Consistency check because ambiguity is low | CRITICAL | Step 3.6 HARD-GATE: clarity ≠ consistency. A 90% clarity spec can still contain pairwise contradictions (scope IN/OUT overlap, rules with no enforcement, orphan ACs) |
    | Handing off to plan with unresolved 🔴 consistency fails | CRITICAL | Step 3.6 gate: 1+ 🔴 = BLOCK. 🟡 allowed only when logged as Risk in requirements.md |
    | Vague functional requirements ("system shall be fast/user-friendly") instead of EARS | MEDIUM | Step 4.5: every FR uses an EARS template with a named subject + testable response; vague targets move to NFRs (Step 6) |
    | Compound EARS requirement ("shall do A and B and C") hiding untested behavior | MEDIUM | Step 4.5: one `shall` per `FR-n` — split compounds so each behavior gets its own AC |
    | EARS `FR-n` with no acceptance criterion (untested promise) | MEDIUM | Step 3.6 check 1b: every FR traces down to an AC and up to a User Story |
    | Manufacturing EARS requirements for a bug fix or refactor | LOW | Step 4.5: skip EARS when there's no new behavior to specify — format recommendation, not ceremony |
    | Producing only requirements.md, skipping mermaid and tasks.md | HIGH | Step 7 is a triad — plan's contract expects all 3. Sequence diagram is always produced; state machine only if stateful; tasks.md always produced |
    | Mermaid diagram unrelated to actual user stories (decorative only) | MEDIUM | Sequence must trace AC-1.1 of US-1; state machine nodes must map to state-bearing ACs. Auditable by pattern-match |
    | tasks.md grouped by layer instead of by story | HIGH | Story-grouped derivation: 1 US → 1 section with ALL its layers (Data→Logic→Interface→Test). Layer-grouped backbones invite "finish the UI layer and stop" — the dead-button root cause |
    | Story with UI tasks but no Logic/Data/Test tasks (broken slice) | HIGH | Step 7 Artifact 3 rule: a `## US-n` section containing only UI/Endpoint tasks is invalid — the UI element and the endpoint it calls belong to the SAME story |
    | Story without an Independent Test (unprovable slice) | HIGH | Step 5 rule: every story names one concrete action proving it end-to-end. Can't name one → story is sliced wrong |
    | AC whose THEN stops at the UI for a data-touching story | HIGH | Step 5 rule: THEN must name the observable outcome (record persisted / data returned), not just the widget state |
    | Data-touching story with no Key Entity listed | MEDIUM | Step 5.5: plan bounces specs where a story touches data absent from Key Entities |
    | Re-litigating a previously rejected concept without surfacing it | HIGH | Step 1.5 HARD-GATE: scan `.out-of-scope/` first; exact match (≥0.8) MUST be surfaced before elicitation begins |
    | Skipping Step 1.5 because `.out-of-scope/` directory looks empty | MEDIUM | Empty directory is silent-skip OK; directory absent entirely is silent-skip OK; never skip due to "I don't think this matches anything" — let the matcher decide |
    | User asserts behavior; agent records user's version without grep verification | HIGH | Step 2.6 HARD-GATE: every "the system does X" assertion gets grep'd; conflicts surface to user before recording |
    | Silently re-defining an existing CONTEXT.md term | HIGH | Step 7.5 conflict gate: ≥0.7 overlap → user chooses merge/rename/keep-distinct |
    | Auto-creating an empty CONTEXT.md when no terms emerged | LOW | Lazy creation rule: only write when there's a non-trivial term to record |
    | Mid-elicitation rejection ("scrap it") that ends the session without writing `.out-of-scope/` | CRITICAL | Step 1.6 HARD-GATE: explicit rejection MUST produce `.out-of-scope/<slug>.md` before session end — oral rejections vanish, force re-litigation next session |
    | Writing `.out-of-scope/` for a deferral instead of routing to backlog | MEDIUM | Step 1.6 procedure step 1: confirm "out of scope" vs "deferred" — temporary reasons go to backlog, not the rejection KB |
    | Running 5-question elicitation when conversation already contains rich context | HIGH | Step 1.4: synthesis-trigger check fires before Step 2 — pasted spec / >1000 words / continuation / explicit "synthesize" → switch to Synthesis Mode (extract + cite + confirm), don't re-interview |
    | Synthesizing requirements without source citations | HIGH | Synthesis Mode requires citing source for every dimension (user message N, pasted doc, continuation file). User cannot verify interpretation without citations |
    | Auto-handoff to plan after synthesis without explicit user "go"/"locked" confirmation | HIGH | Synthesis is interpretation, not transcription. Without explicit confirmation, drift becomes a downstream bug |
    | Asking inferable questions ("what stack are you using?") without first checking package.json | HIGH | Step 2.0 HARD-GATE — every question requires prior tool-call evidence (Read/Glob/Grep) or explicit unavailability declaration |
    | Re-asking a question already answered earlier in the conversation | MEDIUM | Step 2.0 check 4 — cache and reuse, never re-ask |
    
    ## Done When
    
    - Requirement type classified (feature/refactor/integration/greenfield)
    - 5 probing questions asked and answered (or extracted from spec/PRD)
    - Ambiguity Score computed and displayed — must be ≤ 40% before proceeding (≤ 25% preferred)
    - Hidden requirements discovered and confirmed with user
    - Scope defined (in/out/assumptions/dependencies)
    - Functional requirements written in EARS format (FR-n) — skip for Bug Fix/Refactor
    - User stories with testable acceptance criteria produced, each AC citing the `FR-n` it proves
    - Every story has a [P1|P2|P3] priority and an Independent Test; P1 set alone = viable MVP
    - Key Entities listed (if feature involves data) — seeds plan's data-model.md
    - tasks.md grouped by user story (vertical slices), Foundational section minimal
    - Non-functional requirements assessed (relevant ones only)
    - Logic Consistency Report produced — 0 🔴 before handoff (🟡 logged as Risks)
    - Tiered recommendations generated (Quick Win / Differentiation / Moat) — skip for Bug Fix/Refactor
    - Artifact triad saved: `requirements.md` + `requirements.mermaid` + `tasks.md`
    - Out-of-scope match check completed (verdict logged: no-match | similar | exact-match-overridden | exact-match-accepted)
    - Handed off to `plan` for implementation planning
    
    ## Cost Profile
    
    ~3000-6000 tokens input, ~1500-3000 tokens output. Opus for deep requirement analysis — understanding WHAT to build is the most expensive mistake to get wrong.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.