Agent skill
solidstart-client-only
SolidStart clientOnly: render components/pages exclusively on client, bypass SSR for browser APIs (window, document), dynamic imports with fallbacks.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/solidstart-client-only
Metadata
Additional technical details for this skill
- globs
-
[ "src/routes/**/*" ]
SKILL.md
SolidStart clientOnly
The clientOnly function renders components or pages exclusively on the client side, bypassing SSR.
Component Usage
- Create separate file for client-only component:
// ClientOnlyComponent.tsx
export default function ClientOnlyComponent() {
const location = document.location.href;
return <div>Current URL: {location}</div>;
}
- Import with
clientOnly:
import { clientOnly } from "@solidjs/start";
const ClientOnlyComp = clientOnly(() => import("./ClientOnlyComponent"));
export default function IsomorphicComponent() {
return <ClientOnlyComp />;
}
- Optional fallback:
<ClientOnlyComp fallback={<div>Loading...</div>} />
Page-Level Usage
Disable SSR for entire page:
// routes/page.tsx
import { clientOnly } from "@solidjs/start";
export default clientOnly(async () => ({ default: Page }), { lazy: true });
function Page() {
// This code runs only on client
return <div>Client-only page content</div>;
}
Parameters
fn: () => Promise<{ default: () => JSX.Element }>
- Function that dynamically imports component
options: { lazy?: boolean }
lazy: true(default) - Lazy load componentlazy: false- Eager loading
props: Record<string, any> & { fallback?: JSX.Element }
- Props passed to component
- Optional
fallbackfor loading state
Use Cases
- Browser APIs (
window,document,localStorage) - Third-party widgets (maps, charts)
- DOM manipulation
- Avoiding SSR hydration issues
- Code that can't run on server
Best Practices
- Isolate client-only logic in separate files
- Provide meaningful fallbacks for loading states
- Use sparingly - prefer SSR when possible
- Consider progressive enhancement where possible
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?