Core

Foundation of the ubFlow methodology — specifications as code, file organization, and traceability.

Last Updated: 2026-02-15

Level 0: Stakeholder Needs (WHY)

Need: Manage Specifications as Code NEED_CORE_SPEC_AS_CODE

As a developer, I want to manage Stakeholder Needs, Requirements, and Specs in version-controlled RST files, so that I can branch, merge, review, and track the full specification hierarchy like code.

Specification Hierarchy:

┌─────────────────────────────────────────────────────────────┐
│  Level 0: Stakeholder Needs (WHY)                           │
│  "As a user, I want X so that Y"                            │
└──────────────────────┬──────────────────────────────────────┘
                       │ derives
                       ▼
┌─────────────────────────────────────────────────────────────┐
│  Level 1: Requirements (WHAT)                               │
│  "System SHALL do X" + Acceptance Criteria                  │
└──────────────────────┬──────────────────────────────────────┘
                       │ implements
                       ▼
┌─────────────────────────────────────────────────────────────┐
│  Level 2: Design/Specs (HOW)                                │
│  Technical design, architecture, interfaces                 │
└─────────────────────────────────────────────────────────────┘

Acceptance Scenarios:

  1. Given I write a Stakeholder Need, When I commit, Then it’s in Git history

  2. Given I derive a Requirement from a Need, When I link them, Then traceability is preserved

  3. Given I modify any spec level, When I diff, Then I see what changed

  4. Given I branch for a feature, When I merge, Then all spec levels merge together

Need: Consistent File Organization Across Specification Levels NEED_CORE_FILE_ORG
status: implemented
tags: core, methodology, organization
priority: high

As a developer (or AI agent), I want to have a well-defined methodology for organizing specification files across levels (Stakeholder Needs, Requirements, Design), so that I can find, navigate, maintain, and scale specifications consistently as the project grows.

Acceptance Scenarios:

  1. Given I need to add a new stakeholder need, When I check the methodology, Then I know which file to put it in (or when to create a new one)

  2. Given I create a new requirement, When I follow the conventions, Then I know it belongs in the file that mirrors the corresponding US file

  3. Given I write a design spec, When I organize by component, Then it can link to REQs from multiple US themes without artificial file splits

  4. Given the project grows beyond 50 stakeholder needs, When I follow the scaling guidelines, Then the file structure remains navigable and reviewable

Level 1: Requirements (WHAT)

Software Requirement: Requirements Management with sphinx-needs REQ_CORE_SPHINX_NEEDS
status: implemented
tags: core, sphinx-needs
priority: mandatory

Description: ubFlow SHALL manage requirements in sphinx-needs RST format.

Rationale: sphinx-needs provides structured requirements with automatic traceability, validation, and documentation generation.

Acceptance Criteria:

  • AC-1: Requirements stored in .rst files with sphinx-needs directives

  • AC-2: Each requirement has unique ID, status, priority, and tags

  • AC-3: sphinx-build validates requirement syntax and links

  • AC-4: HTML documentation generated from requirements

Software Requirement: Design Specification with Traceability REQ_CORE_TRACEABILITY
status: implemented
tags: core, traceability
priority: mandatory

Description: ubFlow SHALL maintain design specifications linked to requirements.

Rationale: Traceability from requirements to design ensures all requirements are addressed and design decisions are justified.

Acceptance Criteria:

  • AC-1: Design specs use :links: to reference requirements

  • AC-2: sphinx-needs validates all links exist

  • AC-3: Traceability matrix auto-generated

  • AC-4: Orphan detection (specs without requirements, requirements without specs)

File Organization

Software Requirement: File Organization by Domain Type REQ_CORE_DOMAIN_ORG
status: implemented
tags: core, methodology, organization
priority: mandatory
links outgoing: NEED_CORE_FILE_ORG

Description: ubFlow SHALL organize specification files by domain type:

  • Level 0 (Stakeholder Needs) and Level 1 (Requirements): by problem domain — one file per stakeholder theme or value stream

  • Level 2 (Design Specs): by solution domain — one file per technical component or module

Rationale: Stakeholder Needs and Requirements answer “why” and “what” from the stakeholder perspective, so they group naturally by user goals. Design Specs answer “how” from the technical perspective, so they group by architectural component. A single design component may address requirements from multiple themes.

