{"skills":[{"name":"Find rota coverage gaps","description":"Compare staffed time with demand and identify the exact windows where an open desk is short of people.","content":"# Find rota coverage gaps\n\nCompare staffed time with demand and identify the exact windows where an open desk is short of people.\n\n## When to use this skill\n\n- A manager wants to know whether next week's rota covers every desk or role at the required level.\n- Lunch breaks, part shifts or absences might leave a counter or phone line short.\n- Staff can cover more than one role and someone asks whether any assignment could cover everything.\n\n## When not to use it\n\n- Building a rota from scratch. The method checks a proposed rota.\n- Detailed working time compliance such as opt-outs, night work or young workers' rules. In the UK, check GOV.UK or Acas guidance.\n- Forecasting how many staff each hour needs. The required headcount is an input.\n\n## What you need\n\n- Service window and required simultaneous headcount by role\n- Named shifts, breaks, absences, role skills and staff already committed elsewhere\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What hours does each role need covering, and how many people at each time?\n- Does the rota include breaks, absences and training, or only shift start and end times?\n- Which staff can cover which roles?\n- Are some people fixed to a role, or can anyone be moved?\n\n## Method\n\n1. Normalise times to one service day and timezone. Clip shifts and requirements to the service window, splitting across midnight where needed. Use half-open intervals: a shift ending at 12:00 does not cover work starting at 12:00.\n2. Set interval boundaries wherever demand, a shift or a break changes. For each interval, count distinct eligible people for the role after removing breaks, absences and other commitments. Two rows for the same person are one person.\n3. Check that the breaks the rota will need are shown. In the UK, GOV.UK guidance gives workers over 18 an uninterrupted 20-minute break when they work more than 6 hours a day; a long shift with no break listed means cover will drop at a time the rota does not show. Elsewhere, check the local rules.\n4. Calculate the shortage as demand less people available, where positive. Merge adjoining intervals with the same role and shortage. Keep surplus in other hours separate; it does not offset a gap.\n5. Multiply each shortage by the interval length to get staff-minutes short.\n6. For multi-skilled staff, separate the posted assignment from a feasibility check. For feasibility, honour fixed seats, then match people to the remaining eligible seats, each person at most once per interval. If several roles could take an unavoidable shortfall, report the number of uncovered seats and the possible roles without claiming which desk was empty.\n\n## Checks before you deliver\n\n- A whole-day average can look adequate while lunch breaks leave a service uncovered.\n- Two overlapping rows for the same employee are one person, even when the rota export lists two activities.\n- Treating a shift that ends at 12:00 as covering 12:00 creates a hidden gap at every handover.\n- Counting one multi-skilled person in two roles at the same time.\n- Using surplus staff in one hour to cancel a shortage in another.\n\n## How to present the result\n\nLead with the total staff-minutes short and the worst window. Then give a table of gaps in time order: role, start, end, people short and cause (break, shift end, absence). For multi-skilled teams, say whether a different assignment closes the gap. Finish with suggested fixes, such as moving a break or extending a shift, for the manager to confirm.\n\n## Worked example\n\n**Request:** Check the booking desk between 09:00 and 13:00.\n\n**Supplied material:**\n\n```text\nRole DESK needs two people throughout. One timezone. N works 09:00-13:00, breaks 11:00-11:30. K works 09:00-12:00, no break. L works 12:15-13:00. No other assignments.\n```\n\n**Answer:** The booking desk is one person short from 11:00 to 11:30 during N\u2019s break, and from 12:00 to 12:15 between K and L. Arrange 45 staff-minutes of relief across those two windows.\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 gaps as a list sorted by start then role, with role, start and end (24-hour HH:MM) and short (headcount). Return staff_minutes_short as a whole number. For a cross-midnight service split output by the supplied service day. For an unassigned coverage-feasibility gap with several equally valid uncovered roles, list alternatives as sorted possible_roles in place of role, and count the shortage once.\n\n## Sources\n\n- [Microsoft \u00b7 Use the intraday performance report](https:\/\/learn.microsoft.com\/en-us\/dynamics365\/contact-center\/use\/workforce-management-use-performance-report): Microsoft's intraday report compares required and scheduled staff interval by interval, shows Over\/Under as scheduled less required with negative values flagging understaffing, and suggests moving breaks or extending shifts to close gaps.\n- [GOV.UK \u00b7 Rest breaks at work](https:\/\/www.gov.uk\/rest-breaks-work): UK guidance: workers over 18 have the right to one uninterrupted 20-minute break if they work more than 6 hours a day, and to 11 hours' rest between working days. The skill checks that required breaks appear on the rota, because a missing break still creates a gap on the day.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/find-rota-coverage-gaps\n","scope":"contextual","trigger_keywords":["Find rota coverage gaps","find-rota-coverage-gaps","find rota coverage gaps","Does next week\u2019s rota cover every role at the right level?","Does next week\u2019s rota cover every role at the right level","rota coverage","gaps in the rota","shifts without cover"],"is_private":true,"is_active":true,"scripts":[{"name":"find-rota-coverage-gaps-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":"find-rota-coverage-gaps-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: find-rota-coverage-gaps\ndescription: \"Compare a staff rota with the cover each role needs over time and list the exact windows where a desk or role is short, after breaks, absences and duplicate rows. Use when checking a rota, shift plan or staff schedule for gaps in cover.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/find-rota-coverage-gaps\n---\n\n# Find rota coverage gaps\n\nCompare staffed time with demand and identify the exact windows where an open desk is short of people.\n\n## When to use this skill\n\n- A manager wants to know whether next week's rota covers every desk or role at the required level.\n- Lunch breaks, part shifts or absences might leave a counter or phone line short.\n- Staff can cover more than one role and someone asks whether any assignment could cover everything.\n\n## When not to use it\n\n- Building a rota from scratch. The method checks a proposed rota.\n- Detailed working time compliance such as opt-outs, night work or young workers' rules. In the UK, check GOV.UK or Acas guidance.\n- Forecasting how many staff each hour needs. The required headcount is an input.\n\n## What you need\n\n- Service window and required simultaneous headcount by role\n- Named shifts, breaks, absences, role skills and staff already committed elsewhere\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What hours does each role need covering, and how many people at each time?\n- Does the rota include breaks, absences and training, or only shift start and end times?\n- Which staff can cover which roles?\n- Are some people fixed to a role, or can anyone be moved?\n\n## Method\n\n1. Normalise times to one service day and timezone. Clip shifts and requirements to the service window, splitting across midnight where needed. Use half-open intervals: a shift ending at 12:00 does not cover work starting at 12:00.\n2. Set interval boundaries wherever demand, a shift or a break changes. For each interval, count distinct eligible people for the role after removing breaks, absences and other commitments. Two rows for the same person are one person.\n3. Check that the breaks the rota will need are shown. In the UK, GOV.UK guidance gives workers over 18 an uninterrupted 20-minute break when they work more than 6 hours a day; a long shift with no break listed means cover will drop at a time the rota does not show. Elsewhere, check the local rules.\n4. Calculate the shortage as demand less people available, where positive. Merge adjoining intervals with the same role and shortage. Keep surplus in other hours separate; it does not offset a gap.\n5. Multiply each shortage by the interval length to get staff-minutes short.\n6. For multi-skilled staff, separate the posted assignment from a feasibility check. For feasibility, honour fixed seats, then match people to the remaining eligible seats, each person at most once per interval. If several roles could take an unavoidable shortfall, report the number of uncovered seats and the possible roles without claiming which desk was empty.\n\n## Checks before you deliver\n\n- A whole-day average can look adequate while lunch breaks leave a service uncovered.\n- Two overlapping rows for the same employee are one person, even when the rota export lists two activities.\n- Treating a shift that ends at 12:00 as covering 12:00 creates a hidden gap at every handover.\n- Counting one multi-skilled person in two roles at the same time.\n- Using surplus staff in one hour to cancel a shortage in another.\n\n## How to present the result\n\nLead with the total staff-minutes short and the worst window. Then give a table of gaps in time order: role, start, end, people short and cause (break, shift end, absence). For multi-skilled teams, say whether a different assignment closes the gap. Finish with suggested fixes, such as moving a break or extending a shift, for the manager to confirm.\n\n## Worked example\n\n**Request:** Check the booking desk between 09:00 and 13:00.\n\n**Supplied material:**\n\n```text\nRole DESK needs two people throughout. One timezone. N works 09:00-13:00, breaks 11:00-11:30. K works 09:00-12:00, no break. L works 12:15-13:00. No other assignments.\n```\n\n**Answer:** The booking desk is one person short from 11:00 to 11:30 during N\u2019s break, and from 12:00 to 12:15 between K and L. Arrange 45 staff-minutes of relief across those two windows.\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 gaps as a list sorted by start then role, with role, start and end (24-hour HH:MM) and short (headcount). Return staff_minutes_short as a whole number. For a cross-midnight service split output by the supplied service day. For an unassigned coverage-feasibility gap with several equally valid uncovered roles, list alternatives as sorted possible_roles in place of role, and count the shortage once.\n\n## Sources\n\n- [Microsoft \u00b7 Use the intraday performance report](https:\/\/learn.microsoft.com\/en-us\/dynamics365\/contact-center\/use\/workforce-management-use-performance-report): Microsoft's intraday report compares required and scheduled staff interval by interval, shows Over\/Under as scheduled less required with negative values flagging understaffing, and suggests moving breaks or extending shifts to close gaps.\n- [GOV.UK \u00b7 Rest breaks at work](https:\/\/www.gov.uk\/rest-breaks-work): UK guidance: workers over 18 have the right to one uninterrupted 20-minute break if they work more than 6 hours a day, and to 11 hours' rest between working days. The skill checks that required breaks appear on the rota, because a missing break still creates a gap on the day.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/find-rota-coverage-gaps\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\/find-rota-coverage-gaps\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# Lunch creates a shortfall\n\nCheck the booking desk between 09:00 and 13:00.\n\n## Supplied material\n\nRole DESK needs two people throughout. One timezone. N works 09:00-13:00, breaks 11:00-11:30. K works 09:00-12:00, no break. L works 12:15-13:00. No other assignments.\n\n## Worked answer\n\nThe booking desk is one person short from 11:00 to 11:30 during N\u2019s break, and from 12:00 to 12:15 between K and L. Arrange 45 staff-minutes of relief across those two windows.\n\n## Reasoning\n\nCover resumes when the break ends, then a separate gap opens after K finishes.\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":"Check the booking desk between 09:00 and 13:00.\nReturn only the JSON specified in SKILL.md for this test.\n\nRole DESK needs two people throughout. One timezone. N works 09:00-13:00, breaks 11:00-11:30. K works 09:00-12:00, no break. L works 12:15-13:00. No other assignments.\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"gaps\": [\n        {\n            \"role\": \"DESK\",\n            \"start\": \"11:00\",\n            \"end\": \"11:30\",\n            \"short\": 1\n        },\n        {\n            \"role\": \"DESK\",\n            \"start\": \"12:00\",\n            \"end\": \"12:15\",\n            \"short\": 1\n        }\n    ],\n    \"staff_minutes_short\": 45\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"Cover resumes when the break ends, then a separate gap opens after K finishes.\n"},{"path":"tests\/case-2\/request.txt","content":"Where are we below cover between 14:00 and 15:00?\nReturn only the JSON specified in SKILL.md for this test.\n\nRole PHONE needs 2 until 14:30 and 1 from 14:30. Sam PHONE shift 14:00-15:00; duplicated booking for Sam under PHONE 14:00-14:45. No other person.\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"gaps\": [\n        {\n            \"role\": \"PHONE\",\n            \"start\": \"14:00\",\n            \"end\": \"14:30\",\n            \"short\": 1\n        }\n    ],\n    \"staff_minutes_short\": 30\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"Duplicated roster rows cannot create a second operator.\n"},{"path":"tests\/case-3\/request.txt","content":"Could this team cover all required roles regardless of how we assign them?\nReturn only the JSON specified in SKILL.md for this test.\n\n09:00\u201312:00 require one BARISTA and one SUPERVISOR continuously. Maya qualifies for either throughout, Ali only BARISTA 09:00\u201311:00, Bea only BARISTA 11:30\u201312:00. No breaks, commitments or fixed assignments.\n"},{"path":"tests\/case-3\/expected.json","content":"{\n    \"gaps\": [\n        {\n            \"possible_roles\": [\n                \"BARISTA\",\n                \"SUPERVISOR\"\n            ],\n            \"start\": \"11:00\",\n            \"end\": \"11:30\",\n            \"short\": 1\n        }\n    ],\n    \"staff_minutes_short\": 30\n}\n"},{"path":"tests\/case-3\/explanation.txt","content":"Maya covers supervisor while Ali or Bea covers barista. When alone Maya can take either role, leaving one 30-minute seat uncovered.\n"}],"is_active":true,"is_approved":false}]}]}