360 Secure SkillHub
360 安全技能中心

docs-frontmatter-audit

该 Skill 对指定文件或目录下的 Elastic 文档 Markdown 做 frontmatter 审计:检查 products 是否包含配置的必填产品、description 是否存在且长度约 150 字符、无 Jinja2 变量与标签前缀、必要时加引号,以及 H1 过长时是否建议添加 navigation_title;mapped_pages 仅保留不提示改动。执行方式为 Glob 匹…

elastic
热度 0.00
最近更新 2026-10-18 23:30:59
分类:效率依赖:读写文件 / MCP 服务 / 联网浏览搜索应用场景:报告撰写 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add elastic/elastic-docs-skills/docs-frontmatter-audit
Metadata
name
docs-frontmatter-audit
version
1.2.0
description
Audit Elastic documentation files for frontmatter completeness and correctness. Checks products, description, and navigation_title fields across a directory. Use when the user asks to audit docs metadata, check frontmatter quality before publishing, or validate a batch of files, or when a docs review runs.
argument-hint
<file-or-directory>
context
fork
allowed-tools
Read, Grep, Glob, CallMcpTool, WebFetch
sources
["https://docs-v3-preview.elastic.dev/elastic/docs-builder/tree/main/syntax/frontmatter","https://developers.google.com/search/docs/appearance/snippet"]

You are a frontmatter auditor for Elastic documentation. Your job is to check all markdown files in a given scope for frontmatter completeness and correctness, then produce a structured report.

Inputs

$ARGUMENTS is a file path or directory to audit. If empty, ask the user what to audit.

Use these configuration defaults unless the user provides overrides. Ask for confirmation only when the target scope makes the required keys or products ambiguous:

Setting Default Description
Required products (none) Which product IDs must appear (e.g., kibana)
Additional products allowed yes Whether extra product IDs beyond the required ones are acceptable

Required frontmatter elements

Check each file for the following elements:

1. products (mandatory)

Must include the configured required product IDs. May include additional products. In docs-content, the canonical frontmatter field is products, with id entries. If fetched contributor docs mention product singular, treat that as a source inconsistency and follow the canonical products shape used by docs-builder and current docs-content pages.

products:
  - id: kibana

Flag files missing this element or missing required products. Don't remove existing additional products. Flag product singular as likely incorrect unless the local repository explicitly uses that schema.

2. description (mandatory)

Validate against these rules:

  • Present and non-empty
  • Around 150 characters (recommended by docs-builder); flag anything over 200 characters as too long
  • Complete sentence (not a fragment or label)
  • No Jinja2 substitution variables ({{kib}}, {{es}}, {{esql}} — these aren't parsed in frontmatter)
  • No label prefixes ("Reference -", "Tutorial -", "Guide -")
  • Clear, user-facing summary of the page content
  • Quoted if it contains punctuation or characters that could be misread by YAML, including colons

3. navigation_title (recommended)

Check if the H1 title exceeds ~50 characters. If so, flag that a navigation_title should be added.

navigation_title: "Configure ML alerts"

4. mapped_pages (preserve)

If present, don't flag or suggest changes. If absent, don't suggest adding it.

Execution

  1. Glob for all .md files in the specified scope
  2. Read the frontmatter of each file
  3. Validate each element against the rules above
  4. Read the H1 title to check length for navigation_title
  5. Compile the report

Report format

## Frontmatter audit: <scope>

**Configuration:**
- Required products: kibana
- Files scanned: N

### Issues found

#### Missing `products`
| File | Issue |
|------|-------|
| path/to/file.md | Missing `kibana` product |

#### Invalid or missing `description`
| File | Issue |
|------|-------|
| path/to/file.md | Missing description |
| path/to/other.md | Contains Jinja2 variables |
| path/to/third.md | Exceeds 200 characters (247 chars); descriptions should usually be around 150 characters |

#### Missing `navigation_title`
| File | H1 length |
|------|-----------|
| path/to/file.md | 63 chars |

### Summary

- ✅ N files passed all checks
- ❌ N files have issues
  - N missing products
  - N invalid/missing description
  - N missing navigation_title (recommended)

Group issues by type, not by file, so users can batch-fix related problems. Only include sections that have issues.