<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PTODesk</title>
    <description>The latest articles on DEV Community by PTODesk (@ptodesk).</description>
    <link>https://dev.to/ptodesk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4138332%2F1fcdfe24-9eee-40f1-9125-d63407e89cdc.png</url>
      <title>DEV Community: PTODesk</title>
      <link>https://dev.to/ptodesk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ptodesk"/>
    <language>en</language>
    <item>
      <title>How to Write a Goal an AI Agent Can Actually Finish (6 Templates)</title>
      <dc:creator>PTODesk</dc:creator>
      <pubDate>Sun, 27 Sep 2026 06:01:48 +0000</pubDate>
      <link>https://dev.to/ptodesk/how-to-write-a-goal-an-ai-agent-can-actually-finish-6-templates-5f28</link>
      <guid>https://dev.to/ptodesk/how-to-write-a-goal-an-ai-agent-can-actually-finish-6-templates-5f28</guid>
      <description>&lt;p&gt;&lt;em&gt;By KattebTeam, AI Agents Platform&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most disappointing AI agent runs fail before the first click. The agent was not bad; the instruction was. "Find me some leads" or "keep an eye on competitors" reads fine to a person, but to an agent it has no finish line, no definition of good, and no idea what it is not allowed to do.&lt;/p&gt;

&lt;p&gt;After watching a lot of agent runs, we think a useful goal always answers five questions. Below are the five, followed by six copy-paste templates.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five parts of a finishable goal
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Outcome&lt;/strong&gt; - what exists when the job is done? A sheet with 20 rows, three replies posted, one report. Countable beats vague.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source&lt;/strong&gt; - where should the agent look? Name the sites, the inbox, the dashboard, the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quality bar&lt;/strong&gt; - what makes one result acceptable and another not? "Companies with 10-50 employees in Germany that sell B2B software" is a filter; "good companies" is not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limits&lt;/strong&gt; - what must it never do? No purchases, no more than N messages, no deleting, ask before publishing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Report&lt;/strong&gt; - how should it prove what it did? Links, row counts, screenshots, and a plain list of what failed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you can't fill in all five, the agent can't either.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six templates
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Lead research
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Find &lt;strong&gt;20&lt;/strong&gt; companies in &lt;strong&gt;[niche]&lt;/strong&gt; in &lt;strong&gt;[country]&lt;/strong&gt; with &lt;strong&gt;[size]&lt;/strong&gt; employees. Use &lt;strong&gt;[directory / search engine]&lt;/strong&gt;. For each: name, website, one decision-maker's public profile, and one sentence on why they fit. Skip companies already in &lt;strong&gt;[sheet]&lt;/strong&gt;. Do not contact anyone. Report the rows as a table.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  2. Competitor price watch
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Open the product pages at &lt;strong&gt;[list of URLs]&lt;/strong&gt; every morning. Record price, stock status and any promotion banner. Flag any change greater than &lt;strong&gt;5%&lt;/strong&gt; compared to yesterday's row. Report only the changes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  3. Review replies
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Read new reviews on &lt;strong&gt;[platform]&lt;/strong&gt; since the last run. Draft a reply to each one in the reviewer's language, thanking them and addressing the specific point they raised. Post replies to 4 and 5 star reviews; for 1-3 stars, save the draft and ask me before posting.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  4. Invoice follow-up
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Check &lt;strong&gt;[billing tool]&lt;/strong&gt; for invoices more than &lt;strong&gt;14 days&lt;/strong&gt; overdue. Send one polite reminder per client using &lt;strong&gt;[template]&lt;/strong&gt;, at most &lt;strong&gt;10&lt;/strong&gt; emails per run. Never change an invoice amount. Report who was reminded and when they were last contacted.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  5. Content publishing
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Publish the article in &lt;strong&gt;[doc]&lt;/strong&gt; to &lt;strong&gt;[platform]&lt;/strong&gt; with the title, tags and cover image given. After publishing, open the public URL while signed out and confirm it loads and contains the link to &lt;strong&gt;[site]&lt;/strong&gt;. Report the URL and the check result.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  6. Weekly SEO check
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;For the keywords in &lt;strong&gt;[sheet]&lt;/strong&gt;, record our position and the top three competitors on &lt;strong&gt;[search engine]&lt;/strong&gt;. Compare with last week. List keywords that dropped more than &lt;strong&gt;3&lt;/strong&gt; positions and the page that replaced us.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why the "report" part matters most
&lt;/h2&gt;

