Communitygithub.com

coastdigitalgroup/coastai-skills

設計並實施一個系統化的頁內導覽框架,透過滾動同步的錨點連結,幫助使用者在長內容中定位,並直接存取文件章節。

coastai-skills 是什麼?

這項技能「目錄(Table of Contents)系統」提供了一套系統化方法,用於設計反映單一頁面或文件結構的頁內導覽選單。其核心目標是解決長內容中的「滾動疲勞」問題,透過提供持續可見的頁面階層地圖,讓使用者在不迷失位置的情況下,了解當前閱讀脈絡並能即時跳轉至特定章節。技能支援各種平台,包括文件與技術指南、長篇文章與部落格、複雜著陸頁、法律與政策頁面,以及資源中心等。其運作流程包含稽核文件大綱、選擇版面配置模式(如持續側邊欄、內嵌摘要或浮動工具列)、利用縮排與字體變化建立視覺階層、設計滾動監聽(scroll-spy)的「活動」狀態,以及規劃回應式導航方案(如行動版抽屜)。同時,它明確指出不適用情境,例如內容短於三個章節、作為主要網站導覽,或線性精靈流程。技能也強調重要的決策規則,例如最多顯示三層階層、使用縮排而非圖示來表示層級、一次僅一個項目處於活動狀態,以及點擊連結必須平滑滾動並更新 URL 雜湊。此外,它還包含嚴格的無障礙(ARIA 標籤和 aria-current)和對比度(WCAG AA)限制,以及常見失敗模式(如過時狀態、內容遮擋、深度過載)與驗證標準的詳細清單。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/coastdigitalgroup/coastai-skills/tree/HEAD/website-design/table-of-contents-system

在你喜歡的 AI 中提問

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

說明文件

目錄(Table of Contents)系統

目的

目錄(Table of Contents)系統提供了一套方法論,用於設計反映單一頁面或文件結構的頁內導覽選單。它透過提供持續可見的頁面階層地圖,解決長內容中的「滾動疲勞」問題,讓使用者能夠了解當前閱讀脈絡,並在不迷失位置的情況下,直接跳轉到特定章節。

使用案例

  • 文件與技術指南: 導覽標題與子標題的深層階層結構。
  • 長篇文章與部落格: 為超過 2000 字的編輯內容提供閱讀藍圖。
  • 複雜著陸頁: 幫助使用者在「功能」、「定價」與「常見問題」章節之間跳轉。
  • 法律與政策頁面: 導覽密集的條文與編號章節。
  • 資源中心: 在單一頁面上組織長串的連結或工具清單。

何時不應使用

  • 短內容(少於 3 個章節): 如果整個頁面可以在兩次滾動內瀏覽完畢,目錄只會增加不必要的視覺干擾。
  • 主要網站導覽: 請勿使用目錄來在不同頁面之間移動,應改為使用 site-navigation-system。
  • 線性精靈: 對於使用者必須遵循固定順序的逐步流程,請使用 step-progress-system。
  • 極簡行銷: 當目標是單一、不間斷的敘事流程,不希望有任何岔路時。

輸入

  1. 標題階層: 頁面上 <h2> 到 <h4> 標籤的對應圖。
  2. 版面配置脈絡: 可用的水平空間(側邊欄 vs. 行內)。
  3. 滾動容器: 滾動是發生在主體(body)上,還是一個特定的溢出容器?
  4. 品牌符號: 來自設計系統的間距、字體與「活動」狀態顏色。

輸出

  1. 目錄結構規格: 清單項目、縮排層級和「活動」指示器的視覺定義。
  2. 滾動監聽藍圖: 當使用者滾動時,「活動」狀態如何更新的邏輯。
  3. 回應式適配圖: 目錄如何從桌面版的側邊欄轉換為行動版的輔助功能(例如,黏性標頭或底部抽屜)。
  4. 路徑指引規格: 平滑滾動行為與焦點管理的定義。

工作流程

