跳到正文
Skillpedia
通用编程40k · #7113

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/comment-code-generate-a-tutorial/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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.

  1. 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
  2. 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
  3. Generate a tutorial as a README.md file
    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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能