agentleFS
razorpayrazorpay/blade/.agents/skills/write-api-decision/SKILL.md

write-api-decision

Skill658 starsChanged 4 months agoMITView on GitHub

This rule helps in writing API decisions for new components of blade design system

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All API decisions must follow this exact structure:

    line 31
  2. Distinctive:

    Document any decisions made during API design

    line 173
  3. Distinctive:

    Use TypeScript type definitions, not prop tables

    line 185
  4. Very specific:

    Use union types for enums ('small' | 'medium' | 'large')

    line 187
  5. Distinctive:

    Use consistent naming patterns from existing components

    line 189
  6. Distinctive:

    Use actual component names and realistic props

    line 195
  7. Distinctive:

    Start with basic usage

    line 200
  8. Distinctive:

    Use compound components (Parent + Header + Body + Footer)

    line 215
  9. Distinctive:

    Follow WISIWYG (What you see is what you get) philosophy for component structure

    line 216
  10. Distinctive:

    Avoid magic abstractions (e.g.

    line 218
  11. Distinctive:

    Document edge cases and constraints

    line 224

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.

  • You create API in this file - packages/blade/src/components/<ComponentName>/_decisions/decisions.md
  • You write good, consistent, and intuitive APIs based on APIs of other components in this design system
  • You strictly follow the API decision structure mentioned below and not take format reference from other APIs
  • You understand the common props that we normally use, compound component structure that we normally use and follow WISIWYG (What You See is What You Get) Philosophy.
  • To understand the component you're writing the API for, you understand the given task well
  • You create APIs that are possible to implement
  • When given Figma props screenshots, you try to cover all scenarios but don't try to map each prop. E.g. showLeading 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.

Key Examples to Reference

Study these existing decisions.md files for consistent patterns and formatting:

  • packages/blade/src/components/SideNav/_decisions/decisions.md
  • packages/blade/src/components/Modal/_decisions/decisions.md
  • packages/blade/src/components/Button/_decisions/decisions.md
  • packages/blade/src/components/Typography/_decisions/decisions.md
  • packages/blade/src/components/Badge/_decisions/decisions.md

You can look for similar components in existing design systems on the internet for reference

API Decision Structure

All API decisions must follow this exact structure:

--------------------------markdown

ComponentName

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.

Design

  • Figma - ComponentName

API

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>

Alternate API 1

  • Pros
    • ...list down pros of this API
  • Cons -...list down cons of this API

Alternate API 2 (Optional)

  • Pros
    • ...list down pros of this API
  • Cons -...list down cons of this API
</details>

Props

ComponentName

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;
};

SubComponent (if applicable)

type SubComponentProps = {
  /**
   * jsdoc for title
   */
  title: string;

  /**
   * jsdoc for variant
   * @default medium
   */
  variant?: 'small' | 'medium' | 'large';

  /**
   * jsdoc for isActive
   * @default -
   */
  isActive?: boolean;
};

Examples

Basic Usage

-- 2 lines description --

<Component>
  <SubComponent title="Basic Example" />
</Component>

Advanced Usage

-- 2 lines description --

<Component onAction={(value) => console.log(value)}>
  <SubComponent title="Advanced Example" variant="large" isActive />
</Component>

[Specific Use Case Name]

-- 2 lines description --

// Show how the component handles specific scenarios

Accessibility

  • List accessibility features and requirements
  • Mention keyboard navigation patterns
  • Note ARIA attributes and roles
  • Include screen reader considerations

Open Questions

  • Document any decisions made during API design
  • List alternative approaches considered
  • Note future considerations or potential changes

Writing Guidelines

  1. Follow Existing Patterns: Study the referenced decisions.md files to maintain consistency with established naming conventions and prop patterns used in Blade.
  2. Props Section Requirements:

    • Use TypeScript type definitions, not prop tables
    • Group props by component (main component first, then sub-components)
    • Use union types for enums ('small' | 'medium' | 'large')
    • Mark optional props with ?
    • Use consistent naming patterns from existing components
  3. API Section Requirements:

    • Show the overall structure first
    • Include realistic imports
    • Use actual component names and realistic props
    • Show parent-child relationships clearly
  4. Examples Section Requirements:

    • Start with basic usage
    • Progress to more complex scenarios
    • Include real use cases from the design system
    • Show different prop combinations
  5. Common Prop Naming Patterns (from existing components):

    • variant for visual variations
    • size for sizing options ('small' | 'medium' | 'large')
    • isActive, isDisabled, isOpen for boolean states
    • children for content slots
    • onDismiss, onClick, onChange for event handlers
    • accessibilityLabel for accessibility
  6. Component Structure Patterns:
    • Use compound components (Parent + Header + Body + Footer)
    • Follow WISIWYG (What you see is what you get) philosophy for component structure
    • Include as prop for polymorphic components
    • Avoid magic abstractions (e.g. adding some prop that internally does non-intuitive things)
    • Support both controlled and uncontrolled APIs where appropriate
    • If you're refering to figma props, you try to cover all scenarios but don't try to map each prop. E.g. showLeading 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.

  • Document edge cases and constraints
  • Explain design decisions in "Open Questions" or "Discussions" sections

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.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.