Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

custom-blocks

Skill by huggingface

Packages a locally written ModularPipelineBlocks subclass into a Hub-uploadable directory for diffusers. Use it when a developer wants to publish a custom modular block so others can load it with trust_remote_code=True.

  • Score 88
  • 35k stars
  • Apache-2.0
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install custom-blocks

Built from the published package, never by AI.

git clone --depth 1 https://github.com/huggingface/diffusers /tmp/diffusers && mkdir -p ~/.claude/skills && cp -r /tmp/diffusers/.ai/skills/custom-blocks ~/.claude/skills/custom-blocks

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install custom-blocks in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill packages a ModularPipelineBlocks subclass from a local Python file into a directory ready to upload to the Hugging Face Hub. It runs the diffusers-cli custom_blocks command. The command parses the file with ast without executing it, finds block classes, and picks one by name or uses the first one found. It then imports the file, instantiates the class with no arguments, and calls save_pretrained in the current directory. The output includes the block source and an auto_map entry in the config.

It is aimed at developers who write custom modular blocks and want consumers to load them with ModularPipeline.from_pretrained and trust_remote_code=True. The skill covers only the packaging step. Writing the block class, uploading with hf upload, and running existing pipelines with diffusers-cli run or schema are outside its scope.

Written from the project's SKILL.md and checked against it.

What it can do

  • AST class scanFinds ModularPipelineBlocks and composite subclasses in a Python file without executing it.
  • Class selectionPackages the class named by --block_class_name, or the first block class found in the file.
  • Save stepInstantiates the chosen block and calls save_pretrained into the current working directory.
  • auto_map configWrites an auto_map entry so consumers know to load the block with trust_remote_code=True.
  • Error reportingReports syntax errors and lists available block classes when the requested name is not found.

What you need

  • diffusers-cli available on PATH
  • A local block.py with a ModularPipelineBlocks subclass
  • hf CLI for uploading the directory to the Hub

Try asking

  • Package my block.py as a Hub-uploadable directory with diffusers-cli.
  • Package the MyDenoiseBlock class from block.py for upload to the Hub.
  • Help me fix the 'Available classes' error from diffusers-cli custom_blocks.

Good to know

  • Importing the block file executes it, so only package code you trust.
  • The block class is instantiated with no constructor arguments.
  • Aliased imports of the base classes are not detected by the AST scan.
  • Writing the block and uploading to the Hub are outside this skill.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: .ai/skills/custom-blocks/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md7 KB

Alternatives to custom-blocks

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

custom-blocks: common questions

How does the command choose which block to package?

It uses --block_class_name if you give it. Otherwise it uses the first ModularPipelineBlocks subclass it finds in the file, and logs the others.

How do consumers load a published custom block?

They call ModularPipeline.from_pretrained with the repo name and trust_remote_code=True. The CLI commands diffusers-cli schema and run accept --trust-remote-code as well.

Can the block class take constructor arguments?

The command calls the class with no arguments. The source suggests reading values from state or components in __call__, or hardcoding defaults in __init__.

How do I install custom-blocks?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is custom-blocks free?

The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.

Is custom-blocks safe to use?

It scores 88 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to custom-blocks?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

custom-blocks Install

Add to stack

Loading.