Skip to content

docs: enforce What/How separation in the SDD document architecture#120

Merged
singyichen merged 6 commits into
mainfrom
docs/sdd-what-how-separation
Jul 21, 2026
Merged

docs: enforce What/How separation in the SDD document architecture#120
singyichen merged 6 commits into
mainfrom
docs/sdd-what-how-separation

Conversation

@singyichen

Copy link
Copy Markdown
Owner

Purpose

Enforce What/How separation in the SDD document architecture so spec.md instances contain only requirement content (What), while generation rules, review checklists, and technical decisions live where they belong.

Reason

A comparison against duty-mate's OpenSpec architecture surfaced three structural problems in our 16 existing specs:

  1. Meta-instructions land in instances — every spec carries the template's generation rules and review/acceptance checklist (~60 lines of non-requirement content each), and the execution-status subsection duplicates specs/STATUS.md.
  2. Shared constants are copy-pasted — constants like TASK_ROLES and MOBILE_BP are redefined in up to 16 specs and have already drifted (2 value conflicts, 4 same-value aliases found).
  3. Decision history has no home — clarify resolutions and technical trade-offs are scattered across spec bodies, violating the Flow Chart Ownership rule (system-layer diagrams appearing in spec.md).

Result

Change Mechanism
Template meta-content stays out of instances spec-template v1.6.0: generation rules + review checklist become HTML comments; execution-status section deleted (STATUS.md is the single source)
Shared constants get a single source New specs/_shared/constants.md (22 constants extracted from 16 specs, conflicts documented); specs must reference, not redefine
Decisions get a home in plan.md plan-template v1.15.0: new Decisions section (technical decisions + clarify resolutions, with rationale and rejected alternatives)
Enforcement /speckit.analyze gains 3 checks: shared-constant duplication (HIGH), system-layer participants in spec flow diagrams (MEDIUM), deprecated meta sections (LOW, grandfathered)
Migration safety Grandfather clause: existing 16 specs are only flagged once their latest changelog entry is dated on/after 2026-07-21, so they migrate lazily on their next version bump

Changed Files

File Change
specs/_shared/constants.md New — single source for constants used by 2+ specs, with usage rules, conflict notes, and changelog
.specify/templates/spec-template.md v1.6.0 — meta-sections to HTML comments, execution-status removed, shared-constant citation rule, system-layer flow-diagram ban
.specify/templates/plan-template.md v1.15.0 — new Decisions section (technical decisions + clarify resolutions tables)
.claude/commands/speckit.analyze.md 3 new inconsistency checks enforcing the separation
.claude/skills/spec-format/SKILL.md Synced with v1.6.0 structure; grandfather clause note; 2 new common-error entries

Test Plan

  • All extracted constant values grep-verified against source specs (spot checks: MOBILE_BP 767px, TASK_ROLES subset in 015, PASSWORD_MIN_LENGTH in 003/005, ACTIVE_TASK_TYPE_STORAGE_KEY in 010/008/015)
  • Relative link ../../_shared/constants.md resolves correctly from specs/[module]/NNN-feature/
  • Cross-references between the 5 files are consistent (section names, file paths, severity levels)
  • Template changelogs updated (spec-template 1.6.0, plan-template 1.15.0) with matching dates
  • .claude/commands/ content stays English; templates/specs content in Traditional Chinese (language boundary respected)

Notes

Impact Scope

  • Frontend
  • Admin
  • API
  • Queue
  • Other: SDD governance (templates, analyze gate, spec-format skill, shared constants doc)

Related

None

🤖 Generated with Claude Code

