qwik
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "qwik" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c07620e767c1af9185fe409c0d9c41bfeeb4ce0fa949794c1b765b60ecf2458f. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Qwik: A resumable web framework that achieves instant loading by eliminating hydration. It serializes application state on the server and lazily loads JavaScript on interaction, making it well suited for edge deployment to enable fast initial loads and on-demand interactivity.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Qwik eliminates hydration by serializing the application state into HTML. JavaScript loads lazily on user interaction, not on page load. This means near-zero JS on initial load regardless of app complexity.
- Testing
- Not tested
Browse files
Frontmatter
name: qwik
description: |
Qwik is a resumable web framework that delivers instant-loading applications by
eliminating hydration. It serializes application state on the server and lazily
loads JavaScript on interaction, making it ideal for edge deployment.
license: Apache-2.0
compatibility: 'node >= 18, npm or yarn or pnpm'
metadata:
author: terminal-skills
version: 1.0.0
category: development
tags:
- typescript
- frontend
- ssr
- resumable
- edge
- performanceQwik
Qwik eliminates hydration by serializing the application state into HTML. JavaScript loads lazily on user interaction, not on page load. This means near-zero JS on initial load regardless of app complexity.
Installation
# Create Qwik project with Qwik City (meta-framework)
npm create qwik@latest
cd my-app
npm install
npm run dev
Project Structure
# Qwik City project layout
src/
├── entry.ssr.tsx # SSR entry
├── root.tsx # Root component
├── global.css
├── routes/ # File-based routing
│ ├── layout.tsx # Root layout
│ ├── index.tsx # / page
│ └── articles/
│ ├── index.tsx # /articles
│ └── [slug]/
│ └── index.tsx # /articles/:slug
├── components/ # Reusable components
│ └── article-card/
│ └── article-card.tsx
└── lib/ # Utilities
Components
// src/components/article-card/article-card.tsx — Qwik component
import { component$ } from '@builder.io/qwik';
import { Link } from '@builder.io/qwik-city';
interface Props {
title: string;
slug: string;
excerpt: string;
}
export const ArticleCard = component$<Props>((props) => {
return (
<article>
<Link href={`/articles/${props.slug}`}>
<h2>{props.title}</h2>
</Link>
<p>{props.excerpt}</p>
</article>
);
});
Signals and State
// src/routes/counter/index.tsx — signals and reactivity
import { component$, useSignal, useComputed$, useTask$ } from '@builder.io/qwik';
export default component$(() => {
const count = useSignal(0);
const doubled = useComputed$(() => count.value * 2);
useTask$(({ track }) => {
track(() => count.value);
console.log(`Count changed to ${count.value}`);
});
return (
<div>
<p>Count: {count.value} (doubled: {doubled.value})</p>
<button onClick$={() => count.value++}>+1</button>
</div>
);
});
Data Loading with routeLoader$
// src/routes/articles/index.tsx — server-side data loading
import { component$ } from '@builder.io/qwik';
import { routeLoader$ } from '@builder.io/qwik-city';
import { ArticleCard } from '~/components/article-card/article-card';
export const useArticles = routeLoader$(async ({ env }) => {
const res = await fetch(`${env.get('API_URL')}/articles`);
return res.json() as Promise<Article[]>;
});
export default component$(() => {
const articles = useArticles();
return (
<div>
<h1>Articles</h1>
{articles.value.map((article) => (
<ArticleCard key={article.id} title={article.title} slug={article.slug} excerpt={article.excerpt} />
))}
</div>
);
});
Server Actions
// src/routes/articles/new/index.tsx — form with server action
import { component$ } from '@builder.io/qwik';
import { routeAction$, Form, zod$, z } from '@builder.io/qwik-city';
export const useCreateArticle = routeAction$(
async (data, { redirect, env }) => {
const res = await fetch(`${env.get('API_URL')}/articles`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
if (!res.ok) return { success: false, error: 'Failed to create' };
throw redirect(302, '/articles');
},
zod$({
title: z.string().min(1).max(200),
body: z.string().min(1),
})
);
export default component$(() => {
const action = useCreateArticle();
return (
<Form action={action}>
<input name="title" placeholder="Title" required />
<textarea name="body" placeholder="Body" required />
<button type="submit">Create</button>
{action.value?.error && <p>{action.value.error}</p>}
</Form>
);
});
Layouts
// src/routes/layout.tsx — root layout
import { component$, Slot } from '@builder.io/qwik';
import { Link } from '@builder.io/qwik-city';
export default component$(() => {
return (
<div>
<header>
<nav>
<Link href="/">Home</Link>
<Link href="/articles">Articles</Link>
</nav>
</header>
<main>
<Slot />
</main>
</div>
);
});
Middleware
// src/routes/admin/layout.tsx — auth middleware via onRequest
import { type RequestHandler } from '@builder.io/qwik-city';
export const onRequest: RequestHandler = async ({ cookie, redirect }) => {
const token = cookie.get('session')?.value;
if (!token) throw redirect(302, '/login');
};
useStore for Complex State
// src/routes/dashboard/index.tsx — store for nested reactive state
import { component$, useStore, $ } from '@builder.io/qwik';
export default component$(() => {
const state = useStore({
articles: [] as Article[],
filter: '',
loading: false,
});
const fetchArticles = $(async () => {
state.loading = true;
const res = await fetch('/api/articles');
state.articles = await res.json();
state.loading = false;
});
return (
<div>
<button onClick$={fetchArticles}>Load</button>
<input bind:value={state.filter} placeholder="Filter..." />
{state.loading ? <p>Loading...</p> : (
state.articles
.filter((a) => a.title.includes(state.filter))
.map((a) => <div key={a.id}>{a.title}</div>)
)}
</div>
);
});
Deployment
# Add deployment adapter
npm run qwik add cloudflare-pages # or: vercel, netlify, node-server, deno
npm run build
npm run deploy
Key Patterns
- Use
$suffix on functions (onClick$,component$,routeLoader$) — it marks serialization boundaries - Use
useSignalfor primitives,useStorefor objects — similar to Solid's signal/store split routeLoader$runs on the server during SSR — data is serialized into HTMLrouteAction$handles form submissions server-side with Zod validation- JavaScript loads lazily per interaction — no hydration step
- Use
onRequesthandlers in layouts for server-side middleware (auth, redirects) - Deploy anywhere: Cloudflare, Vercel, Netlify, Deno, Node — via adapters
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 Qwik 框架的完整开发指南,涵盖从安装到部署的全流程
- 包含丰富的代码示例,覆盖组件、状态管理、数据加载、服务端操作等核心功能
Highlights
- description 准确描述了 Qwik 的核心特性:可恢复、消除水合、边缘部署
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档未明确说明适用场景和使用时机
Recommendation: 建议添加 When to Use 章节,说明 Qwik 适合哪些类型的项目和应用场景
-
缺少端到端完整示例 Reported severity: Minor
虽然各部分有代码示例,但缺少一个完整的端到端项目示例
Recommendation: 建议添加一个完整的项目示例,展示从创建项目到部署的完整流程
Highlights
- 文档结构清晰,分章节详细,每部分均有代码示例
- frontmatter 完整,包含必要的元数据信息
Highlights
- 所有代码示例语法正确,工具来源明确
- 部署命令清晰,覆盖了主流部署平台
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 32
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.