agentleFS
agentconfigagentconfig/agentconfig.org/.github/skills/create-component/SKILL.md

create-component

Skill7 starsChanged 3 months agoISCView on GitHub

Create new Preact components following project conventions with proper file structure, TypeScript types, and Tailwind styling. Use when adding UI components, sections, or interactive elements to the site.

12 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 0 are common, 5 are distinctive, and 15 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 15

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create Preact components for agentconfig.org following project conventions.

    line 8
  2. Very specific:

    Every component lives in its own folder under site/src/components/:

    line 12
  3. Very specific:

    Explicit return types: - Always specify : ReactNode

    line 45
  4. Very specific:

    Interface over type: - Use interface for props

    line 46
  5. Very specific:

    JSDoc comments: - Document props with / */

    line 47
  6. Very specific:

    No any: - Use proper types or unknown

    line 48
  7. Very specific:

    Readonly arrays: - Use readonly for array props

    line 49
  8. Distinctive:

    Tailwind utilities: - Use Tailwind classes for all styling

    line 66
  9. Very specific:

    cn() helper: - Use cn() from @/lib/utils for conditional classes

    line 67
  10. Very specific:

    Mobile-first: - Start with mobile, add md: and lg: for larger screens

    line 68
  11. Distinctive:

    Theme-aware: - Use CSS variables for theme colors

    line 69
  12. Very specific:

    Always include className prop for style overrides

    line 87
  13. Very specific:

    Use children for flexible content

    line 88
  14. Distinctive:

    Use discriminated unions for variants

    line 89
  15. Very specific:

    Use specific types, not generic Function

    line 101
  16. Very specific:

    Semantic HTML: - Use button for buttons, nav for navigation

    line 115
  17. Very specific:

    ARIA attributes: - Add aria-label, aria-expanded for interactive elements

    line 116
  18. Distinctive:

    Keyboard navigation: - Ensure focusable and keyboard-usable

    line 117
  19. Very specific:

    Focus visible: - Use focus-visible: for focus rings

    line 118
  20. Distinctive:

    Before considering the component complete:

    line 130

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “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

Create Component

Create Preact components for agentconfig.org following project conventions.

File Structure

Every component lives in its own folder under site/src/components/:

site/src/components/
└── {ComponentName}/
    ├── index.ts              # Re-exports component and types
    └── {ComponentName}.tsx   # Main implementation

Step-by-Step Process

  1. Create the component folder in site/src/components/{ComponentName}/
  2. Copy the template from assets/component-template.tsx
  3. Rename and customize the component
  4. Create index.ts with exports
  5. Import in App.tsx or parent component

Template Files

index.ts

export { ComponentName } from './ComponentName'
export type { ComponentNameProps } from './ComponentName'

ComponentName.tsx

See assets/component-template.tsx for the full template.

TypeScript Rules

  1. No semicolons - Omit semicolons at end of statements
  2. Explicit return types - Always specify : ReactNode
  3. Interface over type - Use interface for props
  4. JSDoc comments - Document props with /** */
  5. No any - Use proper types or unknown
  6. Readonly arrays - Use readonly for array props
// Good
interface ListProps {
  /** Items to display in the list */
  readonly items: readonly string[]
}

// Bad
type ListProps = {
  items: string[];
}

Styling Rules

  1. Tailwind utilities - Use Tailwind classes for all styling
  2. cn() helper - Use cn() from @/lib/utils for conditional classes
  3. Mobile-first - Start with mobile, add md: and lg: for larger screens
  4. Theme-aware - Use CSS variables for theme colors
// Good - mobile first, theme aware
<div className="p-4 md:p-6 lg:p-8 bg-background text-foreground">

// Bad - desktop first
<div className="p-8 sm:p-4">

Component Guidelines

Keep Components Focused

  • One component = one responsibility
  • Under 150 lines (split if longer)
  • Extract complex logic into custom hooks in site/src/hooks/

Props Design

  • Always include className prop for style overrides
  • Use children for flexible content
  • Use discriminated unions for variants
interface ButtonProps {
  variant: 'primary' | 'secondary' | 'ghost'
  className?: string
  children?: ReactNode
}

Event Handlers

  • Prefix with on: onClick, onToggle, onSelect
  • Use specific types, not generic Function
interface Props {
  // Good
  onSelect: (id: string) => void

  // Bad
  onSelect: Function
}

Accessibility

  1. Semantic HTML - Use button for buttons, nav for navigation
  2. ARIA attributes - Add aria-label, aria-expanded for interactive elements
  3. Keyboard navigation - Ensure focusable and keyboard-usable
  4. Focus visible - Use focus-visible: for focus rings
<button
  aria-expanded={isOpen}
  aria-controls="menu-content"
  className="focus-visible:ring-2 focus-visible:ring-primary"
>

Checklist

Before considering the component complete:

  • Component is in its own folder with index.ts
  • All props have TypeScript types with JSDoc comments
  • Uses cn() for className merging
  • Mobile-first responsive design
  • Theme-aware colors (CSS variables)
  • Accessible (semantic HTML, ARIA, keyboard)
  • Under 150 lines (or appropriately split)
  • Named export (not default)
  • No semicolons

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.