---
name: business-analyse
description: Business Analysis v4.0 - Iterative multi-module workflow with 5-level navigation hierarchy, client checkpoints, and integrated documentation.
argument-hint: "[-a] [-e] [-q <FEAT-ID> \"question\"] [-r <FEAT-ID> \"change\"] [-m] <feature description>"
---

<objective>
Execute VibeCoding-focused business analysis workflows. This skill produces a single feature.json progressively enriched at each step, published to docs/business/ for web app rendering. Supports 4 use cases: new feature analysis, questions about existing features, feature refactoring, and one-shot micro-features.
</objective>

<quick_start>
**Four use cases:**

```bash
# A. New feature (full workflow)
/business-analyse Order management module

# B. Question about existing feature
/business-analyse -q FEAT-001 "What permissions does the manager have?"

# C. Refactoring (delta on existing)
/business-analyse -r FEAT-001 "Add export PDF functionality"

# D. Micro-feature (one-shot, minimal questions)
/business-analyse -m Add a status field to orders
```

**Recommended autonomous workflow:**

```bash
/business-analyse -a New payment gateway integration
```

See `<parameters>` for complete flag list.
</quick_start>

<parameters>

<flags>
**Enable flags (turn ON):**
| Short | Long | Description |
|-------|------|-------------|
| `-a` | `--auto` | Autonomous mode: skip confirmations |
| `-e` | `--economy` | Economy mode: no subagents |
| `-q` | `--question` | Question mode: query an existing feature (requires FEAT-ID + question) |
| `-r` | `--refactor` | Refactoring mode: delta changes on existing feature (requires FEAT-ID + change description) |
| `-m` | `--micro` | Micro-feature mode: minimal questions, direct handoff |
| `-app` | `--application` | Application mode: multi-module analysis with module decomposition |
| `-i` | `--interactive` | Interactive mode: configure flags via AskUserQuestion |

**Disable flags (turn OFF):**
| Short | Long | Description |
|-------|------|-------------|
| `-A` | `--no-auto` | Disable auto mode |
| `-E` | `--no-economy` | Disable economy mode |
</flags>

<examples>
```bash
# A. New feature analysis (single module - goes through full workflow)
/business-analyse Order management module

# B. Application analysis (multi-module)
/business-analyse -app Complete sales management system

# C. Question about existing feature
/business-analyse -q FEAT-001 "What permissions does the manager have?"

# D. Refactoring (create v1.1)
/business-analyse -r FEAT-001 "Add export PDF functionality"

# E. Micro-feature (minimal questions)
/business-analyse -m Add a status field to orders

# Autonomous application mode
/business-analyse -app -a New HR management system

# Economy mode (no subagents)
/business-analyse -e Order management
```
</examples>

<parsing_rules>
**Flag parsing:**

1. Defaults loaded from `steps/step-00-init.md` `<defaults>` section
2. Command-line flags override defaults
3. Flags removed from input, remainder becomes `{feature_description}`
4. Use case determined by flags: question > refactor > micro > new (default)
5. Feature ID generated as `FEAT-NNN` for new features
</parsing_rules>

</parameters>

<output_structure>
**All outputs saved to PROJECT directory:**

```
docs/business/{app}/business-analyse/v{X.Y}/
    feature.json              # APPLICATION-level master (modules, dependencies, roles)
docs/business/{app}/{module}/business-analyse/v{X.Y}/
    feature.json              # MODULE-level detail (entities, UC, FR, permissions, mockups)
```

**Ralph Loop files (generated by step-05):**
```
.ralph/
├── prd.json            # Task breakdown for /ralph-loop -r
└── progress.txt        # Links to BA documents
```

**Documentation integrated in SmartStack app:**
- Application view: `/docs/business/{app}` (module overview, dependency graph, roles)
- Module view: `/docs/business/{app}/{module}` (full specification, mockups)

**No intermediate markdown files - all state in feature.json**
</output_structure>

<resume_workflow>
**Question mode (`-q {FEAT-ID} "question"`):**

When provided, step-00 will:

1. Locate the feature.json in `docs/business/{app}/{module}/business-analyse/v{X.Y}/`
2. Load ba-reader agent to answer question from existing feature.json
3. Return answer and EXIT (no further steps)

**Refactoring mode (`-r {FEAT-ID} "change description"`):**

When provided, step-00 will:

1. Locate existing feature.json
2. Create new version folder (v1.1 from v1.0, etc.)
3. Load existing feature context
4. Continue through steps 01-04 with delta focus
</resume_workflow>

<workflow>
**Use case routing (step-00):**

1. Parse flags and feature description
2. If `-q`: Load ba-reader, answer question → EXIT
3. If `-r`: Load existing feature.json, create new version
4. If `-m`: Create minimal feature.json → simplified handoff
5. If `-app` or auto-detected multi-module: Full application workflow
6. Default: Single module workflow (same phases, decomposition is trivial)

**Application workflow (multi-module):**
- **Step 00:** Parse flags, create master feature.json (draft)
- **Step 01:** Cadrage: context, stakeholders, scope, application roles (framed)
- **Step 02:** Decomposition: modules, dependencies, client checkpoint (decomposed)
- **Step 03:** Iterative specification per module (specified)
  - For each module in dependency order:
    - Walk through sections & resources with client
    - Propose ASCII/SVG mockups per section
    - Define entities + business rules
    - Generate specification (UC, FR, permissions, SeedData)
    - Per-module validation + client confirmation
