Communitygithub.com

cdcoonce/Portfolio_Website

生產級 Python 程式碼撰寫標準,具備自動版本偵測(3.10-3.13)。適用於撰寫、審閱或重構 Python 程式碼,確保遵循現代型別語法、LBYL 例外處理、pathlib 操作、ABC 基礎介面與生產驗證模式。非 Dagster 專屬,適用於任何 Python 專案。

Portfolio_Website 是什麼?

此技能為開發者提供了一套生產級的 Python 程式碼撰寫標準,涵蓋 Python 3.10 至 3.13 版本。它能自動偵測專案的最低 Python 版本(透過 pyproject.toml、setup.py、.python-version 等檔案),並載入對應的版本特定指引。核心知識包含 LBYL 例外處理、pathlib 操作、基本匯入規範與反模式警示,並且會根據任務模式(如 CLI、subprocess)條件式載入進階參考文件,例如例外處理、介面設計、進階型別標註等。此技能適用於 Claude Code、Cursor、Codex 等 AI 代理工具,在程式碼審閱、重構或撰寫時自動提供最佳實踐建議,幫助開發者產出乾淨、可維護且符合業界標準的 Python 程式碼。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cdcoonce/Portfolio_Website/tree/HEAD/.claude/skills/dignified-python

在你喜歡的 AI 中提問

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

說明文件

尊嚴 Python 程式碼撰寫標準技能

生產級 Python 程式碼撰寫標準,旨在撰寫乾淨、可維護、現代化的 Python 程式碼 (版本 3.10-3.13)。

何時使用此技能

當使用者詢問以下問題時自動觸發:

  • 「讓這段程式碼更 Pythonic」/「這段 Python 寫得好嗎」
  • 「型別提示」/「型別註解」/「typing」
  • 「LBYL vs EAFP」/「例外處理」
  • 「pathlib vs os.path」/「路徑操作」
  • 「CLI 模式」/「click 用法」
  • 「程式碼審閱」/「改進這段程式碼」
  • 任何 Python 程式碼品質或標準相關問題

注意:此技能為通用 Python 標準,非 Dagster 專屬。Dagster 模式請使用 /dagster-expert。

何時使用此技能 vs. 其他技能

使用者需求使用此技能替代技能
「讓這段程式碼更 Pythonic」✅ 是 - Python 標準
「這段 Python 寫得好嗎」✅ 是 - 程式碼品質
「型別提示」✅ 是 - 型別指引
「LBYL vs EAFP」✅ 是 - 例外模式
「pathlib vs os.path」✅ 是 - 路徑處理
「Dagster 專屬模式」❌ 否/dagster-expert
「CLI 參數解析」✅ 是 - CLI 模式

核心知識(始終載入)

dignified-python-core.md

版本偵測

識別專案的最低 Python 版本,依序檢查:

  1. pyproject.toml - 尋找 requires-python 欄位(例如 requires-python = ">=3.12")
  2. setup.py 或 setup.cfg - 尋找 python_requires
  3. .python-version 檔案 - 包含版本號如 3.12 或 3.12.0
  4. 若未找到版本指定,則預設為 Python 3.12

識別後,載入對應的版本特定檔案:

  • Python 3.10:載入 versions/python-3.10.md
  • Python 3.11:載入 versions/python-3.11.md
  • Python 3.12:載入 versions/python-3.12.md
  • Python 3.13:載入 versions/python-3.13.md

條件載入(根據任務模式載入)

核心檔案涵蓋 80% 以上的 Python 程式碼模式。僅在偵測到特定模式時才載入以下額外檔案:

模式偵測範例:

  • 若任務提及「click」或「CLI」-> 載入 cli-patterns.md
  • 若任務提及「subprocess」-> 載入 subprocess.md

參考文件結構

參考文件組織於頂層檔案與子目錄中:

核心參考(與 SKILL.md 同層)

  • dignified-python-core.md - 基本標準(始終載入)
  • cli-patterns.md - 命令列介面模式(click、argparse)
  • subprocess.md - 子程序操作

版本特定參考(versions/)

  • versions/python-3.10.md - Python 3.10+ 可用功能
  • versions/python-3.11.md - Python 3.11+ 可用功能
  • versions/python-3.12.md - Python 3.12+ 可用功能
  • versions/python-3.13.md - Python 3.13+ 可用功能

進階主題(references/advanced/)

  • exception-handling.md - LBYL 模式、錯誤邊界
  • interfaces.md - ABC 與 Protocol 模式
  • typing-advanced.md - 進階型別模式
  • api-design.md - API 設計原則

何時閱讀各參考文件

references/advanced/exception-handling.md

閱讀時機:

  • 撰寫 try/except 區塊時
  • 包裝可能拋出例外的第三方 API 時
  • 看到或撰寫 from e 或 from None 時
  • 不確定是否存在 LBYL 替代方案時

references/advanced/interfaces.md

閱讀時機:

  • 建立 ABC 或 Protocol 類別時
  • 撰寫 @abstractmethod 裝飾器時
  • 設計閘道層介面時
  • 在 ABC 與 Protocol 之間選擇時

references/advanced/typing-advanced.md

閱讀時機:

  • 使用 typing.cast() 時
  • 建立 Literal 型別別名時
  • 在條件區塊中縮小型別時

references/module-design.md

閱讀時機:

  • 建立新的 Python 模組時
  • 新增模組層級程式碼(超出簡單常數範圍)時
  • 在模組層級使用 @cache 裝飾器時
  • 在模組層級看到 Path() 或計算時
  • 考慮內嵌匯入時

