3.0: Work Product Templates

Introduction

ASPICE work products are the tangible evidence of process execution. Well-designed templates accelerate creation, ensure consistency, and satisfy assessor expectations. This chapter provides production-ready templates for all critical ASPICE deliverables.


ASPICE Work Product Landscape

Work Products by Process

The following diagram maps the required work products to each ASPICE process (SWE.1-6, SYS.1-5, SUP), showing which templates are needed at each development phase.

Work Product Templates


Template Design Principles

1. AI-Friendly Templates

Modern templates should be optimized for AI augmentation:

template_requirements:
  format: "Markdown with YAML front-matter"
  structure:
    - "Clear section headings (## H2 for major sections)"
    - "Structured data in tables/YAML where possible"
    - "Placeholders with {{variable}} syntax"
    - "Inline comments for AI guidance"

  ai_augmentation:
    - "Prompt templates for auto-generation"
    - "Validation schemas for quality checks"
    - "Traceability markers ([REQ-ID] references)"
    - "Version control integration (Git-friendly diff)"

  human_readability:
    - "Plain language, avoid jargon overload"
    - "Visual diagrams where appropriate (PlantUML, Mermaid)"
    - "Examples and explanations inline"
    - "Navigation links between related work products"

2. Traceability by Design

Every template embeds traceability:

# Example: Requirement Template with Traceability

## REQ-SWE-042: Remote Door Unlock via CAN

**Traces To**:
- ↑ Parent: [SYS-REQ-018] Remote Access System
- → Related: [SWE-043] CAN Message Processing
- ↓ Implemented By: `src/app/door_lock/remote_unlock.c:87-142`
- [OK] Verified By: [TC-042] Unit Test Remote Unlock

**Traces From**:
- ← Stakeholder Need: [STKH-005] Convenience Features

3. Minimal Overhead, Maximum Value

Templates should enable, not burden:

Template Type Creation Time (Manual) Creation Time (AI-Assisted) Value to Assessment
SRS (20 req) 8 hours 2 hours High (BP1-7)
SAD (5 components) 12 hours 3 hours High (BP1-8)
Unit Test Spec 6 hours 1 hour Medium (BP1-5)
Review Record 30 min 5 min Low (but required)

Principle: Automate low-value, time-consuming templates (review records). Focus human effort on high-value artifacts (architecture decisions).


Template Repository Structure

work-product-templates/
├── requirements/
│   ├── system_requirements_spec.md          # SYS.2 output
│   ├── software_requirements_spec.md        # SWE.1 output
│   ├── requirement_template.yaml            # Single requirement schema
│   └── traceability_matrix.csv              # Auto-generated
│
├── architecture/
│   ├── system_architecture_doc.md           # SYS.3 output
│   ├── software_architecture_doc.md         # SWE.2 output
│   ├── component_template.md                # Component specification
│   └── interface_spec_template.md           # Interface definition
│
├── design/
│   ├── detailed_design_template.md          # SWE.3 output
│   └── design_review_checklist.md           # SUP.1 input
│
├── test/
│   ├── unit_test_spec_template.md           # SWE.4 BP1
│   ├── integration_test_spec_template.md    # SWE.5 BP1
│   ├── qualification_test_spec_template.md  # SWE.6 BP1
│   ├── test_case_template.yaml              # Individual test case
│   └── test_report_template.md              # Test execution record
│
├── reviews/
│   ├── design_review_record.md              # SUP.1 BP4
│   ├── code_review_checklist.md             # SWE.3 BP7
│   └── audit_report_template.md             # SUP.1 BP8
│
├── management/
│   ├── project_plan_template.md             # MAN.3 BP2
│   ├── risk_register_template.csv           # MAN.3 BP6
│   ├── status_report_template.md            # MAN.3 BP10
│   └── change_request_template.md           # SUP.10 BP1
│
└── scripts/
    ├── generate_template.py                 # AI-powered template generator
    ├── validate_work_product.py             # Schema validator
    └── export_to_docx.py                    # Export to Word for customers

AI-Powered Template Generation

Template Generator Script

"""
AI-Powered ASPICE Work Product Generator
Uses Claude API to generate work products from minimal input
"""

import anthropic
import yaml
from pathlib import Path
from typing import Dict, Any

