custom-node-from-github
Turn a model's GitHub repository (already cloned locally) into a self-contained, importable ComfyUI custom-node pack — __init__.py, nodes.py…
by szprivate★ 53 GitHub stars
Install custom-node-from-github in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Custom node from a GitHub repo
Turn a model's source repository into a self-contained ComfyUI custom-node pack. You are given:
repo_url— the GitHub URL the pack is built from.repo_dir— a local clone of that repo you can read (already on disk).pack_dir— the empty output folder you must fill. Everything the node needs lives here; the folder is meant to become its own GitHub repo later, so it must be complete and stand alone.node_nameand optionalnotes.
Your job: read the repo, understand how the model is loaded and run, and write a working ComfyUI custom node that exposes it. You do not execute the model — you author the code.
Workflow
- Read the repo. Start with
README*,docs/,examples/, then the actual inference entry points (inference.py,pipeline*.py,app.py,demo/,*.pyunder the package). Useread_text_fileandrun_script(e.g. list files with a shortos.walk). You must find, concretely: the load call (weights path, config, dtype/device) and the inference call (its inputs, their shapes/dtypes, and its outputs). If the README is thin,web_searchthe model name for a usage snippet — but prefer the repo's code. - Design the node(s). Map the model's inputs/outputs onto ComfyUI types (table below). Split into a Loader node (loads weights, outputs a MODEL handle) and a Run node (takes that handle + inputs, produces IMAGE/etc.) when loading is expensive or reused; use a single node when it's trivial.
- Write the pack (all files below) with
write_text_file, using paths underpack_dir. - Return a summary (final message): the pack path, the files you wrote, the node keys/display names, and a bullet list of every Unresolved / TODO item you could not determine from the docs. Be honest about gaps.
ComfyUI node anatomy (get this exactly right)
A node is a Python class. ComfyUI discovers it through two module-level dicts in
__init__.py:
NODE_CLASS_MAPPINGS = {"MyModelLoader": MyModelLoader, "MyModelSampler": MyModelSampler}
NODE_DISPLAY_NAME_MAPPINGS = {"MyModelLoader": "MyModel Loader", "MyModelSampler": "MyModel Sampler"}
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
Each node class:
class MyModelSampler:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"model": ("MYMODEL",), # handle from the loader node
"image": ("IMAGE",), # ComfyUI image tensor
"prompt": ("STRING", {"multiline": True, "default": ""}),
"steps": ("INT", {"default": 20, "min": 1, "max": 200}),
"cfg": ("FLOAT", {"default": 7.0, "min": 0.0, "max": 30.0, "step": 0.1}),
"mode": (["fast", "quality"], {"default": "fast"}), # dropdown
},
"optional": {"mask": ("MASK",)},
}
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",) # optional but nice
FUNCTION = "run"
CATEGORY = "MyModel"
# OUTPUT_NODE = True # only for terminal/save/preview nodes
def run(self, model, image, prompt, steps, cfg, mode, mask=None):
...
return (out_image,) # ALWAYS a tuple matching RETURN_TYPES
Rules that trip people up:
INPUT_TYPESis a classmethod returning therequired/optional/hiddendict. Widget options:default, min, max, step, multiline, tooltip.- The
FUNCTIONmethod returns a tuple (even for one output:(x,)). - A dropdown is a list of choices as the type:
(["a","b"], {"default":"a"}). - Set
OUTPUT_NODE = Trueonly for nodes that terminate a graph (save/preview); they may return{"ui": {...}}instead of / alongside the tuple.
ComfyUI data types at the node boundary
- IMAGE:
torch.Tensor, shape[B, H, W, C],float32in[0, 1], RGB.- to PIL:
Image.fromarray((t[0].cpu().numpy() * 255).astype(np.uint8)) - from PIL:
torch.from_numpy(np.array(pil).astype(np.float32) / 255.0)[None,] - Batch several outputs with
torch.cat(list_of_BHWC, dim=0).
- to PIL:
- MASK:
torch.Tensor, shape[B, H, W], float[0, 1]. - LATENT: a dict
{"samples": tensor}. - STRING / INT / FLOAT / BOOLEAN: plain Python scalars.
- MODEL / CLIP / VAE / CONDITIONING: opaque handles — for a brand-new model,
invent your own handle type string (e.g.
"MYMODEL") and pass your own object (a small dataclass/dict holding the loaded model + metadata) between your nodes.
Weights, device, and safe importing
- Resolve model files through
folder_paths, never hard-coded paths:
Expose available weight files as a dropdownimport folder_paths, os base = os.path.join(folder_paths.models_dir, "mymodel") # ComfyUI/models/mymodel os.makedirs(base, exist_ok=True) # dropdown of available files: folder_paths.get_filename_list("checkpoints")
Allowed tools
Tools this skill is permitted to call.
- 01
read_text_file - 02
file_read - 03
write_text_file - 04
run_script - 05
web_search
FAQ
What does the custom-node-from-github skill do?
Turn a model's GitHub repository (already cloned locally) into a self-contained, importable ComfyUI custom-node pack — __init__.py, nodes.py, requirements.txt, README.md, pyproject.toml. Use when handed a repo_dir to read and an empty pack_dir to fill.
How do I install the custom-node-from-github skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the custom-node-from-github skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…