using-remote-functions

Enables type-safe client-server communication in SvelteKit via remote functions.

2|1|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/zajca/zfaktury --skill using-remote-functions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-remote-functions
Source: https://github.com/zajca/zfaktury/tree/main/.agents/skills/using-remote-functions
Command: npx skills add https://github.com/zajca/zfaktury --skill using-remote-functions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies client-server communication in SvelteKit by providing a type-safe way to fetch data, submit forms, and execute server-side commands directly from components.

Core Features & Use Cases

  • Colocated Data Fetching: Define data logic alongside your components for better organization.
  • Type Safety: Ensures consistency between client and server code through TypeScript.
  • Progressive Enhancement: Forms work even when JavaScript is disabled.
  • Use Case: Build a dynamic product listing component where each product card fetches its own details and allows users to add items to a cart via a server-side command, all managed within the component's scope.

Quick Start

Use the using-remote-functions skill to create a Svelte component that fetches data from a server API.

Frequently Asked Questions about using-remote-functions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch data type-safely in SvelteKit components?

Type-safe data fetching in SvelteKit components is enabled through remote functions that colocate data logic directly within your components. This approach uses queries to read data while maintaining TypeScript consistency between client and server code.

Can I submit forms in SvelteKit with progressive enhancement using remote functions?

Forms in SvelteKit can be submitted via remote functions with built-in progressive enhancement, ensuring they remain functional even when JavaScript is disabled. This allows direct server-side processing from the component scope.

What is the best way to execute server-side commands from a SvelteKit component?

Executing server-side commands from a SvelteKit component is handled through programmatic mutations called commands. This remote-first architecture supports efficient SSR and client-side rendering without leaving the component's scope.

Does this remote function approach work with TypeScript for client-server communication?

TypeScript is fully supported for client-server communication in SvelteKit via remote functions. It ensures type consistency across your data fetching, form submissions, and command executions, preventing runtime type mismatches.

Why colocate data fetching logic with SvelteKit components?

Colocating data fetching logic with SvelteKit components organizes related server queries and mutations within the component's scope. This simplifies building dynamic features like product cards that independently fetch details and trigger cart additions.

When should I use remote functions instead of standard SvelteKit load functions?

Remote functions should be used when you need component-level data autonomy, such as individual product cards fetching their own details. They provide a remote-first architecture for granular queries, forms, and commands beyond traditional page-level loading.