Communitygithub.com

curiositech/windags-skills

用於建置內容密集型網站,搭配 Astro 使用,協助在 SSG/SSR/Hybrid 之間做選擇、挑選合適的 client 指令 (idle/visible/load/media)、以類型安全的 schema 結構化內容集合、在同一專案中整合 React/Vue/Solid/Svelte 元件,或從 Next.js 遷移行銷/文件網站時使用。

windags-skills 是什麼?

此技能專注於 Astro 框架的核心優勢——預設輸出靜態 HTML,僅對需要 JavaScript 的互動元件進行選擇性水合(island)。對於行銷網站、部落格、文件入口等內容為主的專案,它能顯著減少用戶端 JavaScript 負擔,相較於 React/Next.js 產出更小的套件。它深入解析 Astro 的關鍵能力,包括內容集合(Content Collections)搭配 Zod Schema 實現型別安全的前置資料驗證、四種 client 水合指令(load/idle/visible/media)的適用時機與取捨、多框架同存(React/Vue/Svelte)的設定方式、以及 Astro 4+ 的伺服器島嶼(Server Islands)與視圖轉場(View Transitions)功能。此外,也涵蓋影像最佳化(@astrojs/image)、MDX 搭配 Astro 元件、以及混合 SSR 模式(output: 'hybrid')的實作。此技能明確指出常見的反模式(如到處使用 client:load、在客戶端元件中抓取資料、未定義架構的前置資料),並提供品質檢查清單,協助開發者避開陷阱。支援平台包括所有 Astro 專案(v3+),特別是內容驅動的靜態或混合渲染網站。它不適合用於需要完整互動性的 SPA 風格應用(應使用 Next.js 或 Remix)、Astro 內部或外掛開發、或非內容型網站。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/astro-islands-architect

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Astro Islands 架構師

Astro 的理念是「預設輸出 HTML,僅對需要 JS 的部分進行水合」。對於行銷網站、文件、以及內容密集型網站,這能產出比 React/Next.js 小得多的套件。整個關鍵在於選擇哪些元件是靜態的,哪些是島嶼。

使用時機

  • 行銷網站、部落格、文件入口——內容即產品。
  • 從一個用戶端 JavaScript 過重的 Next.js 行銷網站遷移。
  • 多框架——在 Vue 或 Svelte 元件旁同時使用 React 元件庫。
  • 搭配 MDX 與型別安全的前置資料進行大量內容編寫。
  • 無需 SPA 即可實現跨頁面視圖轉場。

核心能力

頁面結構

---
// src/pages/blog/[slug].astro — 前置資料在建置/SSR 階段執行
import { getCollection, getEntry } from 'astro:content';
import Layout from '../../layouts/Default.astro';
import Newsletter from '../../components/Newsletter.tsx';

export async function getStaticPaths() {
  const posts = await getCollection('blog');
  return posts.map((p) => ({ params: { slug: p.slug }, props: { post: p } }));
}

const { post } = Astro.props;
const { Content } = await post.render();
---
<Layout title={post.data.title}>
  <h1>{post.data.title}</h1>
  <article><Content /></article>

  {/* 島嶼 — 僅此元件會傳送 JS */}
  <Newsletter client:visible />
</Layout>

--- 分隔線內的程式碼是伺服器端程式碼。在 <...> 中,預設輸出靜態 HTML。帶有 client:* 指令的元件會成為島嶼。

Client 指令——選擇正確的指令

指令水合時機用途
client:load頁面載入時網頁上方互動區域(購物車、搜尋)。
client:idle瀏覽器閒置時非關鍵互動(聊天小工具)。
client:visible滾動到可視區域時網頁下方區域(新聞訂閱、留言)。
client:media="(min-width: 768px)"媒體查詢符合時僅限桌面的小工具。
client:only="react"跳過 SSR;僅用戶端渲染在掛載時需要瀏覽器 API 的元件。

client:idle 是大多數非關鍵島嶼的預設值。client:load 是重武器,請保留使用。

內容集合

// src/content/config.ts
import { defineCollection, z } from 'astro:content';

const blog = defineCollection({
  type: 'content',                    // markdown/MDX 檔案
  schema: z.object({
    title: z.string().max(120),
    description: z.string().max(160),
    date: z.coerce.date(),
    tags: z.array(z.string()).default([]),
    draft: z.boolean().default(false),
    cover: z.object({ src: z.string(), alt: z.string() }).optional(),
  }),
});