class WorkProductGenerator:
    def __init__(self, api_key: str):
        self.client = anthropic.Anthropic(api_key=api_key)
        self.templates_dir = Path("work-product-templates")

    def load_template(self, template_name: str) -> str:
        """Load template from file."""
        template_path = self.templates_dir / template_name
        return template_path.read_text()

    def generate_requirements_spec(
        self,
        context: Dict[str, Any],
        requirements_list: list[str]
    ) -> str:
        """
        Generate Software Requirements Specification (SWE.1)

        Args:
            context: Project context (component name, safety level, etc.)
            requirements_list: List of high-level requirement descriptions

        Returns:
            Complete SWRS in markdown format
        """
        template = self.load_template("requirements/software_requirements_spec.md")

        prompt = f"""
You are an automotive ASPICE expert. Generate a complete Software Requirements
Specification (SWRS) conforming to SWE.1 base practices.

**Project Context:**
- Component: {context['component_name']}
- Safety Level: {context['asil_level']}
- ASPICE Target: CL{context['capability_level']}

**Input Requirements (high-level):**
{yaml.dump(requirements_list, default_flow_style=False)}

**Instructions:**
1. Generate detailed, testable software requirements from the high-level input
2. Assign unique IDs (SWE-XXX format)
3. For each requirement, specify:
   - Description (clear, unambiguous)
   - Rationale (why it's needed)
   - Acceptance criteria (how to verify)
   - Parent requirement traceability (from system requirements)
   - Priority (Must/Should/Could)
   - Safety relevance (if ASIL > QM)
4. Use the following template structure:

{template}

**Output Format:** Complete markdown document ready for review.
"""

        response = self.client.messages.create(
            model="claude-sonnet-4-6",
            max_tokens=16000,
            messages=[{"role": "user", "content": prompt}]
        )

        return response.content[0].text

    def generate_test_specification(
        self,
        requirements_file: str,
        test_level: str  # "unit" | "integration" | "qualification"
    ) -> str:
        """
        Generate Test Specification from requirements (SWE.4/5/6 BP1)

        Args:
            requirements_file: Path to SWRS markdown file
            test_level: Level of testing

        Returns:
            Complete test specification
        """
        requirements = Path(requirements_file).read_text()
        template = self.load_template(f"test/{test_level}_test_spec_template.md")

        prompt = f"""
You are an automotive test engineer. Generate a {test_level.upper()} Test
Specification from the given Software Requirements.

**Requirements Document:**
{requirements}

**Test Level:** {test_level}

**Instructions:**
1. For each requirement (SWE-XXX), create test cases (TC-XXX)
2. Each test case must specify:
   - Test case ID
   - Requirement coverage (which SWE-XXX it verifies)
   - Preconditions
   - Test steps (Given/When/Then format)
   - Expected results
   - Pass/Fail criteria
3. Ensure bidirectional traceability (Requirements ↔ Test Cases)
4. For unit tests: Focus on single function/module behavior
5. For integration tests: Focus on component interactions
6. For qualification tests: Focus on system-level black-box verification

**Template:**
{template}

**Output:** Complete test specification document.
"""

        response = self.client.messages.create(
            model="claude-sonnet-4-6",
            max_tokens=16000,
            messages=[{"role": "user", "content": prompt}]
        )

        return response.content[0].text

# Usage Example
if __name__ == "__main__":
    generator = WorkProductGenerator(api_key="your-api-key")

    # Generate SWRS
    context = {
        "component_name": "Door Lock Controller",
        "asil_level": "ASIL-B",
        "capability_level": 2
    }

    requirements = [
        "System shall unlock door when valid CAN message received",
        "System shall lock door when vehicle speed > 10 km/h",
        "System shall handle CAN bus errors gracefully",
        "System shall provide diagnostic status via UDS"
    ]

    swrs = generator.generate_requirements_spec(context, requirements)
    Path("docs/requirements/SWRS_v1.0.md").write_text(swrs)

    # Generate Unit Test Spec from SWRS
    test_spec = generator.generate_test_specification(
        "docs/requirements/SWRS_v1.0.md",
        test_level="unit"
    )
    Path("docs/test/unit_test_spec_v1.0.md").write_text(test_spec)

Template Quality Validation

Automated Quality Checks

"""
ASPICE Work Product Validator
Checks templates for completeness and ASPICE compliance
"""

