Agent Skillszzatpku/AgentFactory › modify_subagent

modify_subagent

GitHub

用于精确替换子代理文件中的代码片段,支持工作区文件和已保存技能。通过指定旧内容和新内容进行修改,适用于修复bug、更新逻辑等微调场景,并建议配合run_subagent进行测试验证。

skills/meta/modify_subagent/SKILL.md zzatpku/AgentFactory

Trigger Scenarios

需要修改现有子代理的具体代码实现 修复子代理中存在的bug或逻辑缺陷 对已保存的技能进行小范围的精准调整

Install

npx skills add zzatpku/AgentFactory --skill modify_subagent -g -y
More Options

Non-standard path

npx skills add https://github.com/zzatpku/AgentFactory/tree/master/skills/meta/modify_subagent -g -y

Use without installing

npx skills use zzatpku/AgentFactory@modify_subagent

指定 Agent (Claude Code)

npx skills add zzatpku/AgentFactory --skill modify_subagent -a claude-code -g -y

安装 repo 全部 skill

npx skills add zzatpku/AgentFactory --all -g -y

预览 repo 内 skill

npx skills add zzatpku/AgentFactory --list

SKILL.md

Frontmatter
{
    "name": "modify_subagent",
    "description": "Edit an existing subagent file by replacing specific code snippets. Supports both workspace files and saved skills."
}

Modify Subagent

Edit an existing subagent file by replacing specific code snippets. Supports two modes:

  1. Workspace file (default): Modify a file in the current workspace.
  2. Saved skill: Provide skill_name to modify a previously saved skill. The skill's code is copied to workspace and modified there.

After modifying, use run_subagent to test — it will automatically run the modified version.

Usage

Modify a workspace file

<action>modify_subagent</action>
<params>
{
    "filename": "subagent.py",
    "old_content": "exact code to replace",
    "new_content": "new code"
}
</params>

Modify a saved skill

<action>modify_subagent</action>
<params>
{
    "skill_name": "web_searcher",
    "old_content": "exact code to replace",
    "new_content": "new code"
}
</params>

You can also specify filename to target a specific file within the saved skill (defaults to the skill's entry_file):

<action>modify_subagent</action>
<params>
{
    "skill_name": "web_searcher",
    "filename": "helper.py",
    "old_content": "exact code to replace",
    "new_content": "new code"
}
</params>

Parameters

Parameter Type Default Description
filename str entry_file or "subagent.py" Name of the file to modify. When used with skill_name, defaults to the skill's entry_file.
skill_name str "" (Optional) Name of a saved skill to modify.
old_content str required Exact code snippet to find and replace
new_content str required New code to replace with

Returns

On success:

{
    "success": True,
    "path": "/path/to/file.py",
    "message": "Subagent code modified."
}

On failure:

{
    "success": False,
    "error": "old_content not found in file..."
}

Important Notes

  • The old_content must be an exact match of text in the source file
  • This modifies your SOURCE CODE, not the subagent's output
  • After modifying, use run_subagent to test the changes — it will run the modified version
  • When modifying a saved skill, use run_subagent with the same skill_name to test
  • When to modify vs. create new: Only use modify_subagent on a saved skill when the skill itself has problems — e.g. it contains hardcoded values, lacks generality, has bugs, or otherwise cannot be reused as-is. If the saved skill is fine but you simply want to borrow ideas or patterns from it for a similar but different task, you should view_subagent_code to study its code, then use create_subagent to build a new one. Do NOT modify a working, general-purpose skill just to adapt it to a different task.
  • modify_subagent vs. supersedes in finish: These serve different purposes:
    • modify_subagent with skill_name: For small, surgical fixes (bug fixes, selector updates, minor logic changes). The skill name and file name stay the same. Changes are saved back to the original skill directory at finish time.
    • create_subagent (new file) + supersedes in finish: For major rewrites where the architecture, approach, or file name changes significantly. This creates a new skill and removes the old one. Use this when modify_subagent would require replacing most of the code.

Version History

  • df92287 Current 2026-07-25 08:38

Same Skill Collection

skills/meta/create_subagent/SKILL.md
skills/meta/finish/SKILL.md
skills/meta/list_saved_subagents/SKILL.md
skills/meta/run_subagent/SKILL.md
skills/meta/view_subagent_code/SKILL.md
skills/tools/google_search/SKILL.md
skills/tools/jina_reader/SKILL.md
skills/tools/mask/local_search/SKILL.md
skills/tools/mask/open_page/SKILL.md
skills/tools/playwright/SKILL.md
skills/tools/shell_command/SKILL.md

Metadata

Files
0
Version
df92287
Hash
039f5f7e
Indexed
2026-07-25 08:38

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 04:13
浙ICP备14020137号-1 $mapa de visitantes$