Command Palette

Search for a command to run...

Back to skills
skill № 78120

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…

FreeNo executable scripts
szprivateby 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
Sign up freeI already have an account

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_name and optional notes.

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

  1. Read the repo. Start with README*, docs/, examples/, then the actual inference entry points (inference.py, pipeline*.py, app.py, demo/, *.py under the package). Use read_text_file and run_script (e.g. list files with a short os.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_search the model name for a usage snippet — but prefer the repo's code.
  2. 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.
  3. Write the pack (all files below) with write_text_file, using paths under pack_dir.
  4. 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_TYPES is a classmethod returning the required/optional/hidden dict. Widget options: default, min, max, step, multiline, tooltip.
  • The FUNCTION method 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 = True only 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], float32 in [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).
  • 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:
    import 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")
    
    Expose available weight files as a dropdown
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

  1. 01read_text_file
  2. 02file_read
  3. 03write_text_file
  4. 04run_script
  5. 05web_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

Compare custom-node-from-github with