Library › Leadership AI › Operations and supply chain

Apply on-call swap rules and output the final rota as JSON

  • For Operations and supply chain
  • You practice Catching mistakes and made-up facts
  • Time about 5 minutes
  • Level Advanced

About this exercise

Decide the swap requests in the order received. Rules: no one is on call two weeks in a row, and a swap needs both people to have agreed. A request is approved only if it follows both rules given the rota at that point. Output one json code block and nothing else, with keys "final_rota" (an array of 6 names, week 1 first), "approved" (a number) and "declined" (an array of two reasons, each under 12 words). At most 12 lines inside the block.

Common mistakes when you ask AI for this

  • Ignoring the order. The AI approves request 2 before request 1. Try: Say: "Process the requests in the order received, updating the rota after each."
  • Missing the back-to-back check. The AI approves request 2 because both agreed. Try: Say: "Check the consecutive-weeks rule on the updated rota."
  • Treating silence as yes. The AI approves request 3 because Raj is generally happy. Try: Say: "A swap needs both people to have agreed."
  • Wrong shape. The AI explains outside the block. Try: Say: "One json code block and nothing else."
  • Long block. The AI pretty-prints extra keys. Try: Say: "Only the three keys, at most 12 lines."

What a strong prompt includes

  • Gives the key names
  • States both rules
  • Says order received
  • One code block only
  • Caps reason length

Practice this now ↑

Related exercises