Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/zzatpku-create-subagent
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/create-subagent
What's inside
- Skill name
create_subagent- Description
- Create a new Python subagent file in the workspace. After creating, use run_subagent to test it (NOT use_saved_subagent).
- License
- MIT
- Instructions
- 289 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Agent Skills spec issues
- name: only lowercase letters, digits and single hyphens allowed
- body: contains an absolute path from the author's machine
Files (1)
- SKILL.md
SKILL.md (first lines)
# Create Subagent
Create a new Python subagent file in the **workspace** (temporary directory).
## IMPORTANT: Workflow After Creating
After `create_subagent`, use `run_subagent` to run it:
```
create_subagent → run_subagent (with query) → finish
```
**DO NOT** use `use_saved_subagent` for newly created subagents!
- `run_subagent`: For subagents you just created (in workspace)
- `use_saved_subagent`: ONLY for subagents listed by `list_saved_subagents`
## Usage
```xml
<action>create_subagent</action>
<params>
{
"skill_name": "my_subagent_name",
"filename": "subagent.py",
"code": "your python code here",
"skills": ["local_search", "open_page"]
}
</params>
```
## Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| skill_name | str | required | Name for this subagent (used when saving with `finish`) |
| filename | str | "subagent.py" | Name of the file to create in workspace |
| code | str | required | The Python code for the subagent |
| skills | list | ["local_search", "open_page"] | List of tool skill names this subagent will use. You MUST call `get_skill_description` for each tool skill BEFORE creating the subagent to understand how to use them. |
## Returns
```python
{
"success": True,
"path": "/path/to/workspace/subagent.py",
"message": "Subagent created with skills: [...]"
}
```
## Next Step After Creating
Use `run_subagent` with the same filename to test:
```xml
<action>run_subagent</action>
<params>{"filename": "subagent.py", "query": "your test query"}</params>
```
## Core Component: call_llm
The LLM is the core reasoning engine of your subagent. Use it like this:
```python
from llm import call_llm
response = call_llm(
system="You are a research assistant.",
messages=[{"role": "user", "content": "Your prompt here"}],
max_tokens=2000 # optional, default 8000
)
# Returns: str - The LLM's text response, or "Error:..." on failure
```
**IMPORTANT**: `call_llm` requires TWO positional arguments:
- `system`: A string for the system prompt
- `messages`: A list of message dicts with "role" and "content" keys
## Tool Skills in Subagent
**IMPORTANT**: Before using any tool skill, use `get_skill_description` to read its documentation and understand:
- How to import the tool
- What parameters it accepts
- What format it returns
Each tool skill has a SKILL.md file that shows exactly how to use it. For example:
```python
# For search tool - check its SKILL.md first with get_skill_description
from tools import local_search
results = local_search(query="your query", topk=10)
# For open_page tool - check its SKILL.md first with get_skill_description
from tools import open_page
content = open_page(docid="doc_id_from_search")
```
**Workflow**:
1. Meta agent calls `get_skill_description("local_search")` to read the tool's documentation
2. Meta agent creates subagent code that imports and uses the tool directly as shown in the documentation
3. Subagent runs and uses the tool by importing it directly
## Important Notes
- **CRITICAL: Data Passing Between Subagents**: When a subagent needs to collect large amounts of data, or when data needs to be passed between multiple subagents, use JSON files as the intermediate format. The producing subagent writes data to a `.json` file in the workspace, and the consuming subagent reads from that JSON file. This avoids passing large data through return values and keeps subagent interfaces clean.
- **CRITICAL: Output Files Must Use Relative Paths**: When the subagent needs to **write/save** output files (markdown, images, JSON, etc.), ALWAYS use **relative paths** (e.g., `output.md`, `result.png`, `data.json`). The subagent runs in a workspace directory, so relative paths will automatically save files to the correct location. Do NOT use absolute paths like `/Users/.../file.md` for output.
- Examples of output files: `plt.savefig('chart.png')`, `pathlib.Path('result.md').write_text(...)`, `json.dump(data, open('data.json', 'w'))`
- **Reading Input Files**: For **reading** files (e.g., reading source code to analyze, reading data files), you CAN use absolute paths if needed — this is allowed since you're referencing existing files, not creating new output.
- **CRITICAL: Matplotlib Text Encoding**: When the subagent uses `matplotlib` for plotting, Do NOT use emoji characters (e.g., `\U0001f4c8`, `📈`, `😊`) in any labels, titles, legends, annotations, or text elements. Emojis are NOT supported by matplotlib's default fonts and will cause rendering failures or missing characters. Use plain text only.
- **CRITICAL**: Before creating a subagent, you MUST call `get_skill_description` for EVERY tool skill the subagent will use. This is mandatory to understand:
- How to import the tool correctly
- What parameters it accepts and their types
- What format the tool returns (essential for writing correct code!)
- The subagent should be a **complete problem-solving pipeline**, not a simple function
- It should have its own reasoning loop: think → act → observe → iterate
- The subagent's `main(query)` function receives the question as a parameter and returns a dict
- Use `def main(query):` as the entry point
- The subagent should work for ANY question of the same category
## ⚠️ CRITICAL: Subagent MUST Be Generic ⚠️
A subagent will be saved and reused for MANY different questions of the same category. **NEVER hardcode the current question's specific details** (entity names, dates, search terms, expected answers, if-checks for specific strings) into the code.From zzatpku/AgentFactory, MIT.
More from zzatpku/AgentFactory
- 0.513score
finish
zzatpku
Complete the task with a final answer and save reusable subagents as skills.
SkillDFreshness: D★ 66Claude Code +9 - 0.510score
playwright
zzatpku
Browser automation via Playwright.
SkillDFreshness: D★ 66Claude Code +9 - 0.509score
view_subagent_code
zzatpku
View the source code of a saved subagent skill.
SkillDFreshness: D★ 66Claude Code +9 - 0.509score
list_saved_subagents
zzatpku
List all previously saved subagent skills.
SkillDFreshness: D★ 66Claude Code +9 - 0.506score
open_page
zzatpku
Retrieve the full content of a document by its ID.
SkillDFreshness: D★ 66Claude Code +9 - 0.506score
google_search
zzatpku
Search the internet via Google (Serper API).
SkillDFreshness: D★ 66Claude Code +9 - 0.506score
local_search
zzatpku
Search for relevant documents in the local knowledge base.
SkillDFreshness: D★ 66Claude Code +9 - 0.503score
modify_subagent
zzatpku
Edit an existing subagent file by replacing specific code snippets.
SkillDFreshness: D★ 66Claude Code +9 - 0.503score
run_subagent
zzatpku
Run a subagent - either a newly created one from workspace or a saved subagent from previous sessions.
SkillDFreshness: D★ 66Claude Code +9 - 0.502score
read_url_jina
zzatpku
Retrieve the full content of a web page by its URL.
SkillDFreshness: D★ 66Claude Code +9 - 0.502score
execute_shell_command
zzatpku
Execute standard Bash shell commands in a non-interactive environment.
SkillDFreshness: D★ 66Claude Code +9 - 0.273score
tencent_docs_final
zzatpku
No description from the publisher yet.
SkillDFreshness: D★ 66Claude Code +9
Signals
- Stars
- 66
- Forks
- 8
- Open issues
- 0
- Last commit (this folder)
- Feb 28, 2026 (8 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/zzatpku/AgentFactory
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from zzatpku
- 0.513score
finish
zzatpku
Complete the task with a final answer and save reusable subagents as skills.
SkillDFreshness: D★ 66Claude Code +9 - 0.510score
playwright
zzatpku
Browser automation via Playwright.
SkillDFreshness: D★ 66Claude Code +9 - 0.509score
view_subagent_code
zzatpku
View the source code of a saved subagent skill.
SkillDFreshness: D★ 66Claude Code +9 - 0.509score
list_saved_subagents
zzatpku
List all previously saved subagent skills.
SkillDFreshness: D★ 66Claude Code +9 - 0.506score
google_search
zzatpku
Search the internet via Google (Serper API).
SkillDFreshness: D★ 66Claude Code +9 - 0.506score
local_search
zzatpku
Search for relevant documents in the local knowledge base.
SkillDFreshness: D★ 66Claude Code +9
Cite this page
create_subagent skill. Agent Mart. https://agentmart.dev/skills/zzatpku-create-subagent (last updated 2026-10-24)