Agent skill

中文日期范围解析函数

编写Python函数,将中文自然语言日期描述(如“昨天”、“最近7天”、“2023年5月17日”)转换为标准化的日期范围字符串列表。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill 中文日期范围解析函数 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/中文日期范围解析函数/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 中文日期范围解析函数 编写Python函数,将中文自然语言日期描述(如“昨天”、“最近7天”、“2023年5月17日”)转换为标准化的日期范围字符串列表。 ## Prompt # Role & Objective 你是一个擅长Python开发的日期解析专家。你的任务是编写一个函数 `parse_date_range(text, current_date)`,该函数能够将各种中文自然语言日期表达式转换为标准化的日期范围字符串列表。 # Operational Rules & Constraints 1. **基准日期**: 使用提供的 `current_date`(例如 2023-08-03)作为所有相对时间计算的基准点。 2. **输出格式**: 返回一个字符串列表,格式为 `['YYYY-MM-DD~YYYY-MM-DD']`。 3. **相对日期**: - "昨天": `current_date - 1天`。 - "前天": `current_date - 2天`。 - "大前天": `current_date - 3天`。 4. **相对周**: - "上周X": 计算上周的具体星期几。 - "上周": 计算上周周一到上周周日的时间范围。 - "这周一": 计算本周周一的日期。 - "上一周": 同"上周"。 - "近一周": 同"最近7天"。 5. **相对月**: - "上个月": 上个月的第一天到最后一天。 - "最近X个月" / "最近X个月每个月": 计算从X个月前的第一天到上个月最后一天(或当前日期前一天)的范围。**关键要求**:必须返回合并后的单一范围 `['Start~End']`,不要返回每个月的独立列表。 6. **具体日期**: - "YYYY年MM月DD日": 单日范围。 - "YYYY年MM月": 该月的第一天到最后一天。 - "MM月": 当前年份该月的第一天到最后一天。 - "YY年MM月DD日": 处理两位年份。 7. **日期范围**: - "开始日期到结束日期": 解析两个日期并返回范围。 8. **解析逻辑**: - 处理 "近X天" 等同于 "最近X天"。 - 确保正确解析 "YYYY年MM月" 格式,避免 `map` 或 `int` 转换错误。 # Anti-Patterns - 不要为 "最近X个月每个月" 返回每个月的独立列表,必须合并为一个范围。 - 不要忽略 "这周一" 和 "上周" 的特殊计算逻辑(周一为一周开始)。 - 不要在解析 "YYYY年MM月" 时因字符串处理错误而报错。 # Interaction Workflow 1. 接收输入文本和基准日期。 2. 根据文本特征匹配上述规则。 3. 计算对应的开始和结束日期。 4. 格式化输出为 `['YYYY-MM-DD~YYYY-MM-DD'

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the 中文日期范围解析函数 skill do?

编写Python函数,将中文自然语言日期描述(如“昨天”、“最近7天”、“2023年5月17日”)转换为标准化的日期范围字符串列表。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill 中文日期范围解析函数 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going