export const collections = { blog };

現在 getCollection('blog') 具有完整的型別推斷。前置資料錯誤會在建置階段失敗,而非上線後才出錯。

const posts = (await getCollection('blog'))
  .filter((p) => !p.data.draft)
  .sort((a, b) => +b.data.date - +a.data.date);

多框架

npx astro add react vue svelte
---
import ReactSearch from '../components/Search.tsx';
import VueChart from '../components/Chart.vue';
import SvelteToggle from '../components/Toggle.svelte';
---
<ReactSearch client:idle />
<VueChart client:visible />
<SvelteToggle client:load />

每個框架的執行環境會獨立打包,並且僅在使用了該框架的頁面上載入。對於一個大部分內容都是靜態的文件網站,這可能意味著大部分頁面都不需要傳送任何 React JavaScript。

伺服器島嶼(Astro 4+)

<Layout>
  <Header />
  <PersonalizedRecommendations server:defer>
    <p slot="fallback">正在載入推薦...</p>
  </PersonalizedRecommendations>
  <Footer />
</Layout>

server:defer 會立即渲染頁面的其餘部分,並透過一個單獨的請求串流式傳輸延遲元件的 HTML。對於那些若採用整體 SSR 會強迫整個頁面都進行伺服器渲染的個人化內容非常有用。

影像最佳化

---
import { Image } from 'astro:assets';
import cover from '../assets/cover.jpg';
---
<Image src={cover} alt="封面照片" widths={[400, 800, 1200]} sizes="(max-width: 768px) 400px, 1200px" />

Astro 會產生 srcset,使用 Sharp 進行縮放,並僅傳送所需的圖片。將圖片放在 src/assets/ 下以獲得完整最佳化;public/ 中的圖片則不會被處理。

視圖轉場

---
import { ViewTransitions } from 'astro:transitions';
---
<html>
  <head>
    <ViewTransitions />
  </head>
  ...
</html>
<a href="/about" transition:name="hero">關於</a>

無需 SPA 即可實現跨頁面轉場。瀏覽器負責大部分工作;Astro 則協調元素匹配。

搭配元件的 MDX

---
title: 我的文章
date: 2026-04-30
---

import Callout from '../../components/Callout.astro';

# {frontmatter.title}

<Callout type="warn">
這是伺服器端渲染的警告。沒有 JavaScript。
</Callout>

在 MDX 中匯入的元件會在建置/SSR 階段執行,除非它們是島嶼。

混合 SSR

// astro.config.mjs
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
  output: 'hybrid',
  adapter: cloudflare(),
});
---
// src/pages/api/search.ts — 在邊緣執行

export const prerender = false;

export async function GET({ request }) {
  const url = new URL(request.url);
  const q = url.searchParams.get('q') ?? '';
  const results = await search(q);
  return new Response(JSON.stringify(results), { headers: { 'content-type': 'application/json' } });
}
---

prerender = false 將特定路由設為 SSR;網站其餘部分保持靜態。

反模式

到處使用 client:load

症狀: Lighthouse 的 JavaScript 套件膨脹;Astro 的水合優勢消失。 診斷: 工程師因為 client:load 最熟悉而將其設為預設。 修正: 預設使用 client:idle 或 client:visible。將 client:load 保留給網頁上方的互動元件。

在客戶端元件中抓取資料

症狀: 每個頁面都有載入中的旋轉動畫;SEO 受損。 診斷: 資料抓取移到 React 元件中,而非放在 Astro 的前置資料區域。 修正: 在 --- 分隔線中抓取資料,在伺服器端渲染,然後將資料作為 props 傳遞給島嶼。

未定義型別的前置資料

症狀: 建置成功;但上線後標題顯示 undefined。 診斷: 沒有內容集合架構;前置資料的拼寫錯誤未被發現。 修正: 使用 defineCollection 搭配 zod schema。前置資料錯誤會使建置失敗。

混合使用 public/ 和 src/assets/ 存放圖片

症狀: 部分圖片有最佳化,部分則以原始大小傳送。 診斷: public/ 中的檔案未經處理直接提供;只有 src/assets/ 會經過 Sharp 處理。 修正: 將圖片移到 src/assets/。到處使用 <Image> 元件。public/ 僅用於 OG 圖片和 favicon。

