$npx -y skills add github/awesome-copilot --skill update-markdown-file-indexUpdate a markdown file section with an index/table of files from a specified folder.
| 1 | # Update Markdown File Index |
| 2 | |
| 3 | Update markdown file `${file}` with an index/table of files from folder `${input:folder}`. |
| 4 | |
| 5 | ## Process |
| 6 | |
| 7 | 1. **Scan**: Read the target markdown file `${file}` to understand existing structure |
| 8 | 2. **Discover**: List all files in the specified folder `${input:folder}` matching pattern `${input:pattern}` |
| 9 | 3. **Analyze**: Identify if an existing table/index section exists to update, or create new structure |
| 10 | 4. **Structure**: Generate appropriate table/list format based on file types and existing content |
| 11 | 5. **Update**: Replace existing section or add new section with file index |
| 12 | 6. **Validate**: Ensure markdown syntax is valid and formatting is consistent |
| 13 | |
| 14 | ## File Analysis |
| 15 | |
| 16 | For each discovered file, extract: |
| 17 | |
| 18 | - **Name**: Filename with or without extension based on context |
| 19 | - **Type**: File extension and category (e.g., `.md`, `.js`, `.py`) |
| 20 | - **Description**: First line comment, header, or inferred purpose |
| 21 | - **Size**: File size for reference (optional) |
| 22 | - **Modified**: Last modified date (optional) |
| 23 | |
| 24 | ## Table Structure Options |
| 25 | |
| 26 | Choose format based on file types and existing content: |
| 27 | |
| 28 | ### Option 1: Simple List |
| 29 | |
| 30 | ```markdown |
| 31 | ## Files in ${folder} |
| 32 | |
| 33 | - [filename.ext](path/to/filename.ext) - Description |
| 34 | - [filename2.ext](path/to/filename2.ext) - Description |
| 35 | ``` |
| 36 | |
| 37 | ### Option 2: Detailed Table |
| 38 | |
| 39 | | File | Type | Description | |
| 40 | |------|------|-------------| |
| 41 | | [filename.ext](path/to/filename.ext) | Extension | Description | |
| 42 | | [filename2.ext](path/to/filename2.ext) | Extension | Description | |
| 43 | |
| 44 | ### Option 3: Categorized Sections |
| 45 | |
| 46 | Group files by type/category with separate sections or sub-tables. |
| 47 | |
| 48 | ## Update Strategy |
| 49 | |
| 50 | - 🔄 **Update existing**: If table/index section exists, replace content while preserving structure |
| 51 | - ➕ **Add new**: If no existing section, create new section using best-fit format |
| 52 | - 📋 **Preserve**: Maintain existing markdown formatting, heading levels, and document flow |
| 53 | - 🔗 **Links**: Use relative paths for file links within the repository |
| 54 | |
| 55 | ## Section Identification |
| 56 | |
| 57 | Look for existing sections with these patterns: |
| 58 | |
| 59 | - Headings containing: "index", "files", "contents", "directory", "list" |
| 60 | - Tables with file-related columns |
| 61 | - Lists with file links |
| 62 | - HTML comments marking file index sections |
| 63 | |
| 64 | ## Requirements |
| 65 | |
| 66 | - Preserve existing markdown structure and formatting |
| 67 | - Use relative paths for file links |
| 68 | - Include file descriptions when available |
| 69 | - Sort files alphabetically by default |
| 70 | - Handle special characters in filenames |
| 71 | - Validate all generated markdown syntax |