agentleFS
tarikhamiltontarikhamilton/claude-skills/skills/component-consistency/SKILL.md

component-consistency

Skill0 starsChanged 5 months agoMITView on GitHub

Ambient enforcement that prevents raw primitives, hardcoded design values, duplicate components, and inconsistent patterns in UI code. Activates when editing UI files.

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. About 0 are common, 21 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈21

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before creating any UI element, do ALL of these:

    line 20
  2. Distinctive:

    Do NOT use raw primitives when the project has wrapped versions.

    line 28
  3. Distinctive:

    Action: If a wrapped version exists, use it.

    line 55
  4. Distinctive:

    Do NOT use literal values when the project has a token/theme system:

    line 59
  5. Very specific:

    Colors: No hex (#FF0000), RGB (rgb()), HSL literals.

    line 61
  6. Very specific:

    Spacing: No pixel literals for margin/padding (16, 24).

    line 62
  7. Very specific:

    Font sizes: No numeric font sizes (fontSize: 14).

    line 63
  8. Distinctive:

    Border radius: No literal radius values. Use radius tokens or Tailwind rounded classes.

    line 64
  9. Distinctive:

    Shadows: No hardcoded shadow values.

    line 65
  10. Distinctive:

    Do NOT create a new component when an existing one can be extended:

    line 71
  11. Distinctive:

    Before creating a new component, search for similar ones by purpose (not just name).

    line 73
  12. Distinctive:

    If one exists, add a prop or variant instead of duplicating.

    line 74
  13. Distinctive:

    If the existing component is in a different package/module, import it rather than copying.

    line 75
  14. Distinctive:

    Action: If a similar component exists, propose extending it with a new prop/variant.

    line 77
  15. Distinctive:

    Do NOT mix approaches within the same project:

    line 81
  16. Distinctive:

    Styling: Don't mix inline styles, StyleSheet, styled-components, and Tailwind in the same project unless the project already mixes them …

    line 83
  17. Distinctive:

    Component libraries: Don't import from multiple UI kits (e.g., both MUI and Chakra) unless the project already does.

    line 84
  18. Distinctive:

    State patterns: Follow the project's established state management pattern.

    line 85
  19. Distinctive:

    Navigation: Use the project's existing navigation approach.

    line 86
  20. Distinctive:

    Action: Check 2-3 existing files in the same area to identify the established pattern.

    line 88
  21. Distinctive:

    Genuine gap: No existing component or token covers the use case (note this in your response).

    line 95
  22. Distinctive:

    When writing UI code:

    line 101
  23. Distinctive:

    Stop and search: before writing any UI element — run the pre-build checklist.

    line 103
  24. Distinctive:

    Do NOT block the user's workflow with excessive warnings.

    line 106

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Component Consistency

You are an ambient consistency enforcer for UI code. Before writing any UI element, verify it aligns with the project's existing components, tokens, and patterns.

Pre-Build Checklist

Before creating any UI element, do ALL of these:

  1. Search for existing components — use the component-locator skill or grep the project's component directories (components/, ui/, shared/, primitives/).
  2. Check for design tokens — look for a theme file, token definitions, or Tailwind config. Use those values, not literals.
  3. Search for similar patterns — grep for similar UI patterns already in the codebase. Extend rather than duplicate.

P1: Raw Primitives

Do NOT use raw primitives when the project has wrapped versions. Search for a wrapped alternative before reaching for these:

React Native

Raw PrimitiveSearch for wrapper named
TextInputInput, TextField, FormInput, SearchInput
TouchableOpacity, PressableButton, IconButton, TouchableRow, Pressable (project-wrapped)
ImageAvatar, CachedImage, FastImage, Icon
ScrollViewScreenWrapper, ScrollContainer, PageScroll
FlatListList, InfiniteList, VirtualizedList (project-wrapped)
TextTypography, Label, Heading, Body, Caption
ViewBox, Card, Container, Row, Stack
ModalBottomSheet, Dialog, Overlay, Sheet
ActivityIndicatorSpinner, Loading, Skeleton

React / Next.js

Raw PrimitiveSearch for wrapper named
<input>Input, TextField, FormField
<button>Button, IconButton, LinkButton
<img>Image (next/image), Avatar, Picture
<a>Link (next/link), NavLink, TextLink
<select>Select, Dropdown, Combobox, Picker
<textarea>TextArea, RichTextInput
<dialog>Modal, Dialog, Sheet, Drawer
<table>DataTable, Table (project-wrapped), Grid

Action: If a wrapped version exists, use it. If not, note it and proceed with the primitive.

P2: Hardcoded Design Values

Do NOT use literal values when the project has a token/theme system:

  • Colors: No hex (#FF0000), RGB (rgb()), HSL literals. Use theme colors or Tailwind classes.
  • Spacing: No pixel literals for margin/padding (16, 24). Use spacing tokens or Tailwind spacing.
  • Font sizes: No numeric font sizes (fontSize: 14). Use typography tokens or Tailwind text classes.
  • Border radius: No literal radius values. Use radius tokens or Tailwind rounded classes.
  • Shadows: No hardcoded shadow values. Use elevation tokens or Tailwind shadow classes.

Action: Grep for theme/token files (theme.*, tokens.*, tailwind.config.*, colors.*, spacing.*). If tokens exist, use them.

P3: Duplicate Components

Do NOT create a new component when an existing one can be extended:

  • Before creating a new component, search for similar ones by purpose (not just name).
  • If one exists, add a prop or variant instead of duplicating.
  • If the existing component is in a different package/module, import it rather than copying.

Action: If a similar component exists, propose extending it with a new prop/variant. Only create new if the use case is genuinely distinct.

P4: Inconsistent Patterns

Do NOT mix approaches within the same project:

  • Styling: Don't mix inline styles, StyleSheet, styled-components, and Tailwind in the same project unless the project already mixes them intentionally.
  • Component libraries: Don't import from multiple UI kits (e.g., both MUI and Chakra) unless the project already does.
  • State patterns: Follow the project's established state management pattern.
  • Navigation: Use the project's existing navigation approach.

Action: Check 2-3 existing files in the same area to identify the established pattern. Follow it.

Acceptable Deviations

These are valid reasons to skip the rules above:

  • Prototyping: Flagged with // TODO: replace with <ComponentName> comment.
  • Genuine gap: No existing component or token covers the use case (note this in your response).
  • Performance: A measured performance concern justifies a lower-level primitive (cite the concern).
  • Third-party constraint: A library requires specific raw elements.

Enforcement Behavior

When writing UI code:

  1. Stop and search before writing any UI element — run the pre-build checklist.
  2. Report what was found — briefly mention which existing components/tokens apply.
  3. Note gaps — if nothing exists, say so and proceed.
  4. Do NOT block the user's workflow with excessive warnings. Be concise: one line per finding.

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.