Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add fabioc-aloha/Alex_Skill_Mall --skill date-threshold-arithmeticgit clone --depth 1 https://github.com/fabioc-aloha/Alex_Skill_MallWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/fabioc-aloha/alex_skill_mall/date-threshold-arithmetic)<a href="https://agentmods.dev/skills/fabioc-aloha/alex_skill_mall/date-threshold-arithmetic"><img src="https://agentmods.dev/badge/skills/fabioc-aloha/alex_skill_mall/date-threshold-arithmetic.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00016 | $0.00568 |
| Opus 5 | $0.00008 | $0.00284 |
| Sonnet 5 | $0.00003 | $0.00114 |
| Haiku 4.5 | $0.00002 | $0.00057 |
Grade A, and why
date-threshold-arithmetic scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Date Threshold Arithmetic
The Problem
Date comparisons at thresholds fail due to fractional days:
const daysBetween = (Date.now() - someDate.getTime()) / (1000 * 60 * 60 * 24);
// someDate is "exactly 7 days ago"
// daysBetween = 7.000012 (due to milliseconds)
// if (daysBetween > 7) { ... } // TRUE — unexpected!
The Solution
Always Math.floor() before threshold comparison.
function daysSince(date) {
const ms = Date.now() - new Date(date).getTime();
return Math.floor(ms / (1000 * 60 * 60 * 24));
}
// Now "exactly 7 days" = 7, not 7.000012
if (daysSince(lastCheck) > 7) {
// Truly more than 7 full days
}
Common Traps
| Code | Bug |
|---|---|
days > 7 |
Triggers on 7.0001 |
days >= 7 |
Doesn't trigger on 6.9999 |
days === 7 |
Never true for fractional values |
Safe Patterns
// Days since (full days only)
const fullDays = Math.floor((now - then) / MS_PER_DAY);
// Is it past the threshold?
if (fullDays > threshold) { ... }
// Is it on or past the threshold?
if (fullDays >= threshold) { ... }
// Is it exactly N days?
if (fullDays === threshold) { ... }
For Cron-Style Checks
// "Run if last run was more than 24 hours ago"
const lastRun = new Date(stored.lastRunTime);
const hoursSince = (Date.now() - lastRun.getTime()) / (1000 * 60 * 60);
// Use Math.floor for "full hours"
if (Math.floor(hoursSince) >= 24) {
runTask();
}
Verification
// Test edge case
const exactlySevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
console.log(daysSince(exactlySevenDaysAgo)); // Should be 7, not 7.xxx
When to Apply
- Cache expiration checks
- "Last N days" filters
- Scheduled task triggers
- Any date-based threshold
Tags
quality dates javascript bugs
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 92 lines · 16 tokens per session scan A d5e7c685dca8
date-threshold-arithmetic is a skill published in the GitHub repository fabioc-aloha/Alex_Skill_Mall (4 stars, last pushed yesterday), licensed MIT. It adds 16 tokens to every session and 568 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
ai-provider-anthropic-sdk
Official Anthropic SDK patterns for TypeScript/Node.js — client setup, Messages API, streaming, tool use, vision, extended thinking, structured outputs, prompt caching, batch API, and production best practices.
ai-provider-mistral-sdk
Official Mistral AI TypeScript SDK patterns — client setup, chat completions, streaming, function calling, structured outputs, embeddings, vision, Codestral FIM, and production best practices.
ai-provider-openai-sdk
Official OpenAI SDK patterns for TypeScript/Node.js — client setup, Chat Completions, Responses API, streaming, structured outputs, function calling, embeddings, vision, audio, and production best practices.
meta-design-expressive-typescript
Readable functional patterns — orchestrators, pure functions, named abstractions.
ai-infrastructure-ollama
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output, model management, and OpenAI-compatible endpoint.
ai-infrastructure-replicate
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning, deployments, and training.