references/api-design.md

閱讀時機:

  • 為函式新增預設參數值時
  • 定義包含 5 個或更多參數的函式時
  • 使用 ThreadPoolExecutor.submit() 時
  • 審閱函式簽名時

references/checklists.md

閱讀時機:

  • 提交 Python 程式碼前的最終審閱時
  • 不確定是否已遵循所有規則時
  • 需要快速查閱需求時

如何使用此技能

  1. 核心知識會自動載入(LBYL、pathlib、基本匯入、反模式)
  2. 版本偵測會執行一次 - 識別最低 Python 版本並載入對應的版本檔案
  3. 參考文件會根據上述觸發條件按需載入
  4. 其他模式可能需要額外載入(CLI 模式、subprocess)
  5. 每個檔案都是自包含的,提供其領域的完整指引

Individual skills in this repo

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

cdcoonce/Portfolio_Website

Git commit workflow with enforced conventional commit style. Use when Claude needs to stage and commit changes, craft commit messages, or the user asks to commit, make a commit, or save their work. Ensures consistent commit message format, proper scoping, and atomic commits across the project.

cdcoonce/Portfolio_Website

AI-powered code quality analysis for Python, Markdown, and Mermaid diagrams. Use this skill when: (1) reviewing code for quality issues, (2) checking Python files for PEP8 violations, unused code, missing type hints, docstring problems, complexity issues, or potential runtime errors, (3) validating Markdown documentation for broken links, heading structure, or formatting issues, (4) validating Mermaid diagram syntax, (5) the user asks for a "code review" or "quality check", (6) analyzing code snippets pasted in conversation, or (7) suggesting and applying fixes for code quality issues.

cdcoonce/Portfolio_Website

Deploy the portfolio chat agent Lambda function to AWS. Use when the user asks to deploy, redeploy, push to Lambda, update the chat agent, or after updating context files or lambda_function.py. Rebuilds the knowledge base, packages dependencies, and deploys to AWS Lambda.

cdcoonce/Portfolio_Website

Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".

cdcoonce/Portfolio_Website

Orchestrate the full GitHub-issues-driven development lifecycle. 7-phase pipeline from brainstorm through PR with state tracking and cross-conversation resume. Use when user says "dev cycle", "development workflow", "full development pipeline", or invokes /dev-cycle.

cdcoonce/Portfolio_Website

Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.

cdcoonce/Portfolio_Website

GitHub CLI (gh) integration for managing issues, pull requests, branches,

cdcoonce/Portfolio_Website

Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".

cdcoonce/Portfolio_Website

Explore a codebase to find opportunities for architectural improvement, focusing on making the codebase more testable by deepening shallow modules. Use when user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more AI-navigable.

cdcoonce/Portfolio_Website

CEO/founder-mode plan review. Rethink the problem, find the 10-star product, challenge premises, expand scope when it creates a better product. Three modes: SCOPE EXPANSION (dream big), HOLD SCOPE (maximum rigor), SCOPE REDUCTION (strip to essentials). Use when the user asks for a plan review, CEO review, mega review, or wants a plan challenged/stress-tested before implementation.

cdcoonce/Portfolio_Website

Break a PRD into independently-grabbable GitHub issues using tracer-bullet vertical slices. Use when user wants to convert a PRD to issues, create implementation tickets, or break down a PRD into work items.

cdcoonce/Portfolio_Website

Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in docs/plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".

cdcoonce/Portfolio_Website

Generate or update the `.claude/docs/project.md` file that gives Claude project-specific context. Use this skill when the user asks to create, update, regenerate, or refresh project context, or says things like "update project.md", "generate project context", "this repo needs a project.md", or "Claude doesn't know about this project". Also trigger when onboarding Claude to a new repository for the first time.

cdcoonce/Portfolio_Website

Generate comprehensive, high-quality README.md files for code repositories. Use this skill whenever the user asks to create, write, generate, update, or improve a README for any project or repository. Also trigger when the user says things like "document this project", "write docs for this repo", "this repo needs a README", "help me onboard developers to this codebase", or asks for project documentation in markdown. Even if the user just says "README" or "readme" in the context of a codebase, use this skill.

cdcoonce/Portfolio_Website

Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.

cdcoonce/Portfolio_Website

Set up pre-commit hooks for the current repo. Use when user wants to add pre-commit hooks, configure commit-time linting, formatting, type checking, or testing. Triggers on "pre-commit", "git hooks", "linting hooks", or /setup-pre-commit.

cdcoonce/Portfolio_Website

Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.

cdcoonce/Portfolio_Website

Triage a bug or issue by exploring the codebase to find root cause, then create a GitHub issue with a TDD-based fix plan. Use when user reports a bug, wants to file an issue, mentions "triage", or wants to investigate and plan a fix for a problem.

cdcoonce/Portfolio_Website

Rewrites the prose sections of wiki pages in-place. Reads source files to understand current context, then updates only the content inside <!-- claude:prose --> ... <!-- claude:prose:end --> markers. Never touches <!-- generated:start --> ... <!-- generated:end --> blocks. Supports targeting a single page with /update-wiki {PageName}.

cdcoonce/Portfolio_Website

Create a PRD through user interview, codebase exploration, and module design, then submit as a GitHub issue. Use when user wants to write a PRD, create a product requirements document, or plan a new feature.

相關技能