Install command
Provided
Automatically compiles and validates Svelte components when they are modified.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
None
Platforms
1 listed
Difficulty
0/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Safety & privacy surface
2 safety and 2 privacy notes across 2 risk areas.
#!/bin/bash
# Read the tool input from stdin
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Check if this is a Svelte component file
if [[ "$FILE_PATH" == *.svelte ]]; then
echo "🔥 Svelte Component Compiler - Validating Svelte component..."
echo "📄 Component: $FILE_PATH"
# Check if file exists
if [ ! -f "$FILE_PATH" ]; then
echo "⚠️ Component file not found: $FILE_PATH"
exit 1
fi
# Check if this is a SvelteKit project
SVELTEKIT_PROJECT=false
if [ -f "svelte.config.js" ] || [ -f "vite.config.js" ] && grep -q "@sveltejs/kit" package.json 2>/dev/null; then
echo "🎯 SvelteKit project detected"
SVELTEKIT_PROJECT=true
elif [ -f "package.json" ] && grep -q "svelte" package.json 2>/dev/null; then
echo "⚡ Svelte project detected"
else
echo "ℹ️ No Svelte project configuration found"
fi
# Check for required tools
echo "🔍 Checking Svelte toolchain..."
SVELTE_CHECK_AVAILABLE=false
if command -v npx >/dev/null 2>&1 && npx svelte-check --version >/dev/null 2>&1; then
SVELTE_CHECK_AVAILABLE=true
SVELTE_CHECK_VERSION=$(npx svelte-check --version 2>/dev/null)
echo "✅ svelte-check available: $SVELTE_CHECK_VERSION"
else
echo "⚠️ svelte-check not available - install with: npm install -D @sveltejs/language-server svelte-check"
fi
# Component syntax validation
echo ""
echo "🔍 Validating component syntax..."
# Basic syntax validation
if grep -q '<script' "$FILE_PATH" && grep -q '</script>' "$FILE_PATH"; then
echo "✅ Script block found"
# Check for TypeScript
if grep -q "<script lang=[\"']ts[\"']>" "$FILE_PATH"; then
echo "📘 TypeScript detected in component"
fi
fi
if grep -q '<style' "$FILE_PATH" && grep -q '</style>' "$FILE_PATH"; then
echo "✅ Style block found"
# Check for scoped styles
if grep -q '<style.*scoped' "$FILE_PATH"; then
echo "🎯 Scoped styles detected"
fi
fi
# Run svelte-check if available
if [ "$SVELTE_CHECK_AVAILABLE" = true ]; then
echo ""
echo "🔍 Running svelte-check validation..."
if npx svelte-check --output human --no-tsconfig 2>&1; then
echo "✅ Svelte component validation passed"
else
echo "❌ Svelte component validation failed"
echo "💡 Check the errors above and fix component issues"
fi
fi
# Component analysis
echo ""
echo "📊 Component Analysis:"
# Count component features
PROPS_COUNT=$(grep -c 'export let' "$FILE_PATH" 2>/dev/null || echo 0)
REACTIVE_COUNT=$(grep -c '\$:' "$FILE_PATH" 2>/dev/null || echo 0)
STORES_COUNT=$(grep -c 'import.*from.*svelte/store' "$FILE_PATH" 2>/dev/null || echo 0)
echo " • Props: $PROPS_COUNT"
echo " • Reactive statements: $REACTIVE_COUNT"
echo " • Store imports: $STORES_COUNT"
# Check for common patterns
if grep -q 'on:click' "$FILE_PATH" 2>/dev/null; then
echo " • 🖱️ Click handlers detected"
fi
if grep -q 'bind:' "$FILE_PATH" 2>/dev/null; then
echo " • 🔗 Data binding detected"
fi
if grep -q '{#if' "$FILE_PATH" 2>/dev/null; then
echo " • 🔀 Conditional rendering detected"
fi
if grep -q '{#each' "$FILE_PATH" 2>/dev/null; then
echo " • 🔁 List rendering detected"
fi
# Accessibility checks
echo ""
echo "♿ Accessibility Analysis:"
if grep -q 'alt=' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ Image alt attributes found"
fi
if grep -q 'aria-' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ ARIA attributes detected"
fi
if grep -q 'role=' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ Role attributes found"
fi
# Performance suggestions
echo ""
echo "⚡ Performance Tips:"
if grep -q 'import.*from.*svelte/transition' "$FILE_PATH" 2>/dev/null; then
echo " • 🎬 Transitions detected - ensure they're necessary"
fi
if [ "$REACTIVE_COUNT" -gt 5 ]; then
echo " • ⚠️ Many reactive statements - consider component splitting"
fi
echo ""
echo "💡 Svelte Best Practices:"
echo " • Use 'export let' for component props"
echo " • Prefer reactive statements over complex logic in templates"
echo " • Use stores for shared state between components"
echo " • Implement proper accessibility attributes"
echo " • Use SvelteKit for full-stack applications"
echo " • Consider component composition over large single components"
echo ""
echo "🎯 Svelte component validation complete!"
else
echo "ℹ️ File is not a Svelte component: $FILE_PATH"
fi
exit 0{
"hooks": {
"postToolUse": {
"script": "./.claude/hooks/svelte-component-compiler.sh",
"matchers": [
"write",
"edit"
]
}
}
}.claude/settings.local.json~/.claude/settings.json.claude/settings.json{
"hooks": {
"postToolUse": {
"script": "./.claude/hooks/svelte-component-compiler.sh",
"matchers": ["write", "edit"]
}
}
}
#!/bin/bash
# Read the tool input from stdin
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Check if this is a Svelte component file
if [[ "$FILE_PATH" == *.svelte ]]; then
echo "🔥 Svelte Component Compiler - Validating Svelte component..."
echo "📄 Component: $FILE_PATH"
# Check if file exists
if [ ! -f "$FILE_PATH" ]; then
echo "⚠️ Component file not found: $FILE_PATH"
exit 1
fi
# Check if this is a SvelteKit project
SVELTEKIT_PROJECT=false
if [ -f "svelte.config.js" ] || [ -f "vite.config.js" ] && grep -q "@sveltejs/kit" package.json 2>/dev/null; then
echo "🎯 SvelteKit project detected"
SVELTEKIT_PROJECT=true
elif [ -f "package.json" ] && grep -q "svelte" package.json 2>/dev/null; then
echo "⚡ Svelte project detected"
else
echo "ℹ️ No Svelte project configuration found"
fi
# Check for required tools
echo "🔍 Checking Svelte toolchain..."
SVELTE_CHECK_AVAILABLE=false
if command -v npx >/dev/null 2>&1 && npx svelte-check --version >/dev/null 2>&1; then
SVELTE_CHECK_AVAILABLE=true
SVELTE_CHECK_VERSION=$(npx svelte-check --version 2>/dev/null)
echo "✅ svelte-check available: $SVELTE_CHECK_VERSION"
else
echo "⚠️ svelte-check not available - install with: npm install -D @sveltejs/language-server svelte-check"
fi
# Component syntax validation
echo ""
echo "🔍 Validating component syntax..."
# Basic syntax validation
if grep -q '<script' "$FILE_PATH" && grep -q '</script>' "$FILE_PATH"; then
echo "✅ Script block found"
# Check for TypeScript
if grep -q "<script lang=[\"']ts[\"']>" "$FILE_PATH"; then
echo "📘 TypeScript detected in component"
fi
fi
if grep -q '<style' "$FILE_PATH" && grep -q '</style>' "$FILE_PATH"; then
echo "✅ Style block found"
# Check for scoped styles
if grep -q '<style.*scoped' "$FILE_PATH"; then
echo "🎯 Scoped styles detected"
fi
fi
# Run svelte-check if available
if [ "$SVELTE_CHECK_AVAILABLE" = true ]; then
echo ""
echo "🔍 Running svelte-check validation..."
if npx svelte-check --output human --no-tsconfig 2>&1; then
echo "✅ Svelte component validation passed"
else
echo "❌ Svelte component validation failed"
echo "💡 Check the errors above and fix component issues"
fi
fi
# Component analysis
echo ""
echo "📊 Component Analysis:"
# Count component features
PROPS_COUNT=$(grep -c 'export let' "$FILE_PATH" 2>/dev/null || echo 0)
REACTIVE_COUNT=$(grep -c '\$:' "$FILE_PATH" 2>/dev/null || echo 0)
STORES_COUNT=$(grep -c 'import.*from.*svelte/store' "$FILE_PATH" 2>/dev/null || echo 0)
echo " • Props: $PROPS_COUNT"
echo " • Reactive statements: $REACTIVE_COUNT"
echo " • Store imports: $STORES_COUNT"
# Check for common patterns
if grep -q 'on:click' "$FILE_PATH" 2>/dev/null; then
echo " • 🖱️ Click handlers detected"
fi
if grep -q 'bind:' "$FILE_PATH" 2>/dev/null; then
echo " • 🔗 Data binding detected"
fi
if grep -q '{#if' "$FILE_PATH" 2>/dev/null; then
echo " • 🔀 Conditional rendering detected"
fi
if grep -q '{#each' "$FILE_PATH" 2>/dev/null; then
echo " • 🔁 List rendering detected"
fi
# Accessibility checks
echo ""
echo "♿ Accessibility Analysis:"
if grep -q 'alt=' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ Image alt attributes found"
fi
if grep -q 'aria-' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ ARIA attributes detected"
fi
if grep -q 'role=' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ Role attributes found"
fi
# Performance suggestions
echo ""
echo "⚡ Performance Tips:"
if grep -q 'import.*from.*svelte/transition' "$FILE_PATH" 2>/dev/null; then
echo " • 🎬 Transitions detected - ensure they're necessary"
fi
if [ "$REACTIVE_COUNT" -gt 5 ]; then
echo " • ⚠️ Many reactive statements - consider component splitting"
fi
echo ""
echo "💡 Svelte Best Practices:"
echo " • Use 'export let' for component props"
echo " • Prefer reactive statements over complex logic in templates"
echo " • Use stores for shared state between components"
echo " • Implement proper accessibility attributes"
echo " • Use SvelteKit for full-stack applications"
echo " • Consider component composition over large single components"
echo ""
echo "🎯 Svelte component validation complete!"
else
echo "ℹ️ File is not a Svelte component: $FILE_PATH"
fi
exit 0
Complete hook script that validates Svelte components on file changes
#!/bin/bash
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
if [[ "$FILE_PATH" == *.svelte ]]; then
echo "🔥 Svelte Component Compiler - Validating Svelte component..."
echo "📄 Component: $FILE_PATH"
if [ ! -f "$FILE_PATH" ]; then
echo "⚠️ Component file not found: $FILE_PATH"
exit 1
fi
if command -v npx >/dev/null 2>&1 && npx svelte-check --version >/dev/null 2>&1; then
echo "🔍 Running svelte-check validation..."
npx svelte-check --output human --no-tsconfig 2>&1
else
echo "⚠️ svelte-check not available - install with: npm install -D @sveltejs/language-server svelte-check"
fi
echo "🎯 Svelte component validation complete!"
fi
exit 0
Complete hook configuration for .claude/settings.json to enable Svelte component validation
{
"hooks": {
"postToolUse": {
"script": "./.claude/hooks/svelte-component-compiler.sh",
"matchers": ["write:**/*.svelte", "edit:**/*.svelte"]
}
}
}
Enhanced hook script with component analysis and SvelteKit detection
#!/bin/bash
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [[ "$FILE_PATH" == *.svelte ]]; then
SVELTEKIT_PROJECT=false
if [ -f "svelte.config.js" ] && grep -q "@sveltejs/kit" package.json 2>/dev/null; then
SVELTEKIT_PROJECT=true
echo "🎯 SvelteKit project detected"
fi
PROPS_COUNT=$(grep -c 'export let' "$FILE_PATH" 2>/dev/null || echo 0)
REACTIVE_COUNT=$(grep -v '<style' "$FILE_PATH" | grep -c '\$:' 2>/dev/null || echo 0)
STORES_COUNT=$(grep -c 'import.*from.*svelte/store' "$FILE_PATH" 2>/dev/null || echo 0)
echo "📊 Component Analysis:"
echo " • Props: $PROPS_COUNT"
echo " • Reactive statements: $REACTIVE_COUNT"
echo " • Store imports: $STORES_COUNT"
if [ "$REACTIVE_COUNT" -gt 5 ]; then
echo " • ⚠️ Many reactive statements - consider component splitting"
fi
if command -v npx >/dev/null 2>&1; then
npx svelte-check --output human --no-tsconfig 2>&1
fi
fi
exit 0
Enhanced hook script with comprehensive accessibility validation
#!/bin/bash
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [[ "$FILE_PATH" == *.svelte ]]; then
echo "♿ Accessibility Analysis:"
if grep -q 'alt=' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ Image alt attributes found"
else
echo " • ⚠️ Missing image alt attributes"
fi
if grep -q 'aria-' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ ARIA attributes detected"
else
echo " • ⚠️ Consider adding ARIA attributes for accessibility"
fi
if grep -q 'role=' "$FILE_PATH" 2>/dev/null; then
echo " • ✅ Role attributes found"
fi
if ! grep -q 'on:keydown\|on:keyup' "$FILE_PATH" 2>/dev/null && grep -q 'on:click' "$FILE_PATH" 2>/dev/null; then
echo " • ⚠️ Click handlers should have keyboard equivalents"
fi
if command -v npx >/dev/null 2>&1; then
npx svelte-check --output human --no-tsconfig 2>&1
fi
fi
exit 0
Example Svelte component compiler configuration for customizing validation behavior
{
"svelte": {
"check_on_save": true,
"sveltekit_detection": true,
"accessibility_checks": true,
"performance_analysis": true,
"dependency_analysis": true,
"svelte_check_options": {
"output": "human",
"no_tsconfig": false,
"workspace": "src/components"
}
}
}
Missing @types or incorrect tsconfig paths. Install: npm install --save-dev @sveltejs/vite-plugin-svelte @types/node. Add to tsconfig: "types": ["svelte", "vite/client"] enabling Svelte module resolution. Verify tsconfig.json paths. Check import paths.
Matchers too broad catching all writes/edits. Restrict: 'matchers': ['write:/*.svelte', 'edit:/*.svelte'] targeting Svelte components only. Prevents unnecessary checks on JS/TS files. Verify matcher patterns. Test with various file types.
Config check requires both svelte.config.js AND @sveltejs/kit in package.json. Verify: grep @sveltejs/kit package.json. Or simplify: if [ -f "svelte.config.js" ]; then SVELTEKIT_PROJECT=true; fi. Check package.json. Verify SvelteKit installation.
grep '$:' matches CSS custom properties in
Show that Svelte Component Compiler - Hooks is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/hooks/svelte-component-compiler)Svelte Component Compiler - Hooks side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Automatically compiles and validates Svelte components when they are modified. Open dossier | Automatically creates or updates test files when React components are modified. Open dossier | Automatically compiles SCSS/Sass files to CSS when they are modified. Open dossier | Automatically runs TypeScript compiler checks after editing .ts or .tsx files to catch type errors early. Open dossier |
|---|---|---|---|---|
| Next steps | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | hooks | hooks | hooks | hooks |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | JSONbored |
| Added | 2025-09-19 | 2025-09-19 | 2025-09-19 | 2025-09-19 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Runs automatically after write/edit tool use for .svelte files and may invoke npx svelte-check inside the current project. Uses the local project toolchain and dependencies, so validation can be slow or fail when Svelte dependencies are missing. | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. |
| Privacy notes | ✓Reads modified .svelte components, package.json, svelte.config.js, and vite.config.js to infer framework, component, accessibility, and performance signals. Prints component statistics and validation output to the local Claude Code hook output stream. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | | | | |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.