跳到正文
Skillpedia
写作40k · #7465

update-markdown-file-index

它能做什么

这个工具可以自动从文本文档(Markdown 文件)中指定的文件夹里生成一份文件列表或表格。它会整理这些文件,展示每个文件的名称、类型和描述。

适用场景

  • ✓当你想在文档中列出项目的所有文件时。
  • ✓创建 README,用来整理目录文档时。
  • ✓需要在笔记文件中生成代码示例索引时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/update-markdown-file-index/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/update-markdown-file-index/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在我的 README.md 文件中,为 documents 文件夹里的文件创建一份索引。”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会读取你的主文件,找到你指定的文件夹,列出里面的文件,然后生成一份有条理的列表或表格,包含每个文件的相关信息,并将其插入到你的文档中。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Update Markdown File Index

Update markdown file ${file} with an index/table of files from folder ${input:folder}.

Process

  1. Scan: Read the target markdown file ${file} to understand existing structure
  2. Discover: List all files in the specified folder ${input:folder} matching pattern ${input:pattern}
  3. Analyze: Identify if an existing table/index section exists to update, or create new structure
  4. Structure: Generate appropriate table/list format based on file types and existing content
  5. Update: Replace existing section or add new section with file index
  6. Validate: Ensure markdown syntax is valid and formatting is consistent

File Analysis

For each discovered file, extract:

  • Name: Filename with or without extension based on context
  • Type: File extension and category (e.g., .md, .js, .py)
  • Description: First line comment, header, or inferred purpose
  • Size: File size for reference (optional)
  • Modified: Last modified date (optional)

Table Structure Options

Choose format based on file types and existing content:

Option 1: Simple List

## Files in ${folder}

- [filename.ext](path/to/filename.ext) - Description
- [filename2.ext](path/to/filename2.ext) - Description

Option 2: Detailed Table

| File | Type | Description |
|------|------|-------------|
| [filename.ext](path/to/filename.ext) | Extension | Description |
| [filename2.ext](path/to/filename2.ext) | Extension | Description |

Option 3: Categorized Sections

Group files by type/category with separate sections or sub-tables.

Update Strategy

  • 🔄 Update existing: If table/index section exists, replace content while preserving structure
  • ➕ Add new: If no existing section, create new section using best-fit format
  • 📋 Preserve: Maintain existing markdown formatting, heading levels, and document flow
  • 🔗 Links: Use relative paths for file links within the repository

Section Identification

Look for existing sections with these patterns:

  • Headings containing: "index", "files", "contents", "directory", "list"
  • Tables with file-related columns
  • Lists with file links
  • HTML comments marking file index sections

Requirements

  • Preserve existing markdown structure and formatting
  • Use relative paths for file links
  • Include file descriptions when available
  • Sort files alphabetically by default
  • Handle special characters in filenames
  • Validate all generated markdown syntax
常见问题

什么是 Markdown 文件?

Markdown 是一种简单的文本格式,可以用一些特殊符号来设置文字格式,比如用星号表示加粗,或者创建列表。它在网络文档中被广泛使用。

AI 怎么知道该列出哪些文件?

你需要告诉 AI 去哪个文件夹查找。它还可以使用“模式”来筛选文件类型,比如只列出 `.txt` 或 `.py` 文件。

AI 会删除我文件中已有的内容吗?

不会。AI 会比较聪明地处理:如果文件中已经有文件列表,它会更新这个列表;如果没有,它会新建一个列表部分,不影响文档的其他内容。

详情

作者的原始描述

Update a markdown file section with an index/table of files from a specified folder.

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7465
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能