当前位置: 首页 > Skill >

技术文档更新

技术文档更新

技术文档更新

该 Skill 是一套用于更新 Next.js 项目文档的引导式工作流,核心作用是帮助你根据源代码的变更,来分析、更新和创建相关的文档,确保代码和文档保持同步。它特别为审查 Pull Request (PR) 时的文档完整性检查而设计,通过一系列标准化的步骤来规范文档的修改过程。 This skill should be used when the user asks to "update documentation for my changes", "check docs for this PR", "what docs need updating", "sync docs with code", "scaffold docs for this feature", "document this feature", "review docs completeness", "add docs for this change", "what documentation is affected", "docs impact", or mentions "docs/", "docs/01-ap

1.0.0 2026.11.27 179
获取Skill文件查看使用说明
作 者:陈言 许可证: 更新时间:2026.11.27
本文目录展开

Next.js Documentation Updater

Guides you through updating Next.js documentation based on code changes on the active branch. Designed for maintainers reviewing PRs for documentation completeness.

Quick Start

  1. Analyze changes: Run git diff canary...HEAD --stat to see what files changed
  2. Identify affected docs: Map changed source files to documentation paths
  3. Review each doc: Walk through updates with user confirmation
  4. Validate: Run pnpm lint to check formatting
  5. Commit: Stage documentation changes

Workflow: Analyze Code Changes

Step 1: Get the diff

# See all changed files on this branch
git diff canary...HEAD --stat

# See changes in specific areas
git diff canary...HEAD -- packages/next/src/

Step 2: Identify documentation-relevant changes

Look for changes in these areas:

Source Path Likely Doc Impact
packages/next/src/client/components/ Component API reference
packages/next/src/server/ Function API reference
packages/next/src/shared/lib/ Varies by export
packages/next/src/build/ Configuration or build docs
packages/next/src/lib/ Various features

Step 3: Map to documentation files

Use the code-to-docs mapping in references/CODE-TO-DOCS-MAPPING.md to find corresponding documentation files.

Example mappings:

  • src/client/components/image.tsx → docs/01-app/03-api-reference/02-components/image.mdx
  • src/server/config-shared.ts → docs/01-app/03-api-reference/05-config/

Workflow: Update Existing Documentation

Step 1: Read the current documentation

Before making changes, read the existing doc to understand:

  • Current structure and sections
  • Frontmatter fields in use
  • Whether it uses <AppOnly> / <PagesOnly> for router-specific content

Step 2: Identify what needs updating

Common updates include:

  • New props/options: Add to the props table and create a section explaining usage
  • Changed behavior: Update descriptions and examples
  • Deprecated features: Add deprecation notices and migration guidance
  • New examples: Add code blocks following conventions

Step 3: Apply updates with confirmation

For each change:

  1. Show the user what you plan to change
  2. Wait for confirmation before editing
  3. Apply the edit
  4. Move to the next change

Step 4: Check for shared content

If the doc uses the source field pattern (common for Pages Router docs), the source file is the one to edit. Example:

# docs/02-pages/... file with shared content
---
source: app/building-your-application/optimizing/images
---

Edit the App Router source, not the Pages Router file.

Step 5: Validate changes

pnpm lint          # Check formatting
pnpm prettier-fix  # Auto-fix formatting issues

Workflow: Scaffold New Feature Documentation

Use this when adding documentation for entirely new features.

Step 1: Determine the doc type

Feature Type Doc Location Template
New component docs/01-app/03-api-reference/02-components/ API Reference
New function docs/01-app/03-api-reference/04-functions/ API Reference
New config option docs/01-app/03-api-reference/05-config/ Config Reference
New concept/guide docs/01-app/02-guides/ Guide
New file convention docs/01-app/03-api-reference/03-file-conventions/ File Convention

Step 2: Create the file with proper naming

  • Use kebab-case: my-new-feature.mdx
  • Add numeric prefix if ordering matters: 05-my-new-feature.mdx
  • Place in the correct directory based on feature type

Step 3: Use the appropriate template

API Reference Template:

---
title: Feature Name
description: Brief description of what this feature does.
---

{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}

Brief introduction to the feature.

## Reference

### Props

<div style={{ overflowX: 'auto', width: '100%' }}>

