tldts

Installation
SKILL.md

tldts

Use this skill for tldts v7 hostname and domain extraction backed by the Public Suffix List (PSL). Snapshot 7.4.18 (2026-10). MIT license. Ships ESM, CJS, UMD, and types.

Workflow

  1. Inspect the local surface:
    • Package: tldts (ICANN + private PSL sections), tldts-icann (ICANN section only, smaller), or tldts-experimental (packed hash lookup, same API).
    • Version: prefer 7.x. getFullDomain and detectSpecialUse / isSpecialUse are recent 7.x additions; check the installed version before using them.
    • Input shape: full URLs, bare hostnames, emails, or a mix. This drives the options.
  2. Pick the narrowest function. Single-purpose getters are faster than parse and do not allocate a result object.
  3. Decide the PSL section on purpose. allowPrivateDomains defaults to false, so a.b.github.io gives domain github.io. For cookie scope, same-site, or tenant isolation on shared hosts, set allowPrivateDomains: true.
  4. Route detail:
    • Full API, result fields, options, CLI, package variants: api-options.md
    • Verified edge cases, security traps, migrations: pitfalls.md
  5. Prefer bun / bunx in command examples. Match the project's import style (import { getDomain } from 'tldts' or require).

Quick Reference

Installs
1
GitHub Stars
3
First Seen
1 day ago