Safe DNS record management for Namecheap domains. Fetch, add, remove, backup, and restore DNS records with automatic safety checks and dry-run mode. Prevents accidental DNS record wipeout via the Namecheap API's destructive setHosts method.
Safe wrapper around the Namecheap API for DNS operations. Prevents accidental record wipeout by always fetching existing records first and merging changes.
The Namecheap API's setHosts method replaces ALL DNS records for a domain. One wrong API call = your entire DNS config is gone. This skill:
CODEBLOCK0
Add to ~/.zshrc or ~/.bashrc:
CODEBLOCK1
⚠️ IMPORTANT: Run this first!
CODEBLOCK2
This command compares DNS records visible to the Namecheap API with actual live DNS records (via dig). It will warn you about "ghost records" that exist in DNS but are invisible to the API (email forwarding, URL redirects, etc.).
CODEBLOCK3
Note: This only shows records visible to the API. Use verify to see ALL records including those managed by Namecheap subsystems.
CODEBLOCK4
Safety: The skill automatically checks for "ghost records" before making changes. If detected, it will refuse to proceed unless you use --force.
CODEBLOCK5
CODEBLOCK6
Default: ./backups/ (relative to skill directory)
Configurable via environment variable:
CODEBLOCK11
Format: INLINECODE7
Each backup includes:
apiHosts: Records visible to Namecheap APIThis allows you to see what was ACTUALLY live in DNS, not just what the API knew about.
add or remove creates a timestamped backup (includes DNS snapshot)--dry-run shows what will change without applying--force flag for when you need to bypass ghost record warningsCODEBLOCK12
Review the diff, then run without --dry-run to apply.
The Namecheap domains.dns.setHosts API method replaces ALL DNS records for a domain. There is no "add one record" or "update one record" endpoint. Every change requires:
getHosts)setHosts)This skill handles this for you by always fetching first and merging changes.
Problem: domains.dns.getHosts does NOT return all DNS records. Records managed by Namecheap subsystems are invisible to the API:
Since setHosts replaces all records, using the API can silently delete these hidden records.
verify command — Compares API records with actual live DNS (via dig) and warns about ghost recordsadd, remove, or restore, the skill checks for ghost records--force is used)dig, not just API state--forceOnly use the --force flag when:
Never use --force blindly. Always run verify first to see what will be lost.
This skill was created after adding Mailgun DNS records via the API wiped out Namecheap's email forwarding records. The email forwarding MX/SPF/TXT records were invisible to getHosts, so the fetch-merge-write pattern deleted them.
Now, the skill would have:
NAMECHEAP_API_KEY is set correctlyNamecheap API docs: https://www.namecheap.com/support/api/methods/domains-dns/
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 namecheap-dns-1776420090 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 namecheap-dns-1776420090 技能
skillhub install namecheap-dns-1776420090
文件大小: 14.68 KB | 发布时间: 2026-4-17 20:15