Agent测试
- 作者仓库星标 708
- 作者更新于 实时读取
- 作者仓库 claude-forge
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @sangrokjung · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- Python >=3.8
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: skill-factory
description: > Automated pipeline: session analysis -> duplicate check -> skill creation. Requires: Python 3.…
category: 通用
runtime: Python
---
# skill-factory 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Parameter Parsing / Phase 1: Session Analysis / Phase 2: Similarity Check”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Parameter Parsing / Phase 1: Session Analysis / Phase 2: Similarity Check”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/tmp`、`/api-load-test` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“Parameter Parsing / Phase 1: Session Analysis / Phase 2: Similarity Check”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: skill-factory
description: > Automated pipeline: session analysis -> duplicate check -> skill creation. Requires: Python 3.…
category: 通用
source: sangrokjung/claude-forge
---
# skill-factory
## 什么时候使用
- 把通用方向的常用动作沉淀成 Agent 可调用的技能 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要额外…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Parameter Parsing / Phase 1: Session Analysis / Phase 2: Similarity Check」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "skill-factory" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Parameter Parsing / Phase 1: Session Analysis / Phase 2: Similarity Check
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Python | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Skill Factory
Automated pipeline: session analysis -> duplicate check -> skill creation.
Requires: Python 3.8+, bash, git. Agent Teams path requires CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1.
| Existing Skill | Role | skill-factory Difference |
|---|---|---|
| skill-creator (archived) | Manual 6-step guide | Automated pipeline |
| manage-skills | Drift detection (verify-* skills) | Proactive skill generation (manage-skills verifies existing; skill-factory creates new) |
| continuous-learning | Passive pattern extraction | On-demand + team execution |
Parameter Parsing
Parse $ARGUMENTS for flags:
| Flag | Default | Description |
|---|---|---|
--dry-run |
false | Analyze and report only, no file creation |
--no-team |
false | Run sequentially without Agent Teams |
--target |
(auto) | Specific pattern name to extract |
--scope |
global | global (~/. claude/skills/) or project (.claude/skills/) |
If no arguments, run full auto-detection pipeline.
Phase 1: Session Analysis
Collect what happened in this session:
# Uncommitted changes
git diff HEAD --name-only 2>/dev/null
# Recent commits on current branch
git log --oneline -20 2>/dev/null
# Branch diff from main
git diff main...HEAD --name-only 2>/dev/null
From collected changes, identify candidate patterns - repeatable workflows that appeared:
- Multi-step sequences - 3+ actions performed in consistent order
- Tool combinations - Specific tools used together (e.g., Grep + Read + Edit)
- Domain procedures - File types or directories accessed with specific operations
- Repeated transformations - Same type of change applied to multiple files
If --target is specified, focus analysis on that named pattern only.
For each candidate, produce a JSON entry (internal, not shown to user):
{
"name": "pattern-name",
"description": "What was done repeatedly",
"files": ["path/a.ts", "path/b.ts"],
"steps": ["Step1", "Step2", "Step3"],
"step_count": 3
}
Present findings to user:
Session Analysis Complete
Candidate Patterns Found: N
1. [pattern-name] - "Description of what was done repeatedly"
Files: path/a.ts, path/b.ts (N files)
Steps: Step1 -> Step2 -> Step3
2. [pattern-name] - "Description"
...
Which patterns should become skills? (select or 'all')
Wait for user selection before proceeding.
Phase 2: Similarity Check
For each selected pattern, check against existing inventory.
Step 1: Scan inventory
bash $HOME/.claude/skills/skill-factory/scripts/scan-inventory.sh --scope all > /tmp/sf-manifest.json
Step 2: Score similarity
python3 $HOME/.claude/skills/skill-factory/scripts/similarity-scorer.py \
--candidate "<pattern description>" \
--candidate-name "<pattern-name>" \
--manifest /tmp/sf-manifest.json \
--top 3
Step 3: Apply decision logic (see references/decision-tree.md)
Present results to user:
Similarity Check Results
Pattern: "pdf-batch-edit"
Top match: nano-pdf (score: 0.72) -> MERGE
Recommendation: Extend nano-pdf with batch operations
Pattern: "config-updater"
Top match: init-project (score: 0.45) -> UPDATE
Recommendation: Add config-update subsection to init-project
Pattern: "api-load-test"
Top match: e2e (score: 0.24) -> CREATE
Recommendation: Create new skill
Action for each pattern? (CREATE / UPDATE / MERGE / SKIP)
Wait for user decision per pattern.
Phase 3: Blueprint
For each CREATE/UPDATE/MERGE decision, design the skill structure.
CREATE Blueprint
Select template type from references/skill-templates.md:
- Workflow for sequential processes
- Task/Tool for operation collections
- Reference for domain knowledge
- Verification for automated checks
Generate blueprint:
Blueprint: api-load-test
Type: Workflow
Scope: global (~/.claude/skills/)
Structure:
api-load-test/
├── SKILL.md (~200 lines)
│ ├── Frontmatter: name, description with triggers
│ ├── Overview
│ ├── Prerequisites
│ ├── Workflow (4 steps)
│ └── Output Format
└── scripts/
└── run-load-test.sh
Key sections:
1. Target URL configuration
2. Load profile definition
3. Test execution
4. Results analysis
Approve this blueprint? (y/n/edit)
Wait for user approval.
UPDATE Blueprint
For UPDATE verdicts (score 0.3-0.6), plan a lightweight addition to the existing skill:
UPDATE Blueprint: config-updater -> init-project
Target skill: ~/.claude/skills/init-project/SKILL.md
Action: Add subsection "## Config Update" with steps
Estimated diff: +20-40 lines in existing SKILL.md
MERGE Blueprint
For MERGE verdicts (score 0.6-0.8), plan a significant extension of the existing skill:
MERGE Blueprint: pdf-batch-edit -> nano-pdf
Target skill: ~/.claude/skills/nano-pdf/SKILL.md
Sections to add: "## Batch Operations" (new workflow section)
Scripts to add: scripts/batch-process.sh
Estimated diff: +60-100 lines in SKILL.md, +1 script
Phase 4: Execution
Two paths based on --no-team flag and Agent Teams availability.
Check Agent Teams availability:
[ "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-0}" = "1" ] && echo "teams" || echo "no-team"
If --no-team is set or env var is missing/0, use Path B automatically.
Path A: Agent Teams (default)
Read references/team-composition.md for full team details.
Team: 3 teammates (tami, jiwon, duri)
TeamCreate -> "skill-factory-run"
TaskCreate -> tami's analysis tasks (T1-T6)
TaskCreate -> jiwon's creation tasks (T7-T12, blocked by T6)
TaskCreate -> duri's validation tasks (T13-T18, blocked by T12)
Task -> tami (Explore, sonnet, blue)
"Analyze session, run scan-inventory.sh, run similarity-scorer.py, report findings"
Task -> jiwon (general-purpose, sonnet, green)
"For CREATE: read skill-templates.md, create SKILL.md + resources based on blueprint"
"For UPDATE/MERGE: read target skill, apply diff from blueprint, add new sections/scripts"
Task -> duri (general-purpose, sonnet, yellow)
"Run validate-skill.sh, verify triggers, register skill"
Pipeline:
- tami completes analysis -> reports to lead
- Lead confirms with user (Checkpoint 1-2)
- jiwon creates skill files -> reports to lead
- Lead confirms with user (Checkpoint 3)
- duri validates and registers -> reports to lead
- Lead confirms with user (Checkpoint 4)
- Shutdown all teammates, TeamDelete
Path B: Sequential (--no-team)
Execute the same phases inline without Agent Teams:
- Run
scan-inventory.shandsimilarity-scorer.pydirectly - Checkpoint 1-2: Present similarity results, ask user for CREATE/UPDATE/MERGE/SKIP per pattern
- Design blueprint based on template selection
- Checkpoint 3: Present blueprint, wait for user approval
- Create/update skill directory and files based on approved blueprint
- Run
validate-skill.shto verify - Checkpoint 4: Present validation results, ask user to register or edit
- Register and log
--dry-run Mode
Stop after Phase 3 (blueprint). Print the blueprint and exit without creating files:
DRY RUN COMPLETE
Patterns analyzed: N
Decisions: X CREATE, Y MERGE, Z SKIP
Blueprints generated: X
No files were created. Remove --dry-run to execute.
Phase 5: Registration
After validation passes:
Log creation - Append to
~/.claude/skill-factory.log:[2026-02-18T14:30:00] CREATED api-load-test (global) from session patterns [2026-02-18T14:30:00] MERGED batch-operations into nano-pdfScope placement:
--scope global:~/.claude/skills/<name>/--scope project:.claude/skills/<name>/
Optional CLAUDE.md update: If project-scoped, offer to add skill reference to project CLAUDE.md.
Output Format
Final report after all patterns are processed:
Skill Factory Report
Session: <branch-name or "main">
Patterns found: N
Patterns processed: M
Results:
CREATED: api-load-test (global) - 4 files, 180 lines
MERGED: batch-ops into nano-pdf - 2 sections added
SKIPPED: data-transform (0.85 match with data-research)
Files created/modified:
~/.claude/skills/api-load-test/SKILL.md
~/.claude/skills/api-load-test/scripts/run-load-test.sh
~/.claude/skills/nano-pdf/SKILL.md (updated)
Validation: ALL PASS
Log: ~/.claude/skill-factory.log
Next steps:
Test the new skill: /api-load-test
Review: cat ~/.claude/skills/api-load-test/SKILL.md
Error Handling
| Situation | Action |
|---|---|
| No git history | Analyze only staged/unstaged changes |
| No patterns found | "No reusable patterns detected. Try after a more complex session." |
| scan-inventory.sh fails | Fall back to manual inventory (glob SKILL.md files) |
| similarity-scorer.py fails | Skip similarity check, default to CREATE |
| Agent Teams unavailable | Auto-fallback to --no-team mode |
| validate-skill.sh fails | Show errors, let user fix or cancel |
| User cancels at checkpoint | Abort gracefully, no partial files left |
Related Files
| File | Purpose | When to Read |
|---|---|---|
| scripts/scan-inventory.sh | Scan all skills/commands/agents to JSON | Phase 2 - always |
| scripts/similarity-scorer.py | 4-dim similarity scoring | Phase 2 - per pattern |
| scripts/validate-skill.sh | Validate created skill structure | Phase 5 - after creation |
| references/decision-tree.md | CREATE/UPDATE/MERGE/SKIP logic | Phase 2 - for decisions |
| references/team-composition.md | tami/jiwon/duri team setup | Phase 4 - Agent Teams path |
| references/skill-templates.md | Skill type templates | Phase 3 - blueprint design |
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核