Skill v1.0.2
currentAutomated scan100/1004 files
name: modify-db-component description: "Modifies an existing DB UX Design System Mitosis component (add variants, update props, change styles)."
triggers:
- "modify component"
- "change component"
- "update component"
- "add variant to component"
- "add prop to component"
- "edit component"
- "refactor component"
inputs:
- name: component_slug
type: string required: true description: "Component directory name in kebab-case (e.g. 'button', 'navigation-item')"
- name: component_name
type: string required: false description: "Optional PascalCase symbol name (e.g. 'Button'). If omitted, derive it from component_slug."
- name: instruction
type: string required: true description: "What to change (e.g. 'add a new variant called outline')"
- name: figma_file_key
type: string required: false description: "Figma file key. Required for visually-driven changes (new variant, layout, spacing). Not needed for purely technical refactorings."
- name: figma_node_id
type: string required: false description: "Figma node ID of the target component/frame. Required together with figma_file_key for visual changes."
requires:
- context: context/architecture.md
autoLoad: true
tools:
- db-ux/list_components
- db-ux/get_component_props
- db-ux/get_component_details
- db-ux/get_example_code
- db-ux/get_design_tokens
- db-ux/list_design_token_categories
- db-ux/list_icons
- db-ux/docs_search
- figma/get_figma_data
- figma/download_figma_images
outputs:
- "packages/components/src/components/{component_slug}/model.ts"
- "packages/components/src/components/{component_slug}/{component_slug}.lite.tsx"
- "packages/components/src/components/{component_slug}/{component_slug}.scss"
- "showcases/e2e/{component_slug}/{component_slug}-interaction.spec.ts"
on_error: max_retries: 3 actions:
- log: "Review the shell output (lint/test/build) and fix reported errors before retrying."
- fallback: "If errors persist after 3 retries, report to user with full error output."
metadata: version: "1.0.2"
Skill: Modify Deutsche Bahn (DB) Component
Variable Convention
Throughout this skill:
{component_slug}= kebab-case directory/file name (e.g.control-panel-navigation-item){component_name}= PascalCase symbol name derived from{component_slug}(e.g.control-panel-navigation-item->ControlPanelNavigationItem)DB{component_name}= full component class name (e.g.DBControlPanelNavigationItem).db-{component_slug}= CSS class (e.g..db-control-panel-navigation-item)
Pre-Conditions
context/architecture.mdIS in context.- MCP (
@db-ux/mcp-server) IS connected. component_slugIS provided by user. Derivecomponent_namefromcomponent_slugunless explicitly provided.- Component EXISTS (verify via
list_components). - Modification instruction IS provided by user.
- For visually-driven changes (new variant, layout, spacing):
figma_file_keyandfigma_node_idSHOULD be provided. If missing for a visual change, ask user before proceeding. - For purely technical changes (bug fix, API cleanup, refactoring): Figma is not required.
Execution
Step 0: Analyze Existing Component
- Call
list_componentsto confirm the component exists. - Call
get_component_propswith the component name to load the currentmodel.ts. - Call
get_component_detailsto understand the current examples and showcase structure. - Read the existing files:
packages/components/src/components/{component_slug}/model.tspackages/components/src/components/{component_slug}/{component_slug}.lite.tsxpackages/components/src/components/{component_slug}/{component_slug}.scssshowcases/e2e/{component_slug}/{component_slug}-interaction.spec.ts(if it exists)
- Read and capture the FULL current state before making ANY changes.
Step 1: RED - Update Tests First
Behavior is tested cross-framework against the running showcase, not by mounting an isolated component (see packages/components/AGENTS.md and the maintainer context/architecture.md § Testing Rules).
Based on the user's instruction:
- If adding a new variant or prop with observable behavior (click, keyboard, focus, open/close, value change): add or update
showcases/e2e/{component_slug}/{component_slug}-interaction.spec.ts, usingrunInteractionTestfrom../default.ts. If the fixture inexamples/interaction.example.lite.tsxdoes not yet expose what the new behavior needs, extend it — reflect the effect into observable DOM (state + conditional render, or a readout element), never into a JS callback variable. - If changing existing behavior: update the existing assertions in that spec to reflect the new expected behavior.
- Purely visual changes (new color, spacing) need no interaction spec update — the existing
*-visual-snapshot.spec.ts/*-aria-snapshot.spec.ts/ axe-core suites inshowcases/e2e/already cover the showcase page and will be updated via CI snapshot regeneration, not by hand. - If no interaction spec exists yet for this component and the change introduces one, create it following the same pattern as
create-db-component's RED phase.
After updating the spec, build the project, generate outputs, and run the interaction test against the React showcase:
pnpm run build && pnpm run build-outputs &&cd showcases/react-showcase && pnpm exec playwright test -g "DB{component_name}"
The RED phase is only complete if:
- The command exits non-zero.
- The failing test names are captured in the output.
- The failure is caused by missing or incomplete implementation, NOT by syntax errors in the spec or fixture itself.
If the spec/fixture has syntax errors, fix them first and re-run until you get clean "missing implementation" failures.
Step 2: GREEN - Implement the Change
2a: Update model.ts
- Read the existing
model.tsto understand the current type definitions and prop structure. - If adding a prop: add it to
DB{component_name}DefaultPropswith a JSDoc comment. - If changing a type: update the type definition.
- NEVER remove existing props without explicit user confirmation (breaking change).
2b: Update {component_slug}.lite.tsx
- Read the existing
.lite.tsxto understand the current component structure and patterns. - Apply changes corresponding to the
model.tsupdate, following the patterns already used in the component. - Check
packages/components/src/styles/internal/for shared internal styles and mixins. Also review other components for similar patterns that could be combined or reused, and suggest those. - NEVER use inline styles in
.lite.tsxcomponents. - PRESERVE
id={props.id ?? props.propOverrides?.id}pattern. - PRESERVE
cls('db-{component_slug}', props.className)usage.
2c: Update {component_slug}.scss
- Read the existing
.scssto understand the current styling patterns. - Call
list_design_token_categoriesthenget_design_tokensfor relevant categories. - Add styles using SCSS variables (
variables.$db-*) from@db-ux/core-foundations/build/styles/variables. Only use CSS custom properties (var(--db-*)) as a fallback when no SCSS variable is available. - Line 1 MUST remain
@use. NO hardcoded values. NO!important. Max 3 levels of nesting.
2d: Update Examples and Showcase (if applicable)
If the change introduces a new visual variant or feature, update files inside `packages/components/src/components/{component_slug}/` (NOT in showcases/):
- Create or update
examples/<feature>.example.lite.tsx. - Update
examples/_{component_slug}.arg.types.tswith new control options. - Update
showcase/{component_slug}.showcase.lite.tsxto include the new example. - Update
agent/{component_slug}.agent.lite.tsxwith new usage example.
Showcase files in showcases/ are generated from these and must not be edited manually.
Step 3: QUALITY CHECK
- Run
pnpm run build. MUST SUCCEED. - Run
pnpm run test. ALL MUST PASS. - Verify no hardcoded values in SCSS.
- Verify all new interactive behavior has an interaction spec assertion.
Step 4: Governance and Framework Outputs
- Build framework outputs:
``bash pnpm run build-outputs ``
This MUST succeed.
- Create changeset:
``bash pnpm changeset ``
Which packages to select depends only on which targets the changed files feed, never on the kind of change:
- Shared component code (
*.scss,model.ts,*.lite.tsx) → all five:@db-ux/core-componentsand the four framework output packages. This holds for a template-only edit as well:@db-ux/core-componentspublishes CSS only, but its consumers hand-write the component HTML, so changed markup concerns them too. - Code only one target consumes (
src/utils/react.ts,configs/plugins/<framework>/,scripts/post-build/angular.ts/react.ts/vue.ts/stencil.ts) → only that one framework package. - Shared build code (
scripts/post-build/index.ts,components.ts,configs/mitosis.config.cjs) → read the targets off the diff: entries incomponents.tsare keyed by target (overwrites.angular,config.react,overwrites.global= all four),index.tsandmitosis.config.cjscover all four, and a target-gated file likecopy-files.tscovers only the targets it gates on. Seepackages/components/AGENTS.md§ Changeset Rules.
Bump type:
patchfor bug fixes.minorfor new features (new variant, new prop).majorif a prop was renamed, removed, or had its type changed.
Output Checklist
- [ ] Component confirmed to exist via
list_components - [ ] Existing files analyzed
- [ ] Tests updated FIRST (RED phase)
- [ ] RED phase verified: ran
testcommand, non-zero exit captured - [ ]
model.tsupdated - [ ]
.lite.tsxupdated (no inline styles,propOverridespreserved) - [ ]
.scssupdated (tokens only) - [ ] Examples/showcase updated (if new visual feature)
- [ ]
pnpm run buildpasses - [ ]
pnpm run testpasses - [ ]
pnpm run build-outputspasses - [ ] Changeset created via
pnpm changeset
Red Flags
| Thought | Response | |
|---|---|---|
| "Edit React output directly" | STOP. .lite.tsx ONLY. | |
| "Hardcoded color for this variant" | STOP. Use var(--db-*). | |
| "Tests can wait" | STOP. Update tests FIRST. TDD is mandatory. | |
| "I know the token name" | STOP. ALWAYS query MCP. | |
| "Removing this prop is fine" | STOP. Breaking change. Confirm with user. | |
| "Skip showcase update" | STOP. New visual feature = showcase update. | |
| "Skip changeset" | STOP. Governance requires it. | |
| "core-components ships no templates, leave it out" | STOP. Its consumers hand-write the HTML. All five packages, always. | |
| "build-outputs is optional" | STOP. It is mandatory. |