import re
from pathlib import Path
from typing import List, Tuple

class WorkProductValidator:
    def __init__(self):
        self.errors = []
        self.warnings = []

    def validate_requirements_spec(self, file_path: str) -> Tuple[bool, List[str]]:
        """
        Validate SWRS against SWE.1 base practices.

        Checks:
        - BP1: All requirements have unique IDs
        - BP2: Requirements are structured/categorized
        - BP5: Traceability to parent requirements exists
        - BP7: Requirements are verifiable (have test criteria)
        """
        content = Path(file_path).read_text()

        # BP1: Check for requirement IDs
        req_pattern = r'\[?(SWE|REQ)-\d+\]?'
        req_ids = re.findall(req_pattern, content)

        if len(req_ids) == 0:
            self.errors.append("BP1 FAIL: No requirement IDs found (expected [SWE-XXX] format)")

        # Check for duplicate IDs
        if len(req_ids) != len(set(req_ids)):
            self.errors.append("BP1 FAIL: Duplicate requirement IDs detected")

        # BP2: Check for structure (sections)
        if "## Functional Requirements" not in content and "## Requirements" not in content:
            self.warnings.append("BP2 WARNING: No requirements structure/categorization found")

        # BP5: Check for traceability markers
        trace_pattern = r'(?:Traces To|Parent|Derived From).*?\[(?:SYS|STKH)-\d+\]'
        if not re.search(trace_pattern, content):
            self.errors.append("BP5 FAIL: No traceability to parent requirements found")

        # BP7: Check for acceptance criteria
        if "Acceptance Criteria" not in content and "Verification" not in content:
            self.warnings.append("BP7 WARNING: Requirements lack verification/acceptance criteria")

        return len(self.errors) == 0, self.errors + self.warnings

    def validate_test_spec(self, file_path: str) -> Tuple[bool, List[str]]:
        """
        Validate Test Specification against SWE.4/5/6 BP1-5.

        Checks:
        - Test cases have unique IDs
        - Traceability to requirements exists
        - Test steps are defined
        - Expected results are specified
        """
        content = Path(file_path).read_text()

        # Check for test case IDs
        tc_pattern = r'\[?TC-\d+\]?'
        test_ids = re.findall(tc_pattern, content)

        if len(test_ids) == 0:
            self.errors.append("No test case IDs found (expected [TC-XXX] format)")

        # Check traceability to requirements
        req_trace_pattern = r'(?:Verifies|Tests|Covers).*?\[(?:SWE|REQ)-\d+\]'
        if not re.search(req_trace_pattern, content):
            self.errors.append("No traceability to requirements found")

        # Check for test steps/procedure
        if "Test Steps" not in content and "Procedure" not in content:
            self.warnings.append("Test procedures/steps not clearly defined")

        # Check for expected results
        if "Expected Result" not in content and "Pass Criteria" not in content:
            self.errors.append("Expected results/pass criteria not specified")

        return len(self.errors) == 0, self.errors + self.warnings

# Usage in CI/CD pipeline
if __name__ == "__main__":
    validator = WorkProductValidator()

    # Validate all SWRS files
    for swrs_file in Path("docs/requirements").glob("SWRS_*.md"):
        is_valid, messages = validator.validate_requirements_spec(str(swrs_file))

        if not is_valid:
            print(f"[FAIL] {swrs_file.name} FAILED validation")
            for msg in messages:
                print(f"   - {msg}")
            exit(1)
        else:
            print(f"[PASS] {swrs_file.name} passed validation")

Summary

Work Product Templates accelerate ASPICE compliance:

  • Comprehensive Coverage: Templates for all SYS, SWE, SUP, MAN processes
  • AI-Augmented: Designed for AI-powered generation (60-75% time savings)
  • Traceability Built-In: Every template embeds requirement/test traceability
  • Quality Validated: Automated validators check ASPICE conformance
  • Format: Markdown + YAML (Git-friendly, human-readable, AI-parseable)

Chapter Structure:

  1. 20.01 Requirements Templates - SRS, SWRS, traceability matrices
  2. 20.02 Architecture Templates - System/software architecture documents
  3. 20.03 Test Specification Templates - Unit, integration, qualification tests
  4. 20.04 Review and Report Templates - Review records, audit reports, status updates