
dx-org-trial-expiration-check
Check when Salesforce orgs expire (or already expired) and what to do about it, for one org, the default org, or across all authenticated orgs, using the Salesforce CLI (sf). Use when the user asks about org or trial expiration, "when does my trial expire", "is my trial org still active", "how many days are left", "which orgs are expiring soon", wants to filter orgs expiring within N days, needs machine-readable (JSON/CSV) output for cron or alerting, wants to back up an at-risk org before it lapses, or asks how to extend or renew an expiring trial or Developer Edition org. Covers trial editions, Developer Edition orgs (anything with a TrialExpirationDate), and scratch orgs (via sf org list). DO NOT TRIGGER for sandbox refresh timing, for creating, deleting, or switching the active org, or for non-Salesforce trials such as AWS, Netflix, or other vendors — this skill reads expiration and prints guidance, it does not modify orgs.
- Installs
- 3.3K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/forcedotcom/sf-skills --skill dx-org-trial-expiration-check- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads dx-org-trial-expiration-check automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Org Expiration Check
Determine when a Salesforce org expires, how many days remain, and whether it has already expired — for one org, the default org, or every authenticated org. Results are prioritized (already-expired and soonest-expiring first) with a one-line summary. The skill can also emit machine-readable output for alerting, print backup commands for an at-risk org, and explain how to renew an expiring trial or Developer Edition org.
When to use
Trigger on requests like:
- "When does my trial org expire?" / "Is it still active or has it expired?"
- "How many days are left on my trial?"
- "Which of my orgs are expiring soon?" / "expiring within 30 days?"
- "Alert me / set up a cron job for expiring orgs" (use
--json+--fail-if-expiring). - "Back up my org before it expires" (use
--preserve). - "How do I extend / renew my trial (or Developer Edition) org?" (use
--renew).
This skill covers trial editions, Developer Edition orgs (anything with a
TrialExpirationDate), and scratch orgs (via the expirationDate from
sf org list).
When NOT to use
Do not trigger this skill for:
- Sandbox refresh timing — that is not an expiration date.
- Creating, deleting, or switching orgs — this skill only reads
expiration and prints guidance; it never creates, deletes, refreshes, or
changes the active/default org. (To switch the default org, use
dx-org-switch.) - Non-Salesforce trials — e.g. AWS free tier, Netflix, or any other vendor's trial. This skill is Salesforce-only.
How expiration is determined
- Trial / Developer Edition orgs: the authoritative source is the org's
Organization.TrialExpirationDatefield, read via SOQL (sf data query). This field isnullfor paid/production orgs, which therefore report no trial expiration — that is expected, not an error. - Scratch orgs: the
expirationDatereported bysf org list(no SOQL query is issued for scratch orgs).
Steps
-
CRITICAL: Run the bundled helper script, which handles date math (days remaining, expired, expiring-soon warnings), prioritized sorting, and structured output, and works on macOS and Linux. Always invoke it by absolute path from the skill directory — never
./scripts/, which resolves against the user's current directory and will either run the wrong script or fail.Before executing, verify:
-
<skill_dir>is an absolute path (starts with/), not a relative path - The path points at this skill's own directory (the one containing this SKILL.md)
bash "<skill_dir>/scripts/check_expiration.sh" <alias-or-username> # one org bash "<skill_dir>/scripts/check_expiration.sh" # default org (target-org config) bash "<skill_dir>/scripts/check_expiration.sh" --all # every authenticated org bash "<skill_dir>/scripts/check_expiration.sh" --all --within 30 # only orgs expiring within 30 days<skill_dir>is the absolute path to the directory containing this SKILL.md. -
-
Relay the script output to the user. When an org could not be queried, surface the
sf org login webcommand the script prints so the user can authenticate. Pick optional flags based on what the user asked for (see below):--preservewhen they want to save their work,--renewwhen they ask how to extend,--json/--csvfor automation,--fail-if-expiringfor a cron/CI gate.
Options
| Flag | Purpose |
|---|---|
--all, -a | Check every authenticated org. |
--within <days>, -w | Show only orgs expiring within N days (includes already-expired; omits paid/production). --within=30 also works. |
--json | Emit a JSON array of org records (data only). |
--csv | Emit CSV rows (data only). |
--preserve | Print backup commands for expiring/expired orgs. |
--renew | Print trial/DE extension & reactivation guidance. |
--fail-if-expiring[=N] | Exit 3 if any org expires within N days (default 7). |
--no-scratch | Exclude scratch orgs (trial/DE only). |
--help, -h | Show usage. |
Flag order is flexible and flags combine (e.g. --all --within 30 --json).
Prioritized output
Human output is grouped by urgency — Expired first, then Expiring soon
(within 7 days, flagged Warning), then Active, then No trial expiration,
then any orgs that could not be queried — and ends with a one-line summary:
Org expiration status for all authenticated orgs:
Expired:
old-trial trial/DE edition expired 2026-06-20 (EXPIRED 19 day(s) ago)
Expiring soon (within 7 day(s)):
almost-up trial/DE edition expires 2026-07-14 (expires in 5 day(s) Warning)
Active (not expiring soon):
acme-trial trial/DE edition expires 2026-08-15 (expires in 37 day(s))
my-scratch scratch org expires 2026-07-25 (expires in 16 day(s))
No trial expiration (paid/production):
prod no trial expiration (paid/production org)
Summary: 1 expired, 1 expiring within 7 day(s), 2 active, 1 with no expiration.
Structured output for alerting and cron (--json / --csv)
For dashboards, spreadsheets, or scheduled jobs, use --json or --csv to get
machine-readable records (no prose). Each record has org, kind,
expirationDate, daysRemaining (negative = expired, null = no expiration),
status, and orgId. This is deterministic and needs no LLM in the loop.
# JSON, filtered to orgs expiring within 30 days:
bash "<skill_dir>/scripts/check_expiration.sh" --all --within 30 --json
Cron watchdog — --fail-if-expiring[=N] exits 3 (and prints an ALERT:
line to stderr) if any org expires within N days (default 7), so a scheduled
job can page you before an org lapses:
# crontab: every morning at 9, alert if anything expires within 7 days
0 9 * * * bash "<skill_dir>/scripts/check_expiration.sh" --all --fail-if-expiring 7 \
|| mail -s "Salesforce org expiring soon" me@example.com
Preserve your work before an org lapses (--preserve)
When an org expires you lose access to its metadata and data. --preserve
prints ready-to-run backup commands (metadata manifest + retrieve, and a bulk
data export) for each expiring or already-expired org. It only prints the
commands — review and run them yourself:
bash "<skill_dir>/scripts/check_expiration.sh" my-trial --preserve
Extend or renew a trial / Developer Edition org (--renew)
--renew prints the current guidance for keeping an org alive, and surfaces the
Org IDs of at-risk orgs so the steps are actionable:
- Partners: request a Trial Org extension (up to +12 months) via
partners.salesforce.com→ Ask Agentforce → "I want to extend my Trial Org", providing the Org ID. Eligible while active or expired < 30 days; not for LDV orgs. (Salesforce Help article 000387818.) - Nonprofits: email your Account Executive with subject "Trial Extension" and the trial-starter email, Org ID, and username; AMER the Power of Us Desk, other regions My Account support / 1-800-NO-SOFTWARE. Works even if already expired. (Article 004754220.)
- Developer Edition: DE orgs have no subscription clock but are deactivated after prolonged inactivity (~180 days without a login); log in periodically. If locked (not yet deleted), open a Salesforce Customer Support case to reactivate — once permanently deleted, an org cannot be recovered.
- To keep a standard trial's data/config, convert/subscribe to a paid edition before it lapses.
Exit codes
0success1an org could not be queried (auth/connection error)2bad usage or a missing dependency (sforjq)3--fail-if-expiringthreshold breached (at least one org expiring)
When both apply, a --fail-if-expiring breach (3) takes precedence over an
auth error (1): the alerting signal wins so a watchdog still fires. If your
job must also detect unreachable orgs, run --json and inspect the records for
status: "auth_error" in addition to checking the exit code. Note that an org
whose credentials fail cannot be date-checked, so it never counts toward a
--fail-if-expiring breach on its own.
--fail-if-expiring with no explicit number treats a following all-numeric
argument as the day count (e.g. --fail-if-expiring 12345). In the rare case an
org's alias is purely numeric, pass the org first (check_expiration.sh 12345 --fail-if-expiring 7) so it isn't mistaken for the threshold.
Authentication
If an org isn't authenticated (no saved credentials, or an expired/revoked token), the script does not fail silently — it prints the exact command to log in and then re-run:
my-trial not authenticated — no saved credentials for this org
To authenticate, run one of:
sf org login web --alias "my-trial"
sf org login web --alias <my-alias> --instance-url https://test.salesforce.com
Then re-run this check. List existing logins with: sf org list
sf org login web opens a browser to complete the OAuth flow. Use
--instance-url https://test.salesforce.com for sandboxes, or a custom My
Domain URL where applicable.
Manual fallback (if the script is unavailable)
# Trial/DE expiration for one org (null = not a trial / paid org):
sf data query --query "SELECT Id, TrialExpirationDate FROM Organization" --target-org <org> --json
# Scratch org expiration comes from the org list, not SOQL:
sf org list --json
Notes
- Requires the Salesforce CLI (
sf) andjqon the PATH, plus at least one authenticated org (sf org login web). - Avoid launching many
sfcommands concurrently — the CLI can be slow under contention. The script queries orgs sequentially for this reason. sf org listexposes atrailExpirationDate(note the typo) field that is oftennull; the script does not rely on it for trial/DE orgs — it uses the SOQLTrialExpirationDate, which is reliable. It does useexpirationDatefrom the list for scratch orgs.
FAQ
What does the dx-org-trial-expiration-check skill do?
Check when Salesforce orgs expire (or already expired) and what to do about it, for one org, the default org, or across all authenticated orgs, using the Salesforce CLI (sf). Use when the user asks about org or trial expiration, "when does my trial expire", "is my trial org still active", "how many days are left", "which orgs are expiring soon", wants to filter orgs expiring within N days, needs machine-readable (JSON/CSV) output for cron or alerting, wants to back up an at-risk org before it lapses, or asks how to extend or renew an expiring trial or Developer Edition org. Covers trial editions, Developer Edition orgs (anything with a TrialExpirationDate), and scratch orgs (via sf org list). DO NOT TRIGGER for sandbox refresh timing, for creating, deleting, or switching the active org, or for non-Salesforce trials such as AWS, Netflix, or other vendors — this skill reads expiration and prints guidance, it does not modify orgs.
How do I install dx-org-trial-expiration-check?
Run npx skills add https://github.com/forcedotcom/sf-skills --skill dx-org-trial-expiration-check in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/dx-org-trial-expiration-check/ (personal) or .claude/skills/dx-org-trial-expiration-check/ (project).
Which AI agents can use dx-org-trial-expiration-check?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is dx-org-trial-expiration-check safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains dx-org-trial-expiration-check?
It is published by forcedotcom in forcedotcom/sf-skills. It has 3,255 recorded installs.
More from forcedotcom/sf-skills
platform-apex-generate
forcedotcom/sf-skills
Primary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract, exception, REST resource). Use this skill for requests involving SObject CRUD, mapping collections, fetching related records, scheduled jobs, batch jobs, trigger design, @AuraEnabled controllers, @RestResource endpoints, custom REST APIs, or code review of existing Apex.
platform-apex-test-generate
forcedotcom/sf-skills
Use to generate and validate Apex test classes with TestDataFactory patterns, bulk testing (251+ records), mocking, assertions, and disciplined test-fix loops. Use when creating Apex test classes (for triggers, services, controllers, batch jobs, queueables, and callouts), improving coverage, debugging or fixing failing Apex tests, or running test/coverage analysis. Triggers on Test.cls files, sf apex run test, coverage reports. Do NOT trigger for production Apex (use platform-apex-generate) or Jest/LWC tests.
platform-apex-test-run
forcedotcom/sf-skills
Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. Use when the user runs Apex tests, checks code coverage, fixes failing tests, or touches Test.cls / Test.cls files. DO NOT TRIGGER when writing Apex production code (use platform-apex-generate), Agentforce agent testing (use agentforce-test), or Jest/LWC tests (use experience-lwc-generate).
platform-apex-logs-debug
forcedotcom/sf-skills
Salesforce debug log analysis and troubleshooting with 100-point scoring. TRIGGER when: user analyzes debug logs, hits governor limits, reads stack traces, or touches .log files from Salesforce orgs. DO NOT TRIGGER when: running Apex tests (use platform-apex-test-run), generating or fixing Apex code (use platform-apex-generate), or Agentforce session tracing (use agentforce-observe).
platform-soql-query
forcedotcom/sf-skills
Use when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and performance or safety improvements. TRIGGER when the user writes, optimizes, or debugs SOQL/SOSL, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER for bulk data operations (use platform-data-manage), Apex DML logic (use platform-apex-generate), or report/dashboard queries.
platform-metadata-deploy
forcedotcom/sf-skills
Salesforce DevOps automation using sf CLI v2. TRIGGER when: user deploys metadata, validates a deploy or does a dry-run, deploys to a Production org, quick-deploys a validated job ID, ships/promotes to prod, creates/manages scratch orgs or sandboxes, sets up CI/CD pipelines, or troubleshoots deployment errors with sf project deploy. DO NOT TRIGGER when: writing Apex code, building LWC components (use experience-lwc-generate), creating metadata definitions (use platform-custom-object-generate), deleting metadata from an org (use platform-destructive-deploy), or querying org data (use platform-data-manage).
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.