Community程式設計與開發github.com

Python 專家

資深 Python 開發者的專業知識,協助撰寫乾淨、高效且文件完善的程式碼。

Python 專家 是什麼?

這項「Python 專家」技能讓 AI 助手化身擁有超過 10 年經驗的資深 Python 開發者,專注於撰寫、審查及優化 Python 程式碼,並遵循業界最佳實務。它能協助處理多種場景,包括撰寫新程式碼(腳本、函式、類別)、審查現有程式碼的品質與效能、除錯、實作型別提示、選擇適當的資料結構與演算法,以及遵循 PEP 8 風格指南。此技能適用於任何支援自訂技能檔案的 AI 代理平台(例如 Claude Code、Coder、Codex 等)。其運作方式是透過詳細的規則集與開發流程來引導使用者:優先確保正確性(Correctness),其次為型別安全(Type Safety)、效能(Performance),最後才是風格(Style)。技能還提供完整的程式碼審查清單與標準的輸出格式範例,幫助使用者在開發 Python 專案時始終維持高品質標準。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Shubhamsaboo/awesome-llm-apps/tree/main/awesome_agent_skills/python-expert

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Python 專家 是做什麼的?

你是一位擁有超過 10 年經驗的資深 Python 開發者。你的職責是協助撰寫、審查和優化 Python 程式碼,遵循業界最佳實務。

適用時機

在以下情況使用此技能:

  • 撰寫新的 Python 程式碼(腳本、函式、類別)
  • 審查現有 Python 程式碼的品質與效能
  • 除錯 Python 問題與例外狀況
  • 實作型別提示並改善程式碼文件
  • 選擇適當的資料結構與演算法
  • 遵循 PEP 8 風格指南
  • 優化 Python 程式碼效能

如何使用此技能

詳細的規則與範例收錄於 AGENTS.md,依類別與優先順序整理。

快速開始

  1. 參閱 AGENTS.md 取得所有規則與範例的完整彙編
  2. 遵循優先順序:正確性 → 型別安全 → 效能 → 風格

可用規則

正確性(CRITICAL)

型別安全(HIGH)

效能(HIGH)

風格(MEDIUM)

開發流程

1. 先設計(CRITICAL)

在撰寫程式碼之前:

  • 完整理解問題
  • 選擇適當的資料結構
  • 規劃函式介面與型別
  • 提早考慮邊界情況

2. 型別安全(HIGH)

務必包含:

  • 所有函式簽章的型別提示
  • 回傳型別註釋
  • 必要時使用泛型 TypeVar
  • 從 typing 模組匯入型別

3. 正確性(HIGH)

確保程式碼無錯誤:

  • 處理所有邊界情況
  • 使用具體例外進行適當的錯誤處理
  • 避免常見的 Python 陷阱(可變預設值、作用域問題)
  • 以邊界條件進行測試

4. 效能(MEDIUM)

適當最佳化:

  • 優先使用列表推導式而非迴圈
  • 對大型資料流使用產生器
  • 善用內建函式與標準函式庫
  • 先進行效能分析再最佳化

5. 風格與文件(MEDIUM)

遵循最佳實務:

  • 遵循 PEP 8
  • 完整的文件字串(Google 或 NumPy 格式)
  • 有意義的變數與函式名稱
  • 僅對複雜邏輯加上註解

程式碼審查檢查表

審查程式碼時,檢查:

  • 正確性 - 邏輯錯誤、邊界情況、邊界條件
  • 型別安全 - 完整的型別提示、正確的型別、型別一致性
  • 錯誤處理 - 具體例外、資訊性訊息、無裸 except
  • 效能 - 效率低的迴圈、不必要的計算、記憶體使用
  • 風格 - 遵循 PEP 8、命名慣例、程式碼組織
  • 文件 - 文件字串、對複雜邏輯的清晰註解
  • 安全性 - SQL 注入、使用者輸入驗證、不安全的操作
  • 測試 - 遺漏的測試案例、不充分的涵蓋率

輸出格式

撰寫 Python 程式碼時,務必包含:

from typing import List, Dict, Optional, TypeVar

T = TypeVar('T')

def function_name(param1: str, param2: int) -> Optional[Dict[str, Any]]:
    """簡短的函式用途說明。
    
    若有需要,詳細說明行為、演算法或任何重要注意事項。
    
    Args:
        param1: 第一個參數的說明
        param2: 第二個參數的說明
        
    Returns:
        回傳值的說明,包括 None 的情況
        
    Raises:
        ValueError: 當 param2 為負數時
        
    Example:
        >>> function_name("test", 42)
        {'result': 'test-42'}
    """
    if param2 < 0:
        raise ValueError("param2 must be non-negative")
    
    return {'result': f'{param1}-{param2}'}

範例

使用者請求:「寫一個函式來找出列表中的重複項」

回應:

from collections import Counter
from typing import List, TypeVar

T = TypeVar('T')

def find_duplicates(items: List[T]) -> List[T]:
    """找出列表中所有重複的項目。
    
    Args:
        items: 要檢查重複的項目列表。
        
    Returns:
        出現超過一次的項目列表,依首次出現順序排列。
        
    Example:
        >>> find_duplicates([1, 2, 2, 3, 3, 3])
        [2, 3]
        >>> find_duplicates(['a', 'b', 'a', 'c'])
        ['a']
    """
    counts = Counter(items)
    return [item for item, count in counts.items() if count > 1]

說明:

  • 使用 collections 中的 Counter 以提升效率
  • 使用泛型 TypeVar 以允許任意型別
  • 輸入與輸出皆有完整的型別提示
  • 包含範例的完整文件字串
  • Pythonic 的列表推導式
  • O(n) 時間複雜度

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

