From dcode-agent-kit
Scaffolds a Deep Agents (LangChain) agent, a dcode CLI agent, or both via an interactive interview. Writes self-contained Python agents using any OpenAI-compatible API.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dcode-agent-kit:new-dcode-agentThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are running the **/new-dcode-agent** skill. It scaffolds a working agent for the user. Everything it writes is SELF-CONTAINED, so it works from any folder, with no dependency on this skill's own location. Run no `git`; the user commits.
You are running the /new-dcode-agent skill. It scaffolds a working agent for the user. Everything it writes is SELF-CONTAINED, so it works from any folder, with no dependency on this skill's own location. Run no git; the user commits.
create_deep_agent) the user runs or deploys. Scaffolded into ./<name>/ in the user's current directory.AGENTS.md) the user chats with via /agents. Scaffolded into ~/.deepagents/<name>/AGENTS.md.(This is NOT Claude Code's own subagents, which are a different feature.)
_, names that match an existing target, or shell-unsafe names).provider:model string for any LangChain provider, or the bundled env-driven connector below); does it change anything? (if yes, it gets an approval gate); how it will run (one-shot / long-running / scheduled / server).Show the user exactly what you will create: the target paths, the tools, the model, and the safety posture. Wait for explicit confirmation. Do not write anything until they confirm.
./<name>/ in the user's current directoryCreate the folder <name>/ with three files. It is self-contained: agent.py imports its connector from the sibling model.py (a same-directory import, so there is no path manipulation at all).
<name>/model.py (write this verbatim; the env-driven, provider-agnostic connector):
"""Model connector for this agent. Provider-agnostic, configured from the environment.
Targets any OpenAI-compatible Chat Completions endpoint (OpenAI itself, or a compatible
gateway). Set these in the environment or a .env file next to this agent:
LLM_API_KEY (or OPENAI_API_KEY) required
LLM_BASE_URL (or OPENAI_BASE_URL) optional; omit for OpenAI's default endpoint
LLM_MODEL optional; the model id (default below)
USE_RESPONSES_API optional; set 1 only if your provider supports it
"""
from __future__ import annotations
import os
import pathlib
from langchain_openai import ChatOpenAI
DEFAULT_MODEL = "gpt-4o-mini" # override via LLM_MODEL or the model= argument
def _load_env() -> None:
"""Minimal .env loader (no extra deps): this agent's folder, then the current
directory, then ~/.deepagents/.env. Existing environment variables always win."""
here = pathlib.Path(__file__).resolve().parent
for path in (here / ".env", pathlib.Path.cwd() / ".env",
pathlib.Path.home() / ".deepagents" / ".env"):
if not path.is_file():
continue
for line in path.read_text().splitlines():
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
key, value = line.split("=", 1)
os.environ.setdefault(key.strip(), value.strip())
def chat_model(model: str | None = None, *, temperature: float = 0.0, **kwargs) -> ChatOpenAI:
"""Return a ChatOpenAI wired to your OpenAI-compatible provider, from env."""
_load_env()
key = os.environ.get("LLM_API_KEY") or os.environ.get("OPENAI_API_KEY")
if not key:
raise RuntimeError("No API key. Set LLM_API_KEY (or OPENAI_API_KEY) in the "
"environment or a .env file next to this agent.")
base_url = os.environ.get("LLM_BASE_URL") or os.environ.get("OPENAI_BASE_URL") or None
use_responses = os.environ.get("USE_RESPONSES_API", "").strip().lower() in ("1", "true", "yes")
return ChatOpenAI(base_url=base_url, api_key=key,
model=model or os.environ.get("LLM_MODEL") or DEFAULT_MODEL,
temperature=temperature, use_responses_api=use_responses, **kwargs)
<name>/agent.py (base, non-mutating flavour; fill in system_prompt and real tools):
"""<name>: a Deep Agents SDK agent. Run: python agent.py "your prompt" """
from __future__ import annotations
import sys
from model import chat_model # sibling model.py, same-directory import
from deepagents import create_deep_agent
def example_tool(query: str) -> str:
"""Describe what this tool does (stub; replace)."""
return f"[stub] {query}"
SYSTEM_PROMPT = """You are a helpful agent. TODO: describe the role, scope, and rules."""
def build_agent():
return create_deep_agent(
model=chat_model(), # your provider/model from env; pass an id to override
tools=[example_tool],
system_prompt=SYSTEM_PROMPT,
)
if __name__ == "__main__":
agent = build_agent()
prompt = " ".join(sys.argv[1:]) or "Hello"
res = agent.invoke({"messages": [{"role": "user", "content": prompt}]})
print(res["messages"][-1].content)
If the agent can change things (a mutating tool), use this gated pattern instead. The approval gate needs BOTH interrupt_on AND a checkpointer, or it silently does nothing:
"""<name>: an ops agent with an approval gate. Run: python agent.py "status check" """
from __future__ import annotations
import sys
from model import chat_model
from deepagents import create_deep_agent
from langgraph.checkpoint.memory import InMemorySaver
def check_status() -> str:
"""Read-only status check (stub)."""
return "ok"
def restart_service(service: str) -> str:
"""MUTATING, gated by approval."""
return f"[would restart {service}]"
def build_agent():
return create_deep_agent(
model=chat_model(),
tools=[check_status, restart_service],
system_prompt="You are an ops engineer. Investigate read-only first; changes need approval.",
interrupt_on={"restart_service": True},
checkpointer=InMemorySaver(), # required, or the gate no-ops
)
if __name__ == "__main__":
agent = build_agent()
cfg = {"configurable": {"thread_id": "s1"}}
res = agent.invoke({"messages": [{"role": "user", "content": " ".join(sys.argv[1:]) or "status check"}]}, config=cfg)
print("[paused for approval]" if res.get("__interrupt__") else res["messages"][-1].content)
Verify a mutating agent actually pauses (a single __interrupt__ check can false-negative):
cfg = {"configurable": {"thread_id": "verify"}}
res = agent.invoke({"messages": [{"role": "user", "content": "<ask it to run the mutating tool>"}]}, config=cfg)
paused = bool(res.get("__interrupt__")) or bool(getattr(agent.get_state(cfg), "next", None))
print("approval gate fired:", paused) # if False, fix interrupt_on + checkpointer before shipping
Flavour adjustments (start from the base or gated file above and change these):
run_tests() tool (shell out to the project's test command) and a senior-engineer system prompt. Point LLM_MODEL at a coding-tuned model.search_issues(jql), or load MCP tools with langchain-mcp-adapters (MultiServerMCPClient) reading JIRA_* from the environment at runtime. Never hard-code credentials.interrupt_on + InMemorySaver).<name>/README.md (write a short one): what the agent does, then:
pip install deepagents langchain-openai # plus langchain-mcp-adapters if it uses MCP
export LLM_API_KEY=your-key # or put it in a .env next to agent.py
# optional: export LLM_BASE_URL=... export LLM_MODEL=...
python agent.py "your prompt"
~/.deepagents/<name>/AGENTS.md<!-- ... --> managed block (dcode self-edits this file).~/.deepagents/<name>/agents/<sub>/AGENTS.md. A subagent's frontmatter is only name, description, model (with a provider prefix, e.g. openai:gpt-4o-mini); the body is its system prompt; the folder and filename must be agents/<sub>/AGENTS.md.cd <name> && python agent.py "hello" (import plus a minimal run; construct-only if there is no key). If it mutates, run the verification snippet and confirm the gate fires.dcode agents list shows <name> (it auto-discovers the directory)..env at runtime only.agent.py plus a sibling model.py, same-directory import, no path manipulation.interrupt_on plus a checkpointer, or the approval gate silently does nothing.git; the user commits.npx claudepluginhub eliaalberti/dcode-agent-kit --plugin dcode-agent-kitCreates Claude Code agents from scratch or by adapting templates. Guides requirements gathering, template selection, and file generation following Anthropic best practices (v2.1.63+).
Create custom agents for Claude Code including YAML frontmatter, system prompts, tool restrictions, and discovery optimization. Use when creating, building, or designing agents, or when asked about agent creation, subagent configuration, Task tool delegation, or agent best practices.
Guides creation of autonomous agents for Claude Code plugins, covering Markdown file structure, YAML frontmatter (name, description, model, color, tools), system prompts, triggering examples, and best practices.