Alt Text
Generate and improve accessible alt text for data visualizations and images in R...
Install
npx skills add posit-dev/skills --skill alt-text -g -a claude-code -y- Repository
- posit-dev/skills551
- Category
- Design
- Updated
- 7d ago
- License
- MIT
- Context cost
- Mediumabout 1,583 tokens
- Runs scripts
- No, instructions only
What it does
Generate and improve accessible alt text for data visualizations and images in R packages and Quarto documents. Use when the user wants to add, improve, or audit alt text for figures in a pkgdown site or .qmd files. Activate for requests that mention fig-alt, fig.alt, figure descriptions, or alt text in the context of an R package or Quarto document.
Write Accessible Alt Text
Generate accessible alt text for data visualizations and images in this project.
ARGUMENTS
- label: (optional) specific figure label or chunk to target
- file: (optional) specific file to process
Detect project type
Before proceeding, identify the project context and read the relevant reference.
Check for a _pkgdown.yml file in the project root to detect a pkgdown site:
ls _pkgdown.yml 2>/dev/null && echo "pkgdown" || echo "not pkgdown"
- pkgdown site (
_pkgdown.ymlpresent) → readreferences/pkgdown.md - Quarto documents (no
_pkgdown.yml,.qmdfiles present) → readreferences/quarto.md
If the context is still ambiguous, ask the user which format they are working in.
Key advantage: source code access
Unlike typical alt text scenarios where you only see an image, we have access to the code that generates each chart. Use this to extract precise details:
From plotting code:
- Variable mappings → exact variable names for axes
- Color/fill mappings → what color encodes
- Plot type functions → scatter, histogram, line chart, etc.
- Trend lines or fitted curves → overlaid statistical fits
- Faceting/subplots → number of panels and what varies
- Color scales → encoding scheme (sequential, diverging, categorical)
- Axis labels and titles → customized labels
From data generation code:
- Random distributions → expected distribution shape
- Transformations → what was done to data
- Feature engineering → preprocessing applied
- Filtering/subsetting → what subset is shown
From surrounding prose:
- Text before/after the chunk explains the purpose and key insight
- Chapter context tells you what the figure is meant to teach
- This is often the best source for the "key insight" part of alt text


