.cursor/skills/write-api-decision/SKILL.md
This rule helps in writing API decisions for new components of blade design system
npx skillsauth add razorpay/blade write-api-decisionInstall 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 the Design System team of Razorpay. Design System requires giving good amount of thought in how to expose certain components. You as a team member of design system team, go through existing API decisions from packages/blade/src/components/*/decision/decisions.md to understand the format and common props that we support, and create a new API bases on that. Especially the decisions which might be similar to the API you're writing at this point.
packages/blade/src/components/<ComponentName>/_decisions/decisions.mdshowLeading prop might exist on figma but won't be needed on dev as leading prop alone is enough to know whether leading should be added or not.Study these existing decisions.md files for consistent patterns and formatting:
packages/blade/src/components/SideNav/_decisions/decisions.mdpackages/blade/src/components/Modal/_decisions/decisions.mdpackages/blade/src/components/Button/_decisions/decisions.mdpackages/blade/src/components/Typography/_decisions/decisions.mdpackages/blade/src/components/Badge/_decisions/decisions.mdYou can look for similar components in existing design systems on the internet for reference
All API decisions must follow this exact structure:
--------------------------markdown
3-4 lines description of what the component does, its purpose in the design system, and when it should be used. Keep it concise but informative about the component's role and primary use cases.
Overall structure of the API showing the main usage pattern with realistic example:
import { Component, SubComponent } from '@razorpay/blade/components';
<Component prop="value">
<SubComponent title="Example" />
</Component>
<details>
<summary>Alternate APIs (if needed. avoid creating unnecessary and far fetched alternate APIs. Skip this section if main API is obvious)</summary>
type ComponentNameProps = {
/**
* jsdoc for propName
*/
propName: 'option1' | 'option2';
/**
* jsdoc for optionalProp
* @default -
*/
optionalProp?: string;
/**
* jsdoc for children
*/
children: React.ReactNode;
/**
* jsdoc for onAction
*/
onAction?: (value: string) => void;
};
type SubComponentProps = {
/**
* jsdoc for title
*/
title: string;
/**
* jsdoc for variant
* @default medium
*/
variant?: 'small' | 'medium' | 'large';
/**
* jsdoc for isActive
* @default -
*/
isActive?: boolean;
};
-- 2 lines description --
<Component>
<SubComponent title="Basic Example" />
</Component>
-- 2 lines description --
<Component onAction={(value) => console.log(value)}>
<SubComponent title="Advanced Example" variant="large" isActive />
</Component>
-- 2 lines description --
// Show how the component handles specific scenarios
Follow Existing Patterns: Study the referenced decisions.md files to maintain consistency with established naming conventions and prop patterns used in Blade.
Props Section Requirements:
'small' | 'medium' | 'large')?API Section Requirements:
Examples Section Requirements:
Common Prop Naming Patterns (from existing components):
variant for visual variationssize for sizing options ('small' | 'medium' | 'large')isActive, isDisabled, isOpen for boolean stateschildren for content slotsonDismiss, onClick, onChange for event handlersaccessibilityLabel for accessibilityComponent Structure Patterns:
as prop for polymorphic componentsshowLeading prop might exist on figma but won't be needed on dev as leading prop can be internally used to decide show or hide leading.Remember: Always reference existing decisions.md files before writing new APIs to ensure consistency with the established Blade design system patterns and naming conventions.
Remember: The goal is to create comprehensive, implementable API documentation that serves both current needs and future extensibility while maintaining consistency with the established Blade design system patterns.
testing
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
tools
Visually verify component changes in Storybook using the agent-browser CLI tool
development
Update an existing Blade component (web only) using Figma designs and knowledgebase documentation