docusaurus

Docusaurus 专家:用于构建文档网站的工具。适用于创建文档站点、开发者门户、API 文档、知识库、版本化文档、带搜索的静态文档站点和旁边的博客,涵盖项目初始化、文档结构、版本管理、自定义页面、博客、Algolia 搜索、MDX 组件与部署等内容以及从 GitBook 或 ReadTheDocs 迁移的场景。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "docusaurus":https://skillpi.com/zh/skills/deepskill-9b253199e68c37c14ceff0175bd7670ac2882d727f9c42c89a0c47bb492a7573。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

Docusaurus 专家:用于构建文档网站的工具。适用于创建文档站点、开发者门户、API 文档、知识库、版本化文档、带搜索的静态文档站点和旁边的博客,涵盖项目初始化、文档结构、版本管理、自定义页面、博客、Algolia 搜索、MDX 组件与部署等内容以及从 GitBook 或 ReadTheDocs 迁移的场景。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

软件、账号及付费要求
贝什
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: docusaurus
description: >-
  Build documentation websites with Docusaurus. Use when a user asks to create
  a documentation site, build a developer portal, set up API docs, create a
  knowledge base, add versioned documentation, build a static docs site with
  search, create a blog alongside docs, or migrate from GitBook or ReadTheDocs.
  Covers project setup, docs structure, versioning, custom pages, blog,
  Algolia search, MDX components, and deployment.
license: Apache-2.0
compatibility: 'Node.js 18+ (any hosting platform)'
metadata:
  author: terminal-skills
  version: 1.0.0
  category: development
  tags:
    - docusaurus
    - documentation
    - docs
    - static-site
    - mdx
    - technical-writing

Docusaurus

Overview

Docusaurus is a static site generator built by Meta specifically for documentation websites. It provides document versioning, sidebar navigation, full-text search (via Algolia), MDX support (React components in Markdown), i18n, and a blog — all out of the box. Used by React, Babel, Jest, Prettier, and hundreds of open-source projects for their documentation.

Instructions

Step 1: Project Setup

# Create new Docusaurus project
npx create-docusaurus@latest my-docs classic

cd my-docs

# Start development server
npm start
# Opens http://localhost:3000

# Build for production
npm run build

# Project structure:
# docs/          — documentation pages (Markdown/MDX)
# blog/          — blog posts
# src/pages/     — custom React pages
# src/css/       — custom styles
# static/        — static assets (images, files)
# docusaurus.config.js — main configuration
# sidebars.js    — sidebar navigation structure

Step 2: Write Documentation

---
id: getting-started
title: Getting Started
sidebar_position: 1
description: Quick start guide for installing and configuring the SDK
tags: [quickstart, installation]
---

# Getting Started

Install the SDK via npm:

```bash
npm install @mycompany/sdk

Configuration

Create a config file in your project root:

// sdk.config.js — SDK configuration
export default {
  apiKey: process.env.SDK_API_KEY,
  region: 'us-east-1',
}

:::tip You can also set configuration via environment variables. :::

:::warning Never commit your API key to version control. :::

:::info For a complete list of options, see the Configuration Reference. :::


### Step 3: Configure Sidebar Navigation

```javascript
// sidebars.js — Define the documentation sidebar structure
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
  docs: [
    'intro',
    {
      type: 'category',
      label: 'Getting Started',
      items: ['getting-started', 'installation', 'configuration'],
      collapsed: false,
    },
    {
      type: 'category',
      label: 'Guides',
      items: [
        'guides/authentication',
        'guides/data-fetching',
        'guides/error-handling',
        'guides/deployment',
      ],
    },
    {
      type: 'category',
      label: 'API Reference',
      items: ['api/client', 'api/hooks', 'api/utilities'],
    },
  ],
}

module.exports = sidebars

Step 4: Site Configuration

// docusaurus.config.js — Main site configuration
/** @type {import('@docusaurus/types').Config} */
const config = {
  title: 'My SDK Documentation',
  tagline: 'Build amazing things with our SDK',
  url: 'https://docs.mycompany.com',
  baseUrl: '/',
  onBrokenLinks: 'throw',
  onBrokenMarkdownLinks: 'warn',

  i18n: { defaultLocale: 'en', locales: ['en'] },

  presets: [
    ['classic', {
      docs: {
        sidebarPath: './sidebars.js',
        editUrl: 'https://github.com/mycompany/docs/tree/main/',
        showLastUpdateTime: true,
        showLastUpdateAuthor: true,
      },
      blog: {
        showReadingTime: true,
        blogSidebarCount: 10,
      },
      theme: { customCss: './src/css/custom.css' },
    }],
  ],

  themeConfig: {
    navbar: {
      title: 'My SDK',
      logo: { alt: 'Logo', src: 'img/logo.svg' },
      items: [
        { type: 'docSidebar', sidebarId: 'docs', position: 'left', label: 'Docs' },
        { to: '/blog', label: 'Blog', position: 'left' },
        { type: 'docsVersionDropdown', position: 'right' },
        { href: 'https://github.com/mycompany/sdk', label: 'GitHub', position: 'right' },
      ],
    },
    footer: {
      style: 'dark',
      links: [
        { title: 'Docs', items: [{ label: 'Getting Started', to: '/docs/getting-started' }] },
        { title: 'Community', items: [{ label: 'Discord', href: 'https://discord.gg/...' }] },
      ],
    },
    algolia: {
      appId: 'YOUR_ALGOLIA_APP_ID',
      apiKey: 'YOUR_ALGOLIA_SEARCH_KEY',
      indexName: 'my-docs',
    },
  },
}

