工具生命周期管理系统

一个用于构建、评分、修复和管理Claude Code工具的自愈生命周期系统,适用于大规模工具生态维护。

  • by eddiebelaval
  • Shell
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 eddiebelaval/tool-factory

使用说明

工具厂

Claude Code工具的自我修复生命周期系统。大规模构建、评分、翻新和管理技能、代理、钩子、命令和MCP服务器。

问题

Claude Code的工具生态系统发展迅速。经过数月的构建,你最终会得到数百个工具——技能、代理、钩子、命令、MCP服务器、插件——而且无法知道哪些工具有效,哪些是重复的,哪些是无用的。质量不一致。工具悄无声息地腐烂。

解决方案

工具厂将工具视为产品。生来就有标准,经过标准测试,漂移时翻新,过时时退役。制造机器并对其进行维护的机器。

建筑

两层,三个空间:

Layer 1: Factory (builds and maintains tools)
Layer 2: Tools  (the skills/agents/hooks that do actual work)

Factory Floor (generators/)  -- Creates new tools from templates
Range         (range/)       -- Scores tools against fitness criteria
Workshop      (workshop/)    -- Auto-retrofits failing tools

目录结构

tool-factory/
  generators/          # Tool creators (skill, agent, command, hook, MCP)
  range/               # Quality scoring (14 criteria, 100-point scale)
  workshop/            # Auto-retrofit for failing tools
  composer/            # Pipeline chaining (YAML compositions)
  registry/            # Tool inventory + intelligence + lifecycle
    index.json         # Single source of truth for all tools
    intelligence.sh    # Fleet health, usage, trends, dormant detection
    lifecycle.sh       # 4-phase maintenance cycle
    score-history.jsonl # Append-only score snapshots
    track-usage.sh     # Invocation logger
  lexicon/             # Constraint documents (best practices per vendor)
  scripts/             # Automation (scheduled lifecycle wrapper)
  lib/                 # Shared utilities (colors, etc.)
  validator/           # Structural validation
  VISION.md            # Where we're going (north star)
  SPEC.md              # What exists today (living spec)
  BUILDING.md          # How we got here (build log)

快速开始

创建工具

# Generate a new skill with frontmatter, test fixtures, and registry entry
bash generators/skill.sh my-new-skill

# Generate other tool types
bash generators/agent.sh my-agent
bash generators/command.sh my-command
bash generators/hook.sh my-hook
bash generators/mcp.sh my-mcp-server

为你的工具打分

# Score a single tool
bash range/runner.sh my-skill

# Score all tools (fleet-wide)
bash range/runner.sh --all

# Report mode (no changes)
bash range/runner.sh --report

评分以100分制对3个类别的14个标准进行评估。结果:通过(70+),部分通过(40-69),未通过(<40)。

改装故障工具

# Fix a single tool
bash workshop/retrofit.sh my-skill

# Fix all failing tools
bash workshop/retrofit.sh --all

研讨会增加了缺失的结构(前体、触发器、工作流),但没有触及使工具有价值的内容。

舰队情报

# Fleet health overview
bash registry/intelligence.sh --health

# Usage analysis (top tools, ghost tools, decay risk)
bash registry/intelligence.sh --usage

# Score trends and regression detection
bash registry/intelligence.sh --trends

# Full intelligence report
bash registry/intelligence.sh

运行生命周期

# Full 4-phase maintenance: score -> retrofit -> dormant check -> decay alerts
bash registry/lifecycle.sh

# Report mode (dry run, no changes)
bash registry/lifecycle.sh --report

# Individual phases
bash registry/lifecycle.sh --score
bash registry/lifecycle.sh --fix
bash registry/lifecycle.sh --flag-dormant

组合管道

# Create a new pipeline
bash composer/compose.sh new my-pipeline

# List all pipelines
bash composer/compose.sh list

# Validate a pipeline
bash composer/compose.sh validate my-pipeline

# Run a pipeline
bash composer/compose.sh run my-pipeline

组合是将工具链接到顺序工作流中的YAML文件:

name: deploy-pipeline
description: Score, fix, and report
steps:
  - type: shell
    name: preflight
    command: "echo 'Starting...'"

  - type: shell
    name: get-version
    command: "cat package.json | jq -r .version"
    export_as: VERSION

  - type: shell
    name: test
    command: "npm test"
    on_fail: fallback-lint

  - type: shell
    name: deploy
    command: "echo Deploying v$VERSION"

  - type: shell
    name: fallback-lint
    command: "npm run lint"
    skip: true

特点:环境变量注射(export_as),条件分支(on_fail),只跳几步(skip: true),以及 continue_on_fail 对于非关键步骤。

计划自动维护(macOS)

计划的生命周期每天通过launchd运行——工作日的模拟运行报告,周日的实时修复:

# Test the wrapper manually
bash scripts/scheduled-lifecycle.sh

# Force a live run (regardless of day)
bash scripts/scheduled-lifecycle.sh --force

看 scripts/ 用于启动plist模板。

三合会

工具厂使用三文档系统而不是PRD:

  • 视觉.md --我们要去哪里。七个支柱,每个支柱都有一个实现百分比。
  • 规格.md --今天存在什么。能力、架构、验证界面。
  • 建筑.md --我们是如何到达这里的。建立包含决策和理由的日志。

VISION和SPEC之间的差异就是路线图。任何两个文件都可以重建第三个文件。

需求

  • macOS或Linux
  • Bash 3.2+
  • Python 3.6+
  • Claude Code(用于工具本身)

许可证

麻省理工学院——见 许可证.

作者

建造于 id8Labs 作为Claude Code工具生态系统的一部分。