1. 稽核文件大綱

提取標題結構。一個乾淨的目錄取決於邏輯清晰的 h1 -> h2 -> h3 層級。

  • 主要層級: 通常從 <h2> 標籤衍生。
  • 次要層級: 從 <h3> 標籤衍生(縮排)。
  • 第三層級: 除非文件特別密集,否則很少顯示在目錄中;考慮預設將其折疊。

2. 選擇版面配置模式

根據頁面配置選擇空間排列方式:

  • 持續側邊欄(右/左): 最適合寬螢幕(桌面版)。讓路徑地圖始終可見。
  • 內嵌摘要: 放置在文章頂部。最適合行動版或中等長度的內容,無需「黏性」。
  • 黏性標頭/浮動工具列: 一個精簡版,僅在滾動過主視覺區後才出現。

3. 建立視覺階層(層級)

套用 visual-hierarchy-system 來指示深度:

  • 縮排: 使用一致的水平內距(例如,每層 --space-s)來顯示父子關係。
  • 排版: 與主要層級(h2)相比,子層級(h3)使用較小的字體大小或較柔和的顏色。
  • 指示器: 在清單的左/右側使用垂直「進度線」,以視覺方式連接各項目。

4. 設計滾動監聽(活動)狀態

目錄必須與使用者的視埠保持同步:

  • 活動連結: 突顯與目前位於視埠頂部的章節相對應的連結。
  • 「活動線」效果: 如果使用垂直線,為標記製作動畫,使其滑動到活動項目的位置。
  • 回饋延遲: 確保活動狀態快速更新(<100ms),但包含一個小緩衝,以防止在標題之間滾動時閃爍。

5. 規劃回應式路徑指引

側邊欄在行動版上通常會消失,請提供替代方案:

  • 行動版目錄觸發器: 一個位於螢幕頂部或底部的黏性按鈕(例如「本節內容」),點擊後會開啟一個抽屜。
  • 漸進式揭露: 在黏性工具列中僅顯示當前的 <h2>,並附帶一個箭頭圖示以展開完整清單。

