.cursor/skills/migrate-to-svelte/SKILL.md
Guidelines for migrating existing Blade components from React to Svelte
npx skillsauth add razorpay/blade migrate-to-svelteInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You work in design system of Razorpay and you are migrating existing components of Blade from React to Svelte. You make sure to cover all the props of the component and enforcing strict typescript checks.
packages/blade/src/components folderpackages/blade/src/utils/makeBorderSize/index.ts should be placed in blade core util directory - packages/blade-core/src/utils and not within the blade-svelte directory.packages/blade-core/src/utils directory, if the util file is not present or same function is not present ask for a confirmation before adding.Components should be created in the following structure:
packages/
└── blade-svelte/
└── src/
└── components/
├── Button/
│ ├── Button.svelte
│ └── types.ts
├── Link/
│ ├── BaseLink/
│ │ ├── BaseLink.svelte
| │ └── types.ts
│ └── Link.svelte
└── ... (other components)
PascalCase (e.g., Button/, Link/)PascalCase.svelte (e.g., Button.svelte, BaseLink.svelte)camelCase.css (e.g., button.css, baseLink.css)Link/BaseLink/)packages/blade-core/src directory. Refer the directory structure belowpackages/
└── blade-core/
└── src/
└── styles/
├── Button/
│ ├── button.module.css
│ └── button.ts
├── Link/
│ ├── BaseLink/
│ │ ├── baselink.module.css
│ │ └── baselink.ts
// packages/blade-core/src/styles/button.ts
import cva from 'class-variance-authority';
import styles from './button.module.css';
export const buttonStyles = cva(
styles.base, {
variants: {
size: {
small: styles.small,
medium: styles.medium,
},
variant: {
primary: styles.primary,
secondary: styles.secondary,
},
isDisabled: {
true: styles.disabled,
false: null,
},
margin: {
"spacing.2": "m-2"
}
},
defaultVariants: {
size: 'medium',
isDisabled: false,
},
}
);
.base {
border-radius: var(--border-radius-medium);
padding: var(--spacing-4) var(--spacing-8);
... etc
}
.base .container {
display: flex;
gap: var(--spacing-4);
}
.primary {
background-color: var(--colors-interactive-background-primary-normal);
&:hover {
background-color: var(--colors-interactive-background-primary-highlighted);
}
}
import { buttonStyles } from '@razorpay/blade-core/styles';
<button className={buttonStyles({ variant, size, isDisabled })}>
<div className="flex gap-4">
{children}
<Icon />
</div>
</button>
Ensure the layout classes like display, margin, padding are stored on a global css and not component specific css. packages/blade-core/src/styles/utilities.ts would be the right place for the same
Ensure there are no inline styling markup in elements. All the styles should come via classes.
Any styling utility should come from blade-core so as to ensure platform agnostic use case.
Components should be created in the following structure:
packages/
└── blade-svelte/
└── src/
└── components/
├── Button/
│ ├── Button.svelte
│ └── types.ts
├── Link/
│ ├── BaseLink/
│ │ ├── BaseLink.svelte
| │ └── types.ts
│ └── Link.svelte
└── ... (other components)
PascalCase (e.g., Button/, Link/)PascalCase.svelte (e.g., Button.svelte, BaseLink.svelte)camelCase.css (e.g., button.css, baseLink.css)Link/BaseLink/)packages/blade-svelte/src/theme/theme.csspackages/blade-svelte/src/components/Button/ which you can refer to for any examplepackages/blade-core if needed. However do confirm before you implementCreate the necessary stories required for the component as well which will be a testing playground for testing whether component is behaving as expected or not
disabled attribute on the element when the component is disabled[disabled] attribute selector in CSS instead of adding/removing classestesting
This rule helps in writing and running unit tests for components of blade design system
documentation
Generate bi-weekly announcement posts for Blade Design System updates by analyzing changelog entries from the past two weeks
development
This rule helps in writing API decisions for new components of blade design system
tools
Visually verify component changes in Storybook using the agent-browser CLI tool