comment-code-generate-a-tutorial
它能做什么
这个工具可以把一段 Python 脚本改造成一个容易理解的项目。它会整理代码、加入分步讲解,并生成一份完整的文字指南,让任何人都能学会使用它。
适用场景
- ✓你的 Python 代码不够清晰时。
- ✓想教别人如何使用某个脚本时。
- ✓想把一段简单的代码变成一个完整、带讲解的项目时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/comment-code-generate-a-tutorial/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“把这段 Python 代码改造成一个适合新手的项目,加上讲解和使用指南。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会先按照最佳实践优化代码,然后为每个部分添加解释性注释,最后生成一份 Markdown 文件,作为完整的项目指南。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Transform this Python script into a polished, beginner-friendly project by refactoring the code, adding clear instructional comments, and generating a complete markdown tutorial.
Refactor the code
- Apply standard Python best practices
- Ensure code follows the PEP 8 style guide
- Rename unclear variables and functions if needed for clarity
Add comments throughout the code
- Use a beginner-friendly, instructional tone
- Explain what each part of the code is doing and why it's important
- Focus on the logic and reasoning, not just syntax
- Avoid redundant or superficial comments
Generate a tutorial as a
README.mdfile
Include the following sections:- Project Overview: What the script does and why it's useful
- Setup Instructions: Prerequisites, dependencies, and how to run the script
- How It Works: A breakdown of the code logic based on the comments
- Example Usage: A code snippet showing how to use it
- Sample Output: (Optional) Include if the script returns visible results
- Use clear, readable Markdown formatting
常见问题
“重构代码” 是什么意思?
就是在不改变代码功能的前提下,整理和优化现有代码,让它更简洁、更易读。
为什么要添加注释?
注释是写在代码里的说明,用来解释每一部分的作用,帮助读者理解代码的逻辑。
什么是 Markdown 教程?
它是一种用简单文本格式编写的指南,可以很方便地转换成网页或排版精美的文档,比如项目的 README。
详情
作者的原始描述
Transform this Python script into a polished, beginner-friendly project by refactoring the code, adding clear instructional comments, and generating a complete markdown tutorial.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7113
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。