&lt;p&gt;An agent that says "Done!" is not useful. An agent that says "Posted 3 of 4; the fourth platform asked for a phone number, so I stopped" is. Ask for evidence and for failures explicitly, and you will be able to trust the agent with longer jobs over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Take one task from your week, fill in the five parts, and run it. If the first report surprises you, the goal was missing a part; fix that part rather than rewriting everything.&lt;/p&gt;

&lt;p&gt;We build browser-based AI agents for small teams at &lt;a href="https://katteb.com" rel="noopener noreferrer"&gt;https://katteb.com&lt;/a&gt;. Questions about writing agent goals are welcome in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>وكلاء الذكاء الاصطناعي (AI Agents): دليل مبسط للمبتدئين مع أمثلة عملية</title>
      <dc:creator>PTODesk</dc:creator>
      <pubDate>Sat, 26 Sep 2026 02:17:17 +0000</pubDate>
      <link>https://dev.to/ptodesk/wkl-ldhk-lstny-ai-agents-dlyl-mbst-llmbtdyyn-m-mthl-mly-2d1e</link>
      <guid>https://dev.to/ptodesk/wkl-ldhk-lstny-ai-agents-dlyl-mbst-llmbtdyyn-m-mthl-mly-2d1e</guid>
      <description>&lt;p&gt;لم يعد الذكاء الاصطناعي مجرد نافذة محادثة نكتب فيها سؤالًا فنحصل على إجابة. خلال العامين الأخيرين ظهر جيل جديد من الأنظمة يسمى "وكلاء الذكاء الاصطناعي" أو AI Agents، وهي أنظمة لا تكتفي بالرد، بل تخطط وتنفذ وتراجع نتائج عملها حتى تصل إلى هدف محدد. في هذا الدليل نشرح الفكرة من الصفر، بلغة بسيطة، مع أمثلة عملية يمكن لأي شخص أن يتخيلها في عمله اليومي.&lt;/p&gt;

&lt;h2&gt;
  
  
  ما هو وكيل الذكاء الاصطناعي؟
&lt;/h2&gt;

