comment-code-generate-a-tutorial

作者: github

將Python腳本重構為適合初學者的專案,包含教學註解與Markdown教學文件。遵循PEP 8風格指南與標準Python最佳實踐以提升程式碼品質,在程式碼中加入教學註解,解釋邏輯、推理與對學習者的重要性。生成完整的README.md教學文件,包含專案概述、設定說明、程式碼解析、使用範例與範例輸出。重新命名不明確的變數與函式以提升清晰度...

npx skills add https://github.com/github/awesome-copilot --skill comment-code-generate-a-tutorial

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