module.exports = config

Step 5: Document Versioning

# Create a new version snapshot (freezes current docs/)
npm run docusaurus docs:version 1.0

# Directory structure after versioning:
# docs/                       — "next" (unreleased) docs
# versioned_docs/version-1.0/ — frozen v1.0 docs
# versioned_sidebars/         — frozen v1.0 sidebars

# Create another version
npm run docusaurus docs:version 2.0
# Users can switch between versions via the dropdown

Step 6: MDX Components

---
title: Interactive Examples
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

# Installation

<Tabs>
  <TabItem value="npm" label="npm" default>
    ```bash
    npm install @mycompany/sdk

</TabItem> <TabItem value="yarn" label="yarn">

    yarn add @mycompany/sdk

</TabItem> <TabItem value="pnpm" label="pnpm">

    pnpm add @mycompany/sdk

</TabItem> </Tabs>

Custom Components

export const Highlight = ({children, color}) => ( <span style={{ backgroundColor: color, padding: '4px 8px', borderRadius: '4px', color: '#fff' }}> {children} </span> )

Status: <Highlight color="#25c2a0">Stable</Highlight> <Highlight color="#1877F2">v2.0+</Highlight>


### Step 7: Deploy

```bash
# Build static site
npm run build
# Output in build/ — deploy anywhere (Vercel, Netlify, GitHub Pages, S3)

# GitHub Pages deployment
GIT_USER=mycompany npm run deploy

# Vercel — just connect the repo, it auto-detects Docusaurus
# Netlify — build command: npm run build, publish directory: build

Examples

Example 1: Create documentation for an open-source library

User prompt: "Set up a documentation site for my npm package. I need a getting started guide, API reference, versioned docs, and a blog for release notes."

The agent will:

  1. Scaffold a Docusaurus project with the classic preset.
  2. Create the docs structure: intro, getting-started, guides/, api/.
  3. Set up sidebars with logical grouping.
  4. Add versioning for v1.0.
  5. Configure Algolia DocSearch for full-text search.
  6. Add GitHub Pages deployment to CI.

Example 2: Build an internal developer portal

User prompt: "We have 5 microservices. Build a single docs site that documents all of them with separate sections, shared architecture diagrams, and an internal blog."

The agent will:

  1. Create a multi-instance docs setup (one docs folder per service).
  2. Add a shared architecture section with embedded diagrams (Mermaid).
  3. Configure internal blog for architecture decisions and RFCs.
  4. Deploy behind VPN/auth for internal access only.

Guidelines

  • Use the classic preset for most documentation sites — it includes docs, blog, pages, and search out of the box.
  • Structure docs in a flat hierarchy when possible — deeply nested sidebars are hard to navigate. 2-3 levels max.
  • Enable showLastUpdateTime and showLastUpdateAuthor — it builds trust with readers and helps identify stale docs.
  • Set onBrokenLinks: 'throw' to catch broken internal links during build. This prevents deploying docs with dead links.
  • Use MDX sparingly — most docs should be plain Markdown for contributor accessibility. Save MDX for interactive examples and complex layouts.
  • Apply for Algolia DocSearch (free for open-source) for production search. For internal docs, use the local search plugin.

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • Docusaurus 是 Meta 开发的静态站点生成器,广泛用于开源项目文档,Skill 提供了完整的项目搭建、配置、版本管理、部署等端到端指导
  • 涵盖项目初始化、文档结构、版本管理、自定义页面、博客、Algolia 搜索、MDX 组件以及部署等内容,适用于大量实际场景
触发精准90/100

亮点

  • 触发词精准完整,覆盖多种变体,边界清晰,包括创建文档站点、构建开发者门户、设置 API 文档、创建知识库、添加版本化文档、构建带搜索功能的静态文档站点、在文档旁创建博客,或从 GitBook 或 ReadTheDocs 迁移的场景
结构规范90/100

亮点

  • Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整,单文件≤500行
  • 提供了详细的步骤说明,包括项目设置、编写文档、配置侧边栏导航、站点配置、文档版本控制、MDX 组件和部署
执行可靠90/100

亮点

  • 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制
  • 提供了完整的代码示例和配置说明,确保用户能够顺利执行
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 37, 74, 228 行
  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 84, 94, 188 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • discord.gg
  • docs.mycompany.com
  • github.com
  • localhost

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

贝什

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。