Skill: Requirements Analysis and Specification Extraction
Input Handling
- Markdown files (
.md): Read the file content directly.
- Word documents (
.docx): Ask the user to paste or convert the content. Do NOT attempt binary parsing.
- Detect the input language (Italian or English) and communicate in that language throughout the session.
Input / Output
|
|
| Input |
Functional specification document (.md or pasted text) |
| Output |
<ProjectName>/spec/requirements_summary.md |
Extraction Procedure
When analyzing the functional specifications document, perform the following extractions systematically:
1. Identify Metrics (Facts / KPIs)
- List ALL required quantitative metrics with their specific aggregation rules (SUM, AVERAGE, COUNT, etc.).
- For each KPI, specify:
- Name (in English for code, original language for descriptions)
- Aggregation type (additive, semi-additive, non-additive)
- Formula or calculation logic (if provided)
- Format (currency, percentage, integer, etc.)
- Time intelligence requirements (YTD, PY, MoM, etc.)
2. Identify Dimensions
- List ALL qualitative attributes used for filtering or grouping.
- For each dimension, identify:
- Attributes (columns for filtering/grouping)
- Hierarchies (drill-down paths, e.g., Area → Country → Customer)
- Cardinality estimate (high/medium/low)
- Whether it's shared across multiple fact tables (conformed dimension per Kimball)
3. Determine Granularity (Grain)
- Explicitly state the lowest level of detail (grain) for each Fact table.
- Example: "One row per sales transaction per day per customer" vs. "One row per month per area".
- If the specs are ambiguous about grain, flag it and ask the user.
4. Extract RLS Rules
- Map out any Row-Level Security requirements:
- Which user roles exist
- Which dimension tables each role filters
- The DAX filter expression logic
- If (and ONLY if) RLS is in scope, reference
.github/references/security-rls-best-practices.md to ensure:
- Least privilege and explicit allow/deny behavior is specified
- The identity mechanism is clear (e.g.,
USERNAME(), USERPRINCIPALNAME(), CUSTOMDATA())
- RLS is designed to filter Dimensions (with propagation to Facts) rather than filtering Facts directly
- Context optimization: if RLS is NOT mentioned/required, do NOT load security references.
- If no RLS is mentioned, explicitly note: "No RLS requirements detected."
5. Identify Fact Table Separation
- Determine if facts should be in separate tables (e.g., Sales Fact vs. Budget Fact).
- Identify the grain of each fact table independently.
- Note any many-to-many relationships that may require bridge tables.
6. Detect Dynamic Switching Requirements
- Explicitly detect whether the report requires field parameters for dynamic switching of dimensions, measures, or mixed field sets.
- For each requested dynamic switch, capture:
- Business intent: what the user wants to change dynamically and why
- Parameter scope: dimension switch, measure switch, or mixed switch
- Target visuals: which charts, tables, or matrices consume the parameter
- Selection behavior: single-select or multi-select
- Default selection: which field should be active when the report opens
- For measure-switch requirements, also capture the allowed analysis context:
- which dimensions are valid to keep on rows, columns, axis, legend, or table grouping when the measure parameter changes
- why those dimensions remain semantically correct for every selectable measure
- whether some dimensions are forbidden because one or more selectable measures do not propagate correctly through the active model relationships
- If the specification says users should "change the breakdown", "switch the axis", "change KPIs", or "choose what the visual shows", treat that as a field-parameter requirement unless the user says otherwise.
Validation Gate
Before declaring Step 1 complete, check:
If ANY of these are missing or ambiguous, flag them explicitly and ask the user before proceeding.
Critical Clarification Gate (MANDATORY)
For this workflow, the following clarifications are blocking and cannot remain implicit:
- Period and calendar semantics used by cumulative or comparative calculations.
- Numeric threshold/classification semantics for status-driven KPIs (including inclusive/exclusive boundaries).
- Grain reconciliation semantics when metrics compare entities at different detail levels.
Required behavior:
- If one or more critical clarifications are unresolved, DO NOT accept Step 1 completion.
- If the user replies with generic approval (for example: "Proceed") without answering, ask targeted follow-up questions and keep the step pending.
- Only proceed when each critical clarification has either:
- a concrete user answer, or
- an explicit user-approved assumption recorded in
workflow_state.json decision tracking.
Output Format
Present the analysis as a structured table:
### KPIs Identified
| # | KPI Name | Aggregation | Formula | Format | Time Intelligence |
|---|----------|------------|---------|--------|-------------------|
### Dimensions Identified
| # | Dimension | Key Attributes | Hierarchy | Shared? |
|---|-----------|---------------|-----------|---------|
### Fact Tables
| # | Fact Table | Grain | Related Dimensions |
|---|-----------|-------|-------------------|
### RLS Rules
| Role | Filtered Dimension | Filter Logic |
|------|-------------------|-------------|
### Dynamic Switching Requirements
| # | Intent | Parameter Scope | Target Visuals | Default Selection | Selection Mode | Allowed Context Dimensions |
|---|--------|-----------------|----------------|-------------------|----------------|----------------------------|
Save the primary artifact to <ProjectName>/spec/requirements_summary.md.
1---2name: requirements-analysis3description: Use when analyzing functional specifications to extract KPIs, dimensions, grain, and constraints. Triggers: "analyze requirements", "extract KPIs", "analyze specification", "requirements summary", "identify dimensions", "define grain", "business requirements", "functional spec analysis", "clarification questions".4---56# Skill: Requirements Analysis and Specification Extraction78## Input Handling910- **Markdown files** (`.md`): Read the file content directly.11- **Word documents** (`.docx`): Ask the user to paste or convert the content. Do NOT attempt binary parsing.12- Detect the input language (Italian or English) and communicate in that language throughout the session.1314## Input / Output1516| | |17|---|---|18| **Input** | Functional specification document (`.md` or pasted text) |19| **Output** | `<ProjectName>/spec/requirements_summary.md` |2021## Extraction Procedure2223When analyzing the functional specifications document, perform the following extractions systematically:2425### 1. Identify Metrics (Facts / KPIs)26- List ALL required quantitative metrics with their specific aggregation rules (SUM, AVERAGE, COUNT, etc.).27- For each KPI, specify:28 - **Name** (in English for code, original language for descriptions)29 - **Aggregation type** (additive, semi-additive, non-additive)30 - **Formula or calculation logic** (if provided)31 - **Format** (currency, percentage, integer, etc.)32 - **Time intelligence requirements** (YTD, PY, MoM, etc.)3334### 2. Identify Dimensions35- List ALL qualitative attributes used for filtering or grouping.36- For each dimension, identify:37 - **Attributes** (columns for filtering/grouping)38 - **Hierarchies** (drill-down paths, e.g., Area → Country → Customer)39 - **Cardinality estimate** (high/medium/low)40 - **Whether it's shared** across multiple fact tables (conformed dimension per Kimball)4142### 3. Determine Granularity (Grain)43- Explicitly state the **lowest level of detail** (grain) for each Fact table.44- Example: "One row per sales transaction per day per customer" vs. "One row per month per area".45- If the specs are ambiguous about grain, **flag it and ask the user**.4647### 4. Extract RLS Rules48- Map out any **Row-Level Security** requirements:49 - Which user roles exist50 - Which dimension tables each role filters51 - The DAX filter expression logic52- If (and ONLY if) RLS is in scope, reference `.github/references/security-rls-best-practices.md` to ensure:53 - Least privilege and explicit allow/deny behavior is specified54 - The identity mechanism is clear (e.g., `USERNAME()`, `USERPRINCIPALNAME()`, `CUSTOMDATA()`)55 - RLS is designed to filter Dimensions (with propagation to Facts) rather than filtering Facts directly56- Context optimization: if RLS is NOT mentioned/required, do NOT load security references.57- If no RLS is mentioned, explicitly note: "No RLS requirements detected."5859### 5. Identify Fact Table Separation60- Determine if facts should be in **separate tables** (e.g., Sales Fact vs. Budget Fact).61- Identify the grain of each fact table independently.62- Note any many-to-many relationships that may require bridge tables.6364### 6. Detect Dynamic Switching Requirements65- Explicitly detect whether the report requires **field parameters** for dynamic switching of dimensions, measures, or mixed field sets.66- For each requested dynamic switch, capture:67 - **Business intent**: what the user wants to change dynamically and why68 - **Parameter scope**: dimension switch, measure switch, or mixed switch69 - **Target visuals**: which charts, tables, or matrices consume the parameter70 - **Selection behavior**: single-select or multi-select71 - **Default selection**: which field should be active when the report opens72- For **measure-switch** requirements, also capture the **allowed analysis context**:73 - which dimensions are valid to keep on rows, columns, axis, legend, or table grouping when the measure parameter changes74 - why those dimensions remain semantically correct for every selectable measure75 - whether some dimensions are forbidden because one or more selectable measures do not propagate correctly through the active model relationships76- If the specification says users should "change the breakdown", "switch the axis", "change KPIs", or "choose what the visual shows", treat that as a field-parameter requirement unless the user says otherwise.7778## Validation Gate7980Before declaring Step 1 complete, check:81- [ ] All KPIs have clear aggregation rules82- [ ] All dimensions have defined attributes83- [ ] Grain is explicitly defined for each fact table84- [ ] Data types are specified or inferrable for all fields85- [ ] RLS requirements are documented (or explicitly none)86- [ ] Time/period calculation requirements are clear (calendar/period boundary definitions, ordering, label semantics)87- [ ] Dynamic switching requirements are explicitly classified as regular slicers, field parameters, or not needed8889If ANY of these are missing or ambiguous, **flag them explicitly and ask the user** before proceeding.9091## Critical Clarification Gate (MANDATORY)9293For this workflow, the following clarifications are **blocking** and cannot remain implicit:94951. Period and calendar semantics used by cumulative or comparative calculations.962. Numeric threshold/classification semantics for status-driven KPIs (including inclusive/exclusive boundaries).973. Grain reconciliation semantics when metrics compare entities at different detail levels.9899Required behavior:100101- If one or more critical clarifications are unresolved, DO NOT accept Step 1 completion.102- If the user replies with generic approval (for example: "Proceed") without answering, ask targeted follow-up questions and keep the step pending.103- Only proceed when each critical clarification has either:104 - a concrete user answer, or105 - an explicit user-approved assumption recorded in `workflow_state.json` decision tracking.106107## Output Format108109Present the analysis as a structured table:110111```112### KPIs Identified113| # | KPI Name | Aggregation | Formula | Format | Time Intelligence |114|---|----------|------------|---------|--------|-------------------|115116### Dimensions Identified117| # | Dimension | Key Attributes | Hierarchy | Shared? |118|---|-----------|---------------|-----------|---------|119120### Fact Tables121| # | Fact Table | Grain | Related Dimensions |122|---|-----------|-------|-------------------|123124### RLS Rules125| Role | Filtered Dimension | Filter Logic |126|------|-------------------|-------------|127128### Dynamic Switching Requirements129| # | Intent | Parameter Scope | Target Visuals | Default Selection | Selection Mode | Allowed Context Dimensions |130|---|--------|-----------------|----------------|-------------------|----------------|----------------------------|131```132133Save the primary artifact to `<ProjectName>/spec/requirements_summary.md`.