cron-ops
Cron job lifecycle: create, update, remove, debug, fix false positives, sanitize payloads
What this skill does
# cron-ops
## Purpose
This skill handles the complete lifecycle of cron jobs in OpenClaw, including creation, updates, removal, debugging, fixing false positives, and sanitizing payloads to ensure secure and reliable automation.
## When to Use
Use this skill for scheduling repetitive tasks like backups, data syncs, or alerts in production environments; when troubleshooting cron failures; or to maintain job hygiene in automated workflows. Apply it in scenarios involving system automation, such as server maintenance or API polling.
## Key Capabilities
- Create cron jobs with custom schedules and commands.
- Update jobs to modify schedules, commands, or parameters.
- Remove jobs to clean up unused schedules.
- Debug jobs by logging outputs and inspecting errors.
- Fix false positives by analyzing execution logs and adjusting filters.
- Sanitize payloads to prevent injection attacks, ensuring commands are safe.
## Usage Patterns
Always authenticate using the `$OPENCLAW_API_KEY` environment variable. For CLI, prefix commands with `openclaw cron`. For API, use HTTPS endpoints like `https://api.openclaw.com/cron`. Start with job creation, then use IDs for updates or deletions. In code, import OpenClaw SDK and handle responses synchronously. Example pattern: Check job status before updating to avoid conflicts.
## Common Commands/API
Use the OpenClaw CLI for quick operations or the REST API for programmatic access. Authentication requires setting `$OPENCLAW_API_KEY`.
- **Create a job (CLI):**
`openclaw cron create --schedule "0 0 * * *" --command "echo 'Hello'" --payload '{"key": "value"}'`
This schedules a job to run daily at midnight.
- **Update a job (API):**
`curl -X PUT https://api.openclaw.com/cron/jobs/{jobId} -H "Authorization: Bearer $OPENCLAW_API_KEY" -d '{"schedule": "0 30 * * *", "command": "backup.sh"}'`
Updates the schedule of an existing job to run every hour at 30 minutes.
- **Remove a job (CLI):**
`openclaw cron delete --job-id 12345 --force`
Deletes the specified job, using `--force` to bypass confirmation.
- **Debug a job (API):**
`curl -X GET https://api.openclaw.com/cron/jobs/{jobId}/logs -H "Authorization: Bearer $OPENCLAW_API_KEY"`
Retrieves logs for debugging; parse JSON output for error details.
- **Fix false positives (CLI):**
`openclaw cron fix --job-id 12345 --filter "error_type=timeout"`
Applies fixes by updating filters in the job config to ignore common false positives.
- **Sanitize payloads (code snippet):**
```python
import openclaw
client = openclaw.Client(api_key=os.environ['OPENCLAW_API_KEY'])
sanitized_payload = client.sanitize({'command': 'echo "unsafe"; rm -rf /'})
print(sanitized_payload) # Outputs a safe version
```
Use this to clean user-input payloads before job creation.
Config format for jobs is JSON, e.g., `{"schedule": "cron_expression", "command": "shell_command", "payload": {"key": "value"}}`.
## Integration Notes
Integrate with other OpenClaw skills by referencing job IDs in workflows. For example, link to `logging` skill for enhanced monitoring. Use webhooks by adding a `--webhook-url` flag in CLI commands, e.g., `openclaw cron create --webhook-url "https://your.service/webhook"`. In multi-service setups, pass `$OPENCLAW_API_KEY` via environment variables in Docker or CI/CD pipelines. Ensure compatibility by using the latest OpenClaw SDK version (v2.5+). For external systems, map cron schedules to standard formats like Unix crontab.
## Error Handling
Common errors include authentication failures (HTTP 401), invalid schedules (HTTP 400), or job conflicts (HTTP 409). Handle by checking response codes: if status is 401, verify `$OPENCLAW_API_KEY`. For invalid schedules, validate with `openclaw cron validate --schedule "invalid"`. In code, use try-except blocks:
```python
try:
response = client.create_job(schedule="0 0 * * *")
except openclaw.AuthError as e:
print("Auth failed: Set $OPENCLAW_API_KEY")
except openclaw.ValidationError as e:
print(f"Invalid input: {e}")
```
Retry transient errors with exponential backoff. Log all errors using the job ID for traceability.
## Concrete Usage Examples
1. **Create a daily backup job:**
First, set `$OPENCLAW_API_KEY`. Then run: `openclaw cron create --schedule "0 2 * * *" --command "rsync -a /data/ /backup/"`. Verify with `openclaw cron list`. This automates daily backups at 2 AM, and you can debug logs if it fails.
2. **Debug and fix a failed cron job:**
Identify the job with `openclaw cron list --status failed`. Debug: `curl -X GET https://api.openclaw.com/cron/jobs/12345/logs -H "Authorization: Bearer $OPENCLAW_API_KEY"`. If it's a false positive, fix with `openclaw cron fix --job-id 12345 --filter "status=timeout"`. This resolves issues like network timeouts in scheduled tasks.
## Graph Relationships
- Depends on: core-openclaw (for base API)
- Relates to: scheduling (for advanced timers), automation (for workflow integration)
- Conflicts with: none
- Extends: jobs (for general task management)
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.