Skip to content
Back to skills

Architecture

ASecurity

Frontend state architecture — which data is server, UI, global or URL state, library choice and state machines. Use when a web app has prop drilling, duplicated state or an unclear data flow.

  • 24 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added October 14, 2026
ai-agentsrustgoreactdebuggingapifrontendperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned November 22, 2026

npx -y skills add andreibesleaga/GABBE --skill architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Architecture?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/andreibesleaga-architecture-db950147/badge)](https://www.skillsdirectory.com/skills/andreibesleaga-architecture-db950147)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: state-management
description: Frontend state architecture — which data is server, UI, global or URL state, library choice and state machines. Use when a web app has prop drilling, duplicated state or an unclear data flow.
triggers: [state management, redux, zustand, react query, xstate, prop drilling]
tags: [architecture]
role: eng-frontend
context_cost: low
---
# state-management Skill

## Goal
This skill guides the architecture of frontend state, avoiding "prop drilling" and "spaghetti state."

## Steps
## 1. Types of State

| Type | Definition | Solution |
|---|---|---|
| **Server State** | Data from API (Users, Posts). | **React Query / SWR / TanStack Query**. Do not use Redux for this. |
| **UI State** | Modals open, Sidebar toggle, Form inputs. | **Local `useState`** or **Context API** or **Zustand**. |
| **Global State** | User session, Theme, Shopping Cart. | **Redux Toolkit / Zustand / Context**. |
| **URL State** | Filters, Pagination, Search Query. | **URL Query Params**. (The URL is the source of truth). |

## 2. Selection Guide

- **Simple App**: `useState` + Context.
- **Medium App (Dashboard)**: Zustand (UI) + TanStack Query (Server).
- **Complex App (Editor, Enterprise)**: Redux Toolkit (if strict structure needed) or XState (state machines).

## 3. Implementation Rules

### 1. Minimal State
- Don't store derived data.
- **Bad**: `{ firstName: 'John', lastName: 'Doe', fullName: 'John Doe' }`
- **Good**: `const fullName = firstName + ' ' + lastName;`

### 2. Single Source of Truth
- If data exists in the URL (`?page=2`), do not duplicate it in a Store.
- The Store should sync *from* the URL, or the URL acts as the store.

### 3. Immutability
- Never mutate state directly (`state.value = 1`).
- Use libraries that enforce this (Immer is built into Redux Toolkit) or spread operators (`...state`).

### 4. Context Performance
- Don't put everything in one `AppProvider`.
- Split contexts: `UserProvider`, `ThemeProvider`, `SettingsProvider`.
- Use `useMemo` for context values to prevent re-renders.

## 4. State Machines (XState)
- Use for complex logic: Payment Flows, Wizards, Game Logic.
- Define explicit states: `idle` -> `loading` -> `success` | `error`.
- Prevents "impossible states" (e.g., `loading: true` AND `error: true`).

## 5. Debugging
- Use Redux DevTools or Zustand DevTools.
- Log state changes in development.
- Monitor render counts (React DevTools Profiler).

## Constraints
- Store no derived data.
- One source of truth: data in the URL is not copied into a store.

## Output Format
A table of the app's state by type (server, UI, global, URL) with the chosen solution for each.

## Limits and safety
- Do not keep access tokens, personal data or secrets in `localStorage`, `sessionStorage` or persisted stores; confirm with the human where the session token lives.
- Client state is untrusted: price, permission and workflow checks, including state machine transitions, are repeated on the server.
- Serialise server-rendered initial state safely (escape it before putting JSON into HTML).
- Cached server data has an expiry or invalidation tied to permission changes.
- Grep the state files for key and secret patterns before handing over.

Files in this skill

  • adaptive-architecture.skill.md3.7 KB
  • api-design.skill.md4.7 KB
  • api-standards.skill.md1.7 KB
  • arch-debt.skill.md8.2 KB
  • arch-design.skill.md12.6 KB
  • arch-patterns.skill.md3.9 KB
  • arch-review.skill.md14.1 KB
  • architecture-governance.skill.md3.6 KB
  • attribute-driven-design.skill.md7.5 KB
  • blockchain-dlt.skill.md1.9 KB
  • compatibility-design.skill.md3.6 KB
  • critical-systems-arch.skill.md2 KB
  • design-patterns.skill.md4.3 KB
  • diagramming.skill.md13.9 KB
  • domain-model.skill.md12.1 KB
  • enterprise-migration-scenario.skill.md2 KB
  • enterprise-patterns.skill.md1.9 KB
  • error-handling-strategy.skill.md3.9 KB
  • event-driven-architecture.skill.md1.8 KB
  • event-governance.skill.md3.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.