返回技能列表

chrysopoeia

pjt222
更新于 2 days ago
7 次查看
17
2
17
在 GitHub 上查看
设计api

关于

Chrysopoeia is a Claude skill for systematically optimizing and refining existing, functional codebases. It focuses on extracting maximum value through performance improvements, API surface cleanup, and dead code elimination. Use it to polish a sluggish or crufty codebase when a full rewrite isn't necessary.

快速安装

Claude Code

推荐
主要方式
npx skills add pjt222/agent-almanac -a claude-code
插件命令备选方式
/plugin add https://github.com/pjt222/agent-almanac
Git 克隆备选方式
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/chrysopoeia

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Chrysopoeia

Pull max value from code → find gold (high-val), lead (heavy), dross (dead). Amplify gold, transmute lead, purge dross.

Use When

  • Working code sluggish → optimize perf
  • API surface crufty → refine
  • Bundle/mem/startup too big → shrink
  • Prep open-source release → extract core
  • Code works but dull → polish, not rewrite

In

  • Required: Codebase/module (paths)
  • Required: Value metric (perf, API clarity, bundle, readability)
  • Optional: Profiling data/benchmarks
  • Optional: Target (e.g., "-40% bundle", "sub-100ms res")
  • Optional: Constraints (public API frozen, back-compat req)

Do

Step 1: Assay — Classify

Classify every element by value.

  1. Define value metric from In
  2. Inventory elements (fns, modules, exports, deps)
  3. Classify each:
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. Perf work → profile first:
    • Hot paths (time sink)
    • Cold paths (rare → maybe dross)
    • Mem alloc patterns
  2. Produce Assay Report: element-by-element w/ evidence

Every element classified w/ evidence. Gold marked protect. Lead ranked by impact.

If err: No profiler → static analysis: cyclomatic complexity, dep count, size as proxies. Huge codebase → critical path first.

Step 2: Refine — Amplify Gold

Protect + enhance highest-value elements.

  1. Each Gold:
    • Full tests (most valuable asset)
    • Clear interface docs
    • Extractable as reusable module?
  2. Each Silver:
    • Targeted improvements (naming, types, minor opt)
    • Tests → Gold-level
    • Resolve minor smells, no restructure
  3. Do NOT modify Gold/Silver behavior → polish only

Gold + Silver better tested, documented, protected. No behavior change, quality up.

If err: "Gold" reveals hidden problems → reclassify. Honest > protect flawed.

Step 3: Transmute — Lead → Gold

Convert heavy elements to optimized equivalents.

  1. Rank Lead by impact (highest resource first)
  2. Each Lead → pick strategy:
    • Algo opt: O(n^2) → O(n log n), kill redundant compute
    • Cache/memoize: Store expensive res req'd repeat
    • Lazy eval: Defer compute until needed
    • Batch proc: Many small ops → fewer big ones
    • Simplify: Lower cyclomatic, flatten nesting
  3. Apply + measure:
    • Before/after benchmarks (perf)
    • Before/after line counts (complexity)
    • Before/after dep counts (coupling)
  4. Valid. behavior identical post-transmute

Measurable metric improvement. Each transmuted > Lead predecessor, same behavior.

If err: Lead resists opt in current interface → interface itself = problem. Sometimes transmute = change caller, not impl.

Step 4: Purge — Remove Dross

Kill dead weight systematically.

  1. Each Dross → valid. truly unused:
    • Grep all refs (IDE find-usages)
    • Dynamic refs (string dispatch, reflection)?
    • External consumers (library)?
  2. Remove confirmed:
    • Delete dead code, unused exports, vestigial features
    • Drop unused deps from manifests
    • Clean config for removed features
  3. Valid. nothing breaks post-removal (tests)
  4. Doc what + why (commit msgs, not code)

Codebase lighter. Bundle/dep count/volume measurably down. Tests pass.

If err: Removal breaks → wasn't dross → reclassify. Dynamic refs hide usage → temp logging before delete to confirm no runtime access.

Step 5: Verify — Weigh Gold

Measure overall improvement.

  1. Run same benchmarks as Step 1
  2. Before/after on metric
  3. Doc results:
    • Refined elements (Gold/Silver wins)
    • Transmuted (Lead → Gold w/ measurements)
    • Purged (Dross removed w/ size/count impact)
    • Overall metric gain (e.g., "47% faster", "32% smaller bundle")

Measurable, documented metric improvement. Codebase demonstrably more valuable.

If err: Marginal improvement → orig code better than assumed. Doc learning → knowing code near-optimal = valuable.

Check

  • Assay report classifies all w/ evidence
  • Gold has full tests + docs
  • Lead transmutes show before/after metric gain
  • Dross removal valid'd w/ ref checks pre-delete
  • Tests pass each stage
  • Overall improvement measured + documented
  • No behavior regressions
  • In constraints met

Traps

  • Premature opt: Opt w/o profile → always measure first, opt hot paths
  • Polish dross: Effort on code should-be-deleted → classify before refine
  • Break Gold: Opt degrades best code → Gold only improves, never worse
  • Unmeasured: "Feels faster" ≠ chrysopoeia → quantify every gain
  • Opt cold paths: Effort on startup-once code when req loop = bottleneck

  • athanor — Full four-stage when restructure needed, not just opt
  • transmute — Targeted conversion when Lead needs paradigm shift
  • review-software-architecture — Architecture-level eval
  • review-data-analysis — Data pipeline opt parallels code opt

GitHub 仓库

pjt222/agent-almanac
路径: i18n/caveman-ultra/skills/chrysopoeia
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

相关推荐技能

executing-plans

设计

该Skill用于当开发者提供完整实施计划时,以受控批次方式执行代码实现。它会先审阅计划并提出疑问,然后分批次执行任务(默认每批3个任务),并在批次间暂停等待审查。关键特性包括分批次执行、内置检查点和架构师审查机制,确保复杂系统实现的可控性。

查看技能

requesting-code-review

设计

该Skill可在完成任务、实现主要功能或合并代码前自动调度代码审查子代理,确保实现符合需求和计划。它支持通过指定git SHA范围进行精准的代码变更审查,帮助开发者在关键节点及时发现潜在问题。核心原则是"早审查、勤审查",适用于开发流程的各个关键阶段。

查看技能

connect-mcp-server

设计

这个Skill指导开发者如何将MCP服务器连接到Claude Code,支持HTTP、stdio和SSE三种传输协议。它涵盖了从安装配置到认证安全的完整流程,适用于集成GitHub、Notion、数据库等外部服务。当开发者需要添加集成、配置外部工具或提及MCP相关功能时,这个Skill能提供实用的操作指南。

查看技能

web-cli-teleport

设计

该Skill帮助开发者根据任务特性选择Claude Code的Web或CLI界面,并指导如何在两种环境间无缝迁移会话。它能分析任务复杂度、迭代需求等要素,推荐最优工作界面和工作流。关键特性包括会话状态管理、环境切换指导和上下文优化建议。

查看技能