| Prop                    | Example            | Type   | Status   |
| ----------------------- | ------------------ | ------ | -------- |
| [`propName`](#propname) | `propName="value"` | String | Required |

</div>

#### `propName`

Description of the prop.

```tsx filename="app/example.tsx" switcher
// TypeScript example
```

```jsx filename="app/example.js" switcher
// JavaScript example
```

Guide Template:

---
title: How to do X in Next.js
nav_title: X
description: Learn how to implement X in your Next.js application.
---

Introduction explaining why this guide is useful.

## Prerequisites

What the reader needs to know before starting.

## Step 1: First Step

Explanation and code example.

```tsx filename="app/example.tsx" switcher
// Code example
```

## Step 2: Second Step

Continue with more steps...

## Next Steps

Related topics to explore.

Step 4: Add related links

Update frontmatter with related documentation:

related:
  title: Next Steps
  description: Learn more about related features.
  links:
    - app/api-reference/functions/related-function
    - app/guides/related-guide

Documentation Conventions

See references/DOC-CONVENTIONS.md for complete formatting rules.

Quick Reference

Frontmatter (required):

---
title: Page Title (2-3 words)
description: One or two sentences describing the page.
---

Code blocks:

```tsx filename="app/page.tsx" switcher
// TypeScript first
```

```jsx filename="app/page.js" switcher
// JavaScript second
```

Router-specific content:

<AppOnly>Content only for App Router docs.</AppOnly>

<PagesOnly>Content only for Pages Router docs.</PagesOnly>

Notes:

> **Good to know**: Single line note.

> **Good to know**:
>
> - Multi-line note point 1
> - Multi-line note point 2

Validation Checklist

Before committing documentation changes:

  • Frontmatter has title and description
  • Code blocks have filename attribute
  • TypeScript examples use switcher with JS variant
  • Props tables are properly formatted
  • Related links point to valid paths
  • pnpm lint passes
  • Changes render correctly (if preview available)

References

  • references/DOC-CONVENTIONS.md - Complete frontmatter and formatting rules
  • references/CODE-TO-DOCS-MAPPING.md - Source code to documentation mapping

相关文章

更多
Git项目协作模式详解:从集中式到Forking工作流

Git的分布式特性支持多种团队协作模式。本文详细解析了集中式工作流、分支工作流、GitFlow工作流及Forking工作流的适用场景、操作流程与优缺点。集中式模式简单但易冲突;分支模式通过Feature隔离提升安全性;GitFlow通过master、develop、release和hotfix分支实现标准化发布流程,适合大型项目;Forking模式则通过独立仓库和Pull Request机制,完美适配开源社区与外部贡献者管理。

2025.02.08 510
Skill 文件
  • SKILL.md
    • Next.js Documentation Updater
    • Quick Start
    • Workflow: Analyze Code Changes
      • Step 1: Get the diff
      • Step 2: Identify documentation-relevant changes
      • Step 3: Map to documentation files
    • Workflow: Update Existing Documentation
      • Step 1: Read the current documentation
      • Step 2: Identify what needs updating
      • Step 3: Apply updates with confirmation
      • Step 4: Check for shared content
      • Step 5: Validate changes
    • Workflow: Scaffold New Feature Documentation
      • Step 1: Determine the doc type
      • Step 2: Create the file with proper naming
      • Step 3: Use the appropriate template
      • Step 4: Add related links
    • Documentation Conventions
      • Quick Reference
    • Validation Checklist
    • References
  • 项目或源文件

相关 Skill

更多
gy3 gy3 Use when preparing a concise pull request summary, review notes, or change explanation from git diffs, commit logs, or implementation details.
Deterministic security fixes for infrastructure code via Gomboc.ai Community Edition Deterministic security fixes for infrastructure code via Gomboc.ai Community Edition 自动扫描并确定性修复 Terraform、CloudFormation 和 IaC 中的安全问题,提供可合并的 Pull Request 并集成 CI/CD。
Pr Review Pr Review 全面审查Pull Request,关注代码质量、安全、性能和可维护性,适用于任何代码审查任务。
Pr Description Generator Pr Description Generator 自动从 git diff 和提交历史生成 Pull Request 描述,解析常规提交并对变更进行分类(功能、修复、重构等)。
comprehensive-review-pr-enhance comprehensive-review-pr-enhance 你是一名 PR 优化专家,专注于创建便于高效代码审查的高质量 pull request。生成全面的 PR 描述、自动化审查流程,并确保 PR 在清晰度、规模与可