Instead of duplicating the entire specification and making changes, delta specs express only the differences:
## ADDED Requirements### Requirement: CSV ExportThe system SHALL support exporting data to CSV format.#### Scenario: Export all observations- GIVEN the user has observations stored- WHEN the user requests CSV export- THEN a CSV file is generated with all observations- AND column headers match the observation fields## MODIFIED Requirements### Requirement: Data ExportThe system SHALL support multiple export formats.(Previously: The system SHALL support JSON export.)
Brand new requirements that don’t exist in the main spec:
## ADDED Requirements### Requirement: Dark Mode ToggleThe system SHALL provide a UI control to switch between light and dark themes.#### Scenario: User toggles dark mode- GIVEN the user is viewing the app in light mode- WHEN the user clicks the theme toggle button- THEN the UI switches to dark mode- AND the preference is saved to localStorage
## MODIFIED Requirements### Requirement: Theme SupportThe system SHALL support light mode, dark mode, and system preference detection.(Previously: The system SHALL support light mode only.)**Rationale for change:** Adding dark mode support and respecting user system preferences.
Always include the previous version with “(Previously: …)” for clarity and audit trail purposes.
## REMOVED Requirements### Requirement: Hardcoded Theme Colors~~The system SHALL use hardcoded theme colors defined in globals.css.~~**Rationale for removal:** Replacing with CSS custom properties for dynamic theme switching.
### Requirement: AuthenticationThe system SHALL require authentication for all protected routes.(Must be implemented)### Requirement: LoggingThe system SHOULD log all authentication attempts.(Recommended but not critical)### Requirement: AnalyticsThe system MAY track user theme preferences for analytics.(Optional feature)
Use SHALL/MUST for critical functionality. Overusing it makes everything seem equally important. Use SHOULD for recommendations and MAY for optional features.
Delta specs use Given/When/Then format for scenarios (acceptance criteria):
#### Scenario: System detects dark mode preference- GIVEN the user's OS is set to dark mode- AND the user has not manually set a preference in the app- WHEN the user loads the application- THEN the app displays in dark mode- AND no preference is stored in localStorage
A requirement typically has multiple scenarios covering different paths:
### Requirement: Theme PersistenceThe system SHALL persist the user's theme preference.#### Scenario: Save theme on toggle- GIVEN the user is logged in- WHEN the user toggles the theme- THEN the preference is saved to localStorage- AND the preference persists after page reload#### Scenario: Anonymous user theme- GIVEN the user is not logged in- WHEN the user toggles the theme- THEN the preference is saved to localStorage only- AND the preference is not synced to the server#### Scenario: Clear saved preference- GIVEN the user has a saved theme preference- WHEN the user clicks "Reset to system default"- THEN the saved preference is removed from localStorage- AND the theme matches the OS preference
Delta specs follow a lifecycle that maintains the source of truth:
1. Specs describe current behavior (main specs) ↓2. Changes propose modifications (as delta specs) ↓3. Implementation makes changes real (code written) ↓4. Archive merges deltas into specs (automated merge) ↓5. Specs now describe the new behavior (updated main specs) ↓6. Next change builds on updated specs (cycle repeats)
# Export Specification## Requirements### Requirement: JSON ExportThe system SHALL support exporting observations to JSON format.#### Scenario: Export to JSON- GIVEN the user has observations- WHEN the user clicks "Export as JSON"- THEN a JSON file is downloaded
# Export Specification (Delta)## ADDED Requirements### Requirement: CSV ExportThe system SHALL support exporting observations to CSV format.#### Scenario: Export to CSV- GIVEN the user has observations- WHEN the user clicks "Export as CSV"- THEN a CSV file is downloaded- AND column headers match observation fields- AND data rows contain all observations#### Scenario: Empty observations CSV- GIVEN the user has no observations- WHEN the user clicks "Export as CSV"- THEN a CSV file is downloaded with headers only- AND the file contains no data rows## MODIFIED Requirements### Requirement: Export FormatsThe system SHALL support exporting observations to JSON and CSV formats.(Previously: The system SHALL support exporting observations to JSON format.)**Rationale:** Adding CSV for spreadsheet compatibility.
# Export Specification## Requirements### Requirement: Export FormatsThe system SHALL support exporting observations to JSON and CSV formats.#### Scenario: Export to JSON- GIVEN the user has observations- WHEN the user clicks "Export as JSON"- THEN a JSON file is downloaded### Requirement: CSV ExportThe system SHALL support exporting observations to CSV format.#### Scenario: Export to CSV- GIVEN the user has observations- WHEN the user clicks "Export as CSV"- THEN a CSV file is downloaded- AND column headers match observation fields- AND data rows contain all observations#### Scenario: Empty observations CSV- GIVEN the user has no observations- WHEN the user clicks "Export as CSV"- THEN a CSV file is downloaded with headers only- AND the file contains no data rows
The sdd-apply sub-agent uses delta specs as acceptance criteria:
FOR EACH TASK:├── Read the task description├── Read relevant spec scenarios (these are acceptance criteria)├── Implement code that satisfies the scenarios└── Mark task complete
Delta specs are acceptance criteria, not implementation instructions. The design.md provides the HOW, while delta specs provide the WHAT.