skills/modern-web-app-architecture/SKILL.md
Use when designing or building modern web applications in JavaScript/TypeScript (SPA/SSR/SSG/ISR/RSC): architecture trade-offs, state/data patterns, performance, testing, delivery, and team scaling.
npx skillsauth add ratacat/claude-skills modern-web-app-architectureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive guidance for designing and building modern web applications (including SPAs and hybrid rendering apps). This skill emphasizes trade-offs, explicit boundaries, and production-ready practices (performance, accessibility, security, testing, delivery).
Core principle: Everything in architecture is a trade-off. There are no "right" answers, only least-worst combinations for your specific context.
When activated, work in this order:
If the user can’t answer a question, state reasonable assumptions and continue (don’t block).
| Topic | When to Load | |-------|--------------| | @references/design-patterns.md | Implementing JS patterns (Module, Observer, Factory, etc.) | | @references/react-patterns.md | React components, hooks, state, composition | | @references/spa-fundamentals.md | SPA architecture, routing, module organization | | @references/micro-frontends.md | Scaling teams, independent deployments | | @references/performance.md | Bundle size, loading, Core Web Vitals | | @references/architecture-decisions.md | Trade-offs, coupling, fitness functions | | @references/rendering-strategies.md | CSR vs SSR vs SSG vs ISR vs RSC | | @references/state-management.md | Local, global, server state patterns | | @references/security-and-auth.md | Auth choices, token storage, XSS/CSRF, CSP, API boundaries | | @references/accessibility-and-i18n.md | WCAG basics, SPA focus mgmt, inclusive components, i18n pitfalls | | @references/testing-and-quality.md | Testing strategy, CI quality gates, a11y checks, contract tests | | @references/tooling-and-delivery.md | Bundling, environments, deployment, observability, feature flags |
Project Requirements?
├─ SEO critical + dynamic content → SSR (or SSR+streaming)
├─ SEO critical + mostly static → SSG/ISR (or hybrid)
├─ Mostly behind auth + app-like UX → CSR SPA (or hybrid with pre-rendered shell)
├─ Mixed (marketing + app) → Hybrid/Islands (route-level strategy)
│
Team Size?
├─ <5 developers → Modular monolith SPA
├─ 5-15 developers → Well-structured SPA or Service-based
├─ >15 developers, multiple teams → Consider micro-frontends
│
Domain Complexity?
├─ Simple CRUD → Layered architecture
├─ Complex workflows → Domain-partitioned (DDD)
├─ Multiple bounded contexts → Micro-frontends
Depending on the user request, aim to output:
| Pattern | Use When | |---------|----------| | Container/Presentational | Separating data from UI | | Compound Components | Building composable APIs (Select, Menu) | | Hooks | Sharing stateful logic without HOCs | | Provider | Avoiding prop drilling for global data |
| Approach | Use When | |----------|----------| | useState/useReducer | Local component state | | Context | Theme, auth, low-frequency global state | | Zustand/Jotai | Simple global state, minimal boilerplate | | Redux Toolkit | Complex state, time-travel debugging | | React Query/SWR | Server state, caching, background refresh | | XState | Complex flows with explicit state machines |
| Technique | Impact | |-----------|--------| | Code splitting | Reduce initial bundle | | Lazy loading | Defer non-critical | | React.memo | Prevent unnecessary re-renders | | useMemo/useCallback | Stable references | | Virtual lists | Handle large datasets |
| Characteristic | Questions to Ask | |----------------|------------------| | Scalability | How many concurrent users? Growth rate? | | Performance | What's acceptable TTI? LCP target? | | Deployability | How often do you ship? Independent deploys? | | Testability | How easy to verify changes? | | Maintainability | What's the expected lifespan? | | Modularity | How often do requirements change? |
| Anti-pattern | Problem | Fix | |--------------|---------|-----| | Prop drilling | Tight coupling | Context or state management | | God components | Too many responsibilities | Split by concern | | Premature optimization | Complexity without evidence | Profile first | | Shared mutable state | Race conditions, bugs | Immutable patterns | | Monolithic bundle | Slow initial load | Code splitting | | Over-fetching | Wasted bandwidth | GraphQL or BFF | | LocalStorage tokens by default | XSS turns into account takeover | Prefer httpOnly cookies + CSP (see security refs) | | Global store for server data | Cache invalidation pain | Use React Query/SWR for server state |
Budgets must be calibrated to your users/devices, but these are good starting points for a “fast by default” app:
| Metric | Target | Needs Work | |--------|--------|------------| | LCP | <2.5s | 2.5–4s | | INP | <200ms | 200–500ms | | CLS | <0.1 | 0.1–0.25 | | TTFB | <800ms | 800ms–1.8s | | Route JS (initial) | <170KB gzip | <300KB gzip |
Synthesized from:
tools
Build and test iOS apps on simulator using XcodeBuildMCP
development
Produces concise, clear documentation by applying Elements of Style principles. Use when writing or improving any technical documentation (READMEs, guides, API docs, architecture docs). Not for code comments.
testing
Use when user asks to create, write, edit, or test a skill. Also use when documenting reusable techniques, patterns, or workflows for future Claude instances.
testing
Execute work plans efficiently while maintaining quality and finishing features