doc-smith-check

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Doc-Smith 文档检查

Doc-Smith Document Check

校验 Doc-Smith workspace 的结构和内容完整性。
Validates the structure and content integrity of Doc-Smith workspaces.

用法

Usage

bash
/doc-smith-check                              # 全部检查(结构 + 内容)
/doc-smith-check --structure                  # 只检查结构
/doc-smith-check --content                    # 只检查内容
/doc-smith-check --content --path /api/auth   # 检查指定文档
bash
/doc-smith-check                              # Full check (structure + content)
/doc-smith-check --structure                  # Check structure only
/doc-smith-check --content                    # Check content only
/doc-smith-check --content --path /api/auth   # Check specified document

选项

Options

选项别名说明
--structure
-s
只运行结构检查
--content
-c
只运行内容检查
--path <docPath>
-p
指定文档路径(可多次使用,仅与
--content
配合)
OptionAliasDescription
--structure
-s
Run structure check only
--content
-c
Run content check only
--path <docPath>
-p
Specify document path (can be used multiple times, only works with
--content
)

校验规则

Validation Rules

结构校验 (--structure)

Structure Check (--structure)

执行脚本:
node skills/doc-smith-check/scripts/check-structure.mjs
校验
planning/document-structure.yaml
  • YAML 语法正确
  • 每个文档有 title、path、description
  • path 以
    /
    开头
  • sourcePaths 格式正确
  • 可自动修复的格式错误会自动修复并提示重新读取
Execution script:
node skills/doc-smith-check/scripts/check-structure.mjs
Validates
planning/document-structure.yaml
:
  • Correct YAML syntax
  • Each document has title, path, and description
  • Path starts with
    /
  • sourcePaths format is correct
  • Automatically fixable format errors will be fixed automatically with a prompt to re-read

内容校验 (--content)

Content Check (--content)

执行脚本:
node skills/doc-smith-check/scripts/check-content.mjs [--path <p>]
校验
dist/
中的 HTML 和
docs/
中的元数据:
校验项说明
HTML 文件存在
dist/{lang}/docs/{path}.html
.meta.yaml 存在
docs/{path}/.meta.yaml
,含 kind/source/default
nav.js 存在
dist/assets/nav.js
内部链接有效链接目标文档存在,无
.md
后缀
图片可访问本地图片文件存在,远程图片可达
路径格式MD 源文件应使用
/assets/
格式,
../../assets/
旧格式产生警告
Execution script:
node skills/doc-smith-check/scripts/check-content.mjs [--path <p>]
Validates HTML in
dist/
and metadata in
docs/
:
Validation ItemDescription
HTML file exists
dist/{lang}/docs/{path}.html
exists
.meta.yaml exists
docs/{path}/.meta.yaml
exists, containing kind/source/default
nav.js exists
dist/assets/nav.js
exists
Internal links are validLinked target documents exist, no
.md
suffix
Images are accessibleLocal image files exist, remote images are reachable
Path formatMD source files should use
/assets/
format; the old
../../assets/
format will trigger a warning

路径格式校验

Path Format Check

内容校验自动包含路径格式检查:
  • docs/{path}/
    下存在
    .md
    源文件,检查其中的图片引用格式
  • 使用
    /assets/xxx
    格式 → 通过
  • 使用
    ../../assets/xxx
    旧格式 → 产生警告,建议迁移到
    /assets/
    格式
  • 代码块中的路径不触发警告
Content check automatically includes path format validation:
  • If
    .md
    source files exist under
    docs/{path}/
    , check the image reference format in them
  • Uses
    /assets/xxx
    format → Pass
  • Uses old
    ../../assets/xxx
    format → Warning triggered, migration to
    /assets/
    format is recommended
  • Paths in code blocks do not trigger warnings

错误处理

Error Handling

  • 结构检查失败:根据错误信息修正
    document-structure.yaml
    ,重新检查
  • 内容检查失败:根据问题类型(缺失文档/链接错误/图片问题)采取对应行动
  • 依赖未安装:
    cd skills/doc-smith-check/scripts && npm install
  • Structure check failed: Fix
    document-structure.yaml
    according to the error message and re-check
  • Content check failed: Take corresponding actions based on the issue type (missing document/link error/image issue)
  • Dependencies not installed:
    cd skills/doc-smith-check/scripts && npm install

被其他 Skill 调用

Called by Other Skills

  • 生成 document-structure.yaml 后:
    /doc-smith-check --structure
  • 生成文档内容后:
    /doc-smith-check --content
  • 结束前最终校验:
    /doc-smith-check
  • After generating document-structure.yaml:
    /doc-smith-check --structure
  • After generating document content:
    /doc-smith-check --content
  • Final validation before completion:
    /doc-smith-check