singyichen and others added 4 commits July 21, 2026 16:41
- **Create** specs/_shared/constants.md as the single source of truth for constants used by 2+ specs (22 constants extracted from 16 specs), eliminating duplicated definitions that drifted independently
- **Record** 2 value conflicts (TASK_ROLES subset in spec 015, DEFAULT_SORT divergence between 010/006) and 4 same-value alias pairs as explicit reconciliation notes instead of silent inconsistency
- **Define** usage rules: reference-only citation from specs, promotion threshold (used by 2+ specs), and version-bump propagation to referencing specs on any change

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- **Move** generation rules and the review/acceptance checklist into HTML comments so they guide /speckit.specify at generation time without landing in spec instances, cutting meta-instruction noise from every future spec
- **Delete** the execution-status subsection because specs/STATUS.md is already the single source of pipeline state, removing a second copy that drifted
- **Require** shared constants to be cited from specs/_shared/constants.md instead of redefined, and ban system-layer participants (API/Service/DB) in spec flow diagrams per the Flow Chart Ownership rule (system flow belongs in plan.md)
- **Sync** the spec-format skill with the v1.6.0 section table, grandfather clause for the 16 existing specs, and two new common-error entries

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- **Add** a Decisions section (technical decisions + clarify resolutions, each with rationale and rejected alternatives) between Technical Context and Constitution Check, adapted from duty-mate's design.md pattern
- **Route** /speckit.clarify resolutions into plan.md instead of the spec body so the spec stays What-only while decision history remains traceable
- **Clarify** the split with ADRs: feature-scoped trade-offs live here; cross-feature decisions still open ADRs under docs/adr/

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- **Add** a HIGH-severity check for shared-constant duplication so specs that redefine constants from specs/_shared/constants.md fail the pre-PR gate instead of silently drifting
- **Add** a MEDIUM-severity check for system-layer participants (API/Service/DB) in spec flow diagrams, enforcing the Flow Chart Ownership rule mechanically
- **Add** a LOW-severity check for deprecated meta sections, grandfathered: only flags specs whose latest changelog entry is on or after 2026-07-21, so the 16 existing specs migrate lazily on their next version bump

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@singyichen singyichen added the docs 文件需求/修正 — Documentation additions or fixes label Jul 21, 2026
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR successfully implements What/How separation in the SDD document architecture. The changes are well-structured and correctly enforce the principle that spec.md instances contain only requirement content (What), while generation rules, review checklists, and technical decisions are moved to their proper locations.

Key improvements:

  • Spec template v1.6.0 moves meta-instructions to HTML comments that don't appear in spec instances
  • New specs/_shared/constants.md eliminates duplication of 22 constants across 16 specs
  • Plan template v1.15.0 adds a Decisions section for technical decisions and clarify resolutions
  • Three new consistency checks added to speckit.analyze enforce the separation
  • Grandfather clause allows existing specs to migrate lazily on their next version bump

All files are internally consistent, cross-references are correct, and the implementation aligns with the documented design. No blocking issues found.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the specification and planning templates, commands, and skills to enforce better separation of concerns, such as moving generation rules to comments, restricting flow diagrams to business-layer participants, and introducing a centralized shared constants file. The review feedback points out a logical contradiction with the DEFAULT_SORT constant in the new shared constants file, as its conflicting values across specs mean it should remain spec-specific to avoid triggering static analysis duplication errors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread specs/_shared/constants.md Outdated
Comment thread specs/_shared/constants.md Outdated
singyichen and others added 2 commits July 21, 2026 16:47
- **Remove** DEFAULT_SORT from the shared constants table and conflict notes because its value differs by context (010: updated_at desc, 006: created_at desc) — promoting it would force local overrides that trip the HIGH duplicate-definition check in /speckit.analyze
- **Tighten** the promotion rule to require identical values (or alias/subset pending unification) across specs, so context-dependent constants stay spec-specific by definition
- **Keep** a note documenting why DEFAULT_SORT was evaluated and rejected, preventing re-promotion later

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- **Resolve** the spec-template changelog conflict by keeping both entries: 1.6.0 (this branch) above 1.5.1 (PR #119 story-number stability rule, merged to main after this branch was cut)
- **Verify** PR #119's story-number stability additions auto-merged intact into the v1.6.0 AC comment block and the spec-format skill

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@singyichen
singyichen merged commit 946707a into main Jul 21, 2026
9 checks passed
@singyichen
singyichen deleted the docs/sdd-what-how-separation branch July 21, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs 文件需求/修正 — Documentation additions or fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant