|
| 1 | +--- |
| 2 | +name: docs-alt-text |
| 3 | +description: Generates W3C-compliant alt text for images in documentation pages. Analyzes each image's purpose and adds descriptive alt text for informative images or empty alt for decorative images, improving accessibility and SEO. |
| 4 | +user-invocable: true |
| 5 | +disable-model-invocation: false |
| 6 | +--- |
| 7 | + |
| 8 | +> **Accessibility skill:** Generates alt text following W3C/WCAG 2.1 guidelines. Analyzes actual image content plus context to create concise, meaningful descriptions. |
| 9 | +
|
| 10 | +## Workflow |
| 11 | + |
| 12 | +**CRITICAL: Follow this order for each image:** |
| 13 | + |
| 14 | +1. **STEP 1 - View the image file** (REQUIRED) |
| 15 | + - Extract image src path from figure shortcode |
| 16 | + - Convert path: `src="/attachments/path/file.png"` → `static/attachments/path/file.png` |
| 17 | + - Use Read tool to view the actual image |
| 18 | + - Understand what the image shows BEFORE reading context |
| 19 | + |
| 20 | +2. **STEP 2 - Read surrounding context** |
| 21 | + - Read the heading, preceding/following text, list item, or numbered step |
| 22 | + - Understand the image's purpose within the documentation |
| 23 | + - Consider if context + image together make the image informative or decorative |
| 24 | + |
| 25 | +3. **STEP 3 - Apply W3C decision tree** |
| 26 | + - **Technical docs assumption:** Images are informative unless obviously decorative |
| 27 | + - Categorize as: UI screenshot, procedural step, diagram, code example, graph, or configuration screen |
| 28 | + - Only use `alt=""` if certain the image is pure decoration (borders, spacers, decorative backgrounds) |
| 29 | + |
| 30 | +4. **STEP 4 - Generate alt text** |
| 31 | + - Maximum 30 words |
| 32 | + - Convey meaning, not literal description |
| 33 | + - Don't include "screenshot of", "image of", or "picture of" |
| 34 | + - Use Mendix terminology |
| 35 | + - Avoid redundancy with nearby text |
| 36 | + - For UI screenshots: describe the UI element (e.g., "Create Workspace dialog") |
| 37 | + - For diagrams: describe what it shows (e.g., "Client-server connection flow") |
| 38 | + - For procedural steps: describe what user sees (e.g., "Download button in Registration dialog") |
| 39 | + |
| 40 | +5. **STEP 5 - Edit the figure shortcode** |
| 41 | + - Use Edit tool to add/update only the `alt` attribute |
| 42 | + - Preserve all other attributes: `class`, `width`, `max-width`, `link` |
| 43 | + - Maintain exact indentation and spacing |
| 44 | + |
| 45 | +## W3C Guidelines Summary |
| 46 | + |
| 47 | +**Informative images:** |
| 48 | +- Convey meaning or information → provide descriptive alt text |
| 49 | +- Be "the most concise description possible" |
| 50 | +- Focus on what information it communicates, not what it looks like |
| 51 | + |
| 52 | +**Decorative images (rare in technical docs):** |
| 53 | +- Pure visual styling with no informational value → use `alt=""` |
| 54 | +- When in doubt: describe it—better than incorrectly marking decorative |
| 55 | + |
| 56 | +**Never:** |
| 57 | +- Omit the alt attribute entirely |
| 58 | +- Say "image of" or "screenshot of" (screen readers already announce it's an image) |
| 59 | +- Create alt text longer than 30 words (flag as complex image needing body text description) |
| 60 | + |
| 61 | +## Special Cases |
| 62 | + |
| 63 | +- **Images in numbered lists:** Common in procedures—describe the procedural step shown |
| 64 | +- **Before/after sequences:** Describe what changed or the state shown |
| 65 | +- **Existing alt text:** May update if it's empty, generic, or poor quality (e.g., `alt=""`, `alt="button"`, `alt="before"`) |
| 66 | +- **File format icons:** Use format name (e.g., "PDF", "ZIP", "Word document") |
| 67 | +- **Complex diagrams:** If needs >30 words, flag to user and suggest adding description to body text |
| 68 | + |
| 69 | +## What NOT to do |
| 70 | + |
| 71 | +- Don't modify `src` path or attributes other than `alt` |
| 72 | +- Don't change surrounding text or document structure |
| 73 | +- Don't process images outside the determined scope |
| 74 | +- Don't generate alt text based solely on filename—always view the image first |
| 75 | + |
| 76 | +## After Processing |
| 77 | + |
| 78 | +Report summary: |
| 79 | +- How many images processed |
| 80 | +- How many updated |
| 81 | + |
| 82 | +**Always suggest user review:** Recommend that the user review the images themselves to confirm alt text accuracy, as AI-generated descriptions may miss important nuances or context-specific details. |
0 commit comments