Article Bookmarker Skill
IMPORTANT: Before any operation, read the environment variable $ARTICLE_BOOKMARK_DIR to determine the bookmark storage directory. All bookmark files and the tag index must be stored under this path. If the variable is not set, prompt the user to configure it.
When calling scripts/bookmark.sh, you must pass ARTICLE_BOOKMARK_DIR and ARTICLE_BOOKMARK_GITHUB as inline environment variables — the script runs in a subprocess and does not inherit them automatically.
Quick Start
When the user provides a URL or article text to bookmark:
- 1. Run
scripts/bookmark.sh init to initialize the bookmark directory - Read
$ARTICLE_BOOKMARK_DIR to get the storage path - Use
web_fetch to get the article content - Generate a concise summary using the current model
- Auto-generate relevant tags based on content analysis
- Create a markdown file with URL, content, summary, and tags (see file-structure.md for format details)
- Save to the bookmark directory with descriptive filename
- Update the tag index file
- Run
scripts/bookmark.sh save "Brief commit message" to commit and push changes
For deletion requests: find the article, confirm details with user, then remove, update index, and run scripts/bookmark.sh save "Delete article xxx".
Workflow
Adding Articles
CODEBLOCK0
Deleting Articles
CODEBLOCK1
Tag Management
Auto-Tagging Logic
Generate tags by analyzing:
- - Article domain/topic keywords
- Technical terms and concepts
- Content categories (tutorial, news, research, etc.)
- Named entities and proper nouns
Maintain consistent tag vocabulary to avoid duplicates (e.g., use "AI" not "artificial-intelligence").
Tag Index Format
TAGINDEX.md maintains bidirectional mapping (see file-structure.md for full format):
CODEBLOCK2
Implementation Details
Content Extraction
- - Use
web_fetch with extractMode: "markdown" for web articles - Handle truncation gracefully (respect
maxChars limits) - Preserve original formatting where possible
- GitHub Repository URLs: When the URL is a GitHub repository (e.g.,
https://github.com/user/repo), prioritize fetching the README content from the repository's main page or from README.md, readme.md, or README.rst files in the root directory
Proxy Configuration and Retry
When fetching article content from URLs fails:
- 1. First Attempt: Try fetching without proxy
- On Failure: Load proxy configuration from environment variables:
-
HTTP_PROXY or
http_proxy: HTTP proxy URL
-
HTTPS_PROXY or
https_proxy: HTTPS proxy URL
-
NO_PROXY or
no_proxy: Comma-separated list of hosts to bypass
- 3. Retry: Re-attempt fetching with proxy configuration
- Final Failure: Notify user if both attempts fail
Example environment variables:
CODEBLOCK3
Summary Generation
Generate 2-3 paragraph summaries that capture:
- - Main thesis or argument
- Key insights or findings
- Practical implications or applications
Keep summaries informative but concise (typically 150-300 words).
File Naming
Create SEO-friendly filenames:
- - Convert title to lowercase
- Replace spaces and special chars with hyphens
- Limit length to ~50 characters
- Ensure uniqueness by appending numbers if needed
Safety Checks
- - Validate URLs before fetching
- Confirm deletions with users (show path and key details)
- Maintain backup of index before modifications
- Handle concurrent access gracefully
文章书签技能
重要:在执行任何操作前,先读取环境变量 $ARTICLEBOOKMARKDIR 以确定书签存储目录。所有书签文件和标签索引必须存储在此路径下。如果该变量未设置,请提示用户进行配置。
调用 scripts/bookmark.sh 时,必须将 ARTICLEBOOKMARKDIR 和 ARTICLEBOOKMARKGITHUB 作为内联环境变量传递——该脚本在子进程中运行,不会自动继承这些变量。
快速开始
当用户提供要添加书签的URL或文章文本时:
- 1. 运行 scripts/bookmark.sh init 初始化书签目录
- 读取 $ARTICLEBOOKMARKDIR 获取存储路径
- 使用 webfetch 获取文章内容
- 使用当前模型生成简洁摘要
- 基于内容分析自动生成相关标签
- 创建包含URL、内容、摘要和标签的Markdown文件(格式详情见 file-structure.md)
- 使用描述性文件名保存到书签目录
- 更新标签索引文件
- 运行 scripts/bookmark.sh save 简短的提交信息 提交并推送更改
对于删除请求:查找文章,与用户确认详情,然后删除、更新索引,并运行 scripts/bookmark.sh save 删除文章 xxx。
工作流程
添加文章
- 1. 运行 scripts/bookmark.sh init
- 读取 $ARTICLEBOOKMARKDIR
- 接收URL或文本内容
- 提取/保存内容(URL使用 web_fetch)
- 生成摘要(基于模型)
- 自动标签(关键词/主题分析)
- 创建书签文件(Markdown格式)
- 更新标签索引
- 运行 scripts/bookmark.sh save 添加文章:<标题>
删除文章
- 1. 运行 ARTICLEBOOKMARKDIR=$ARTICLEBOOKMARKDIR ARTICLEBOOKMARKGITHUB=$ARTICLEBOOKMARKGITHUB scripts/bookmark.sh init
- 读取 $ARTICLEBOOKMARKDIR
- 识别目标文章(按文件名、主题或内容)
- 显示文章详情以供确认
- 获取用户确认
- 删除书签文件
- 更新标签索引
- 运行 ARTICLEBOOKMARKDIR=$ARTICLEBOOKMARKDIR ARTICLEBOOKMARKGITHUB=$ARTICLEBOOKMARKGITHUB scripts/bookmark.sh save 删除文章:<标题>
标签管理
自动标签逻辑
通过分析以下内容生成标签:
- - 文章领域/主题关键词
- 技术术语和概念
- 内容类别(教程、新闻、研究等)
- 命名实体和专有名词
保持一致的标签词汇以避免重复(例如,使用AI而非artificial-intelligence)。
标签索引格式
TAGINDEX.md 维护双向映射(完整格式见 file-structure.md):
markdown
文章标签索引
标签
按标签数量排列的文章
实现细节
内容提取
- - 对网页文章使用 web_fetch 并设置 extractMode: markdown
- 优雅处理截断(遵守 maxChars 限制)
- 尽可能保留原始格式
- GitHub仓库URL:当URL是GitHub仓库时(例如 https://github.com/user/repo),优先从仓库主页或根目录下的 README.md、readme.md 或 README.rst 文件中获取README内容
代理配置和重试
当从URL获取文章内容失败时:
- 1. 首次尝试:尝试不使用代理获取
- 失败后:从环境变量加载代理配置:
- HTTP
PROXY 或 httpproxy:HTTP代理URL
- HTTPS
PROXY 或 httpsproxy:HTTPS代理URL
- NO
PROXY 或 noproxy:逗号分隔的绕过代理主机列表
- 3. 重试:使用代理配置重新尝试获取
- 最终失败:如果两次尝试都失败,通知用户
环境变量示例:
bash
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
export NO_PROXY=localhost,127.0.0.1,.example.com
摘要生成
生成2-3段摘要,包含:
保持摘要信息丰富但简洁(通常150-300字)。
文件命名
创建SEO友好的文件名:
- - 将标题转换为小写
- 用连字符替换空格和特殊字符
- 限制长度约50个字符
- 必要时通过追加数字确保唯一性
安全检查
- - 在获取前验证URL
- 与用户确认删除操作(显示路径和关键详情)
- 在修改前维护索引备份
- 优雅处理并发访问