smithery/agentient

typescript-prop-definition

TypeScript interface conventions, JSDoc comments, generics, utility types, and cva + VariantProps patterns.

Installation

$ npx skills add smithery/agentient --skill typescript-prop-definition

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/agentient · top by installs.

npx skills add smithery/agentient

Browse all from smithery/agentient

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,630 B
  • docs SUMMARY.md 224 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

TypeScript Prop Definition

Interface Convention

Use \interface\ for component props:

\\\`tsx /** Props for the Button component / interface ButtonProps { /** Button text or content */ children: React.ReactNode; /** Click handler */ onClick?: () => void; /** Whether button is disabled */ disabled?: boolean; }

export function Button({ children, onClick, disabled }: ButtonProps) { // ... } \\\`

JSDoc Comments

Document each prop:

\\\tsx interface UserCardProps { /** User's full name */ name: string; /** User's email address */ email: string; /** Optional avatar URL */ avatarUrl?: string; } \\\

Generics for Reusable Components

\\\`tsx interface ListProps<T> { items: T[]; renderItem: (item: T) => React.ReactNode; keyExtractor: (item: T) => string; }

function List<T>({ items, renderItem, keyExtractor }: ListProps<T>) { return ( <ul> {items.map(item => ( <li key={keyExtractor(item)}> {renderItem(item)} </li> ))} </ul> ); } \\\`

Utility Types

Extending Native Props

\\\tsx interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { variant?: 'default' | 'destructive'; } \\\

Pick/Omit

\\\tsx type UserPublicInfo = Pick<User, 'name' | 'email'>; type UserWithoutPassword = Omit<User, 'password'>; \\\

Partial

\\\tsx type PartialUser = Partial<User>; // All fields optional \\\

cva + VariantProps Pattern

\\\`tsx import { cva, type VariantProps } from 'class-variance-authority';

const buttonVariants = cva("base-classes", { variants: { variant: { default: "...", destructive: "...", }, size: { default: "...", sm: "...", }, }, defaultVariants: { variant: "default", size: "default", }, });

// Automatically inferred type from cva interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> { // variant?: "default" | "destructive" // size?: "default" | "sm" } \\\`

Anti-Patterns

❌ Using \any\ type ❌ Missing JSDoc comments ❌ Manually typing variants (use VariantProps) ❌ \children: any\ (use \React.ReactNode\)

✅ Explicit interface with JSDoc ✅ Use VariantProps for cva ✅ Leverage utility types


Token Estimate: ~2,800 tokens