{"skills":[{"name":"Forecast cash shortfalls by period","description":"Roll an opening bank balance through expected receipt and payment dates to find the first funding gap.","content":"# Forecast cash shortfalls by period\n\nRoll an opening bank balance through expected receipt and payment dates to find the first funding gap.\n\n## When to use this skill\n\n- Someone asks whether the business can pay wages, rent, suppliers or a tax bill over the coming weeks or months.\n- A customer is paying late and the owner wants to see when the bank balance dips below a safe level.\n- A lender, investor or the owner wants a simple cash flow forecast showing the funding gap.\n\n## When not to use it\n\n- Profit budgets or management accounts. Those are prepared on an accruals basis; this method follows cash only.\n- Choosing or applying for finance. The forecast supports that conversation with a lender or accountant but does not recommend a product.\n- A business that already cannot pay its debts when they fall due. Its owners or directors should get advice from an accountant or, in the UK, a licensed insolvency practitioner promptly.\n\n## What you need\n\n- Opening cleared cash, start date, reporting periods and dated receipts and payments\n- Scenario exclusions, the minimum cash buffer and any facilities with their terms\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What cleared bank balance are you starting from, and on what date? An accounting balance with uncleared items gives a false start.\n- What minimum balance do you want to keep, and does it apply at each period end or on every day?\n- When do customers actually pay compared with your terms? Late payers move receipts into later periods.\n- Which receipts are certain and which are hoped for, and which scenario should the forecast show?\n\n## Method\n\n1. Set the horizon and periods. Cover at least one full cash cycle, use weeks when cash is tight, and work in one currency. Start from the cleared bank balance on the start date, counted once.\n2. Put each flow in the period the money reaches or leaves the bank, not the period it was invoiced or earned. Include non-sales receipts and outflows such as tax payments, loan repayments, capital purchases and owner drawings. Leave out depreciation, other non-cash items and debts that will not be paid.\n3. Split committed flows from uncertain pipeline. Apply the scenario requested and record each excluded flow by source ID.\n4. For each period, closing equals opening plus receipts less payments. Carry the closing balance into the next period even if it is negative.\n5. Find the first period close strictly below the buffer. The funding gap is the buffer less the lowest period close; one injection of that size carries forward, so do not add up the shortfalls of successive periods.\n6. When the question is whether payments can be met on their dates, roll the balance through the dated flows in date order. Report the first dated shortfall, the lowest dated balance and the dated funding gap separately from the period-end figures. Do not claim an intraday low when the order of same-day items is unknown.\n7. Treat an overdraft or credit line as cash only when a draw is assumed. Record the draw date, limit and cost, and show the forecast before and after financing.\n8. State every assumption, especially customer payment timing, and say when the forecast should next be updated.\n\n## Checks before you deliver\n\n- Sales booked in a month can settle in a later month.\n- Adding a new top-up at every negative period double-counts the same cash shortfall when one injection would carry forward.\n- Starting from the accounting balance rather than cleared funds counts receipts that have not reached the bank.\n- An undrawn overdraft or credit line is not cash. Counting it hides the shortfall.\n- A healthy period-end balance can hide a payment date in the middle of the period when the account goes overdrawn.\n- Where receipts include VAT or sales tax, the later payment to the tax authority is an outflow. Leaving it out overstates cash.\n\n## How to present the result\n\nLead with the first period, or date, that cash falls below the buffer and the largest top-up needed, or say the buffer holds. Then give a table by period: opening, receipts, payments, closing and gap to buffer. If dated flows were tested, add the lowest dated balance and its date. List assumptions and excluded items, and the options that would close the gap.\n\n## Worked example\n\n**Request:** Show the committed monthly cash forecast and buffer gap.\n\n**Supplied material:**\n\n```text\nGBP opening 800, buffer 200. Apr: pay rent 500 and wages 300, depreciation 80; invoice sale 900 received in May. May: pay wages 300. Jun: committed receipt 400, pay 250. Exclude speculative sales.\n```\n\n**Answer:** April closes at \u00a30, May at \u00a3600 and June at \u00a3750. April is \u00a3200 below the required buffer, the largest month-end funding gap. The \u00a3900 May receipt provides no April cash, and depreciation does not draw cash.\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 closing as an object mapping each period label to its signed closing balance, first_below_buffer as a period label or null, and maximum_funding_gap as a non-negative money amount calculated against the lowest period close. For a dated liquidity check also return first_dated_shortfall (ISO date or null), lowest_dated_balance and dated_funding_gap against the buffer. Avoid claiming an intraday low if same-day transaction sequence is unknown.\n\n## Sources\n\n- [British Business Bank \u00b7 How to create a cash flow forecast](https:\/\/www.british-business-bank.co.uk\/business-guidance\/guidance-articles\/finance\/how-to-create-a-cash-flow-forecast-in-4-steps): The British Business Bank's four-step method puts each item in the week or month the cash is actually in the bank, includes non-sales income and all outgoings, keeps a running total and covers at least the cash flow cycle. The skill follows the same structure.\n- [ACCA \u00b7 Cash budgets](https:\/\/www.accaglobal.com\/gb\/en\/student\/exam-support-resources\/fundamentals-exams-study-resources\/f2\/technical-articles\/cash-budgets.html): ACCA's article shows that sales revenue does not equal cash inflow, that depreciation is a non-cash item left out, that irrecoverable debts never become cash, and that each closing balance becomes the next opening. These are the rules for what goes in each period.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/forecast-cash-shortfalls\n","scope":"contextual","trigger_keywords":["Forecast cash shortfalls by period","forecast-cash-shortfalls","forecast cash shortfalls","Will we have enough cash for wages and the VAT bill over the next three months?","Will we have enough cash for wages and the VAT bill over the next three months","cash shortfall","cash flow forecast","cashflow forecast"],"is_private":true,"is_active":true,"scripts":[{"name":"forecast-cash-shortfalls-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":"forecast-cash-shortfalls-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: forecast-cash-shortfalls\ndescription: \"Roll a cleared bank balance forward through dated receipts and payments to find the first period below a minimum buffer and the largest top-up needed. Use when someone asks whether they will run short of cash, needs a cash flow forecast or wants to test a payment date.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/forecast-cash-shortfalls\n---\n\n# Forecast cash shortfalls by period\n\nRoll an opening bank balance through expected receipt and payment dates to find the first funding gap.\n\n## When to use this skill\n\n- Someone asks whether the business can pay wages, rent, suppliers or a tax bill over the coming weeks or months.\n- A customer is paying late and the owner wants to see when the bank balance dips below a safe level.\n- A lender, investor or the owner wants a simple cash flow forecast showing the funding gap.\n\n## When not to use it\n\n- Profit budgets or management accounts. Those are prepared on an accruals basis; this method follows cash only.\n- Choosing or applying for finance. The forecast supports that conversation with a lender or accountant but does not recommend a product.\n- A business that already cannot pay its debts when they fall due. Its owners or directors should get advice from an accountant or, in the UK, a licensed insolvency practitioner promptly.\n\n## What you need\n\n- Opening cleared cash, start date, reporting periods and dated receipts and payments\n- Scenario exclusions, the minimum cash buffer and any facilities with their terms\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What cleared bank balance are you starting from, and on what date? An accounting balance with uncleared items gives a false start.\n- What minimum balance do you want to keep, and does it apply at each period end or on every day?\n- When do customers actually pay compared with your terms? Late payers move receipts into later periods.\n- Which receipts are certain and which are hoped for, and which scenario should the forecast show?\n\n## Method\n\n1. Set the horizon and periods. Cover at least one full cash cycle, use weeks when cash is tight, and work in one currency. Start from the cleared bank balance on the start date, counted once.\n2. Put each flow in the period the money reaches or leaves the bank, not the period it was invoiced or earned. Include non-sales receipts and outflows such as tax payments, loan repayments, capital purchases and owner drawings. Leave out depreciation, other non-cash items and debts that will not be paid.\n3. Split committed flows from uncertain pipeline. Apply the scenario requested and record each excluded flow by source ID.\n4. For each period, closing equals opening plus receipts less payments. Carry the closing balance into the next period even if it is negative.\n5. Find the first period close strictly below the buffer. The funding gap is the buffer less the lowest period close; one injection of that size carries forward, so do not add up the shortfalls of successive periods.\n6. When the question is whether payments can be met on their dates, roll the balance through the dated flows in date order. Report the first dated shortfall, the lowest dated balance and the dated funding gap separately from the period-end figures. Do not claim an intraday low when the order of same-day items is unknown.\n7. Treat an overdraft or credit line as cash only when a draw is assumed. Record the draw date, limit and cost, and show the forecast before and after financing.\n8. State every assumption, especially customer payment timing, and say when the forecast should next be updated.\n\n## Checks before you deliver\n\n- Sales booked in a month can settle in a later month.\n- Adding a new top-up at every negative period double-counts the same cash shortfall when one injection would carry forward.\n- Starting from the accounting balance rather than cleared funds counts receipts that have not reached the bank.\n- An undrawn overdraft or credit line is not cash. Counting it hides the shortfall.\n- A healthy period-end balance can hide a payment date in the middle of the period when the account goes overdrawn.\n- Where receipts include VAT or sales tax, the later payment to the tax authority is an outflow. Leaving it out overstates cash.\n\n## How to present the result\n\nLead with the first period, or date, that cash falls below the buffer and the largest top-up needed, or say the buffer holds. Then give a table by period: opening, receipts, payments, closing and gap to buffer. If dated flows were tested, add the lowest dated balance and its date. List assumptions and excluded items, and the options that would close the gap.\n\n## Worked example\n\n**Request:** Show the committed monthly cash forecast and buffer gap.\n\n**Supplied material:**\n\n```text\nGBP opening 800, buffer 200. Apr: pay rent 500 and wages 300, depreciation 80; invoice sale 900 received in May. May: pay wages 300. Jun: committed receipt 400, pay 250. Exclude speculative sales.\n```\n\n**Answer:** April closes at \u00a30, May at \u00a3600 and June at \u00a3750. April is \u00a3200 below the required buffer, the largest month-end funding gap. The \u00a3900 May receipt provides no April cash, and depreciation does not draw cash.\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 closing as an object mapping each period label to its signed closing balance, first_below_buffer as a period label or null, and maximum_funding_gap as a non-negative money amount calculated against the lowest period close. For a dated liquidity check also return first_dated_shortfall (ISO date or null), lowest_dated_balance and dated_funding_gap against the buffer. Avoid claiming an intraday low if same-day transaction sequence is unknown.\n\n## Sources\n\n- [British Business Bank \u00b7 How to create a cash flow forecast](https:\/\/www.british-business-bank.co.uk\/business-guidance\/guidance-articles\/finance\/how-to-create-a-cash-flow-forecast-in-4-steps): The British Business Bank's four-step method puts each item in the week or month the cash is actually in the bank, includes non-sales income and all outgoings, keeps a running total and covers at least the cash flow cycle. The skill follows the same structure.\n- [ACCA \u00b7 Cash budgets](https:\/\/www.accaglobal.com\/gb\/en\/student\/exam-support-resources\/fundamentals-exams-study-resources\/f2\/technical-articles\/cash-budgets.html): ACCA's article shows that sales revenue does not equal cash inflow, that depreciation is a non-cash item left out, that irrecoverable debts never become cash, and that each closing balance becomes the next opening. These are the rules for what goes in each period.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/forecast-cash-shortfalls\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\/forecast-cash-shortfalls\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# Customer pays a month later\n\nShow the committed monthly cash forecast and buffer gap.\n\n## Supplied material\n\nGBP opening 800, buffer 200. Apr: pay rent 500 and wages 300, depreciation 80; invoice sale 900 received in May. May: pay wages 300. Jun: committed receipt 400, pay 250. Exclude speculative sales.\n\n## Worked answer\n\nApril closes at \u00a30, May at \u00a3600 and June at \u00a3750. April is \u00a3200 below the required buffer, the largest month-end funding gap. The \u00a3900 May receipt provides no April cash, and depreciation does not draw cash.\n\n## Reasoning\n\nOnly the May receipt changes the bank balance for that sale.\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":"Show the committed monthly cash forecast and buffer gap.\nReturn only the JSON specified in SKILL.md for this test.\n\nGBP opening 800, buffer 200. Apr: pay rent 500 and wages 300, depreciation 80; invoice sale 900 received in May. May: pay wages 300. Jun: committed receipt 400, pay 250. Exclude speculative sales.\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"closing\": {\n        \"Apr\": 0,\n        \"May\": 600,\n        \"Jun\": 750\n    },\n    \"first_below_buffer\": \"Apr\",\n    \"maximum_funding_gap\": 200\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"Only the May receipt changes the bank balance for that sale.\n"},{"path":"tests\/case-2\/request.txt","content":"When will the cash forecast first breach our buffer?\nReturn only the JSON specified in SKILL.md for this test.\n\nEUR opening 100, buffer 50. W1 pay 50. W2 pay 60. W3 receive 30. No other movements.\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"closing\": {\n        \"W1\": 50,\n        \"W2\": -10,\n        \"W3\": 20\n    },\n    \"first_below_buffer\": \"W2\",\n    \"maximum_funding_gap\": 60\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"Equality meets the buffer. The deepest period-end shortfall is \u20ac60.\n"},{"path":"tests\/case-3\/request.txt","content":"Will this week both close positive and cover each payment?\nReturn only the JSON specified in SKILL.md for this test.\n\nGBP. Week ending 2026-11-06. Opening 250, buffer 0. Supplier debit 400 on Tue 2026-11-03; customer pays 300 Fri 2026-11-06. An undrawn credit line of 500 exists. Forecast before financing, no other cash flows.\n"},{"path":"tests\/case-3\/expected.json","content":"{\n    \"closing\": {\n        \"2026-11-06\": 150\n    },\n    \"first_below_buffer\": null,\n    \"maximum_funding_gap\": 0,\n    \"first_dated_shortfall\": \"2026-11-03\",\n    \"lowest_dated_balance\": -150,\n    \"dated_funding_gap\": 150\n}\n"},{"path":"tests\/case-3\/explanation.txt","content":"The Friday receipt restores the balance. On Tuesday the forecast needs \u00a3150 in financing or a changed payment schedule.\n"}],"is_active":true,"is_approved":false}]}]}