{"skills":[{"name":"Choose text alternatives for page images","description":"Classify an image by what it contributes in its page context and identify the information its alternative needs to preserve.","content":"# Choose text alternatives for page images\n\nClassify an image by what it contributes in its page context and identify the information its alternative needs to preserve.\n\n## When to use this skill\n\n- Someone is writing alt text for images on a page, product listing, email or report and wants to know what each one should say.\n- A content audit flagged images with missing alt, file-name alt or 'image of' alt text.\n- An icon is the only content of a button or link and the team needs its text alternative.\n- A chart, diagram or infographic needs a text equivalent.\n\n## When not to use it\n\n- Captions or audio description for video. Use the captions skill or a media alternative review.\n- Checking the name of a control that already has visible text. Use the check-control-labels-for-speech-input skill to check that the name contains the visible words.\n\n## What you need\n\n- Each image and its neighbouring text, caption and enclosing link or button.\n- Its purpose, any text in the image, and the data or relationship conveyed by a complex graphic.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Where does each image appear, and what are the surrounding text, caption and any link or button around it? The same image can need different text in different places.\n- What is each image for: to act, to inform, to decorate or to show data? If the page does not make this clear, the author has to say.\n- For charts and diagrams, can you supply the underlying figures or key points? A long description cannot be written from the picture's appearance alone.\n\n## Method\n\n1. Work through the images in page order. For each, read the surrounding text, caption and enclosing link or button as if the image were absent, and decide whether understanding or the ability to act changes. This follows the W3C alt decision tree.\n2. If the image is the only content of a link or button, write alt text that names the destination or action ('Print receipt', 'Search', 'Example.com home'), not the picture ('printer icon'). If text in the same link or button already names the action, give the image an empty alt so the name is not repeated.\n3. If the image contains text that is not also present as real text, the alternative includes that text. If the same words already appear next to it, use an empty alt.\n4. For a meaningful photo or illustration, say what it shows that matters in this context, such as the defect in a product photo, in a sentence or less. Do not start with 'image of'; screen readers already announce that it is an image.\n5. For a chart, map or diagram carrying several values or relationships, use a two-part alternative: a short alt that identifies it and says where the detail is, and a long description or data table nearby with the figures and trends.\n6. For purely decorative images, borders and spacers, use alt=\"\" or move the image into CSS. Never leave alt out: screen readers may then read the file name or URL.\n7. If the purpose or the chart data cannot be worked out from what was supplied, ask for it instead of inventing a description, and say which images are waiting.\n\n## Checks before you deliver\n\n- An empty alt and an absent alt are different. Some assistive technology announces a filename when alt is missing.\n- Naming the shape of an icon seldom tells someone what an otherwise unnamed control does.\n- Repeating a visible caption word for word in the alt makes screen-reader users hear it twice. Give the alt only what the caption does not already say.\n- A chart alt that only says 'bar chart' leaves out every figure. The data must be somewhere a screen reader can reach, such as a table or text next to the chart.\n- Reusing one alt for every copy of an image ignores context. An icon that names a button in one place can be redundant beside text in another.\n\n## How to present the result\n\nGive a table in page order with each image, its role (decorative, functional, informative, complex or unknown), the proposed alt text in quotation marks or alt=\"\", and where any long description goes. For charts, include the draft long description or data table ready to paste. Put images waiting for context at the end with the question to ask about each.\n\n## Worked example\n\n**Request:** Choose treatments for these images in context.\n\n**Supplied material:**\n\n```text\nI1: a printer icon is the only child of a button; its documented action is Print receipt.\nI2: a second printer icon sits beside the words Print receipt in the same button; adds no information.\nI3: a sales chart contains five monthly values and a seasonal peak; no equivalent data elsewhere.\n```\n\n**Answer:** Name the icon-only button \u201cPrint receipt\u201d. Give the duplicate icon beside those same words an empty alt. Give the sales chart a short identification and put its five monthly figures and the seasonal peak in accessible text or a table nearby.\n\n## Structured output for tests\n\nFor an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.\n\nReturn images in source order with id and action, using empty-alt, name-action, describe-information, short-and-long or ask-context. Include purpose only for name-action, using the supplied action or destination wording.\n\n## Sources\n\n- [W3C WAI image decision tree](https:\/\/www.w3.org\/WAI\/tutorials\/images\/decision-tree\/): W3C's decision tree asks, in order, about text in the image, images in links and buttons, meaning in context, redundancy and decoration, and gives the alt treatment for each. The skill's classification follows that order.\n- [W3C WAI functional images](https:\/\/www.w3.org\/WAI\/tutorials\/images\/functional\/): Says the alt for an image in a link or button conveys the action, such as 'print this page' rather than 'printer', and warns that missing or empty alt on such images leads screen readers to read the file name or URL.\n- [W3C Understanding Non-text Content](https:\/\/www.w3.org\/WAI\/WCAG22\/Understanding\/non-text-content.html): Explains WCAG 2.2 success criterion 1.1.1 (Level A): a text alternative that serves the equivalent purpose, a name describing the purpose for controls, and decoration implemented so assistive technology ignores it. It supports short and long alternatives for complex images such as charts.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/choose-image-alternatives\n","scope":"contextual","trigger_keywords":["Choose text alternatives for page images","choose-image-alternatives","choose image alternatives","What alt text should each image on this page have?","What alt text should each image on this page have","alt text for these images","choose alt text","image alternatives"],"is_private":true,"is_active":true,"scripts":[{"name":"choose-image-alternatives-check","description":"Compare a saved JSON answer with a published test. Pass tests\/case-1\/expected.json (or another case) and the path to your answer.","language":"python","filename":"choose-image-alternatives-check.py","content":"from pathlib import Path\nimport runpy\n\nrunpy.run_path(str(Path(__file__).parent \/ 'tests' \/ 'check.py'), run_name='__main__')\n","supporting_files":[{"path":"SKILL.md","content":"---\nname: choose-image-alternatives\ndescription: \"Decide what text alternative each image needs from its role on the page: empty alt for decoration, the action for images in links or buttons, the information for meaningful photos, and a short plus long description for charts. Use when writing or reviewing alt text for a web page, email or document.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/choose-image-alternatives\n---\n\n# Choose text alternatives for page images\n\nClassify an image by what it contributes in its page context and identify the information its alternative needs to preserve.\n\n## When to use this skill\n\n- Someone is writing alt text for images on a page, product listing, email or report and wants to know what each one should say.\n- A content audit flagged images with missing alt, file-name alt or 'image of' alt text.\n- An icon is the only content of a button or link and the team needs its text alternative.\n- A chart, diagram or infographic needs a text equivalent.\n\n## When not to use it\n\n- Captions or audio description for video. Use the captions skill or a media alternative review.\n- Checking the name of a control that already has visible text. Use the check-control-labels-for-speech-input skill to check that the name contains the visible words.\n\n## What you need\n\n- Each image and its neighbouring text, caption and enclosing link or button.\n- Its purpose, any text in the image, and the data or relationship conveyed by a complex graphic.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Where does each image appear, and what are the surrounding text, caption and any link or button around it? The same image can need different text in different places.\n- What is each image for: to act, to inform, to decorate or to show data? If the page does not make this clear, the author has to say.\n- For charts and diagrams, can you supply the underlying figures or key points? A long description cannot be written from the picture's appearance alone.\n\n## Method\n\n1. Work through the images in page order. For each, read the surrounding text, caption and enclosing link or button as if the image were absent, and decide whether understanding or the ability to act changes. This follows the W3C alt decision tree.\n2. If the image is the only content of a link or button, write alt text that names the destination or action ('Print receipt', 'Search', 'Example.com home'), not the picture ('printer icon'). If text in the same link or button already names the action, give the image an empty alt so the name is not repeated.\n3. If the image contains text that is not also present as real text, the alternative includes that text. If the same words already appear next to it, use an empty alt.\n4. For a meaningful photo or illustration, say what it shows that matters in this context, such as the defect in a product photo, in a sentence or less. Do not start with 'image of'; screen readers already announce that it is an image.\n5. For a chart, map or diagram carrying several values or relationships, use a two-part alternative: a short alt that identifies it and says where the detail is, and a long description or data table nearby with the figures and trends.\n6. For purely decorative images, borders and spacers, use alt=\"\" or move the image into CSS. Never leave alt out: screen readers may then read the file name or URL.\n7. If the purpose or the chart data cannot be worked out from what was supplied, ask for it instead of inventing a description, and say which images are waiting.\n\n## Checks before you deliver\n\n- An empty alt and an absent alt are different. Some assistive technology announces a filename when alt is missing.\n- Naming the shape of an icon seldom tells someone what an otherwise unnamed control does.\n- Repeating a visible caption word for word in the alt makes screen-reader users hear it twice. Give the alt only what the caption does not already say.\n- A chart alt that only says 'bar chart' leaves out every figure. The data must be somewhere a screen reader can reach, such as a table or text next to the chart.\n- Reusing one alt for every copy of an image ignores context. An icon that names a button in one place can be redundant beside text in another.\n\n## How to present the result\n\nGive a table in page order with each image, its role (decorative, functional, informative, complex or unknown), the proposed alt text in quotation marks or alt=\"\", and where any long description goes. For charts, include the draft long description or data table ready to paste. Put images waiting for context at the end with the question to ask about each.\n\n## Worked example\n\n**Request:** Choose treatments for these images in context.\n\n**Supplied material:**\n\n```text\nI1: a printer icon is the only child of a button; its documented action is Print receipt.\nI2: a second printer icon sits beside the words Print receipt in the same button; adds no information.\nI3: a sales chart contains five monthly values and a seasonal peak; no equivalent data elsewhere.\n```\n\n**Answer:** Name the icon-only button \u201cPrint receipt\u201d. Give the duplicate icon beside those same words an empty alt. Give the sales chart a short identification and put its five monthly figures and the seasonal peak in accessible text or a table nearby.\n\n## Structured output for tests\n\nFor an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.\n\nReturn images in source order with id and action, using empty-alt, name-action, describe-information, short-and-long or ask-context. Include purpose only for name-action, using the supplied action or destination wording.\n\n## Sources\n\n- [W3C WAI image decision tree](https:\/\/www.w3.org\/WAI\/tutorials\/images\/decision-tree\/): W3C's decision tree asks, in order, about text in the image, images in links and buttons, meaning in context, redundancy and decoration, and gives the alt treatment for each. The skill's classification follows that order.\n- [W3C WAI functional images](https:\/\/www.w3.org\/WAI\/tutorials\/images\/functional\/): Says the alt for an image in a link or button conveys the action, such as 'print this page' rather than 'printer', and warns that missing or empty alt on such images leads screen readers to read the file name or URL.\n- [W3C Understanding Non-text Content](https:\/\/www.w3.org\/WAI\/WCAG22\/Understanding\/non-text-content.html): Explains WCAG 2.2 success criterion 1.1.1 (Level A): a text alternative that serves the equivalent purpose, a name describing the purpose for controls, and decoration implemented so assistive technology ignores it. It supports short and long alternatives for complex images such as charts.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/choose-image-alternatives\n"},{"path":"LICENSE.txt","content":"Original Raq.com instructions and synthetic examples: CC BY 4.0.\nhttps:\/\/creativecommons.org\/licenses\/by\/4.0\/\nAttribution: Raq.com, https:\/\/skills.raq.com\/skills\/choose-image-alternatives\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# Product page pictures\n\nChoose treatments for these images in context.\n\n## Supplied material\n\nI1: a printer icon is the only child of a button; its documented action is Print receipt.\nI2: a second printer icon sits beside the words Print receipt in the same button; adds no information.\nI3: a sales chart contains five monthly values and a seasonal peak; no equivalent data elsewhere.\n\n## Worked answer\n\nName the icon-only button \u201cPrint receipt\u201d. Give the duplicate icon beside those same words an empty alt. Give the sales chart a short identification and put its five monthly figures and the seasonal peak in accessible text or a table nearby.\n\n## Reasoning\n\nTwo identical icons require different text treatments because their control names differ.\n"},{"path":"tests\/check.py","content":"\"\"\"Check a saved agent answer locally with Python 3 (standard library only).\"\"\"\nimport json\nimport math\nimport sys\nfrom pathlib import Path\n\n\ndef compare(expected, actual, path=\"$\", accepted=None):\n    if isinstance(expected, bool) or isinstance(actual, bool):\n        if expected is not actual:\n            yield path\n    elif isinstance(expected, (int, float)) and isinstance(actual, (int, float)):\n        if not math.isclose(expected, actual, rel_tol=0, abs_tol=1e-8):\n            yield path\n    elif isinstance(expected, dict) and isinstance(actual, dict):\n        for key in sorted(set(expected) | set(actual)):\n            if key not in expected or key not in actual:\n                yield f\"{path}.{key}\"\n            elif not any(\n                not list(compare(option, actual[key]))\n                for option in (accepted or {}).get(key, [])\n            ):\n                yield from compare(expected[key], actual[key], f\"{path}.{key}\")\n    elif isinstance(expected, list) and isinstance(actual, list):\n        if len(expected) != len(actual):\n            yield f\"{path} (length)\"\n        for i, (left, right) in enumerate(zip(expected, actual)):\n            yield from compare(left, right, f\"{path}[{i}]\")\n    elif type(expected) != type(actual) or expected != actual:\n        yield path\n\n\ndef main():\n    if len(sys.argv) != 3:\n        raise SystemExit(\"Usage: python3 check.py expected.json answer.json\")\n    try:\n        expected, actual = [json.loads(Path(p).read_text(encoding=\"utf-8\")) for p in sys.argv[1:]]\n        alternatives = Path(sys.argv[1]).with_name(\"accepted.json\")\n        accepted = json.loads(alternatives.read_text(encoding=\"utf-8\")) if alternatives.is_file() else {}\n    except (ValueError, OSError) as error:\n        raise SystemExit(str(error))\n    differences = list(compare(expected, actual, accepted=accepted))\n    if differences:\n        raise SystemExit(\"Different fields: \" + \", \".join(differences))\n    print(\"Pass\")\n\n\nif __name__ == \"__main__\":\n    main()\n"},{"path":"tests\/README.md","content":"Give your agent SKILL.md and one request.txt in a fresh session. Keep the expected answer aside. Save the reply as answer.json, then run this from the tests folder:\n\n    python3 check.py case-1\/expected.json answer.json\n\nEach case also has an explanation. Where accepted.json exists, the checker accepts the alternatives listed there.\n"},{"path":"tests\/case-1\/request.txt","content":"Choose treatments for these images in context.\nReturn only the JSON specified in SKILL.md for this test.\n\nI1: a printer icon is the only child of a button; its documented action is Print receipt.\nI2: a second printer icon sits beside the words Print receipt in the same button; adds no information.\nI3: a sales chart contains five monthly values and a seasonal peak; no equivalent data elsewhere.\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"images\": [\n        {\n            \"id\": \"I1\",\n            \"action\": \"name-action\",\n            \"purpose\": \"Print receipt\"\n        },\n        {\n            \"id\": \"I2\",\n            \"action\": \"empty-alt\"\n        },\n        {\n            \"id\": \"I3\",\n            \"action\": \"short-and-long\"\n        }\n    ]\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"Two identical icons require different text treatments because their control names differ.\n"},{"path":"tests\/case-2\/request.txt","content":"Choose treatments for the catalogue images.\nReturn only the JSON specified in SKILL.md for this test.\n\nP1: photo of a chipped rim on a second-hand jug; no text elsewhere describes the defect.\nP2: abstract patterned border for decoration.\nP3: image file 23.jpg, no preview, caption, purpose or other context supplied.\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"images\": [\n        {\n            \"id\": \"P1\",\n            \"action\": \"describe-information\"\n        },\n        {\n            \"id\": \"P2\",\n            \"action\": \"empty-alt\"\n        },\n        {\n            \"id\": \"P3\",\n            \"action\": \"ask-context\"\n        }\n    ]\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"The chipped rim changes a purchasing decision. The filename supplies no basis for a description.\n"}],"is_active":true,"is_approved":false}]}]}