Install
openclaw skills install namecheap-dnsClawHub Security found sensitive or high-impact capabilities. Review the scan results before using.
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.
openclaw skills install namecheap-dnsSafe 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:
cd ~/.openclaw/workspace/skills/namecheap-dns
npm install
Add to ~/.zshrc or ~/.bashrc:
export NAMECHEAP_API_KEY="your-api-key-here"
export NAMECHEAP_USERNAME="your-username"
export NAMECHEAP_API_USER="your-username" # Usually same as username
⚠️ IMPORTANT: Run this first!
./namecheap-dns.js verify example.com
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.).
./namecheap-dns.js list example.com
Note: This only shows records visible to the API. Use verify to see ALL records including those managed by Namecheap subsystems.
# Add a single TXT record
./namecheap-dns.js add example.com \
--txt "mail.example.com=v=spf1 include:mailgun.org ~all"
# Add multiple records at once
./namecheap-dns.js add example.com \
--txt "mail=v=spf1 include:mailgun.org ~all" \
--cname "email.mail=mailgun.org" \
--mx "mail=10 mxa.mailgun.org"
# Dry-run (preview changes without applying)
./namecheap-dns.js add example.com \
--txt "test=hello" \
--dry-run
# Force override safety check (if you know ghost records can be deleted)
./namecheap-dns.js add example.com \
--txt "test=hello" \
--force
Safety: The skill automatically checks for "ghost records" before making changes. If detected, it will refuse to proceed unless you use --force.
# Remove by host + type
./namecheap-dns.js remove example.com \
--host "old-record" \
--type "TXT"
# Dry-run first
./namecheap-dns.js remove example.com \
--host "old-record" \
--type "TXT" \
--dry-run
# Create manual backup
./namecheap-dns.js backup example.com
# List available backups
./namecheap-dns.js backups example.com
# Restore from latest backup
./namecheap-dns.js restore example.com
# Restore from specific backup
./namecheap-dns.js restore example.com \
--backup "example.com-20260213-114500.json"
--txt "subdomain=value"
--txt "@=value" # Root domain
--cname "subdomain=target.com"
--mx "subdomain=10 mx.target.com"
--mx "@=10 mx.target.com" # Root domain
--a "subdomain=192.168.1.1"
--a "@=192.168.1.1" # Root domain
Default: ./backups/ (relative to skill directory)
Configurable via environment variable:
export NAMECHEAP_BACKUP_DIR="/custom/path/to/backups"
Format: {domain}-{timestamp}.json
Each backup includes:
apiHosts: Records visible to Namecheap APIliveDNS: Actual DNS records captured via digThis 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 warnings./namecheap-dns.js add menuhq.ai \
--txt "mail.menuhq.ai=v=spf1 include:mailgun.org ~all" \
--txt "smtp._domainkey.mail.menuhq.ai=k=rsa; p=MIGfMA0..." \
--txt "_dmarc.mail.menuhq.ai=v=DMARC1; p=quarantine;" \
--cname "email.mail.menuhq.ai=mailgun.org" \
--mx "mail.menuhq.ai=10 mxa.mailgun.org" \
--mx "mail.menuhq.ai=20 mxb.mailgun.org" \
--dry-run
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:
verify--forcecurl ifconfig.meNAMECHEAP_API_KEY is set correctlyNamecheap API docs: https://www.namecheap.com/support/api/methods/domains-dns/