svelte-styling

Svelte CSS styling patterns covering scoped styles, CSS custom properties, the style: directive, :global, and approaches for styling child components, aimed at componentized style management.

Last repository push
GitHub Stars
96
Forks
3
Issues / PRs
2

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "svelte-styling" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4e216e0f971e393b52b19c059cacffe628f1fa19abc7d9f459dd67d09cad9f64. Verify the upstream source and version against https://github.com/spences10/svelte-skills-kit before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Svelte CSS styling patterns covering scoped styles, CSS custom properties, the style: directive, :global, and approaches for styling child components, aimed at componentized style management.

0 Downloads

Introduction source: third_party · spences10 · 0.0.1 Reference

SkillPi interpretation

Tasks
Svelte CSS styling patterns. Use for scoped styles, CSS custom properties, style: directive, :global, or styling child components.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: svelte-styling
# IMPORTANT: Keep description on ONE line for agent compatibility
# prettier-ignore
description: "Svelte CSS styling patterns. Use for scoped styles, CSS custom properties, style: directive, :global, or styling child components."

Svelte Styling

Quick Start

JS vars in CSS: Use style: directive to set CSS custom properties from JavaScript.

<script>
    let columns = $state(3);
</script>

<div style:--columns={columns}>
    {@render children()}
</div>

<style>
    div {
        display: grid;
        grid-template-columns: repeat(var(--columns), 1fr);
    }
</style>

Styling Child Components

Preferred: Pass CSS custom properties as component props:

<!-- Parent.svelte -->
<Child --color="red" --spacing="1rem" />

<!-- Child.svelte -->
<h1>Hello</h1>

<style>
    h1 {
        color: var(--color, blue);
        margin: var(--spacing, 0);
    }
</style>

Fallback: Use :global when custom properties aren't possible (e.g., library components):

<div>
    <LibraryComponent />
</div>

<style>
    div :global {
        h1 { color: red; }
    }
</style>

Reference Files

Notes

  • All <style> blocks are scoped to the component by default
  • Use style: directive, not inline style strings, for dynamic values
  • Prefer CSS custom properties over :global for child styling
  • Last verified: 2026-03-12

<!-- PROGRESSIVE DISCLOSURE GUIDELINES:

  • Keep this file ~50 lines total (max ~150 lines)
  • Use 1-2 code blocks only (recommend 1)
  • Keep description <200 chars for Level 1 efficiency
  • Move detailed docs to references/ for Level 3 loading
  • This is Level 2 - quick reference ONLY, not a manual -->

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value78/100

Highlights

  • 提供 Svelte CSS 样式模式的实用技术方案
  • 涵盖作用域样式、CSS 自定义属性、style: 指令等核心功能
  • 面向前端开发者解决实际开发痛点
Trigger Precision95/100

Highlights

  • description 明确描述用途和适用范围
  • 覆盖多种变体且边界清晰
  • 触发词精准完整
Structure and Standards75/100

Areas to improve

  • 缺少 When to Use 章节 Reported severity: Minor

    文档结构良好但缺少明确的 When to Use 使用场景说明章节

    Recommendation: 建议添加 When to Use 章节,明确说明在什么情况下使用此 Skill

Highlights

  • 文档结构清晰,包含多个实用章节
  • frontmatter 完整且规范
  • 提供了代码示例和最佳实践建议
Execution Reliability85/100

Highlights

  • 代码示例语法正确且实用
  • 覆盖了主要使用场景和异常情况
  • 提供了 fallback 方案和最佳实践建议
Evidence Verifiability (mean of the first four)83/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.