{"id":"19bc582e-eb46-4943-a5f8-240e70b82375","shortId":"anvQ5c","kind":"skill","title":"baoyu-danger-x-to-markdown","tagline":"Converts X (Twitter) tweets and articles to markdown with YAML front matter. Uses reverse-engineered API requiring user consent. Use when user mentions \"X to markdown\", \"tweet to markdown\", \"save tweet\", or provides x.com/twitter.com URLs for conversion.","description":"# X to Markdown\n\nConverts X content to markdown:\n- Tweets/threads → Markdown with YAML front matter\n- X Articles → Full content extraction\n\n## User Input Tools\n\nWhen this skill prompts the user, follow this tool-selection rule (priority order):\n\n1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.\n2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.\n3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.\n\nConcrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.\n\n## Script Directory\n\nScripts located in `scripts/` subdirectory.\n\n**Path Resolution**:\n1. `{baseDir}` = this SKILL.md's directory\n2. Script path = `{baseDir}/scripts/main.ts`\n3. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun\n\n## Consent Requirement\n\n**Before any conversion**, check and obtain consent.\n\n### Consent Flow\n\n**Step 1**: Check consent file\n\n```bash\n# macOS\ncat ~/Library/Application\\ Support/baoyu-skills/x-to-markdown/consent.json\n\n# Linux\ncat ~/.local/share/baoyu-skills/x-to-markdown/consent.json\n```\n\n**Step 2**: If `accepted: true` and `disclaimerVersion: \"1.0\"` → print warning and proceed:\n```\nWarning: Using reverse-engineered X API. Accepted on: <acceptedAt>\n```\n\n**Step 3**: If missing or version mismatch → display disclaimer:\n```\nDISCLAIMER\n\nThis tool uses a reverse-engineered X API, NOT official.\n\nRisks:\n- May break if X changes API\n- No guarantees or support\n- Possible account restrictions\n- Use at your own risk\n\nAccept terms and continue?\n```\n\nUse `AskUserQuestion` with options: \"Yes, I accept\" | \"No, I decline\"\n\n**Step 4**: On accept → create consent file:\n```json\n{\n  \"version\": 1,\n  \"accepted\": true,\n  \"acceptedAt\": \"<ISO timestamp>\",\n  \"disclaimerVersion\": \"1.0\"\n}\n```\n\n**Step 5**: On decline → output \"User declined. Exiting.\" and stop.\n\n## Preferences (EXTEND.md)\n\nCheck EXTEND.md in priority order — the first one found wins:\n\n| Priority | Path | Scope |\n|----------|------|-------|\n| 1 | `.baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md` | Project |\n| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md` | XDG |\n| 3 | `$HOME/.baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md` | User home |\n\n| Result | Action |\n|--------|--------|\n| Found | Read, parse, apply settings |\n| Not found | **MUST** run first-time setup (see below) — do NOT silently create defaults |\n\n**EXTEND.md supports**: Download media by default, default output directory.\n\n### First-Time Setup (BLOCKING)\n\n**CRITICAL**: When EXTEND.md is not found, you **MUST use `AskUserQuestion`** to ask the user for their preferences before creating EXTEND.md. **NEVER** create EXTEND.md with defaults without asking. This is a **BLOCKING** operation — do NOT proceed with any conversion until setup is complete.\n\nUse `AskUserQuestion` with ALL questions in ONE call:\n\n**Question 1** — header: \"Media\", question: \"How to handle images and videos in tweets?\"\n- \"Ask each time (Recommended)\" — After saving markdown, ask whether to download media\n- \"Always download\" — Always download media to local imgs/ and videos/ directories\n- \"Never download\" — Keep original remote URLs in markdown\n\n**Question 2** — header: \"Output\", question: \"Default output directory?\"\n- \"x-to-markdown (Recommended)\" — Save to ./x-to-markdown/{username}/{tweet-id}.md\n- (User may choose \"Other\" to type a custom path)\n\n**Question 3** — header: \"Save\", question: \"Where to save preferences?\"\n- \"User (Recommended)\" — ~/.baoyu-skills/ (all projects)\n- \"Project\" — .baoyu-skills/ (this project only)\n\nAfter user answers, create EXTEND.md at the chosen location, confirm \"Preferences saved to [path]\", then continue.\n\nFull reference: [references/config/first-time-setup.md](references/config/first-time-setup.md)\n\n### Supported Keys\n\n| Key | Default | Values | Description |\n|-----|---------|--------|-------------|\n| `download_media` | `ask` | `ask` / `1` / `0` | `ask` = prompt each time, `1` = always download, `0` = never |\n| `default_output_dir` | empty | path or empty | Default output directory (empty = `./x-to-markdown/`) |\n\n**Value priority**:\n1. CLI arguments (`--download-media`, `-o`)\n2. EXTEND.md\n3. Skill defaults\n\n## Usage\n\n```bash\n${BUN_X} {baseDir}/scripts/main.ts <url>\n${BUN_X} {baseDir}/scripts/main.ts <url> -o output.md\n${BUN_X} {baseDir}/scripts/main.ts <url> --download-media\n${BUN_X} {baseDir}/scripts/main.ts <url> --json\n```\n\n## Options\n\n| Option | Description |\n|--------|-------------|\n| `<url>` | Tweet or article URL |\n| `-o <path>` | Output path |\n| `--json` | JSON output |\n| `--download-media` | Download image/video assets to local `imgs/` and `videos/`, and rewrite markdown links to local relative paths |\n| `--login` | Refresh cookies only |\n\n## Supported URLs\n\n- `https://x.com/<user>/status/<id>`\n- `https://twitter.com/<user>/status/<id>`\n- `https://x.com/i/article/<id>`\n\n## Output\n\n```markdown\n---\nurl: \"https://x.com/user/status/123\"\nauthor: \"Name (@user)\"\ntweetCount: 3\ncoverImage: \"https://pbs.twimg.com/media/example.jpg\"\n---\n\nContent...\n```\n\n**File structure**: `x-to-markdown/{username}/{tweet-id}/{content-slug}.md`\n\nWhen `--download-media` is enabled:\n- Images are saved to `imgs/` next to the markdown file\n- Videos are saved to `videos/` next to the markdown file\n- Markdown media links are rewritten to local relative paths\n\n## Media Download Workflow\n\nBased on `download_media` setting in EXTEND.md:\n\n| Setting | Behavior |\n|---------|----------|\n| `1` (always) | Run script with `--download-media` flag |\n| `0` (never) | Run script without `--download-media` flag |\n| `ask` (default) | Follow the ask-each-time flow below |\n\n### Ask-Each-Time Flow\n\n1. Run script **without** `--download-media` → markdown saved\n2. Check saved markdown for remote media URLs (`https://` in image/video links)\n3. **If no remote media found** → done, no prompt needed\n4. **If remote media found** → use `AskUserQuestion`:\n   - header: \"Media\", question: \"Download N images/videos to local files?\"\n   - \"Yes\" — Download to local directories\n   - \"No\" — Keep remote URLs\n5. If user confirms → run script **again** with `--download-media` (overwrites markdown with localized links)\n\n## Authentication\n\n1. **Environment variables** (preferred): `X_AUTH_TOKEN`, `X_CT0`\n2. **Chrome login** (fallback): Auto-opens Chrome, caches cookies locally\n\n## Extension Support\n\nCustom configurations via EXTEND.md. See **Preferences** section for paths and supported options.","tags":["baoyu","danger","markdown","skills","jimliu","agent-skills","claude-skills","codex-skills","openclaw-skills"],"capabilities":["skill","source-jimliu","skill-baoyu-danger-x-to-markdown","topic-agent-skills","topic-claude-skills","topic-codex-skills","topic-openclaw-skills"],"categories":["baoyu-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/JimLiu/baoyu-skills/baoyu-danger-x-to-markdown","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add JimLiu/baoyu-skills","source_repo":"https://github.com/JimLiu/baoyu-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 16958 github stars · SKILL.md body (6,846 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-03T00:52:27.090Z","embedding":null,"createdAt":"2026-04-18T21:53:28.022Z","updatedAt":"2026-05-03T00:52:27.090Z","lastSeenAt":"2026-05-03T00:52:27.090Z","tsv":"'/.baoyu-skills':547 '/.local/share/baoyu-skills/x-to-markdown/consent.json':243 '/baoyu-danger-x-to-markdown/extend.md':363 '/baoyu-skills/baoyu-danger-x-to-markdown/extend.md':370 '/i/article/':692 '/library/application':239 '/media/example.jpg':707 '/scripts/main.ts':200,629,633,639,646 '/status':687,689 '/twitter.com':43 '/user/status/123':698 '/x-to-markdown':521,609 '0':588,596,779 '1':83,190,232,328,359,463,587,593,612,770,803,875 '1.0':251,333 '2':109,196,245,365,507,619,812,884 '3':136,201,266,372,537,621,703,823 '4':320,833 '5':335,858 'accept':247,263,305,315,322,329 'acceptedat':331 'account':298 'action':377 'agent':96 'alway':487,489,594,771 'answer':559 'api':23,262,283,292 'appli':381 'applic':148 'argument':614 'articl':12,62,653 'ask':104,124,159,423,438,475,482,585,586,589,788,793,799 'ask-each-tim':792,798 'askuserquest':99,169,310,421,455,839 'asset':666 'auth':880 'authent':874 'author':699 'auto':889 'auto-open':888 'avail':212 'baoyu':2,361,552 'baoyu-danger-x-to-markdown':1 'baoyu-skil':360,551 'base':761 'basedir':191,199,628,632,638,645 'bash':236,625 'batch':137 'behavior':769 'block':411,442 'break':288 'built':86 'built-in':85 'bun':203,207,209,215,219,626,630,636,643 'cach':892 'call':145,153,461 'cat':238,242 'chang':291 'check':225,233,346,813 'choos':529 'chosen':131,564 'chrome':885,891 'clarifi':103 'cli':613 'combin':146 'complet':453 'concret':168 'config':367 'configur':898 'confirm':566,861 'consent':26,220,228,229,234,324 'content':52,64,708,720 'content-slug':719 'continu':308,572 'convers':46,224,449 'convert':7,50 'cooki':682,893 'coverimag':704 'creat':323,396,430,433,560 'critic':412 'ct0':883 'current':95 'custom':534,897 'danger':3 'declin':318,337,340 'default':397,403,404,436,511,580,598,605,623,789 'descript':582,650 'dir':600 'directori':182,195,406,497,513,607,853 'disclaim':273,274 'disclaimervers':250,332 'display':272 'done':829 'download':400,485,488,490,499,583,595,616,641,662,664,725,759,763,776,785,808,843,850,867 'download-media':615,640,661,724,775,784,807,866 'e.g':98 'els':216 'emit':116 'empti':601,604,608 'enabl':728 'engin':22,260,281 'environ':876 'equival':108,177 'exampl':173 'exist':115 'exit':341 'expos':92 'extend.md':345,347,398,414,431,434,561,620,767,900 'extens':895 'extract':65 'fallback':110,887 'file':235,325,709,738,748,848 'first':352,388,408 'first-tim':387,407 'flag':778,787 'flow':230,796,802 'follow':75,790 'found':354,378,384,417,828,837 'front':17,59 'full':63,573 'guarante':294 'handl':469 'header':464,508,538,840 'home':368,375 'home/.baoyu-skills/baoyu-danger-x-to-markdown/extend.md':373 'home/.config':369 'id':525,718 'imag':470,729 'image/video':665,821 'images/videos':845 'img':494,669,733 'input':67,90,102 'instal':208,218 'json':326,647,658,659 'keep':500,855 'key':578,579 'link':675,751,822,873 'linux':241 'local':176,493,668,677,755,847,852,872,894 'locat':184,565 'login':680,886 'maco':237 'markdown':6,14,33,36,49,54,56,481,505,517,674,694,714,737,747,749,810,815,870 'matter':18,60 'may':287,528 'md':526,722 'media':401,465,486,491,584,617,642,663,726,750,758,764,777,786,809,818,827,836,841,868 'mention':30 'messag':122 'mismatch':271 'miss':268 'multipl':142 'must':385,419 'n':844 'name':700 'need':832 'never':432,498,597,780 'next':734,744 'npx':211,213 'number':118 'number/answer':132 'o':618,634,655 'obtain':227 'offici':285 'one':161,353,460 'open':890 'oper':443 'option':312,648,649,908 'order':82,167,350 'origin':501 'output':338,405,509,512,599,606,656,660,693 'output.md':635 'overwrit':869 'pars':380 'path':188,198,357,535,570,602,657,679,757,905 'pbs.twimg.com':706 'pbs.twimg.com/media/example.jpg':705 'per':144 'plain':120 'plain-text':119 'possibl':297 'prefer':84,344,428,544,567,878,902 'print':252 'prioriti':81,166,349,356,611 'proceed':255,446 'project':364,549,550,555 'prompt':72,590,831 'provid':40 'question':135,143,149,158,458,462,466,506,510,536,540,842 'read':379 'recommend':478,518,546 'refer':170,574 'references/config/first-time-setup.md':575,576 'refresh':681 'relat':678,756 'remot':502,817,826,835,856 'repli':128 'request':100 'requir':24,221 'resolut':189 'resolv':202 'restrict':299 'result':376 'revers':21,259,280 'reverse-engin':20,258,279 'rewrit':673 'rewritten':753 'risk':286,304 'rule':80 'run':386,772,781,804,862 'runtim':97,180,205 'save':37,480,519,539,543,568,731,741,811,814 'scope':358 'script':181,183,186,197,773,782,805,863 'section':903 'see':391,901 'select':79 'set':382,765,768 'setup':390,410,451 'silent':395 'singl':152,157 'single-quest':156 'skill':71,362,553,622 'skill-baoyu-danger-x-to-markdown' 'skill.md':193 'slug':721 'source-jimliu' 'step':231,244,265,319,334 'stop':343 'structur':710 'subdirectori':187 'substitut':174 'suggest':217 'support':141,296,399,577,684,896,907 'support/baoyu-skills/x-to-markdown/consent.json':240 'term':306 'text':121 'time':164,389,409,477,592,795,801 'token':881 'tool':68,78,91,114,140,276 'tool-select':77 'topic-agent-skills' 'topic-claude-skills' 'topic-codex-skills' 'topic-openclaw-skills' 'true':248,330 'tweet':10,34,38,474,524,651,717 'tweet-id':523,716 'tweetcount':702 'tweets/threads':55 'twitter':9 'twitter.com':688 'type':532 'url':44,503,654,685,695,819,857 'usag':624 'use':19,27,257,277,300,309,420,454,838 'user':25,29,66,74,89,101,105,126,339,374,425,527,545,558,701,860 'user-input':88 'usernam':522,715 'valu':581,610 'variabl':877 'version':270,327 'via':899 'video':472,496,671,739,743 'warn':253,256 'whether':483 'win':355 'without':437,783,806 'workflow':760 'x':4,8,31,47,51,61,204,261,282,290,515,627,631,637,644,712,879,882 'x-to-markdown':514,711 'x.com':42,686,691,697 'x.com/i/article/':690 'x.com/twitter.com':41 'x.com/user/status/123':696 'xdg':366,371 'y':214 'yaml':16,58 'yes':313,849","prices":[{"id":"1c82a82f-2187-4e88-acd7-e66f33dcd4f6","listingId":"19bc582e-eb46-4943-a5f8-240e70b82375","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"JimLiu","category":"baoyu-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:53:28.022Z"}],"sources":[{"listingId":"19bc582e-eb46-4943-a5f8-240e70b82375","source":"github","sourceId":"JimLiu/baoyu-skills/baoyu-danger-x-to-markdown","sourceUrl":"https://github.com/JimLiu/baoyu-skills/tree/main/skills/baoyu-danger-x-to-markdown","isPrimary":false,"firstSeenAt":"2026-04-18T21:53:28.022Z","lastSeenAt":"2026-05-03T00:52:27.090Z"}],"details":{"listingId":"19bc582e-eb46-4943-a5f8-240e70b82375","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"JimLiu","slug":"baoyu-danger-x-to-markdown","github":{"repo":"JimLiu/baoyu-skills","stars":16958,"topics":["agent-skills","claude-skills","codex-skills","openclaw-skills"],"license":null,"html_url":"https://github.com/JimLiu/baoyu-skills","pushed_at":"2026-04-25T20:03:31Z","description":null,"skill_md_sha":"a36e581c101f7cb0dea60bb9667ab4852f29b5d6","skill_md_path":"skills/baoyu-danger-x-to-markdown/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/JimLiu/baoyu-skills/tree/main/skills/baoyu-danger-x-to-markdown"},"layout":"multi","source":"github","category":"baoyu-skills","frontmatter":{"name":"baoyu-danger-x-to-markdown","description":"Converts X (Twitter) tweets and articles to markdown with YAML front matter. Uses reverse-engineered API requiring user consent. Use when user mentions \"X to markdown\", \"tweet to markdown\", \"save tweet\", or provides x.com/twitter.com URLs for conversion."},"skills_sh_url":"https://skills.sh/JimLiu/baoyu-skills/baoyu-danger-x-to-markdown"},"updatedAt":"2026-05-03T00:52:27.090Z"}}