Email audit

From shenxingy/Clade · View interactive version

Email audit is an AI agent skill from the GitHub repository shenxingy/Clade. Audits email domain deliverability setup (SPF, DKIM, DMARC, MX records, blacklists, TLS) and generates health score (0-100) with prioritized fix list. Checks bulk sender compliance against Google/Yahoo/Microsoft 2024-2026 requirements. Provides DNS records to add/update. Use when user asks to audit,

How to use this skill

Skill file

Email Audit Sub-Skill

Purpose

Performs comprehensive email deliverability auditing for a domain. Checks DNS authentication records (SPF, DKIM, DMARC), infrastructure (MX, PTR, TLS), reputation (blacklists), and bulk sender compliance. Generates a health score (0-100) with prioritized fixes.

Input

Audit Categories

1. SPF Record (Weight: 10%)

What to check:

Commands:

dig txt <domain> +short | grep "v=spf1"
# or
python scripts/check_deliverability.py <domain> --spf

Scoring:

2. DKIM Record (Weight: 15%)

What to check:

Commands:

dig txt google._domainkey.<domain> +short
dig txt default._domainkey.<domain> +short
dig txt selector1._domainkey.<domain> +short
# Check common selectors

Note: DKIM selectors are not discoverable without prior knowledge. Check common ones and ask user if their email provider uses a specific selector.

Scoring:

3. DMARC Policy (Weight: 15%)

What to check:

Commands:

dig txt _dmarc.<domain> +short

Scoring:

4. MX Records (Weight: 10%)

What to check:

Commands:

dig mx <domain> +short
dig a <mx-hostname> +short

Scoring:

5. Reverse DNS / PTR (Weight: 5%)

What to check:

Commands:

dig -x <mx-ip> +short

Scoring:

6. TLS/STARTTLS (Weight: 10%)

What to check:

Commands:

openssl s_client -starttls smtp -connect <mx-hostname>:25 -brief

Note: This may require network access. If not available, note as "Unable to verify".

Scoring:

7. Blacklist Check (Weight: 20%)

What to check:

Commands:

# Use checkdmarc library if available
python -c "import checkdmarc; print(checkdmarc.check_domains(['<domain>']))"

# Or manual checks
dig <ip>.zen.spamhaus.org +short
dig <ip>.b.barracudacentral.org +short

Scoring:

Critical: Any listing on major blacklists severely impacts deliverability.

8. Bulk Sender Compliance (Weight: 10%)

Applies to: Domains sending 5,000+ emails/day to Gmail, Yahoo, Microsoft recipients.

Requirements (Google/Yahoo/Microsoft 2024-2026 rules):

  1. Both SPF AND DKIM must pass (not just one)
  2. DMARC policy at minimum p=none with alignment
  3. One-click unsubscribe header (RFC 8058: List-Unsubscribe-Post: One-Click)
  4. Spam complaint rate under 0.3% (target under 0.1%)
  5. Valid forward and reverse DNS (PTR records)
  6. Honor unsubscribe within 2 business days
  7. No impersonation of Gmail/Yahoo/Microsoft from headers
  8. TLS connection for message transmission

Scoring:

9. Additional Checks (Weight: 5%)

Bonus points for:

Commands:

dig txt default._bimi.<domain> +short
curl https://mta-sts.<domain>/.well-known/mta-sts.txt
dig txt _smtp._tls.<domain> +short

Scoring:

Health Score Calculation

Formula:

Total Score = (SPF × 0.10) + (DKIM × 0.15) + (DMARC × 0.15) + (MX × 0.10) +
              (PTR × 0.05) + (TLS × 0.10) + (Blacklists × 0.20) +
              (Bulk Compliance × 0.10) + (Extras × 0.05)

Score Interpretation:

| Score | Rating | Status | Action |

|-------|--------|--------|--------|

| 90-100 | Excellent | All critical checks pass, fully compliant | Monitor regularly |

| 75-89 | Good | Minor issues, generally deliverable | Fix medium priority items |

| 60-74 | Fair | Issues that could impact inbox placement | Fix high priority items within 1 week |

| 40-59 | Poor | Significant deliverability risks | Fix critical items immediately |

| 0-39 | Critical | Major issues, emails likely going to spam | Emergency fixes required |

Workflow

Step 1: Gather Domain Information

Ask user for:

Step 2: Parallel Delegation

Spawn these agents in parallel for faster auditing:

Agent 1: email-deliverability

Check DNS authentication records for <domain>:
- SPF record validation
- DKIM record discovery (selectors: google, default, selector1, selector2, k1)
- DMARC policy analysis
- MX record validation
- PTR/reverse DNS check

Return JSON with pass/fail status and raw records.

Agent 2: email-compliance

Check bulk sender compliance for <domain>:
- Verify both SPF and DKIM pass
- Check DMARC alignment
- Note TLS support
- Check for List-Unsubscribe headers (if sample email provided)

Return compliance checklist with met/not met status.

Agent 3: email-reputation (if tools available)

Check reputation for <domain>:
- Blacklist status (Spamhaus, Barracuda, SORBS, SpamCop)
- Historical deliverability issues
- Spam complaint rate (if available)

Return list of blacklist hits and reputation score.

Step 3: Aggregate Results

Collect results from all agents and calculate weighted health score.

Step 4: Generate Prioritized Fix List

Categorize issues by priority:

Critical (Fix Immediately):

High (Fix Within 1 Week):

Medium (Fix Within 1 Month):

Step 5: Generate DNS Record Recommendations

Provide exact DNS records to add/update with copy-paste ready values.

Output Format

Structure the audit report as:

  1. Header: ## Email Deliverability Audit: [domain] with date, health score, rating
  2. Authentication table: SPF/DKIM/DMARC with status, score, raw records
  3. Infrastructure table: MX/PTR/TLS with status, score, provider detection
  4. Reputation: Blacklist status across Spamhaus, Barracuda, SORBS, SpamCop
  5. Bulk Sender Compliance: 8-requirement checklist (Google/Yahoo/Microsoft rules)
  6. Bonus Features: BIMI, MTA-STS, TLSRPT, Mail-from alignment
  7. Prioritized Fix List: Critical/High/Medium with impact, fix steps, DNS records
  8. DNS Records to Add: Copy-paste ready TXT/MX records
  9. Next Steps: Immediate, this week, this month, monitoring, re-audit

Use score weights from Health Score Calculation section. Use status badges: ✅ PASS, ⚠️ WARN, ❌ FAIL.

Tools

Run python scripts/check_deliverability.py <domain> --json for automated DNS checks.

Manual DNS commands (used in audit categories above):

Quality Gates

Before delivering audit results:

  1. All critical checks completed (SPF, DKIM, DMARC, MX, Blacklists)
  2. Health score calculated with breakdown by category
  3. Prioritized fix list generated with specific action steps
  4. DNS records provided in copy-paste ready format
  5. Score interpretation explained with next steps

Error Handling

If DNS queries fail:

If DKIM selector unknown:

If no MX records found:

References

Load on demand:

Success Criteria

Audit is successful when:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.