One-click install
npx skills add https://github.com/ftnilsson/agent-cli --skill state-management-ftnilsson
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: State Management
Source: https://github.com/ftnilsson/agent-cli/tree/main/frontend/skills/02-state-management
Command: npx skills add https://github.com/ftnilsson/agent-cli --skill state-management-ftnilsson

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers choose, structure, and maintain application state effectively, preventing common bugs and improving application performance across various frontend frameworks.

Core Features & Use Cases

  • State Classification: Guides decisions on where to store different types of data (local, global, server, URL).
  • Server State Caching: Recommends dedicated cache layers for API data to avoid staleness and manual synchronization.
  • State Normalization: Provides patterns for structuring global state like a database for consistency.
  • Use Case: Refactoring a complex application where UI state is inconsistent and difficult to debug, by applying best practices for state classification and normalization.

Quick Start

Guide me on how to classify the state for a new feature that requires sharing user preferences across multiple components.

Frequently Asked Questions about State Management

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

FAQPage Schema
How do I classify frontend application state for new features?

Frontend application state should be classified into local, global, server, and URL state to determine optimal storage locations and prevent UI inconsistencies across components.

What is the best way to cache server state in React or Vue?

The best way to cache server state is implementing dedicated cache layers for API data to avoid staleness and eliminate manual synchronization across frontend frameworks.

How does state normalization improve frontend data consistency?

State normalization improves frontend data consistency by structuring global application state like a database, ensuring data integrity and easier updates across various components.

Why does global-by-default state cause bugs in frontend apps?

Global-by-default state causes bugs by increasing unnecessary component re-renders and complicating data flow, making UI state inconsistent and difficult to debug effectively.

Can I synchronize URL state with local component state in Svelte?

You can synchronize URL state with local component state in Svelte to maintain shareable application views and ensure persistent UI configurations across user navigation.

How do I avoid stale closures when managing frontend application state?

Avoid stale closures when managing frontend application state by applying correct data normalization techniques and ensuring state updates reference the latest functional execution contexts.