SoftBank UDS keeps React and Vue components consistent with a shared spec

This article has been automatically translated.
Loading article...
Merry Christmas & Happy New Year!
Loading article...

This article has been automatically translated.
Pass the number 0 to the same Badge component, and the React version shows nothing while the Vue version shows a "0". This isn't a bug in either framework. The two implementations simply make different judgments about whether there is content, and the team never wrote down whether 0 should be displayed. SoftBank's frontend design team maintains Unicorn Design System (UDS), a design system for internal business systems. It provides both React and Vue components and uses AI to help generate implementations and tests. Their approach: write the behavior both frameworks must guarantee into a shared spec, then verify it with each framework's own tests, rather than letting AI improvise.
In UDS this small component is called Badge, used to indicate whether there are notifications or how many are unread. At the time, the React version used Boolean(children) to decide whether child content existed, so the number 0 was treated as "no content"; the Vue version checked the text of the default slot, so 0 was treated as valid content. The different code is only a symptom.
What was really missing was the rule on whether 0 should be displayed. The author is clear: aligning the code first is the wrong order. Decide the expected behavior first, then assess the impact on existing pages that use Badge, and only then talk about implementation.
This holds for any team using AI to maintain multi-framework components. AI can quickly produce an implementation that looks reasonable, but without a behavior definition both sides reference, it can only fill gaps by guessing, and those guesses may not match across the two frameworks.
UDS collects the APIs and behaviors both frameworks must guarantee into a YAML file, which the article calls the "spec". Requirements are written using EARS (Easy Approach to Requirements Syntax), a fixed-sentence format for describing system behavior: WHILE means "during...", and THE COMPONENT SHALL means "the component must...".
Take Button. A description like "the action is unavailable" is too vague: it could mean the style is grayed out, it could mean aria-disabled, or it could mean the click event is intercepted, and the first two do not stop the click callback from running. Rewritten as a conditional sentence, the meaning becomes unambiguous: while disabled=true, the component must not execute the click handler.
Besides behavior descriptions, the spec also includes acceptance items defining what counts as verified, and gives each spec an ID, such as BTN-003 for design docs and tests to reference back. The article gives this example:
- id: BTN-003
category: interaction
statement: WHILE disabled=true, THE COMPONENT SHALL クリック処理を実行しない。
acceptance:
- disabled=true の場合は、ルートの button 要素に disabled 属性を付与する
- disabled=true の場合は、クリックしても利用側にクリックを通知しないNote that EARS plus YAML is just UDS's own choice; other sentence formats and storage formats work equally well for spec-driven development. The format is not the point. The point is having all four things at once: a condition, a required behavior, an observable acceptance item, and a stable ID.
UDS initially had an "implementation notes" column in the spec, so that when AI regenerated code it could refer to the original rationale. The column was later removed because it mixed in React- or Vue-specific implementation approaches, so even changing only internal handling required touching the shared spec.
The split now: the spec records only the APIs and behaviors both frameworks must guarantee; each framework's design doc records prop names, event names, slot handling, and implementation and test methods; the usage guide records selection advice such as when to use Button versus IconButton.
In other words, the behavior to guarantee is shared, while implementation and tests are prepared separately on the React and Vue sides. This keeps the spec's change frequency low and its semantics stable, makes it the single source of truth for both people and AI, and leaves implementation freedom at the framework layer.
The tests use Vitest and Testing Library, running on jsdom, which simulates the browser DOM. The React version asserts that disabled does not call onClick, and the Vue version asserts that disabled does not emit the click event. Both test names include BTN-003.
Passing tests alone are not enough. The author ran an experiment worth borrowing: in a copy of the project, delete the line in the React implementation that sets the disabled attribute, leave the Vue implementation untouched, and run both test suites. React went from 70 passing to 68 passing and 2 failing, and the failures were exactly the acceptance items "add the disabled attribute" and "do not execute the click handler"; Vue still had 79 passing; after restoring the code, React was back to 70 passing.
This shows the tests really do catch spec violations, rather than merely happening to pass. The author also honestly notes the limits: the breakage experiment was done only on the React version, with the Vue version unchanged; keyboard operation, focus management, real browser behavior, appearance, and duplicate-submission prevention were not verified. These are open scope, not covered conclusions.
There is an easy trap here: if you only change the test expectation from "called 0 times" to "called 1 time", the test passes, but the button still runs the click handler while disabled, violating the original spec.
So UDS's policy is: to change an externally guaranteed behavior, first change the shared spec, write the new behavior and acceptance items clearly, then update the implementation and tests to match; anything that changes the design definition also requires updating Figma. Tests turning green and intentionally changing the spec are two different things, and mixing them silently drops constraints.
UDS has AI draft specs, and people confirm them. Judgments involving usage scenarios and impact, such as whether Badge should display 0, must be made by people. If the spec serving as the basis is itself wrong, the implementation and tests will faithfully reproduce the same error, and passing tests do not prove the spec correct.
When delegating a check to AI, saying only "look at Button" is too vague. The article suggests specifying at least four things: which materials to reference (the shared spec and both frameworks' design docs and implementations), which behavior to confirm (for example, in BTN-003, the disabled attribute and click handling when disabled), the commands to run each framework's tests, and the instruction not to guess when materials conflict or behavior is undecided, but to hand it back to a person for confirmation.
After running, require AI to report separately by framework: the confirmed code version, the behavior, which tests were run and their results, and which scope remains unconfirmed. People then use this to judge whether the delegated scope covered both sides.