- **Step 04:** Cross-module consolidation (consolidated)
- **Step 05:** Handoff with per-module prd.json (handed-off)

**Single module workflow (same phases, simplified):**
- **Step 00:** Parse flags, create master feature.json (draft)
- **Step 01:** Cadrage: context, stakeholders, scope, roles (framed)
- **Step 02:** Decomposition: trivial (1 module), quick checkpoint (decomposed)
- **Step 03:** Specification: single iteration (specified)
- **Step 04:** Consolidation: auto-pass (consolidated)
- **Step 05:** Handoff (handed-off)

**Micro workflow:**
- **Step 00:** Create minimal feature.json
- **Step 05:** Direct handoff (skip 01-04)
</workflow>

<state_variables>
**Persist throughout all steps via feature.json:**

| Variable                | Type    | Description                                            |
| ----------------------- | ------- | ------------------------------------------------------ |
| `{feature_id}`          | string  | Unique identifier (e.g., `FEAT-001`)                   |
| `{feature_description}` | string  | What to analyze (flags removed)                        |
| `{use_case}`            | string  | One of: new, question, refactoring, micro              |
| `{version}`             | string  | SemVer (1.0, 1.1, 2.0, etc.)                           |
| `{application_name}`    | string  | Target application name                                |
| `{module_name}`         | string  | Target module name                                     |
| `{context}`             | string  | Always "business" for BA                               |
| `{auto_mode}`           | boolean | Skip confirmations                                     |
| `{economy_mode}`        | boolean | No subagents, direct tool usage only                   |
| `{workflow_mode}`       | string  | "application" or "module"                              |
| `{docs_dir}`            | string  | `docs/business/{app}/{module}/business-analyse/v{X.Y}/` |

</state_variables>

<entry_point>

**FIRST ACTION:** Load `steps/step-00-init.md`

</entry_point>

<step_files>
**Progressive loading - only load current step:**

| Step | File                              | Model  | Purpose                                              |
| ---- | --------------------------------- | ------ | ---------------------------------------------------- |
| 00   | `steps/step-00-init.md`           | Haiku  | Parse flags, route use case, create master feature.json |
| 01   | `steps/step-01-cadrage.md`        | Opus   | Framing: context, stakeholders, scope, application roles |
| 02   | `steps/step-02-decomposition.md`  | Sonnet | Module decomposition, dependency graph, client checkpoint |
| 03   | `steps/step-03-specify.md`        | Opus   | Iterative per-module specification + validation |
| 04   | `steps/step-04-consolidation.md`  | Sonnet | Cross-module validation, E2E flows, permissions coherence |
| 05   | `steps/step-05-handoff.md`        | Opus   | Development prompt + Ralph Loop prd.json |

</step_files>

<questionnaire_files>
**Progressive questionnaire loading (step-01 only):**

Load ONLY relevant categories based on feature type:

| Category | File                                | Questions | When to load |
| -------- | ----------------------------------- | --------- | ------------ |
| 00       | `questionnaire/00-application.md` | 8         | If application mode |
| 01       | `questionnaire/01-context.md`       | 4         | Always       |
| 02       | `questionnaire/02-stakeholders.md`  | 6         | Always       |
| 03       | `questionnaire/03-scope.md`         | 6         | Always       |
| 04       | `questionnaire/04-data.md`          | 6         | If data-centric |
| 05       | `questionnaire/05-integrations.md`  | 6         | If integrations |
| 06       | `questionnaire/06-security.md`      | 4         | Always (minimal) |
| 07       | `questionnaire/07-ui.md`            | 6         | If UI-centric |
| 08       | `questionnaire/08-performance.md`   | 4         | If performance-critical |
| 09       | `questionnaire/09-constraints.md`   | 4         | If constraints exist |
| 10       | `questionnaire/10-documentation.md` | 4         | If doc required |

**Total: ~60 questions (trimmed from 100+)**

</questionnaire_files>

<template_files>
**Progressive template loading:**

| Template | File                                | Used in step |
| -------- | ----------------------------------- | ------------ |
| schema   | `schemas/feature-schema.json`       | All steps    |
| spec     | `templates/tpl-frd.md`              | 02           |
| handoff  | `templates/tpl-handoff.md`          | 04           |
| suggestions | `patterns/suggestion-catalog.md` | 01           |

</template_files>

<execution_rules>

- **Load one step at a time** - Only load the current step file
- **ULTRATHINK** for steps 01, 02, 04 (critical thinking)
- **State persisted in feature.json** (NOT markdown files)
- **Use ba-writer agent** for all JSON writes
- **Use ba-reader agent** for all JSON reads
- **Follow next_step directive** at end of each step
- **Context: business only** - Reject platform/personal/system contexts
- **Use parallel agents** for exploration (unless economy_mode)
</execution_rules>

<success_criteria>

- Master feature.json created and enriched progressively through all steps
- Module decomposition validated by client (step-02 checkpoint)
- Each module specified iteratively with client validation
- ASCII/SVG mockups proposed for each module's sections
- Cross-module consolidation passed (step-04)
- Development handoff ready for `/ralph-loop -r` or `/feature-full`
- Ralph Loop prd.json generated (per module or consolidated)
- All outputs renderable by SmartStack app viewer at `/docs/business/{app}/`
</success_criteria>
