AGENTS.md · kepano/defuddle
AGENTS.md from kepano/defuddle: 42 lines covering Security, Build and test, Runtime compatibility, Debugging extraction and more.
Template by kepano
Install
Works with Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code. Read the repository before you give any tool access to your data.
curl -fsSL https://raw.githubusercontent.com/kepano/defuddle/main/AGENTS.md -o AGENTS.md
Read it and adapt it to your project before use.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: prompt-engineering
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
What's in it
An AGENTS.md file: instructions coding agents (Codex, Cursor, Copilot, Gemini CLI and others) read before working in a repo.
- For
- Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code
- Length
- 42 lines
- File
AGENTS.md
Sections
- Security
- Build and test
- Runtime compatibility
- Debugging extraction
- Common pitfalls
First lines (shown under the repo's MIT license)
# Defuddle
Extracts main content from web pages as clean HTML.
## Security
- Never use `innerHTML` directly. Use `parseHTML()` from `src/utils/dom.ts` (template-based parsing without script execution or resource loading).
- Escape every page-derived value interpolated into HTML with `escapeHtml()`, or build nodes with `createElement`/`setAttribute` and `serializeHTML()`. Downstream sanitization does not replace escaping at the point of interpolation.
- Strip `javascript:`, `blob:`, and non-image `data:` URLs from `href`/`src`. Allow `data:image/*` except as an iframe `src`. Strip iframe `srcdoc` and all `on*` event handlers.
- Preserve sanitization regardless of pipeline options. See `isDangerousUrl()` in `src/utils/dom.ts` and `_stripUnsafeElements()` in `src/defuddle.ts`.
- Cover new extractors with a poisoned-attribute case in `tests/extractor-xss.test.ts`.
## Build and test
- `npm run build` — build all bundles.
- `npm test` — run Vitest.
- For extraction fixes, add a minimal HTML fixture in `tests/fixtures/` with correct expected output in `tests/expected/`. Verify the same fixture fails before the fix and passes afterward; do not change expectations to match buggy behavior.
- Anonymize fixtures: replace real names, emails, URLs, and identifying content with generic placeholders.
- Always use `curl` to test the Worker or defuddle.md; never open those URLs in a browser.
- Local Worker: run `cd website && npx wrangler dev`, then `curl http://localhost:8787/https://stephango.com/saw`.
- Production: `curl https://defuddle.md/https://stephango.com/saw`.
## Runtime compatibility
Changes must work across these environments:
- Browser (`defuddle`, `defuddle/full`): native DOM.
- Node.js (`defuddle/node`): async API accepting any DOM `Document`, including linkedom, JSDOM, and happy-dom.
- CLI (`src/cli.ts`) and Cloudflare Worker (`website/src/convert.ts`): linkedom; the Worker is the most constrained environment.
## Debugging extraction
- Start with `{ debug: true }` and inspect `result.debug.removals` and `result.debug.contentSelector`. Debug mode preserves class/id/data attributes and skips div flattening.
- Disable removal steps individually to isolate content loss. Use `contentSelector` to bypass incorrect main-content detection.
- For selector issues, inspect `EXACT_SELECTORS` and `PARTIAL_SELECTORS` in `src/constants.ts`. Elements inside `<pre>` or `<code>` are protected from selector removal.
- Standardize footnotes and callouts before removals: CSS sidenotes may use `display:none`, and callout classes such as `.alert` otherwise match clutter selectors.
## Common pitfalls
- UMD bundles use webpack `export: 'default'`; expose named exports as static properties on the default class (see `src/index.full.ts`).
- `getElementsByTagName` returns live HTMLCollections. Use `Array.from()` before mutating the DOM.Signals
- Stars
- 9,778
- Forks
- 444
- Open issues
- 60
- Last commit (this folder)
- Sep 20, 2026 (1 month ago)
- Last release
- Oct 24, 2026 (4 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/kepano/defuddle
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from kepano
- 0.830score
knap
kepano
Render Markdown from templates and structured data using Knap CLI.
SkillBFreshness: B★ 50KClaude Code +9 - 0.820score
defuddle
kepano
Extract clean Markdown from HTML pages with Defuddle CLI.
SkillBFreshness: B★ 50KClaude Code +9 - 0.704score
json-canvas
kepano
Create and edit JSON Canvas files (.canvas) with nodes, edges, groups, and connections.
SkillDFreshness: D★ 50KClaude Code +9 - 0.698score
obsidian-cli
kepano
Interact with Obsidian vaults using the Obsidian CLI to read, create, search, and manage notes, tasks, properties, and more.
SkillDFreshness: D★ 50KClaude Code +9 - 0.587score
obsidian-markdown
kepano
Create and edit Obsidian Flavored Markdown with wikilinks, embeds, callouts, properties, and other Obsidian-specific syntax.
SkillDFreshness: D★ 50KClaude Code +9 - 0.587score
obsidian-bases
kepano
Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries.
SkillDFreshness: D★ 50KClaude Code +9
Cite this page
AGENTS.md · kepano/defuddle. Agent Mart. https://agentmart.dev/templates/kepano-defuddle-agents-md (last updated 2026-10-24)