baoyu-danger-x-to-markdown
Install this skill
npx skills add jimliu/baoyu-skillsWorks across Claude Code, Cursor, Codex, Copilot & Antigravity
The baoyu-danger-x-to-markdown skill provides an automated pipeline for transforming X content into structured Markdown files. It handles both individual tweet threads and full-length X articles, wrapping the captured text in YAML front matter that includes author information, the source URL, and total tweet counts. Because the tool relies on a reverse-engineered API rather than an official integration, it incorporates a mandatory consent workflow to ensure users acknowledge the stability risks associated with third-party web scraping. By supporting both environment variable authentication and browser-based cookie caching, it permits users to archive social media content locally for knowledge management or offline reference. The skill is extensible through configuration files, allowing customization of the output process for specific user requirements or project-based documentation standards.
When to Use This Skill
- β’Archiving technical tweet threads into a personal knowledge base
- β’Saving long-form X articles into project-specific Markdown documentation
- β’Converting social media discussions into internal developer notes
- β’Creating local backups of research content for offline viewing
How to Invoke This Skill
Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:
- βConvert this X thread to markdown
- βSave this twitter article to a local md file
- βExport thread from x.com to obsidian
- βRun the x-to-markdown script on this url
- βExtract content from this tweet and format as markdown
Pro Tips
- π‘Always ensure explicit consent is given as per the skill's instructions to avoid interruption and ensure proper functionality.
- π‘Review the generated Markdown for any specific formatting nuances, especially with complex tweet threads or heavily formatted articles.
- π‘Combine this skill with other content processing agents, such as summarizers or translators, to further enhance the utility of the extracted Markdown.
What this skill does
- β’Converts X threads and long-form articles into Markdown
- β’Generates YAML front matter with metadata for each export
- β’Supports browser cookie caching for automated session login
- β’Provides optional JSON output format for programmatic handling
- β’Allows custom logic injections via EXTEND.md configuration files
When not to use it
- βWhen you require a stable, officially supported API integration
- βWhen you need to interact with private or protected accounts
- βWhen building a production-grade application that cannot tolerate unexpected breaking changes
Example workflow
- Verify X URL is valid and matches supported formats
- Execute the tool via npx bun with the target URL
- Complete the mandatory disclaimer consent prompt in the terminal
- Provide authentication tokens or complete the browser-based login
- Review the generated .md file in the destination directory
Prerequisites
- βBun runtime installed on the local machine
- βActive X account for authentication tokens
- βRead/write permissions for the target output directory
Pitfalls & limitations
- !The tool may fail immediately if X updates their API structure
- !Frequent scraping can lead to account restrictions or rate limiting by X
- !Requires manual maintenance of auth cookies if environment variables expire
FAQ
How it compares
Unlike manual copy-pasting or generic AI summarization, this tool produces machine-readable YAML front matter and preserves thread structure automatically, ensuring consistency for permanent archival.
π Full skill instructions β original source: jimliu/baoyu-skills
Converts X (Twitter) content to markdown format:
- Tweet threads β Markdown with YAML front matter
- X Articles β Full article content extraction
## Script Directory
**Important**: All scripts are located in the
scripts/ subdirectory of this skill.**Agent Execution Instructions**:
1. Determine this SKILL.md file's directory path as
SKILL_DIR2. Script path =
${SKILL_DIR}/scripts/<script-name>.ts3. Replace all
${SKILL_DIR} in this document with the actual path**Script Reference**:
| Script | Purpose |
|--------|---------|
|
scripts/main.ts | CLI entry point for URL conversion |## β οΈ Disclaimer (REQUIRED)
**Before using this skill**, the consent check MUST be performed.
### Consent Check Flow
**Step 1**: Check consent file
# macOS
cat ~/Library/Application\ Support/baoyu-skills/x-to-markdown/consent.json 2>/dev/null
# Linux
cat ~/.local/share/baoyu-skills/x-to-markdown/consent.json 2>/dev/null
# Windows (PowerShell)
Get-Content "$env:APPDATA\baoyu-skills\x-to-markdown\consent.json" 2>$null**Step 2**: If consent exists and
accepted: true with matching disclaimerVersion: "1.0":Print warning and proceed:
β οΈ Warning: Using reverse-engineered X API (not official). Accepted on: <acceptedAt date>**Step 3**: If consent file doesn't exist or
disclaimerVersion mismatch:Display disclaimer and ask user:
β οΈ DISCLAIMER
This tool uses a reverse-engineered X (Twitter) API, NOT an official API.
Risks:
- May break without notice if X changes their API
- No official support or guarantees
- Account restrictions possible if API usage detected
- Use at your own risk
Do you accept these terms and wish to continue?Use
AskUserQuestion tool with options:- **Yes, I accept** - Continue and save consent
- **No, I decline** - Exit immediately
**Step 4**: On acceptance, create consent file:
# macOS
mkdir -p ~/Library/Application\ Support/baoyu-skills/x-to-markdown
cat > ~/Library/Application\ Support/baoyu-skills/x-to-markdown/consent.json << 'EOF'
{
"version": 1,
"accepted": true,
"acceptedAt": "<ISO timestamp>",
"disclaimerVersion": "1.0"
}
EOF
# Linux
mkdir -p ~/.local/share/baoyu-skills/x-to-markdown
cat > ~/.local/share/baoyu-skills/x-to-markdown/consent.json << 'EOF'
{
"version": 1,
"accepted": true,
"acceptedAt": "<ISO timestamp>",
"disclaimerVersion": "1.0"
}
EOF**Step 5**: On decline, output message and stop:
User declined the disclaimer. Exiting.---
## Usage
# Convert tweet (outputs markdown path)
npx -y bun ${SKILL_DIR}/scripts/main.ts <url>
# Save to specific file
npx -y bun ${SKILL_DIR}/scripts/main.ts <url> -o output.md
# JSON output
npx -y bun ${SKILL_DIR}/scripts/main.ts <url> --json## Options
| Option | Description |
|--------|-------------|
|
<url> | Tweet or article URL ||
-o <path> | Output path (file or dir) ||
--json | Output as JSON ||
--login | Refresh cookies only |## File Structure
x-to-markdown/
βββ {username}/
βββ {tweet-id}.md## Supported URLs
-
https://x.com/<user>/status/<id>-
https://twitter.com/<user>/status/<id>-
https://x.com/i/article/<id>## Output Format
---
url: https://x.com/username/status/123
author: "Display Name (@username)"
tweet_count: 3
---
Tweet content...
---
Thread continuation...## Authentication
**Option 1**: Environment variables (recommended)
-
X_AUTH_TOKEN - auth_token cookie-
X_CT0 - ct0 cookie**Option 2**: Chrome login (auto if env vars not set)
- First run opens Chrome for login
- Cookies cached locally
## Extension Support
Custom configurations via EXTEND.md.
**Check paths** (priority order):
1.
.baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md (project)2.
~/.baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md (user)If found, load before workflow. Extension content overrides defaults.
How to Use This Skill Unit
Option A: Project-Specific (Recommended)
- Click "Download" above
- In your project, create the directory:
.agent/skills/baoyu-danger-x-to-markdown/ - Save the file as
SKILL.md - The agent will automatically discover the skill based on its description.
Option B: Global Installation (All Agents)
Save the file to these locations to make it available across all projects:
- Claude Code:
~/.claude/skills/jimliu/baoyu-skills/baoyu-danger-x-to-markdown/SKILL.md - Cursor:
~/.cursor/skills/jimliu/baoyu-skills/baoyu-danger-x-to-markdown/SKILL.md - Antigravity:
~/.gemini/antigravity/skills/jimliu/baoyu-skills/baoyu-danger-x-to-markdown/SKILL.md
π Install with CLI:npx skills add jimliu/baoyu-skills