.claude/skills/add-cron-job/SKILL.md
Create a scheduled background job using node-cron with logging, error handling, and health tracking. Use for nightly recalculations, campaign processing, alert checks.
npx skillsauth add malhajri07/real-estate-CRM-project add-cron-jobInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Creates a new scheduled background job that runs on a cron schedule. Includes execution logging, error handling, retry logic, and health monitoring.
0 2 * * * for 2am daily, */15 * * * * for every 15 min)Check cron infrastructure exists. Read apps/api/cron/index.ts. If missing, create:
import cron from "node-cron";
const jobs: Map<string, cron.ScheduledTask> = new Map();
export function registerJob(name: string, schedule: string, handler: () => Promise<void>) { ... }
Create the job file at apps/api/cron/{job-name}.ts:
export async function handler() {
const startedAt = Date.now();
// ... business logic using prisma
const duration = Date.now() - startedAt;
await prisma.cron_runs.create({ data: { jobName, status: "SUCCESS", durationMs: duration } });
}
Register the job in apps/api/cron/index.ts:
import { handler as recalcScores } from "./recalculate-lead-scores";
registerJob("recalculate-lead-scores", "0 2 * * *", recalcScores);
Add the cron_runs tracking model (if not exists):
model cron_runs {
id String @id @default(uuid())
jobName String
status String // SUCCESS, FAILED
durationMs Int
error String?
createdAt DateTime @default(now())
}
Add error handling wrapper:
try { await handler(); }
catch (err) { await prisma.cron_runs.create({ data: { jobName, status: "FAILED", error: err.message } }); }
Install node-cron if needed: pnpm add node-cron && pnpm add -D @types/node-cron
/typecheck passestesting
Create and edit Obsidian Flavored Markdown with wikilinks, embeds, callouts, properties, and other Obsidian-specific syntax. Use when working with .md files in Obsidian, or when the user mentions wikilinks, callouts, frontmatter, tags, embeds, or Obsidian notes.
tools
Interact with Obsidian vaults using the Obsidian CLI to read, create, search, and manage notes, tasks, properties, and more. Also supports plugin and theme development with commands to reload plugins, run JavaScript, capture errors, take screenshots, and inspect the DOM. Use when the user asks to interact with their Obsidian vault, manage notes, search vault content, perform vault operations from the command line, or develop and debug Obsidian plugins and themes.
data-ai
Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.
tools
Create and edit JSON Canvas files (.canvas) with nodes, edges, groups, and connections. Use when working with .canvas files, creating visual canvases, mind maps, flowcharts, or when the user mentions Canvas files in Obsidian.