嘗試將 Astro 用於 SPA

症狀: 不斷與水合機制搏鬥;島嶼不斷擴大,直到整個頁面都變成互動式。 診斷: 選錯了框架。Astro 擅長處理內容;SPA 需要 Next/Remix。 修正: 當大部分頁面都是互動式時,選擇 Next/Remix。將 Astro 用於行銷和文件網站。

過度使用 client:only

症狀: 每次頁面載入時發生版面位移(CLS);內容出現前有「閃爍」現象。 診斷: 跳過 SSR 意味著瀏覽器在 JavaScript 執行前看到一個空的佔位符。 修正: 僅在元件真的無法在伺服器端渲染時才使用 client:only。提供一個能近似最終大小的佔位符。

品質檢查清單

  • 預設 client 指令為 client:idle 或 client:visible;client:load 的使用應有正當理由。
  • 所有內容都透過 defineCollection 定義了型別架構。
  • 圖片存放在 src/assets/ 下並使用 <Image> 元件。
  • 僅在元件實際存在時才加入多框架整合(@astrojs/react 等)。
  • 在最慢的代表性頁面上,最大內容繪製(LCP)低於 2 秒。
  • 每個頁面設定了首次載入的 JavaScript 預算;CI 在預算超標時失敗。
  • MDX 的靜態部分使用 Astro 元件;僅在需要互動的地方使用島嶼。
  • 已在主要導覽路徑上測試過視圖轉場功能。

不適用於

  • 完整 SPA — Next.js, Remix, TanStack Start 更適合。
  • Astro 外掛/整合開發 — 獨立技能(目前尚無專屬技能)。
  • Vite 建置調校 — Astro 底層使用 Vite。→ 套件大小、HMR、外掛生命週期問題請參考 vite-build-optimizer。
  • 重度客戶端狀態應用(儀表板、即時工具)— JavaScript 太多,島嶼效益有限。
  • 原生行動應用 — Astro 僅限於網頁。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

curiositech/windags-skills

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

curiositech/windags-skills

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

curiositech/windags-skills

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

curiositech/windags-skills

Implement WCAG 2.2 AA/AAA compliance with automated testing, keyboard navigation, screen reader support, and focus management. Activate on: accessibility audit, WCAG compliance, keyboard navigation, screen reader, aria attributes, axe-core, focus trap. NOT for: design-level accessibility review (use design-accessibility-auditor), color contrast only (use css-in-js-architect).

curiositech/windags-skills

Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that actually work for neurodivergent minds.

curiositech/windags-skills

Designs digital experiences for ADHD brains using neuroscience research and UX principles. Expert in reducing cognitive load, time blindness solutions, dopamine-driven engagement, and compassionate design patterns. Activate on 'ADHD design', 'cognitive load', 'accessibility', 'neurodivergent UX', 'time blindness', 'dopamine-driven', 'executive function'. NOT for general accessibility (WCAG only), neurotypical UX design, or simple UI styling without ADHD context.

curiositech/windags-skills

>- Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

curiositech/windags-skills

Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development, analytics, user management, and internal tooling.

curiositech/windags-skills

Conversation patterns and interaction protocols for multi-agent systems. Covers request/response, pub/sub, blackboard, delegation chains, debate, critique, consensus, fan-out/fan-in, supervisor-worker, and peer negotiation. Deep analysis of AutoGen conversation patterns, CrewAI delegation, LangGraph state passing, and FIPA-ACL performatives. Teaches how to design what agents say to each other and in what order. Activate on: "agent conversation", "agent protocol", "multi-agent debate", "agent delegation", "supervisor worker pattern", "agent voting", "consensus protocol", "fan-out fan-in", "agent negotiation", "blackboard pattern", "agent dialogue", "conversation topology", "agent handoff". NOT for: wire format or serialization (use agent-interchange-formats), orchestration infrastructure (use agentic-infrastructure-2026), single agent behavior (use agentic-patterns).

curiositech/windags-skills

Meta-agent for creating new custom agents, skills, and MCP integrations. Expert in agent design, MCP development, skill architecture, and rapid prototyping. Activate on 'create agent', 'new skill', 'MCP server', 'custom tool', 'agent design'. NOT for using existing agents (invoke them directly), general coding (use language-specific skills), or infrastructure setup (use deployment-engineer).

