@spences10/pi-svelte-guardrails

Svelte 5 guardrails for Pi that block discouraged agent-written patterns before they land in code

Packages

Package details

extension

Install @spences10/pi-svelte-guardrails from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@spences10/pi-svelte-guardrails
Package
@spences10/pi-svelte-guardrails
Version
0.0.12
Published
Jun 17, 2026
Downloads
616/mo · 52/wk
Author
spences10
License
MIT
Types
extension
Size
21 KB
Dependencies
1 dependency · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./dist/index.js"
  ],
  "image": "https://raw.githubusercontent.com/spences10/my-pi/main/assets/pi-package-preview.png"
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@spences10/pi-svelte-guardrails

built with Vite+ tested with Vitest npm version license

my-pi package preview

Catch discouraged Svelte patterns before they land in your codebase. pi-svelte-guardrails blocks common agent mistakes and points the model toward current Svelte 5 practices while edits are still cheap to fix.

By default, blocks $effect in .svelte write/edit tool calls and bash writes, then tells the agent to prefer $derived, event handlers, actions, or explicit lifecycle alternatives.

pi install npm:@spences10/pi-svelte-guardrails

Standalone package use is opt-in: installing the package globally applies it to your Pi sessions, but projects and downstream users do not inherit it unless they install the package.

Status and disabling

Use /extensions or /extensions list in my-pi to inspect whether Svelte guardrails are enabled, disabled by saved settings, or force-disabled for the current process.

Disable options:

  • CLI: start my-pi with --no-svelte-guardrails.
  • TUI: toggle Svelte guardrails in /extensions and reload.
  • SDK/API: pass svelte_guardrails: false to create_my_pi().
  • Rule config: set "mode": "off" or "blockEffect": false in the config file below.

Configuration

Create ~/.config/my-pi/svelte-guardrails.json to tune the guardrail globally, or .pi/svelte-guardrails.json in a project to override it locally:

{
	"blockEffect": true,
	"allow": ["examples/**", "legacy/**"],
	"mode": "block"
}
  • blockEffect: set to false to disable the $effect rule while keeping the extension installed.
  • allow: glob patterns for paths where the rule is skipped.
  • mode: block prevents the write, warn allows it with a warning, and off skips the rule.

Current default:

{
	"version": 1,
	"blockEffect": true,
	"allow": [],
	"mode": "block"
}

Use block for strict enforcement, warn to observe violations before enforcing them, and off for projects that intentionally allow the pattern. The current default remains block.

When a tool result says a write was blocked, the target file was not created or modified. Rewrite the change without $effect and run the write/edit again before reporting success.

Development

Package scripts build transitive workspace dependencies first, then run local tools through Vite+ with vp exec.

pnpm --filter @spences10/pi-svelte-guardrails run check
pnpm --filter @spences10/pi-svelte-guardrails run test
pnpm --filter @spences10/pi-svelte-guardrails run build