write-adblock-plus-filters
Write, debug, and explain Adblock Plus (ABP) filter syntax. Use this skill whenever the user needs to create ABP filters, understand filter syntax, build filter lists, debug why a filter isn't working, convert between filter types, or learn about ABP-specific features like extended CSS selectors, snippet filters, or sitekey. Also trigger when users mention ad blocking rules, element hiding, filter options, EasyList format, or any ABP filter-related question — even if they don't explicitly say 'Adblock Plus.'
- License 许可
- MIT
- 所属仓库
- luestr/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 94
- Forks
- 1
01 前言 Front Matter
- name
- write-adblock-plus-filters
- metadata
- { "language": "en-US" }
- description
- Write, debug, and explain Adblock Plus (ABP) filter syntax. Use this skill whenever the user needs to create ABP filters, understand filter syntax, build filter lists, debug why a filter isn't working, convert between filter types, or learn about ABP-specific features like extended CSS selectors, snippet filters, or sitekey. Also trigger when users mention ad blocking rules, element hiding, filter options, EasyList format, or any ABP filter-related question — even if they don't explicitly say 'Adblock Plus.'
02 资源文件 8
- 参考文档references/01-basic-rules.md3.9 KB
- 参考文档references/02-exception-rules.md3.1 KB
- 参考文档references/03-network-options.md7.2 KB
- 参考文档references/04-element-hiding.md4.9 KB
- 参考文档references/05-extended-selectors.md5.0 KB
- 参考文档references/06-inline-styles-remove.md4.4 KB
- 参考文档references/07-snippet-filters.md11.4 KB
- 参考文档references/08-special-comments.md2.8 KB
03 SKILL.md 正文
Write Adblock Plus Filters
You are an expert in Adblock Plus filter syntax. Your job is to help users write correct, efficient filters and filter lists.
How to Use This Skill
This skill is organized into 8 reference modules covering every aspect of ABP filter syntax. Based on the user's question, read only the relevant module(s) — do not load all references at once.
Routing Guide
| User Question About | Read This Reference |
|---|---|
Basic filter syntax, wildcards (*), address matching (|, ||), separator (^), comments (!) |
references/01-basic-rules.md |
Exception rules (@@ prefix), allowlisting requests/pages |
references/02-exception-rules.md |
Filter options: $script, $image, $domain, $third-party, $match-case, $popup, $csp, $rewrite, $header, $addheader, regex filters, etc. |
references/03-network-options.md |
Element hiding (##), CSS selectors, attribute selectors, domain limiting for content filters |
references/04-element-hiding.md |
Extended CSS selectors: :-abp-has(), :-abp-contains(), :-abp-properties(), :xpath(), :not() |
references/05-extended-selectors.md |
Inline CSS styles in filters, remove: true; action |
references/06-inline-styles-remove.md |
Snippet filters (#$#), behavioral snippets, conditional hiding, shadow DOM, JSONPath |
references/07-snippet-filters.md |
Special comments: ! Title:, ! Homepage:, ! Expires:, ! Redirect:, ! Version: |
references/08-special-comments.md |
Multi-Topic Questions
If the user's question spans multiple topics (e.g., "write a filter that blocks scripts on example.com and hides a div"), read all relevant modules. For a full syntax overview or "how do ABP filters work" questions, you may read modules 01–04 as the core set.
Workflow
- Understand the user's intent — what they want to block, hide, allow, or debug.
- Read the relevant reference module(s) listed above.
- Write the filter(s) with a brief explanation of each syntax element used.
- Validate — double-check syntax against the reference before presenting.
- If the user provides a filter that isn't working, diagnose by checking each syntax component against the reference.
Key Principles
- Filters are case-insensitive by default. Use
$match-caseif case matters. - The
^separator matches anything except letters, digits, and_ - . %. ||domain^is the standard pattern for matching an entire domain.- Element hiding (
##) works at the CSS level — it hides but doesn't block. - Extended selectors (
#?#) have a performance cost — prefer standard##when possible. - Snippet filters (
#$#) can only be added to user custom filters or the ABP Anti-Circumvention list. - Header matching (
$header=) and add header ($addheader=) are Firefox-only features.
Pre-installed Filter Lists
Adblock Plus comes with these filter lists pre-installed:
- Acceptable Ads — allows non-intrusive ads by default (can be disabled)
- EasyList — the primary ad-blocking list, plus a bundled language-specific list based on browser locale
- ABP Anti-Circumvention Filter List — targets sites that try to bypass ad blockers
Users can add their own custom filters via the ABP Settings page (Advanced tab → "Create and edit your filter list").
Generic vs. Specific Filters
The distinction between generic and specific filters matters for $generichide and $genericblock:
- Specific filter — matches one or more domains or has a sitekey. Examples:
example.com##.textad,/ads/*$domain=example.com - Generic filter — has no domain restrictions (or only domain exceptions) and no sitekey. Examples:
##.textad,~example.com##.textad,||example.com^
For blocking rules, the domain must be under $domain to be specific: ||example.com^ is generic, but /ads/*$domain=example.com is specific.
Common Patterns Quick Reference
||example.com^ Block entire domain
||example.com/ads/*$script Block scripts under /ads/
@@||example.com^$document Allowlist entire site
example.com##.ad-banner Hide .ad-banner on example.com
example.com#?#div:-abp-has(.ad) Hide divs containing .ad (extended)
example.com#$#abort-on-property-read adblock Run snippet on example.com
04 同仓库更多 Skills
write-ublock-origin-filters
完整的 uBlock Origin (uBO) 静态过滤语法参考。编写 uBlock Origin 自定义过滤规则时使用此技能,涵盖广告拦截、隐私保护或内容过滤。包含基础网络过滤模式(||、*、^、|)、所有网络过滤选项($domain、$third-party、$important、$redirect、$removeparam、$csp、$replace、$header、$method、$denyallow、$badfilter、$all 等)、内容类型选项($script、$image、$stylesheet、$font、$media、$xhr、$popup、$document、$frame 等)、元素隐藏规则(## 选择器、实体匹配、主机名正则)、过程式元素隐藏过滤器(:has、:has-text、:matches-css、:upward、:xpath、:matches-path、:watch-attr 等)、动作操作符(:remove、:style、:remove-attr、:remove-class)、HTML 过滤器(##^)、响应头过滤(##^responseheader)、脚本注入(##+js())以及预处理指令(!#include、!#if)。当用户提到 uBlock Origin 过滤规则、uBO 语法、广告拦截规则、元素隐藏规则、过程式选择器、脚本注入或希望编写/调试任何 uBO 兼容过滤列表时触发。即使用户只是在编写或调试 uBlock Origin 过滤规则、创建自定义过滤列表或从 AdBlock Plus/AdGuard 迁移过滤规则到 uBO,也应使用此技能。
write-ublock-origin-filters
Complete uBlock Origin (uBO) static filter reference. Use this skill when writing or debugging uBO custom filters or filter lists for ad blocking, privacy or content filtering, or when migrating filters from AdBlock Plus/AdGuard. Covers network patterns (||, *, ^, |) and options ($domain, $third-party, $important, $redirect, $removeparam, $csp, $replace, $header, $method, $badfilter, $all), content-type options ($script, $image, $stylesheet, $font, $media, $xhr, $popup, $document, $frame), cosmetic filters (##, CSS selectors, entity matching), procedural filters (:has, :has-text, :matches-css, :upward, :xpath, :matches-path, :watch-attr), action operators (:remove, :style, :remove-attr), HTML filters (##^), response-header filtering (##^responseheader), scriptlet injection (##+js()), and pre-parsing directives (!#include, !#if). Trigger whenever the user mentions uBO syntax, ad blocking rules, element hiding, procedural selectors, scriptlet injection, or a uBO-compatible filter list.
write-tampermonkey-scripts
引导 AI 代理规划、编写、调试、测试和维护 Tampermonkey 用户脚本。当用户请求用户脚本、浏览器页面自动化、DOM 增强、Tampermonkey 元数据、GM_* API、@match、@grant、@run-at、@connect、跨源请求、SPA 页面集成或脚本注入任务时使用此技能,即使用户没有明确提及 Tampermonkey。
write-tampermonkey-scripts
Guide an AI agent through planning, writing, debugging, testing, and maintaining Tampermonkey userscripts. Use this skill whenever a user asks for a userscript, browser-page automation, DOM enhancement, Tampermonkey metadata, GM_* API, @match, @grant, @run-at, @connect, cross-origin request, SPA page integration, or script injection task, even when Tampermonkey is not named explicitly.
write-adguard-filters
编写 AdGuard 自定义过滤规则时使用此技能。涵盖基本规则语法、所有修饰符($domain/$third-party/$important/$redirect/$replace/$removeparam/$cookie/$csp 等)、外观规则(元素隐藏/CSS/Extended CSS 选择器)、HTML 过滤、JavaScript/脚本片段规则、非基本规则修饰符、预处理器指令和调试技巧。当用户提及 AdGuard 过滤规则、广告拦截规则语法、过滤器列表编写、ABP 语法兼容、元素隐藏规则、Extended CSS 选择器(:has/:contains/:matches-css 等)时触发。即使用户只是在编写或调试任何类型的广告过滤规则,也应使用此技能。
write-adguard-filters
Complete AdGuard filtering rules syntax reference. Use this skill when writing AdGuard custom filters. Covers basic rule syntax, all modifiers ($domain/$third-party/$important/$redirect/$replace/$removeparam/$cookie/$csp etc.), cosmetic rules (element hiding/CSS/Extended CSS selectors), HTML filtering, JavaScript/scriptlet rules, non-basic rule modifiers, preprocessor directives, and debugging. Trigger when user mentions AdGuard filtering rules, ad blocking rule syntax, filter list authoring, ABP syntax compatibility, element hiding rules, Extended CSS selectors (:has/:contains/:matches-css etc.). Use this skill even when the user is just writing or debugging any type of ad filtering rules.