Acceptance Criteria:

  • AC-1: NEED files named need_<theme>.rst grouping by stakeholder theme

  • AC-2: REQ files named req_<theme>.rst grouping by the same themes

  • AC-3: SPEC files named spec_<component>.rst grouping by technical component

  • AC-4: A SPEC file MAY link to REQs from multiple themes

Software Requirement: Level 1 Mirrors Level 0 File Structure REQ_CORE_L1_MIRROR
status: approved
tags: core, methodology, organization
priority: mandatory

Description: ubFlow SHALL maintain a 1:1 correspondence between Level 0 (Stakeholder Need) and Level 1 (Requirement) files.

Rationale: A Stakeholder Need file defines a bounded context. Its requirements are cohesive and belong together. The 1:1 mapping provides a simple mental model: “Where are the REQs for this NEED file? In the matching req_ file.”

Acceptance Criteria:

  • AC-1: For each need_<theme>.rst there SHALL be a req_<theme>.rst

  • AC-2: Requirements in req_<theme>.rst SHALL link to Stakeholder Needs in the corresponding need_<theme>.rst

  • AC-3: Merging related requirement files is acceptable when a NEED file produces fewer than 3 requirements

Level 2: Design (HOW)

Software Detailed Design: sphinx-needs Documentation Structure SPEC_DOC_STRUCTURE
status: approved
tags: core, sphinx-needs, structure

Design: Documentation organized thematically in a flat module structure with combined US/REQ/SPEC content per theme.

Directory Structure:

docs/
├── conf.py                      # sphinx-needs configuration
├── index.rst                    # Main index
├── methodology.rst              # File organization guide
├── namingconventions.rst        # ID naming conventions
├── quickstart.rst               # Getting started guide
├── workflows.rst                # Workflow documentation
├── releasenotes.rst             # Release history
├── modules/                     # Thematic specifications
│   ├── installation.rst         # Installation theme
│   ├── changemanagement.rst     # Change management theme
│   ├── release.rst              # Release theme
│   ├── traceability.rst         # Quality & traceability theme
│   ├── workflows.rst            # Workflow orchestration theme
│   ├── core.rst                 # Core methodology theme
│   └── devexperience.rst        # Developer experience theme
├── changes/                     # Change Documents (deleted after release)
└── 31_traceability/
    └── index.rst                # Auto-generated traceability matrices

Naming Conventions:

  • Stakeholder Needs: NEED_<THEME>_<SLUG> (e.g., NEED_CORE_SPEC_AS_CODE)

  • Requirements: REQ_<THEME>_<SLUG> (e.g., REQ_CORE_SPHINX_NEEDS)

  • Designs: SPEC_<COMPONENT>_<SLUG> (e.g., SPEC_DOC_STRUCTURE)

See [docs/namingconventions.rst](../namingconventions.rst) for full convention.

File Organization by Domain Type:

Each module file contains related NEED + REQ + SPEC organized by theme. This provides natural thematic grouping while maintaining full traceability.

  • Theme Modules: Combine all specification levels for one stakeholder theme or value stream. Examples: installation.rst, changemanagement.rst.

  • Cross-Theme Links: Specifications can link across module files when dependencies exist. sphinx-needs validates all cross-file links.

This structure provides thematic cohesion while preserving the three-level hierarchy within each file.

Traceability

Stakeholder Needs

ID

Title

Status

Priority

NEED_CORE_FILE_ORG

Consistent File Organization Across Specification Levels

implemented

high

NEED_CORE_SPEC_AS_CODE

Manage Specifications as Code

implemented

mandatory

Requirements

ID

Title

Status

Tags

REQ_CORE_DOMAIN_ORG

File Organization by Domain Type

implemented

core; methodology; organization

REQ_CORE_L1_MIRROR

Level 1 Mirrors Level 0 File Structure

approved

core; methodology; organization

REQ_CORE_SPHINX_NEEDS

Requirements Management with sphinx-needs

implemented

core; sphinx-needs

REQ_CORE_TRACEABILITY

Design Specification with Traceability

implemented

core; traceability

Design Specifications

ID

Title

Status

Links

SPEC_DOC_STRUCTURE

sphinx-needs Documentation Structure

approved