Hand-writing hundreds of rules is unrealistic. Rule providers externalize rules into standalone files - community-maintained, auto-updating - referenced by a single RULE-SET line. This is a Premium-core feature, built into Clash for Windows.
Basic structure
rule-providers:
cn-domains:
type: http
behavior: domain
url: "https://example.com/rules/cn-domains.yaml"
path: ./ruleset/cn-domains.yaml
interval: 86400
rules:
- RULE-SET,cn-domains,DIRECT
- GEOIP,CN,DIRECT
- MATCH,Select
type: httpdownloads from the URL and refreshes everyintervalseconds;type: filereads a local file.pathis the local cache location - each provider needs a distinct path or they overwrite each other.
The three behaviors
| behavior | File contents | Equivalent rules |
|---|---|---|
domain | Plain domain list (+.google.com) | DOMAIN / DOMAIN-SUFFIX |
ipcidr | Plain CIDR list (8.8.8.0/24) | IP-CIDR |
classical | Full rule lines (type,content) | Any mixture |
The behavior must match the file's actual format, or the whole set silently does nothing - the number-one cause of "my rule set isn't working".
Community-maintained sets
Widely used collections (e.g. Loyalsoldier/clash-rules) offer well-categorized, daily-updated domain and IP lists. When choosing, look at update frequency, category granularity, and whether domain/ipcidr formats are provided separately. Combining the usual categories (cn, proxy, reject, private, telegram, …) yields a mature routing setup - full example in the classic split guide.
Updates and debugging
- Provider status is visible in the client;
provider ... initial failedin the logs means the download failed. - The rule-set URL itself may require the proxy: connect through any working node first, then reload the profile.