---
name: multi-agent-analysis
language: en
description: "Standalone feature-spec analysis. Two profiles picked at intake: global (23-section development handoff, 8 of them in Lite mode) or corporate (IG/UC/FG requirements document with traceability matrices). Platform-agnostic concept layer with repo-driven convention extraction and per-platform Pass B render; stack selection is optional. Collects Figma / Swagger / Confluence / Jira / Standards / Firebase / repo inputs, then stops. Does not chain into dev or create branches. Use when a feature needs a written specification before any code."
user-invocable: true
argument-hint: "[\"<analysis-name>\"] [--lite | --full] [--no-cache] [--preview-conventions]"
---

# multi-agent-analysis - Feature Spec Analysis (v3)

**Input**: $ARGUMENTS (optional analysis name, e.g. `"FlightStatus"`)

Produces a stakeholder-ready, platform-agnostic feature-spec document set (one markdown file per selected platform) before any implementation starts. Do not confuse with the orchestrator's Phase 1 (which is an in-pipeline stack detector). This command is **independent and side-effect free**: no branches, worktrees, commits, or PRs.

> **Language**: Per `refs/rules.md` Language Application matrix - instruction prose stays English. `AskUserQuestion.label` and `header` stay English. `question` and `description` follow `outputLanguage`. The emitted document body follows `outputLanguage` (`tr` or `en`).

## When to use

- Before kicking off a new feature: design + API + business rules + architecture plan + test strategy crystallized into one per-platform document set
- To refresh a stale Confluence spec page
- For API-only work (no Figma) or frontend-only work (no API) - the omission rule keeps the output clean

## Profile

Phase 0 Step 1b picks the analysis standard, and that selects the template. Both profiles read the same evidence; only the projection differs, which is what keeps them from drifting into two products.

| Profile | Template | Shape |
|---|---|---|
| `global` (default) | `analysis-template.md` | Development handoff. Business rules with Gherkin acceptance criteria, architecture, files, tests. Zero-evidence sections drop. |
| `corporate` | `analysis-template-corporate.md` | Requirements document. `IG -> UC -> FG` spine with three traceability matrices, current and target state with impact analysis, then technical and development analysis. The Part A backbone always renders, carrying `N/A` or `EKLENECEK`, and each `EKLENECEK` owes an open-question row. |

One run emits one profile. A missing input never blocks either: the gap is written as `EKLENECEK` and raised as an open question instead of halting the run.

**Stack is optional.** With no platform selected the run still completes: everything that does not need a target repository renders in full, only the development layer and the Pass B projection are skipped, and the output is a single file at `~/Desktop/multiAgentAnalysis/<feature-name>/<feature>.md` (never the current working directory, which for a repo-less run is arbitrary).

**References are built, not written.** `build-references.mjs` projects `state.analysisSpec.evidence.*` into Section 21, carrying a precision anchor per row (Figma node id, Confluence pageId plus version, repo commit sha) and an access cell, so a source that could not be fetched is listed as unreachable rather than dropped. A coverage gate blocks dispatch on a consumed-but-unlisted source and on an invented row.

## Template (v3)

Full mode renders 23 sections (Glossary, Changelog, References). Lite mode renders 7 sections (Summary, Goals + Non-Goals, User Stories, API Contracts, Architecture, Files to Add, References) and auto-activates for small features via three scored signals; `--lite` / `--full` flags always win.

**Section omission**: zero-evidence sections are dropped entirely (no "TBD" placeholder); numbering re-flows to stay sequential. Sections 1, 2, 4, 9, 13, 14, 20, 21 are never omitted.

**Two-pass render**: Pass A computes the shared logical content once; Pass B projects it onto each selected platform using conventions extracted from the repos (Phase 1c, seven pattern groups with confidence levels). Every projected cell carries an evidence footnote. A convention preview gate lets the user approve or override cells before any file renders.

## Flow

| Phase | Action |
|-------|--------|
| 0. Intake | Analysis name + account picker + platform multi-select (iOS / Android / Backend / Frontend) + repo multi-select per platform + 6-question URL batch (Figma / Swagger / Confluence / Jira / Standards / Firebase - each independently skippable) |
| 1. Fetch | Parallel Swagger / Confluence / Figma (3-tier chain) / Jira / Standards / Firebase fetch + repo-evidence collector (13 buckets) + Code Connect index + convention extraction (Phase 1c) |
| 2. Synth | Pass A shared synthesis, Pass B preview gate, per-platform Pass B render, schema validation |
| 3. Humanize + Buffer | Resolve `outputLanguage`, render drafts to `/tmp`, humanizer pass, punctuation gate |
| 3.5 Output picker | Local file (default) / Confluence page / Jira description (multi-select, asked only after drafts exist) |
| 4. Dispatch + Report | Write per-platform files, post Confluence/Jira on request, report. **Stop.** |

When the rendered Section 20 (Risks and Open Questions) has open rows, the report suggests `multi-agent-analysis-resolve` to close them interactively.

## Detailed implementation

Full steps: `$HOME/.claude/commands/multi-agent/analysis/SKILL.md`.
Template master copies: `$HOME/.claude/multi-agent-refs/analysis-template.md` (global) and `$HOME/.claude/multi-agent-refs/analysis-template-corporate.md` (corporate).
References builder: `$HOME/.claude/scripts/build-references.mjs`.
Schema: `$HOME/.claude/schemas/analysis-spec.schema.json`.
Convention extractor: `$HOME/.claude/lib/extract-conventions.sh` (output contract: `$HOME/.claude/schemas/conventions-output.schema.json`).

## Notes

- Output file naming: `analysis/<feature>-<platform>.md`, one per selected platform.
- The `analysis/` directory is not gitignored, but no auto-commit happens.
- If Confluence / Jira POST returns 401 / 403, the command surfaces the error and offers a Local fallback.
