#601

Global Rank · of 601 Skills

hydration-guardian AI Agent Skill

View Source: oakoss/agent-skills

Safe

Installation

npx skills add oakoss/agent-skills --skill hydration-guardian

49

Installs

Hydration Guardian

Overview

Ensures zero-mismatch integrity between server-rendered HTML and client-side React trees. Covers hydration error diagnosis, selective hydration via Suspense boundaries, deterministic data bridges with the React 19 use() hook, 'use cache' for eliminating data drift, two-pass rendering for client-only content, React 19's single-diff hydration error reporting for pinpointing exact mismatches, and automated validation of rendered DOM state.

When to use: Debugging hydration mismatch errors, fixing text content mismatches, handling browser extension DOM pollution, implementing deterministic data bridges, optimizing SSR/client hydration performance, setting up error monitoring with onRecoverableError.

When NOT to use: Client-only React applications without SSR, static sites without hydration, API-only backends.

Quick Reference

Pattern Approach Key Points
Selective hydration <Suspense fallback={...}> boundary Hydrates independently; prioritizes user interaction
Deterministic bridge use(serverPromise) instead of useEffect Direct server-to-client data transition (React 19)
Cache directive 'use cache' in data fetchers Share exact server result with client during hydration
Two-pass rendering useState + useEffect for client-only First render matches server; second adds client content
Client-only skip next/dynamic with ssr: false Exclude component from server render entirely
Error monitoring onRecoverableError on hydrateRoot Detect and report silent hydration recovery
Error reporting React 19 single-diff error format Pinpoints exact mismatch location with unified diff output
Error callbacks onUncaughtError, onCaughtError Granular error handling on createRoot/hydrateRoot
Date/time safety UTC normalization or server-synced context Prevent locale-dependent hydration mismatches
Extension resilience Test with common browser extensions active Detect DOM pollution from translators, dark-mode tools

Hydration Error Diagnosis

Error Message Likely Cause Corrective Action
Text content did not match Non-deterministic render (dates, random values) Use two-pass rendering or suppressHydrationWarning
Expected server HTML to contain Client renders content server did not Move client-only code to useEffect or dynamic import
Hydration failed Invalid HTML nesting (<p> inside <p>) Fix HTML structure; browsers auto-correct causing drift
Extra attributes from server Server-only attributes not on client Ensure attribute parity or use suppressHydrationWarning
There was an error while hydrating Extension-modified DOM or major mismatch Check for browser extensions; verify HTML validity

Common Mistakes

Mistake Correct Pattern
Using suppressHydrationWarning on container elements Fix the root cause; suppress only on leaf elements with unavoidable differences
Accessing window or document in the render body Wrap client-only code in useEffect or use next/dynamic with ssr: false
Using Math.random() or new Date() without stable seeds Use UTC normalization, server-cached values, or two-pass rendering
Ignoring silent hydration recovery in production Configure onRecoverableError on hydrateRoot to log and monitor
Using dangerouslySetInnerHTML with server/client mismatch Ensure identical content or use a dedicated key change to force remount
Checking typeof window !== 'undefined' in render Use two-pass rendering; the check runs on server too (it returns false)
Nesting <p> inside <p> or <div> inside <p> Fix invalid HTML nesting; browsers correct it causing server/client drift

Delegation

  • Scan rendered pages for hidden hydration warnings: Use Explore agent with Chrome DevTools to run the hydration audit script
  • Fix hydration mismatches across multiple routes: Use Task agent to isolate, correct, and verify each affected component
  • Design hydration-safe architecture for new features: Use Plan agent to select between Suspense boundaries, two-pass rendering, and cache patterns

References

  • Common Mismatches -- causes, diagnosis, and fixes for hydration mismatch errors including dates, locales, HTML nesting, and browser extensions
  • Selective Hydration -- Suspense-based selective hydration, streaming SSR, two-pass rendering, and client-only components
  • Use Cache Patterns -- data drift prevention, Next.js use cache directive, React 19 use() hook, deterministic data bridges
  • Validation Techniques -- automated DOM verification, mutation monitoring, onRecoverableError, and production hydration monitoring

Installs

Installs 49
Global Rank #601 of 601

Security Audit

ath Safe
socket Safe
Alerts: 0 Score: 90
snyk Low
EU EU-Hosted Inference API

Power your AI Agents with the best open-source models.

Drop-in OpenAI-compatible API. No data leaves Europe.

Explore Inference API

GLM

GLM 5

$1.00 / $3.20

per M tokens

Kimi

Kimi K2.5

$0.60 / $2.80

per M tokens

MiniMax

MiniMax M2.5

$0.30 / $1.20

per M tokens

Qwen

Qwen3.5 122B

$0.40 / $3.00

per M tokens

How to use this skill

1

Install hydration-guardian by running npx skills add oakoss/agent-skills --skill hydration-guardian in your project directory. Run the install command above in your project directory. The skill file will be downloaded from GitHub and placed in your project.

2

No configuration needed. Your AI agent (Claude Code, Cursor, Windsurf, etc.) automatically detects installed skills and uses them as context when generating code.

3

The skill enhances your agent's understanding of hydration-guardian, helping it follow established patterns, avoid common mistakes, and produce production-ready output.

What you get

Skills are plain-text instruction files — not executable code. They encode expert knowledge about frameworks, languages, or tools that your AI agent reads to improve its output. This means zero runtime overhead, no dependency conflicts, and full transparency: you can read and review every instruction before installing.

Compatibility

This skill works with any AI coding agent that supports the skills.sh format, including Claude Code (Anthropic), Cursor, Windsurf, Cline, Aider, and other tools that read project-level context files. Skills are framework-agnostic at the transport level — the content inside determines which language or framework it applies to.

Data sourced from the skills.sh registry and GitHub. Install counts and security audits are updated regularly.

EU Made in Europe

Chat with 100+ AI Models in one App.

Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.

Customer Support