Back to Skills

chrysopoeia

pjt222
Updated 6 days ago
20 views
17
2
17
View on GitHub
Designapi

About

The Chrysopoeia skill systematically refactors and polishes existing, functional codebases to extract maximum value without a full rewrite. It focuses on performance optimization, API surface refinement, and eliminating dead code to reduce bundle size and memory footprint. Use it when your code works but needs optimization, cruft removal, or polishing for open-source release.

Quick Install

Claude Code

Recommended
Primary
npx skills add pjt222/agent-almanac -a claude-code
Plugin CommandAlternative
/plugin add https://github.com/pjt222/agent-almanac
Git CloneAlternative
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/chrysopoeia

Copy and paste this command in Claude Code to install this skill

Documentation

Chrysopoeia

提碼之極值:辨金(值高、善構)、鉛(重、拙)、渣(死)。揚金、轉鉛、去渣。

  • 可用而遲→優
  • API 積垢→修
  • 減包量、減存、減啟時
  • 開源前→取其精
  • 碼可而不耀→磨非重寫

  • :碼庫/模塊(路徑)
  • :值度(性能、API 明、包量、可讀)
  • :剖析或基準數據
  • :標(如「減包 40%」、「響應 < 100ms」)
  • :約束(API 不變、向後兼容)

一:察——分料

按值分諸元。

  1. 依入定值度
  2. 列碼元(函、模、出、依)
  3. 各元分級:
Value Classification:
+--------+---------------------------------------------------------+
| Gold   | High value, well-designed. Amplify and protect.         |
| Silver | Good value, minor imperfections. Polish.                |
| Lead   | Functional but heavy — poor performance, complex API.   |
|        | Transmute into something lighter.                       |
| Dross  | Dead code, unused exports, vestigial features.          |
|        | Remove entirely.                                        |
+--------+---------------------------------------------------------+
  1. 優化性能→先剖:
    • 識熱路(耗時處)
    • 識冷路(少行之碼→或渣)
    • 量存配模式
  2. 察報:逐元+證據

得: 諸要元皆分+證。金者得護。鉛者按影響序。

敗: 無剖析具→用靜析:函複雜度、依數、碼量。庫過大→先焦路。

二:煉——揚金

護且強至貴者。

  1. 每金元:
    • 確有全備測試(最貴資產)
    • 介面明文
    • 或可抽為可重用模
  2. 每銀元:
    • 施定點改(命名、類型、微優)
    • 測覆至金級
    • 除微瑕不重構
  3. 勿變金銀之行——只磨不改

得: 金銀更備測、文、護。無行變,只磨。

敗: 「金」細察現瑕→重分。誠於值,勝護瑕碼。

三:轉——鉛化金

化重拙為優。

  1. 鉛按影響序(耗資最大先)
  2. 每鉛擇策:
    • 算優:O(n^2)→O(n log n)、除冗算
    • 緩存/記憶化:存昂貴多求之果
    • 惰求:用時方算
    • 批處:併小為大
    • 結構簡化:減複雜度、平深嵌
  3. 施策→量變:
    • 性能→前後基準
    • 複雜度→前後行數
    • 耦合→前後依數
  4. 每轉後驗行相等

得: 度上可量之進。每轉元優於鉛且行同。

敗: 鉛於現介面拒優→或介面即病。須變調用法,非只實現。

四:滌——除渣

系統除死重。

  1. 每渣驗真未用:
    • 尋諸引(grep、IDE find-usages)
    • 察動引(字串派發、反射)
    • 察外用(若為庫)
  2. 去確渣:
    • 刪死碼、未用出、退化功能
    • 除未用依於清單
    • 清已去功能之配
  3. 每去後驗不破(行測)
  4. 記所去與因(於提交訊息,非碼)

得: 庫輕矣。包量/依數/碼量可量減。諸測猶過。

敗: 去破某物→非渣,重分。動引難驗→暫加日誌,確無運行存取後刪。

五:驗——稱金

量總進。

  1. 行步一同之基準
  2. 比前後於值度
  3. 記 chrysopoeia 果:
    • 煉元(金銀之磨)
    • 轉元(鉛→金+量)
    • 滌元(渣去+量)
    • 總進(如「快 47%」、「包小 32%」)

得: 可量有文之進於值度。庫明勝於前。

敗: 總進微→原碼或勝於所設。記所學——知碼近極優亦貴。

  • 察報分諸要元+證
  • 金有全測與文
  • 鉛轉可量前後進
  • 渣刪前驗引
  • 每階後諸測皆過
  • 總進有量有文
  • 無行退
  • 入之約束皆守

  • 早優:未剖即優——先量再優熱路
  • 磨渣:費力於當刪之碼——先分再煉
  • 破金:優致最佳碼退——金只進不退
  • 無量之辭:「感覺快」非 chrysopoeia——每進須有量
  • 優冷路:費力於啟時單行之碼,瓶頸實在求環

  • athanor — 四階全變,chrysopoeia 揭須重構非只優時
  • transmute — 點轉,鉛元須范式變時
  • review-software-architecture — 架構級察,補碼級 chrysopoeia
  • review-data-analysis — 數據管道優,合於碼優

GitHub Repository

pjt222/agent-almanac
Path: i18n/wenyan-ultra/skills/chrysopoeia
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

Related Skills

executing-plans

Design

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

View skill

requesting-code-review

Design

This skill dispatches a code-reviewer subagent to analyze code changes against requirements before proceeding. It should be used after completing tasks, implementing major features, or before merging to main. The review helps catch issues early by comparing the current implementation with the original plan.

View skill

connect-mcp-server

Design

This skill provides a comprehensive guide for developers to connect MCP servers to Claude Code using HTTP, stdio, or SSE transports. It covers installation, configuration, authentication, and security for integrating external services like GitHub, Notion, and custom APIs. Use it when setting up MCP integrations, configuring external tools, or working with Claude's Model Context Protocol.

View skill

web-cli-teleport

Design

This skill helps developers choose between Claude Code Web and CLI interfaces based on task analysis, then enables seamless session teleportation between these environments. It optimizes workflow by managing session state and context when switching between web, CLI, or mobile. Use it for complex projects requiring different tools at various stages.

View skill