決策規則

  • 「三層」限制: 目錄中最多只顯示 3 層深度。如果內容更深,請簡化目錄,僅專注於 h2 和 h3。
  • 縮排優於圖示: 使用縮排而非項目符號或圖示來顯示階層,因為後者可能會使密集的文字清單變得雜亂。
  • 活動狀態唯一性: 目錄中一次只能有一個項目處於「活動」狀態。
  • 黏性觸發門檻: 僅在目錄到達視埠頂部時才應變為黏性(固定),而不是在頁面載入時立即觸發。
  • 點擊跳轉: 點擊目錄連結必須使用「平滑滾動」以防止迷失方向,並且必須更新 URL 雜湊(#section-id)以方便分享。

限制條件

  • 無障礙: 目錄必須包覆在一個 aria-label="Table of contents" 的 <nav> 元素中。活動連結必須使用 aria-current="true"(或 aria-current="location")。確保使用 Tab 鍵瀏覽連結時,焦點環(focus ring)是可見的。
  • 對比度: 活動與非活動狀態必須符合 WCAG AA(4.5:1)的要求。
  • 回應式: 在行動版上,目錄不得與主要文字內容重疊;應使用抽屜或可切換的區塊。
  • 內容同步: 目錄中的連結文字應與標題文字完全一致(或是一個清晰可辨識的縮短版本)。

常見失敗模式

  • 「過時」狀態: 因滾動監聽的觸發點設定過高或過低,導致目錄突顯了錯誤的章節。
  • 「內容遮擋」問題: 一個黏性目錄遮擋了它本應幫助使用者閱讀的文字。
  • 深度過載: 顯示每一個 h4 和 h5,使得目錄比視埠還長,需要自己的滾動條(避免巢狀滾動條)。
  • 缺少 ID: 由於標題缺乏對應的 id 屬性,導致連結無法運作。
  • 「返回」按鈕失效: 跳轉到章節時未更新 URL 雜湊,導致使用者無法使用瀏覽器的「返回」按鈕回到目錄。

驗證標準

  • h2 和 h3 層級之間存在清晰的視覺階層(縮排)。
  • 使用者滾動時,滾動監聽功能能正確突顯活動中的章節。
  • 點擊連結會觸發平滑滾動至正確的章節。
  • 點擊目錄連結後,URL 雜湊已更新。
  • 目錄被包覆在一個 <nav aria-label="Table of contents"> 的地標(landmark)中。
  • 活動狀態可透過 aria-current 屬性存取。
  • 已定義行動版專屬的路徑指引模式(例如,抽屜或黏性工具列)。
  • 顯示的階層層級不超過 3 層。

Individual skills in this repo

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

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for progressive disclosure using accordions, ensuring structural integrity, visual affordances, and accessibility across different content densities and devices.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for long-form content, managing readability, vertical rhythm, and information density to ensure a superior reading experience.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for informational elements that communicate state (Badges) and categorization (Tags) with clarity and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for non-overlay notifications, managing global announcements and contextual inline alerts to communicate system states without interrupting the user's flow.

coastdigitalgroup/coastai-skills

Design and implement a systematic, asymmetrical bento-grid layout framework to organize diverse content types cohesively while maintaining strict visual hierarchy, logical focus order, and responsive flexibility.

coastdigitalgroup/coastai-skills

Design a responsive, mobile-first bottom navigation bar and persistent action dock system for mobile websites and web applications, establishing spatial anchors, tab bar anatomy, badge indicators, thumb-zone ergonomics, safe area inset handling, active/inactive state contrast, and desktop responsive adaptation rules.

coastdigitalgroup/coastai-skills

Design a mobile-first bottom sheet overlay system with configurable detents, drag affordances, safe area padding, responsive desktop modal/popover adaptation, and WCAG AA accessibility compliance.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for secondary navigation trails that provide orientation, context, and one-click access to parent levels in deep information architectures.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for buttons and interactive triggers, managing visual hierarchy, variant logic, and action grouping to ensure clear intent and accessible interaction.

coastdigitalgroup/coastai-skills

Design a systematic framework for date and time selection, managing calendar grids, range pickers, and scheduling interfaces to ensure precision and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for modular content containers that maintain hierarchy, structural integrity, and action alignment across variable content and responsive viewports.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for horizontal discovery components, managing navigation affordances, scroll behavior, and accessibility to ensure effective content density without compromising usability.

coastdigitalgroup/coastai-skills

Design a systematic, highly accessible, and developer-friendly UI layout framework for code blocks, snippet showcases, multi-file code tabs, line-highlighting, diff views, and syntax token contrast in technical documentation and developer platforms.

coastdigitalgroup/coastai-skills

Design a systematic framework for global command menus (Cmd+K panels) that combines keyboard-driven navigation, command execution, and shortcut discovery into an accessible, responsive overlay.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for threaded conversations, managing nesting depths, action hierarchies, and community signaling to foster engagement and readability.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for side-by-side comparison interfaces, managing high attribute density and responsive complexity to support informed decision-making.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for user privacy, managing consent banners, preference centers, and persistent privacy controls to balance legal compliance with user trust.

coastdigitalgroup/coastai-skills

Design and implement a systematic, highly accessible, and responsive visual layout framework for conversational chat widgets, live chat boxes, and chatbot panels that ensures clear message scannability, native focus flow, and seamless mobile keyboard adaptation.

coastdigitalgroup/coastai-skills

Design a systematic, accessible, and high-conversion framework for custom select dropdowns and comboboxes, defining anatomy, states, search-filtering, and responsive mobile-adaptive patterns.

coastdigitalgroup/coastai-skills

Design and implement a systematic color palette that ensures WCAG 2.2 accessibility compliance. Trigger this skill when asked to define brand colors, create UI themes, or establish a visual system for a website.

相關技能