بنقرة واحدة
add-component
// 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.
// 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.
Creates a new blog post for the Torrust website. Use when asked to write, add, create, or publish a new blog post or article.
Opens a GitHub Pull Request from the current branch, linking it to the related issue when the branch name starts with an issue number.
Creates a new git branch for a GitHub issue following naming conventions with issue number as prefix.
Deploys the Torrust website to GitHub Pages. Use when asked to deploy, publish, or release the site, or to set up the deployment workflow.
Runs the full quality check suite for the Torrust website. Use before committing or opening a PR to verify types, linting, and that the build succeeds.
Updates the contributors list on the Torrust website homepage. Use when asked to refresh, update, or sync the contributors list from the Torrust GitHub org.
| name | add-component |
| description | 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. |
Use this skill when asked to create a new reusable UI component for the Torrust website.
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 |
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:
<style> blocks minimallang="scss") only when needed for variables/mixinsTypeScript guidelines:
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.
If the component should be importable as $lib/..., export it from src/lib/index.ts:
export { default as MyComponent } from './components/atoms/MyComponent.svelte';
npm run check # TypeScript + Svelte type checking
npm run lint # Prettier + ESLint