Skip to content

Commit f267832

Browse files
committed
Add alt text skill
1 parent f3ea47a commit f267832

2 files changed

Lines changed: 88 additions & 1 deletion

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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.

.claude/skills/docs-polish/SKILL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Improve clarity and readability without changing meaning, structure, or paragrap
1212
**docs-polish should**:
1313
* Read Mendix style guides first (in parallel): `grammar-formatting.md`, `terminology.md`, and `product-naming-guide.md` from `/content/en/docs/community-tools/contribute-to-mendix-docs/style-guide/`
1414
* Fix all spelling, grammar, and punctuation errors
15-
* Add missing alt text to images (use simple, factual descriptions)
15+
* Check all figure shortcodes for missing alt text. If the alt text parameter is missing, insert `alt=""` as a placeholder.
1616
* Ensure required front matter fields are present (title, url, description) and make descriptions concise and action-oriented
1717
* Fix broken Markdown syntax
1818
* Fix capitalization and terminology inconsistencies
@@ -24,10 +24,15 @@ Improve clarity and readability without changing meaning, structure, or paragrap
2424
* Apply Mendix style guide standards (overrides the Microsoft Writing Style Guide)
2525
* Apply Microsoft Writing Style Guide standards, unless they conflict with the Mendix style guide standards
2626

27+
**After completing edits**:
28+
* Report what was changed in a concise summary
29+
* If any images were found with missing or empty alt text, state "I found [N] image(s) with missing alt text. Consider running `/docs-alt-text` to generate alt text."
30+
2731
**docs-polish should NOT**:
2832
* Move paragraphs or restructure sections (that's `/docs-enhance`)
2933
* Change technical meaning or accuracy
3034
* Significantly increase document length
35+
* Generate alt text for images
3136
* Change command syntax, code identifiers, variable names, placeholders, or any other text that appears in code formatting (inline backticks or code blocks). Code-formatted text represents literal technical content that must remain unchanged. If you notice an issue with code-formatted text, flag it in the chat but don't edit it directly.
3237

3338
Every edit should serve a clear purpose in making the text easier to read, scan, and understand.

0 commit comments

Comments
 (0)