add-component
Generates Torrust UI components using Svelte 5 runes syntax and Tailwind styling.
Install
mkdir -p .claude/skills/add-component && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15954" && unzip -o skill.zip -d .claude/skills/add-component && rm skill.zipInstalls to .claude/skills/add-component
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Creates a new Svelte UI component for the Torrust website. Use when asked to add, create, or build a new reusable UI component, widget, or UI element.Key capabilities
- →Create new Svelte UI components
- →Place components in correct directories based on complexity (Atom, Molecule, Organism, Singleton)
- →Use Svelte 5 runes syntax for reactivity (`$props`, `$state`, `$derived`, `$effect`)
- →Type props via an interface
- →Add Histoire stories for component preview
- →Export publicly available components from `src/lib/index.ts`
How it works
This skill creates Svelte UI components by following a tiered directory structure, using Svelte 5 runes syntax, and adhering to specific styling and TypeScript guidelines.
Inputs & outputs
When to use add-component
- →Create a new button atom
- →Build a reusable blog post card molecule
- →Construct a complex header organism
- →Generate a singleton search bar component
About this skill
Add Component
When to use this skill
Use this skill when asked to create a new reusable UI component for the Torrust website.
Component tiers
Place the new component in the correct directory based on its complexity:
| Tier | Directory | Description |
|---|---|---|
| Atom | src/lib/components/atoms/ | Basic building blocks: Button, Card, Image, Tag, etc. |
| Molecule | src/lib/components/molecules/ | Combinations of atoms: BlogPostCard, Callout, CodeBlock |
| Organism | src/lib/components/organisms/ | Complex sections: Header, Footer, Hero, Post |
| Singleton | src/lib/components/singletons/ | Unique, one-off components: SearchBar, ShareButton |
Steps
1. Create the component file
Use kebab-case for the filename. Inside the component, use Svelte 5 runes syntax:
<script lang="ts">
// Use $props() instead of export let
interface Props {
label: string;
variant?: 'primary' | 'secondary';
}
let { label, variant = 'primary' }: Props = $props();
// Use $state, $derived, $effect for reactivity
let count = $state(0);
let doubled = $derived(count * 2);
</script>
<div class="my-component">
{label}
</div>
<style lang="scss">
@use '$lib/scss/breakpoints.scss' as bp;
.my-component {
/* component styles */
}
</style>
Style guidelines:
- Use Tailwind utility classes where possible
- Keep custom
<style>blocks minimal - Use Sass (
lang="scss") only when needed for variables/mixins
TypeScript guidelines:
- Always type props via an interface
- Always type function parameters and return values (strict mode is on)
- Single quotes, no semicolons (Prettier enforces this)
2. Add a Histoire story (optional but recommended)
Create a *.story.svelte file alongside the component to preview it in isolation:
<script lang="ts">
import { Story, Template } from 'histoire/client';
import MyComponent from './MyComponent.svelte';
</script>
<Story name="Default">
<Template>
<MyComponent label="Hello" />
</Template>
</Story>
Run npm run story:dev to open the Histoire storybook.
3. Export the component (if publicly available)
If the component should be importable as $lib/..., export it from src/lib/index.ts:
export { default as MyComponent } from './components/atoms/MyComponent.svelte';
4. Verify and lint
npm run check # TypeScript + Svelte type checking
npm run lint # Prettier + ESLint
When not to use it
- →When creating components for frameworks other than Svelte
- →When not asked to create a reusable UI component for the Torrust website
Limitations
- →Components must use kebab-case for filenames
- →Custom `<style>` blocks should be minimal
- →All content must be for the Torrust website
How it compares
This skill enforces a structured approach to Svelte component creation with specific architectural tiers and modern Svelte 5 syntax, unlike ad-hoc component development.
Compared to similar skills
add-component side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| add-component (this skill) | 0 | 5mo | Review | Intermediate |
| svelte-expert | 11 | 9mo | No flags | Intermediate |
| web-component-design | 5 | 5mo | No flags | Intermediate |
| svelte | 3 | 2mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by torrust
View all by torrust →You might also like
svelte-expert
Raudbjorn
Expert Svelte/SvelteKit development assistant for building components, utilities, and applications. Use when creating Svelte components, SvelteKit applications, implementing reactive patterns, handling state management, working with stores, transitions, animations, or any Svelte/SvelteKit development task. Includes comprehensive documentation access, code validation with svelte-autofixer, and playground link generation.
web-component-design
wshobson
Master React, Vue, and Svelte component patterns including CSS-in-JS, composition strategies, and reusable component architecture. Use when building UI component libraries, designing component APIs, or implementing frontend design systems.
svelte
EpicenterHQ
Svelte 5 patterns including TanStack Query mutations, shadcn-svelte components, and component composition. Use when writing Svelte components, using TanStack Query, or working with shadcn-svelte UI.
admin-crud-page
svelte-society
Create admin dashboard pages with tables, forms, and actions
component-builder
svelte-society
Create UI components using tailwind-variants for type-safe styling. Use when creating or editing components in src/lib/ui/.
svelte-ui-design
XIYO
ALWAYS use this skill for ANY Svelte component styling, design, or UI work. Svelte 5 UI design system using Tailwind CSS 4, Skeleton Labs design tokens/presets/Tailwind Components, and Bits UI headless components. Covers class composition, color systems, interactive components, forms, overlays, and all visual design.