---
name: business-analyse
description: Business Analysis - Complete business analysis workflow (BABOK/IEEE 830) with progressive step loading and context refresh.
argument-hint: "[-a] [-s] [-e] [-r <task-id>] <feature description>"
---

<objective>
Execute systematic business analysis workflows following BABOK v3 and IEEE 830 standards.
This skill uses progressive step loading to minimize context usage and maintain fresh context throughout the workflow.
</objective>

<quick_start>
**Basic usage:**

```bash
/business-analyse Module de gestion des clients
```

**Recommended workflow (autonomous with save):**

```bash
/business-analyse -a -s Gestion des commandes avec workflow validation
```

**Resume a previous analysis:**

```bash
/business-analyse -r FEAT-001
```

**Flags:**

- `-a` (auto): Skip confirmations
- `-s` (save): Save outputs to `.business-analyse/`
- `-e` (economy): No subagents, direct tool usage
- `-r` (resume): Resume from a previous FEAT-ID

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

<parameters>

<flags>
**Enable flags (turn ON):**
| Short | Long | Description |
|-------|------|-------------|
| `-a` | `--auto` | Autonomous mode: skip confirmations, auto-approve |
| `-s` | `--save` | Save mode: output to `.business-analyse/` (default: true) |
| `-e` | `--economy` | Economy mode: no subagents, save tokens |
| `-r` | `--resume` | Resume mode: continue from a previous FEAT-ID |
| `-i` | `--interactive` | Interactive mode: configure flags via AskUserQuestion |

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

<examples>
```bash
# Basic usage
/business-analyse Module gestion clients

# Autonomous mode (no confirmations)
/business-analyse -a Module gestion clients

# Economy mode (save tokens)
/business-analyse -e Module gestion clients

# Resume a previous feature
/business-analyse -r FEAT-001
/business-analyse -r 001  # Partial match supported

# Combined flags
/business-analyse -a -e Module gestion clients
```
</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. Feature ID generated as `FEAT-NNN`
</parsing_rules>

</parameters>

<output_structure>
**When `{save_mode}` = true (default):**

All outputs saved to PROJECT directory:
```
.business-analyse/business/{app}/modules/{module}/features/{FEAT-NNN}/
├── 00-context.md              # Params, user request, timestamp, progress
├── 1-discovery.md             # Phase 1: Discovery findings
├── 2-business-requirements.md # Phase 2: BRD
├── 3-functional-specification.md # Phase 3: FRD
├── validation.json            # Phase 4: Validation gate
├── 4-development-handoff.md   # Phase 5: Dev prompt
└── tracking/
    ├── changes/
    ├── bugs/
    └── hotfixes/
```
</output_structure>

<resume_workflow>
**Resume mode (`-r {FEAT-ID}`):**

When provided, step-00 will:

1. Locate the feature folder in `.business-analyse/`
2. Read `00-context.md` to restore state
3. Find the last completed step
4. Continue from the next step
</resume_workflow>

<workflow>
**Standard flow:**
1. Parse flags and feature description
2. If `-r`: Execute resume workflow
3. Create output folder and 00-context.md
4. Load step-01-discover.md -> elicitation with ULTRATHINK
5. Load step-02-analyse.md -> BRD + business rules
6. Load step-03-specify.md -> FRD + use cases
7. Load step-04-validate.md -> validation gate
8. Load step-05-handoff.md -> development prompt
9. Load step-06-doc-html.md -> React documentation (optional)
</workflow>

<state_variables>
**Persist throughout all steps:**

| Variable                | Type    | Description                                            |
| ----------------------- | ------- | ------------------------------------------------------ |
| `{feature_description}` | string  | What to analyze (flags removed)                        |
| `{feature_id}`          | string  | Unique identifier (e.g., `FEAT-001`)                   |
| `{application_name}`    | string  | Target application name                                |
| `{module_name}`         | string  | Target module name                                     |
| `{context}`             | string  | Always "business" for BA                               |
| `{auto_mode}`           | boolean | Skip confirmations                                     |
| `{save_mode}`           | boolean | Save outputs (default: true)                           |
| `{economy_mode}`        | boolean | No subagents, direct tool usage only                   |
| `{output_dir}`          | string  | Full path to feature output directory                  |

</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, create structure, initialize state      |
| 01   | `steps/step-01-discover.md`  | Opus   | Elicitation with ULTRATHINK (load questionnaire)     |
| 02   | `steps/step-02-analyse.md`   | Sonnet | BRD + business rules formalization                   |
| 03   | `steps/step-03-specify.md`   | Sonnet | FRD + use cases + permissions                        |
| 04   | `steps/step-04-validate.md`  | Haiku  | Validation gate (APPROVED/REJECTED)                  |
| 05   | `steps/step-05-handoff.md`   | Opus   | Development prompt generation                        |
| 06   | `steps/step-06-doc-html.md`  | Sonnet | React documentation (optional)                       |

</step_files>

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

Load ONLY relevant categories based on feature type:

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

</questionnaire_files>

<template_files>
**Progressive template loading:**

| Template | File                          | Used in step |
| -------- | ----------------------------- | ------------ |
| discovery | `templates/frd-discovery.md` | 01           |
| brd       | `templates/frd-brd.md`       | 02           |
| frd       | `templates/frd-spec.md`      | 03           |
| handoff   | `templates/frd-handoff.md`   | 05           |

</template_files>

<execution_rules>

- **Load one step at a time** - Only load the current step file
- **ULTRATHINK** for phases 01, 02, 03, 05 (critical thinking)
- **Persist state variables** across all steps via 00-context.md
- **Follow next_step directive** at end of each step
- **Save outputs** immediately after each phase
- **Use parallel agents** for exploration (unless economy_mode)
- **Context: business only** - Reject platform/personal/system contexts
</execution_rules>

<success_criteria>

- Each step loaded progressively (max 300-400 lines/step)
- All outputs saved to feature folder
- Validation gate passed (APPROVED)
- Development handoff ready for `/implement`
- Clear completion summary with next steps
</success_criteria>