&lt;p&gt;وكيل الذكاء الاصطناعي هو برنامج يعتمد على نموذج لغوي كبير، لكنه يمتلك ثلاث قدرات إضافية تجعله مختلفًا عن روبوت المحادثة العادي:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;هدف واضح&lt;/strong&gt;: لا ينتظر سؤالًا تلو الآخر، بل يُعطى مهمة كاملة مثل "اجمع لي أسعار المنافسين وضعها في جدول".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;أدوات&lt;/strong&gt;: يستطيع استخدام أدوات خارجية مثل المتصفح، والبريد الإلكتروني، وجداول البيانات، وواجهات البرمجة (APIs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;حلقة تفكير وتنفيذ&lt;/strong&gt;: يقسم المهمة إلى خطوات، ينفذ الخطوة الأولى، يقرأ النتيجة، ثم يقرر الخطوة التالية، ويكرر ذلك حتى ينتهي.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;بعبارة أخرى: روبوت المحادثة يشبه موظف استقبال يجيب عن الأسئلة، أما الوكيل فيشبه مساعدًا تنفيذيًا تكلفه بمهمة فيعود إليك بعد إنجازها.&lt;/p&gt;

&lt;h2&gt;
  
  
  كيف يعمل الوكيل من الداخل؟
&lt;/h2&gt;

&lt;p&gt;يمكن تبسيط دورة عمل أي وكيل في أربع مراحل:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;الإدراك&lt;/strong&gt;: يقرأ الوكيل المدخلات، سواء كانت تعليمات المستخدم، أو صفحة ويب، أو ملفًا مرفقًا.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;التخطيط&lt;/strong&gt;: يحول الهدف إلى قائمة خطوات. مثلًا: افتح موقع المنافس، ابحث عن صفحة الأسعار، استخرج الباقات، قارنها بأسعارنا.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;التنفيذ&lt;/strong&gt;: يستدعي الأداة المناسبة لكل خطوة، كأن يفتح المتصفح أو يكتب في ملف.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;المراجعة&lt;/strong&gt;: يتحقق من النتيجة. إذا فشلت خطوة يعدل خطته ويحاول بطريقة أخرى.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;هذه الحلقة البسيطة هي سر قوة الوكلاء؛ فهي تسمح لهم بالتعامل مع مهام متعددة الخطوات كانت تحتاج سابقًا إلى إنسان يتابعها باستمرار.&lt;/p&gt;

&lt;h2&gt;
  
  
  الفرق بين الوكيل والأتمتة التقليدية
&lt;/h2&gt;

&lt;p&gt;قد يسأل البعض: أليست لدينا أدوات أتمتة منذ سنوات؟ الإجابة نعم، لكن الأتمتة التقليدية تعمل وفق قواعد ثابتة: "إذا حدث كذا، افعل كذا". إذا تغير شكل صفحة الويب أو جاءت رسالة بصيغة غير متوقعة، تتوقف الأتمتة.&lt;/p&gt;

&lt;p&gt;الوكيل في المقابل يفهم السياق. إذا تغير تصميم الموقع، يبحث عن الزر الجديد. وإذا كتب العميل رسالته بلهجة عامية، يفهم المقصود. هذه المرونة هي ما يجعل الوكلاء مناسبين للمهام التي تتضمن قراءة وفهمًا واتخاذ قرارات صغيرة متتالية.&lt;/p&gt;

&lt;h2&gt;
  
  
  أبرز استخدامات وكلاء الذكاء الاصطناعي
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. البحث وجمع المعلومات
&lt;/h3&gt;

&lt;p&gt;يمكن للوكيل أن يزور عشرات المواقع، ويقرأ الصفحات، ويستخرج البيانات المطلوبة، ثم يلخصها في تقرير أو جدول. مهمة كانت تستغرق يوم عمل كاملًا قد تنتهي في دقائق.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. خدمة العملاء
&lt;/h3&gt;

&lt;p&gt;وكيل يقرأ رسائل العملاء، ويبحث في قاعدة المعرفة، ويرد على الأسئلة المتكررة، ويحول الحالات المعقدة إلى موظف بشري مع ملخص جاهز للمشكلة.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. كتابة المحتوى وإدارته
&lt;/h3&gt;

&lt;p&gt;من اقتراح الأفكار، إلى البحث عن المصادر، إلى كتابة المسودة الأولى وتنسيقها. أدوات مثل &lt;a href="https://katteb.com" rel="noopener noreferrer"&gt;منصة كتّاب Katteb&lt;/a&gt; تقدم هذا النوع من الوكلاء الذين يساعدون صناع المحتوى على البحث والكتابة والنشر ضمن سير عمل واحد.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. العمليات الإدارية
&lt;/h3&gt;

&lt;p&gt;متابعة الفواتير غير المدفوعة، وإرسال التذكيرات، وتحديث جداول المتابعة، وجدولة الاجتماعات.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. المبيعات
&lt;/h3&gt;

&lt;p&gt;البحث عن العملاء المحتملين، وتجهيز رسائل تواصل مخصصة لكل عميل بناءً على نشاطه، ومتابعة من لم يرد.&lt;/p&gt;

&lt;h2&gt;
  
  
  مثال عملي: وكيل لمراقبة الأسعار
&lt;/h2&gt;

&lt;p&gt;لنفترض أنك تدير متجرًا إلكترونيًا صغيرًا وتريد معرفة أسعار ثلاثة منافسين كل صباح. بدون وكيل، ستفتح المواقع يدويًا وتنسخ الأسعار في جدول. مع وكيل، تكتب له تعليمات واحدة:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"كل يوم الساعة الثامنة صباحًا، افتح صفحات هذه المنتجات عند المنافسين، سجل السعر الحالي وحالة التوفر، وأرسل لي تنبيهًا إذا انخفض أي سعر أكثر من 10٪ عن سعرنا."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ينفذ الوكيل المهمة يوميًا، وإذا تغير تصميم موقع أحد المنافسين فإنه يحاول العثور على السعر في مكانه الجديد بدل أن يتوقف تمامًا.&lt;/p&gt;

&lt;h2&gt;
  
  
  فوائد الاعتماد على الوكلاء
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;توفير الوقت&lt;/strong&gt;: المهام المتكررة تنتقل من جدول الموظف إلى الوكيل.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;الاستمرارية&lt;/strong&gt;: الوكيل يعمل ليلًا ونهارًا دون إرهاق.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;تقليل الأخطاء البشرية&lt;/strong&gt; في المهام الروتينية مثل نسخ البيانات.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;قابلية التوسع&lt;/strong&gt;: يمكنك تشغيل عدة وكلاء في وقت واحد لمهام مختلفة.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;تركيز الفريق على الإبداع&lt;/strong&gt;: عندما تختفي المهام المملة، يتفرغ الفريق للتفكير والتخطيط.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ما الذي يجب الانتباه إليه؟
&lt;/h2&gt;

&lt;p&gt;رغم كل هذه المزايا، الوكلاء ليسوا سحرًا. هناك نقاط مهمة:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;المراجعة البشرية&lt;/strong&gt; ضرورية للمهام الحساسة مثل إرسال رسائل للعملاء أو الدفع.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;الصلاحيات&lt;/strong&gt;: لا تمنح الوكيل وصولًا أكثر مما يحتاجه.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;وضوح التعليمات&lt;/strong&gt;: كلما كان الهدف أوضح، كانت النتائج أدق.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;الخصوصية&lt;/strong&gt;: تأكد من طريقة تعامل الأداة مع بياناتك وبيانات عملائك.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  كيف تبدأ؟
&lt;/h2&gt;

&lt;p&gt;ابدأ بمهمة صغيرة ومتكررة تستهلك وقتك أسبوعيًا، مثل تلخيص رسائل البريد أو جمع بيانات من موقع معين. اكتب خطوات المهمة كما لو كنت تشرحها لموظف جديد، ثم جربها مع وكيل وراقب النتيجة. بعد أن تثق في أدائه، انتقل إلى مهام أكبر.&lt;/p&gt;

&lt;h2&gt;
  
  
  الخلاصة
&lt;/h2&gt;

&lt;p&gt;وكلاء الذكاء الاصطناعي هم الخطوة التالية بعد روبوتات المحادثة: أنظمة تفهم الهدف، وتستخدم الأدوات، وتنجز المهام من البداية إلى النهاية. من يبدأ في تجربتها اليوم بمهام بسيطة سيكون مستعدًا عندما تصبح جزءًا أساسيًا من طريقة عمل كل فريق وكل شركة.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>productivity</category>
      <category>arabic</category>
    </item>
    <item>
      <title>Five accrual denominators, one engine: modelling US sick-leave rules in code</title>
      <dc:creator>PTODesk</dc:creator>
      <pubDate>Wed, 23 Sep 2026 05:33:42 +0000</pubDate>
      <link>https://dev.to/ptodesk/five-accrual-denominators-one-engine-modelling-us-sick-leave-rules-in-code-dkj</link>
      <guid>https://dev.to/ptodesk/five-accrual-denominators-one-engine-modelling-us-sick-leave-rules-in-code-dkj</guid>
      <description>&lt;p&gt;If you have ever added "track paid sick leave" to a backlog, you have probably written down the rule as &lt;em&gt;one hour accrued for every thirty hours worked&lt;/em&gt; and moved on. That constant is wrong often enough to matter, and the way it is wrong is instructive if you build anything that has to encode law.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule surface is wider than one constant
&lt;/h2&gt;

&lt;p&gt;Seventeen states and the District of Columbia mandate paid sick-leave accrual, and they do not agree on the denominator:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1:30&lt;/strong&gt; — the majority, including California, New York, Colorado, New Jersey&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1:35&lt;/strong&gt; — Rhode Island&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1:37&lt;/strong&gt; — DC, and it varies by employer size&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1:40&lt;/strong&gt; — Washington&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1:52&lt;/strong&gt; — Vermont&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Caps differ too. Minnesota and Washington set no annual cap at all, while California limits &lt;em&gt;use&lt;/em&gt; to 40 hours a year and &lt;em&gt;accrual&lt;/em&gt; to 80, which are two separate numbers people routinely collapse into one.&lt;/p&gt;

&lt;p&gt;So the first modelling mistake is storing the denominator as a constant in the accrual service. It belongs in data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The second mistake: no effective date
&lt;/h2&gt;

&lt;p&gt;Legislatures change these numbers, and they change them on a date. If your rules table is a flat lookup keyed on state, then the day a change ships you have silently rewritten history: last year's balances recompute under this year's law, and the numbers your customers reconciled against payroll no longer reproduce.&lt;/p&gt;

&lt;p&gt;The fix is boring and worth doing on day one — key rules on &lt;code&gt;(jurisdiction, effective_from)&lt;/code&gt; and resolve them per ledger entry, not per employee:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;sick_leave_rule&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;jurisdiction&lt;/span&gt;   &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;effective_from&lt;/span&gt; &lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;hours_worked_per_hour_accrued&lt;/span&gt; &lt;span class="nb"&gt;numeric&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- 30, 35, 37, 40, 52&lt;/span&gt;
  &lt;span class="n"&gt;accrual_cap_hours&lt;/span&gt;  &lt;span class="nb"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;-- null means uncapped&lt;/span&gt;
  &lt;span class="n"&gt;annual_use_cap_hours&lt;/span&gt; &lt;span class="nb"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;carryover_allowed&lt;/span&gt;  &lt;span class="nb"&gt;boolean&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;citation&lt;/span&gt;       &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;primary&lt;/span&gt; &lt;span class="k"&gt;key&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;jurisdiction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;effective_from&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;citation&lt;/code&gt; column looks like decoration until the first support ticket that says "our lawyer disagrees with your number." Then it is the whole product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Balances are a fold, not a column
&lt;/h2&gt;

&lt;p&gt;The related design decision: do not store a balance. Store ledger entries — opening balance, each accrual, each use, each adjustment, each carryover expiry — and compute the balance by summing them.&lt;/p&gt;

&lt;p&gt;It costs a little at read time and it buys two things you cannot get otherwise. You can answer "why is my balance 12.5 days?" with arithmetic rather than an apology. And a rule change becomes a recomputation you can diff, instead of a migration that overwrites the evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Proration is where the off-by-one lives
&lt;/h2&gt;

&lt;p&gt;A mid-year hire is the classic failure. Someone joins on 15 June on a 20-day annual entitlement. The naive answer is 20 ÷ 2 = 10. The correct answer depends on what you are prorating against: 200 remaining days of the year gives 20 × 200 ÷ 365 = 10.96. Whether you then round, and in which direction, is a policy choice you should expose rather than bury — rounding down by default quietly shorts every employee a fraction of a day, every year.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would put in the test suite
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Hire dates on 1 Jan, 29 Feb of a leap year, and 31 Dec&lt;/li&gt;
&lt;li&gt;An employee who moves between two jurisdictions mid-year&lt;/li&gt;
&lt;li&gt;A rule whose effective date falls mid pay period&lt;/li&gt;
&lt;li&gt;Semi-monthly pay periods, which are not two-week periods and break any code that assumes a fixed period length&lt;/li&gt;
&lt;li&gt;Termination mid-accrual-period, with and without payout&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is hard. It is just detailed, and detail is exactly what gets skipped when leave tracking is a side feature of a payroll product rather than the product itself.&lt;/p&gt;

&lt;p&gt;I work on &lt;a href="https://ptodesk.com" rel="noopener noreferrer"&gt;PTODesk&lt;/a&gt;, a flat-priced PTO and leave tracker for small teams, and this rules engine is the part I have rewritten most. If you are building something similar, the two decisions I would make earlier next time are: rules in data with effective dates, and balances as a fold over a ledger. Everything else was recoverable.&lt;/p&gt;

</description>
      <category>architecture</category>
    </item>
    <item>
      <title>PTO accrual is date math, not a spreadsheet column: four things that break</title>
      <dc:creator>PTODesk</dc:creator>
      <pubDate>Tue, 22 Sep 2026 21:45:11 +0000</pubDate>
      <link>https://dev.to/ptodesk/pto-accrual-is-date-math-not-a-spreadsheet-column-four-things-that-break-2mm6</link>
      <guid>https://dev.to/ptodesk/pto-accrual-is-date-math-not-a-spreadsheet-column-four-things-that-break-2mm6</guid>
      <description>&lt;p&gt;Most small teams track paid time off in a shared spreadsheet. It works right up until it doesn't, and the failures are always the same four. I have spent the last while building a leave tracker, so here is what I learned about the math.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A balance should be a sum, not a cell
&lt;/h2&gt;

&lt;p&gt;If the balance lives in a cell, you can never answer "why do I have 12.5 days?". Store every event instead — opening balance, each accrual, each booking, each adjustment — and derive the balance as a sum of the ledger. It costs you a join and buys you an audit trail plus the ability to show an employee the arithmetic instead of asking them to trust it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;opening   +10.96
accrual   + 0.63   (pay period 17)
usage     - 1.00
--------------------
available   10.59
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Accrued, available and projected are three different numbers
&lt;/h2&gt;

&lt;p&gt;Employees read one number and assume it is theirs. It usually isn't:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;accrued&lt;/strong&gt; — what the ledger says has been earned to date&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;available&lt;/strong&gt; — accrued minus days already booked but not yet taken&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;projected&lt;/strong&gt; — accrued plus what will accrue by a future date&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A request in June for two weeks at Christmas is valid against &lt;em&gt;projected&lt;/em&gt;, not against &lt;em&gt;available&lt;/em&gt;. Systems that only model &lt;em&gt;available&lt;/em&gt; force managers back into a side calendar, which defeats the point of tracking at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Mid-year proration is a real formula, and it is easy to get wrong
&lt;/h2&gt;

&lt;p&gt;Hire someone on 15 June on a 20-day policy and they do not get 20 days, and they do not get 10 either. Over a calendar year:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20 × 200 / 365 = 10.96 days
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;200 being the days remaining in the year from the hire date. Rounding this to "half the year, so half the entitlement" is the single most common spreadsheet bug I have seen, and it compounds because next year's carryover is computed from it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. US state sick leave does not use one denominator
&lt;/h2&gt;

&lt;p&gt;If you are building for US teams: seventeen states and DC mandate paid sick leave accrual, and they do not agree on the rate.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rate&lt;/th&gt;
&lt;th&gt;Where&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1 hr / 30 worked&lt;/td&gt;
&lt;td&gt;14 states&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 hr / 35 worked&lt;/td&gt;
&lt;td&gt;Rhode Island&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 hr / 37 worked&lt;/td&gt;
&lt;td&gt;DC (varies by employer size)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 hr / 40 worked&lt;/td&gt;
&lt;td&gt;Washington&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 hr / 52 worked&lt;/td&gt;
&lt;td&gt;Vermont&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Caps differ too — Minnesota and Washington have no annual cap at all. The practical lesson is that the rule cannot be a constant in your code. It needs an effective date and a citation, so that when a legislature changes something you can see what changed, when, and which balances were computed under the old rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;If you are writing this yourself: model the ledger first, keep the three balance types distinct, prorate on days rather than months, and version your jurisdiction rules by effective date. If you would rather not write it, this is what I build at &lt;a href="https://ptodesk.com" rel="noopener noreferrer"&gt;PTODesk&lt;/a&gt; — happy to answer questions about any of the above in the comments.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>database</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
