agentleFS
scitixscitix/siclaw/skills/core/job-debug/SKILL.md

job-debug

Skill236 starsChanged 6 months agoApache-2.0View on GitHub

Diagnose Job and CronJob failures (BackoffLimitExceeded, DeadlineExceeded, pods failing, CronJob not triggering). Checks Job status, pod logs, and CronJob schedule to identify why batch workloads are failing.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When a Job has failed, is stuck, or a CronJob is not triggering as expected, follow this flow to identify the root cause.

    line 10
  2. Distinctive:

    If the pod was terminated, check the exit code:

    line 45
  3. Distinctive:

    Check why the pods are failing — look at the logs of the most recent failed pod (step 2).

    line 86
  4. Distinctive:

    Check if the Job's pods are slow or stuck:

    line 103
  5. Very specific:

    Use the pod-pending-debug skill to diagnose the scheduling failure.

    line 115
  6. Very specific:

    If the pod has been garbage collected, check if ttlSecondsAfterFinished caused it to be deleted:

    line 135
  7. Distinctive:

    Check if there are active Jobs blocking the next run:

    line 155
  8. Distinctive:

    If every Job created by the CronJob fails, the root cause is in the Job template.

    line 165
  9. Very specific:

    Check the startingDeadlineSeconds — if set, Jobs that miss their window (e.g., because the previous Job ran too long) are skipped:

    line 167

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Job / CronJob Failure Diagnosis

When a Job has failed, is stuck, or a CronJob is not triggering as expected, follow this flow to identify the root cause.

Scope: This skill is for diagnosis only. Once you identify the root cause, report it to the user and stop. Do NOT attempt to delete, restart, or modify Jobs or CronJobs — that should be left to the user.

Diagnostic Flow

1. Check Job status

kubectl get jobs -n <ns>

Note the COMPLETIONS (succeeded/total) and DURATION columns. For a specific Job:

kubectl describe job <job-name> -n <ns>

Focus on:

  • Conditions — look for Complete (success) or Failed (failure) with the reason
  • Events — look for BackoffLimitExceeded, DeadlineExceeded, or pod creation errors
  • Pods Statuses — counts of Succeeded, Failed, and Active pods

2. Check the Job's pods

kubectl get pods -n <ns> -l job-name=<job-name> --sort-by='.metadata.creationTimestamp'

Note pod statuses. For failed pods, check logs:

kubectl logs <pod-name> -n <ns>

If the pod was terminated, check the exit code:

kubectl get pod <pod-name> -n <ns> -o jsonpath='{.status.containerStatuses[*].state.terminated}'

3. For CronJobs — check schedule and history

kubectl get cronjobs -n <ns>

Note the SCHEDULE, SUSPEND, ACTIVE, and LAST SCHEDULE columns.

For details:

kubectl describe cronjob <cronjob-name> -n <ns>

Focus on:

  • Schedule — the cron expression
  • Suspend — if True, the CronJob will not create new Jobs
  • Last Schedule Time — when the last Job was triggered
  • Active Jobs — currently running Jobs
  • Events — look for creation events or errors

List Jobs created by the CronJob:

kubectl get jobs -n <ns> -l job-name --sort-by='.metadata.creationTimestamp' | grep <cronjob-name>

4. Match patterns and conclude


BackoffLimitExceeded — Too many pod failures

The Job's pods have failed more times than the backoffLimit (default: 6). The Job is marked as Failed.

Check why the pods are failing — look at the logs of the most recent failed pod (step 2). Common causes:

  • Application error — the program exits with a non-zero code
  • OOMKilled — the container exceeded its memory limit (use pod-crash-debug for deeper analysis)
  • Configuration error — missing environment variables, wrong arguments, or missing config files

Advise the user to fix the underlying pod failure, then create a new Job.


DeadlineExceeded — Job took too long

The Job did not complete within its activeDeadlineSeconds limit. All running pods are terminated.

kubectl get job <job-name> -n <ns> -o jsonpath='{.spec.activeDeadlineSeconds}'

Check if the Job's pods are slow or stuck:

  • The workload may genuinely take longer than the deadline allows
  • Pods may be stuck waiting for resources, network, or external dependencies

Advise the user to either increase activeDeadlineSeconds or investigate why the workload is slow.


Pods in Pending — Scheduling issues

Job pods are created but cannot be scheduled.

Use the pod-pending-debug skill to diagnose the scheduling failure. Common causes for batch jobs:

  • Resource constraints — the Job requests more resources than available
  • Node affinity — the Job's pods can only run on specific nodes that are busy

Pods in ImagePullBackOff — Image issue

The Job pod cannot pull its container image. Use the image-pull-debug skill.


Job succeeded but results are wrong — Application-level issue

The Job completed (status Complete) but produced incorrect results. This is not a Kubernetes issue — check the application logs:

kubectl logs <succeeded-pod> -n <ns>

If the pod has been garbage collected, check if ttlSecondsAfterFinished caused it to be deleted:

kubectl get job <job-name> -n <ns> -o jsonpath='{.spec.ttlSecondsAfterFinished}'

CronJob not triggering — Schedule or suspend issue

The CronJob exists but is not creating Jobs on schedule.

  • Suspended — spec.suspend is true. No new Jobs will be created until it is unsuspended.
  • Invalid schedule — the cron expression may be malformed. Kubernetes uses standard 5-field cron syntax (minute, hour, day-of-month, month, day-of-week).
  • Concurrency policy — if concurrencyPolicy: Forbid and a previous Job is still running, the new Job will be skipped.
kubectl get cronjob <cronjob-name> -n <ns> -o jsonpath='suspend={.spec.suspend} concurrencyPolicy={.spec.concurrencyPolicy} schedule={.spec.schedule}'

Check if there are active Jobs blocking the next run:

kubectl get jobs -n <ns> | grep <cronjob-name>

CronJob creates Jobs but they keep failing — Recurring failure

If every Job created by the CronJob fails, the root cause is in the Job template. Diagnose the most recent Job using steps 1-2 above.

Check the startingDeadlineSeconds — if set, Jobs that miss their window (e.g., because the previous Job ran too long) are skipped:

kubectl get cronjob <cronjob-name> -n <ns> -o jsonpath='{.spec.startingDeadlineSeconds}'

Also check successfulJobsHistoryLimit and failedJobsHistoryLimit — if these are set to 0, completed/failed Jobs and their pods are deleted immediately, making diagnosis harder.

Notes

  • Jobs created by CronJobs are named <cronjob-name>-<timestamp>. Use this pattern to find related Jobs.
  • By default, failed Job pods are kept (not deleted) so you can inspect their logs. The backoffLimit controls how many retries happen before the Job is marked as Failed.
  • completions and parallelism control how many pods need to succeed and how many run concurrently. A Job with completions: 5, parallelism: 2 runs 2 pods at a time until 5 have succeeded.
  • For indexed Jobs (completionMode: Indexed), each pod gets a unique index. A failure in one index does not affect others — check which specific index is failing.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.