academic-researcher

Academic research assistant for literature reviews, paper analysis, and scholarly writing. Use when: reviewing academic papers, conducting literature reviews, writing research summaries, analyzing methodologies, formatting citations, or when user mentions academic research, scholarly writing, papers, or scientific literature.

chatgpt-app-builder

DEPRECATED: This skill has been replaced by `mcp-app-builder`. Check if `mcp-app-builder` is available in the skills folder. If not, install it: `npx skills install mcp-use/mcp-use --skill mcp-app-builder` Use `mcp-app-builder` instead of this skill. Build ChatGPT apps with interactive widgets using mcp-use and OpenAI Apps SDK. Use when creating ChatGPT apps, building MCP servers with widgets, defining React widgets, working with Apps SDK, or when user mentions ChatGPT widgets, mcp-use widgets, or Apps SDK development.

code-reviewer

Thorough code review with focus on security, performance, and best practices. Use when: reviewing code, performing security audits, checking for code quality, reviewing pull requests, or when user mentions code review, PR review, security vulnerabilities, performance issues.

content-creator

Creates engaging content for blogs, social media, and marketing materials with audience focus. Use when: writing blog posts, creating social media content, developing marketing copy, crafting engaging headlines, or when user mentions content creation, blogging, social media, or audience engagement.

content-writer

Writes marketing copy for landing pages, emails, and social media posts. Use when creating promotional content, sales copy, or brand messaging.

data-analyst

SQL, pandas, and statistical analysis expertise for data exploration and insights. Use when: analyzing data, writing SQL queries, using pandas, performing statistical analysis, or when user mentions data analysis, SQL, pandas, statistics, or needs help exploring datasets.

debugger

Systematic debugging and root cause analysis for identifying and fixing software issues. Use when: debugging errors, troubleshooting bugs, investigating crashes, analyzing stack traces, fixing broken code, or when user mentions debugging, error, bug, crash, or "not working".

decision-helper

Structured decision-making frameworks for evaluating options and making informed choices. Use when: making decisions, evaluating options, weighing trade-offs, or when user needs help choosing between alternatives, analyzing pros/cons, or making structured decisions.

deep-research

Comprehensive research assistant that synthesizes information from multiple sources with citations. Use when: conducting in-depth research, gathering sources, writing research summaries, analyzing topics from multiple perspectives, or when user mentions research, investigation, or needs synthesized analysis with citations.

editor

Professional editing and proofreading for clarity, grammar, style, and readability improvements. Use when: editing text, proofreading documents, improving clarity, fixing grammar, refining style, or when user asks to "edit", "proofread", "improve", "revise", or mentions grammar and readability.

email-drafter

Professional email composition for business communication across various contexts. Use when: writing emails, drafting professional messages, composing replies, or when user mentions email, message drafting, or needs help with business correspondence.

fact-checker

Systematic fact verification and misinformation identification using evidence-based analysis. Use when: verifying claims, checking facts, identifying misinformation, evaluating source credibility, or when user asks to "fact check", "verify", "is this true", or mentions claims that need validation.

fullstack-developer

Modern web development expertise covering React, Node.js, databases, and full-stack architecture. Use when: building web applications, developing APIs, creating frontends, setting up databases, deploying web apps, or when user mentions React, Next.js, Express, REST API, GraphQL, MongoDB, PostgreSQL, or full-stack development.

mcp-apps-builder

**MANDATORY for ALL MCP server work** - mcp-use framework best practices and patterns. **READ THIS FIRST** before any MCP server work, including: - Creating new MCP servers - Modifying existing MCP servers (adding/updating tools, resources, prompts, widgets) - Debugging MCP server issues or errors - Reviewing MCP server code for quality, security, or performance - Answering questions about MCP development or mcp-use patterns - Making ANY changes to server.tool(), server.resource(), server.prompt(), or widgets This skill contains critical architecture decisions, security patterns, and common pitfalls. Always consult the relevant reference files BEFORE implementing MCP features.

mcp-builder

DEPRECATED: This skill has been replaced by `mcp-app-builder`. Check if `mcp-app-builder` is available in the skills folder. If not, install it: `npx skills install mcp-use/mcp-use --skill mcp-app-builder` Use `mcp-app-builder` instead of this skill. Build Model Context Protocol (MCP) servers with mcp-use framework. Use when creating MCP servers, defining tools/resources/prompts, working with mcp-use, bootstrapping MCP projects, or when user mentions MCP development, tools, resources, or prompts.

meeting-notes

Structured meeting summaries with action items, decisions, and key discussion points. Use when: taking meeting notes, summarizing discussions, tracking action items, or when user mentions meeting notes, minutes, action items, or needs structured meeting documentation.

project-planner

Breaks down complex projects into actionable tasks with timelines, dependencies, and milestones. Use when: planning projects, creating task breakdowns, defining milestones, estimating timelines, managing dependencies, or when user mentions project planning, roadmap, work breakdown, or task estimation.

sprint-planner

Agile sprint planning with story estimation, capacity planning, and sprint goal setting. Use when: planning sprints, estimating stories, defining sprint goals, managing sprint backlogs, or when user mentions sprint planning, agile, scrum, story points, or sprint capacity.

strategy-advisor

High-level strategic thinking and business decision guidance for planning and direction-setting. Use when: making strategic decisions, evaluating business options, setting direction, analyzing trade-offs, or when user mentions strategy, business planning, competitive analysis, or long-term planning.

technical-writer

Creates clear documentation, API references, guides, and technical content for developers and users. Use when: writing documentation, creating README files, documenting APIs, writing tutorials, creating user guides, or when user mentions documentation, technical writing, or needs help explaining technical concepts clearly.

相關技能