Source: https://frameworkrecipes.dev/sveltekit/

# SvelteKit: preserve requirements through advanced agent edits

Work through TypeScript examples of real application boundaries: Authorize a SvelteKit form action before its conditional write; Keep SvelteKit private SSR responses out of shared caches. Each recipe includes implementation code, integration prerequisites, failure-path tests to add, a Perch rule, and the captured broken/fixed source checks.

[Download the SvelteKit rule pack ZIP](https://reporules.fyi/sveltekit/rule-pack.zip) · [Inspect the YAML rules](https://reporules.fyi/sveltekit/rules.yaml)

TypeScript

## [Authorize a SvelteKit form action before its conditional write](https://frameworkrecipes.dev/sveltekit/server-action-authorization/)

A protected page load does not protect its form action. Server actions must enforce their own identity and resource scope. Passing the verified tenant into the conditional mutation makes that boundary visible to both the code reviewer and the rule.

Broken edit flagged · corrected edit passes

TypeScript

## [Keep SvelteKit private SSR responses out of shared caches](https://frameworkrecipes.dev/sveltekit/private-ssr-state/)

A server module is reused across requests. Returning request-local data is safe; putting it into a module-level store or a shared response cache can expose one user’s orders to another. Explicit response policy helps keep the load result outside shared caches.

Broken edit flagged · corrected edit passes

## Use a correction as a saved requirement

Choose the failure you need to prevent, add the scoped rule to your repository, and check both the broken and corrected implementation. Ask your agent to inspect the finding, repair the code and recheck the same rule. Keep framework tests beside the model check.

Perch keeps the requirement beside the code. Reuse the named check during the agent’s next edit and in CI, with cached answers free on unchanged requests.

[Official SvelteKit documentation](https://svelte.dev/docs/kit) · [All language and framework recipes](https://frameworkrecipes.dev/)

**Framework Recipes**

Implementation, failure path, check.

Published by Perch · © 2026 Verglas LLC. Framework Recipes is a Perch publication.

Perch’s MIT license covers the CLI; hosted model analysis is a paid service. Relevant source is sent to the configured model service.

[Perch CLI MIT license](https://github.com/lakeday-org/perch/blob/main/LICENSE) · [Article text](https://frameworkrecipes.dev/sveltekit/index.md) · [Resource index](https://frameworkrecipes.dev/llms.txt)