curiositech/windags-skills

AI-powered calendar management and agent-based scheduling coordination. Covers calendar APIs (Google Calendar, CalDAV/iCal), AI scheduling assistants (Reclaim, Clockwise, Motion, Cal.com), building custom calendar agents with MCP, multi-calendar merging, timezone management, focus block protection, meeting fatigue detection, and agent-to-agent meeting negotiation protocols. Activate on: "calendar agent", "AI scheduling", "calendar coordination", "meeting scheduling", "calendar API", "focus time protection", "calendar optimization", "Google Calendar MCP", "Reclaim", "Clockwise", "Motion", "Cal.com", "smart scheduling", "calendar-aware agent", "timezone scheduling", "agent negotiation meetings". NOT for: manual calendar UI component design (use form-validation-architect), project management scheduling or Gantt charts (use project-management-guru-adhd), general time-tracking or pomodoro apps (use adhd-daily-planner for time-awareness), building the agent itself from scratch (use agent-creator).

curiositech/windags-skills

Build and adopt production AI agent infrastructure in 2026. Covers framework selection (LangGraph, CrewAI, AutoGen, MCP), orchestration patterns, evaluation, observability, memory systems, and tool use. Also covers the SOCIAL dimension: how to sell agent infrastructure internally, change management, measuring ROI, building trust in autonomous systems, and scaling adoption across teams. Activate on: "agent infrastructure", "agent framework comparison", "which agent framework", "sell AI tools internally", "agent adoption", "agent observability", "agent evaluation", "MCP architecture", "agentic mesh", "enterprise AI agents", "AI change management", "agent ROI". NOT for: building specific agents (use ai-engineer), designing agent behavior patterns (use agentic-patterns), prompt tuning (use prompt-engineer).

curiositech/windags-skills

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use windags-architect), specific tool implementation.

curiositech/windags-skills

Automated discovery and matching of agent skills for dynamic task routing and capability assessment

curiositech/windags-skills

Cryptographic security for agentic systems — zero-trust agent networking, signed message envelopes (JWS/JWE), capability-based security (ocaps), Merkle tree audit trails, WASM sandboxing, and formal verification. Covers CLI dev tool security, mTLS between agents, permission boundaries (least privilege for AI agents), and supply chain security for skills/plugins. Activate on: "agent security", "zero trust agents", "secure agent communication", "capability-based security", "ocap", "signed messages between agents", "agent audit trail", "sandbox agent execution", "agent permissions", "mTLS agents", "cryptographic verification", "agent supply chain", "OWASP agentic", "prove agent did X", "tamper-proof agent logs". NOT for: application-level SAST scanning (use security-auditor), network firewall rules (use infrastructure), SOC2/HIPAA compliance (organizational), or prompt injection defense (use prompt-engineer).

curiositech/windags-skills

Data structures and serialization formats for agent-to-agent communication. Covers message envelopes, structured output schemas, capability declarations, task handoff payloads, error/retry signaling, and context windows as data structures. Deep comparison of A2A protocol, MCP, OpenAI function calling, and LangChain message types. Teaches when to use rigid schemas vs free-form with validation, typed vs untyped, streaming vs batch. Activate on: "agent message format", "agent communication schema", "agent-to-agent protocol", "A2A protocol", "MCP message format", "structured output for agents", "agent interop", "interchange format", "agent serialization", "task handoff format", "capability declaration". NOT for: what agents say to each other (use agent-conversation-protocols), orchestration topology (use multi-agent-coordination), building agent infrastructure (use agentic-infrastructure-2026).

curiositech/windags-skills

Logic-based agent programming language implementing BDI architecture for practical autonomous agent development

curiositech/windags-skills

>- Design AgentSpeak(L)-style BDI agents with context-guarded plans, selection functions, and intention stacks. Use for interruptible autonomy, agent policy, and multi-agent orchestration in dynamic environments. NOT for simple rule engines, static planners, or centralized workflows.

curiositech/windags-skills

Foundational concurrent computation model where actors communicate exclusively through asynchronous message passing

curiositech/windags-skills

license: Apache-2.0 NOT for unrelated tasks outside this domain.

相關技能