Communitygithub.com

cdcoonce/Portfolio_Website

探索程式碼庫以找出架構改進的機會,專注於透過加深淺層模組來提升可測試性。適用於使用者想要改善架構、尋找重構機會、整合緊密耦合的模組,或讓程式碼庫更易於 AI 瀏覽時。

Portfolio_Website 是什麼?

這個技能「改善程式碼庫架構」旨在引導 AI 代理以結構化方式分析軟體專案的架構,找出並解決因「淺層模組」(介面複雜度與實作相當的模組)所導致的可測試性與可瀏覽性問題。其核心理論來自 John Ousterhout 的《軟體設計哲學》,鼓勵將模組加深,讓小型介面包裝大型實作,以提升測試邊界而非內部的效率。技能支援 GitHub 平台,流程包含:透過探索代理自然發掘架構摩擦點、列出候選重構項目、與使用者共同選擇、並行設計多種介面方案、最後以 RFC 格式自動建立 GitHub Issue。整體設計對於希望系統性重構、減少技術債、或讓程式碼對 AI 代理更友善的開發者與團隊特別有用。

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

在你喜歡的 AI 中提問

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

說明文件

改善程式碼庫架構

以 AI 的視角探索程式碼庫,找出架構摩擦點,發現提升可測試性的機會,並將模組加深的重構提案以 GitHub Issue RFC 的形式提出。

深層模組(John Ousterhout,《軟體設計哲學》)是指一個小型介面包藏大量實作的模組。深層模組更具可測試性、更易於 AI 瀏覽,並且讓你可以在邊界進行測試,而非深入內部。

流程

1. 探索程式碼庫

使用 subagent_type=Explore 的代理工具自然瀏覽程式碼庫。請勿遵循僵化的啟發式規則 — 以有機的方式探索,並記錄下你遇到摩擦的地方:

  • 理解某個概念是否需要在多個小檔案之間來回跳轉?
  • 哪些模組淺層到介面幾乎和實作一樣複雜?
  • 哪些純粹函式只是為了可測試性而提取,但真正的錯誤卻隱藏在它們被呼叫的方式中?
  • 緊密耦合的模組在哪裡產生了模組間接縫處的整合風險?
  • 程式碼庫的哪些部分未經測試,或難以測試?

你所遇到的摩擦本身就是訊號。

2. 提出候選項目

提供一個編號列表,列出加深的機會。每個候選項目需包含:

  • 叢集:涉及哪些模組/概念
  • 為何耦合:共享的型別、呼叫模式、共同擁有的概念
  • 依賴類別:請參閱 REFERENCE.md 中的四個類別
  • 測試影響:哪些現有測試將被邊界測試取代

不要先提出介面。詢問使用者:「您想探索哪一個?」

3. 使用者選擇候選項目

4. 界定問題空間

在產生子代理之前,先為所選的候選項目撰寫一份面對使用者的問題空間說明:

  • 任何新介面必須滿足的限制條件
  • 它需要依賴的依賴項目
  • 一個粗略的說明性程式碼草稿,以便將限制條件具體化 — 這不是提案,只是為了讓限制條件更具體

向使用者展示此說明,然後立即進入步驟 5。使用者可以在子代理並行工作時閱讀並思考問題。

5. 設計多個介面

使用代理工具並行產生 3 個以上的子代理。每個子代理必須為加深的模組提供一個截然不同的介面。

為每個子代理提供獨立的技術摘要(檔案路徑、耦合細節、依賴類別、隱藏了什麼)。此摘要獨立於步驟 4 中面對使用者的說明。給予每個代理不同的設計限制:

  • 代理 1:「最小化介面 — 目標最多 1-3 個進入點」
  • 代理 2:「最大化靈活性 — 支援多種使用案例與擴展」
  • 代理 3:「為最常見的呼叫者最佳化 — 讓預設案例變得簡單」
  • 代理 4(如適用):「針對跨邊界依賴,以連接埠與適配器模式進行設計」

每個子代理輸出:

  1. 介面簽章(型別、方法、參數)
  2. 使用範例,展示呼叫者如何使用
  3. 它內部隱藏了哪些複雜度
  4. 依賴策略(如何處理依賴 — 請參閱 REFERENCE.md)
  5. 取捨

依序呈現設計,然後以文字進行比較。

比較之後,提出你自己的推薦:你認為哪個設計最強以及原因。如果不同設計的元素可以很好地結合,提出一個混合方案。請抱持明確的意見 — 使用者想要的是明確的觀點,而不只是一個選項清單。

6. 使用者選擇介面(或接受推薦)

7. 建立 GitHub Issue

使用 gh issue create 將重構 RFC 建立為 GitHub Issue。使用 REFERENCE.md 中的範本。建立前無需請使用者審查 — 直接建立並分享網址。

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

Production Python coding standards with automatic version detection (3.10-3.13). Use when writing, reviewing, or refactoring Python to ensure adherence to modern type syntax, LBYL exception handling, pathlib operations, ABC-based interfaces, and production-tested patterns. Not Dagster-specific - applies to any Python project.

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

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.

相關技能