Repository navigation
Restructure skill files and reference guides for CLI based installation. #14454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4f07218
83b2efc
5791767
28c0847
f942750
dceeef4
6ee6735
c803edc
007e8ae
29f8cbf
653c7c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "diffusers", | ||
| "description": "Conventions and task skills for contributing to diffusers", | ||
| "author": { | ||
| "name": "The Hugging Face team" | ||
| }, | ||
| "homepage": "https://huggingface.co/docs/diffusers/main/en/conceptual/contribution#coding-with-ai-agents", | ||
| "repository": "https://github.com/huggingface/diffusers", | ||
| "license": "Apache-2.0", | ||
| "keywords": [ | ||
| "diffusers", | ||
| "diffusion-models", | ||
| "contributing" | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "diffusers", | ||
| "version": "0.1.0", | ||
| "description": "Conventions and task skills for contributing to diffusers", | ||
| "skills": "./skills/" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,45 +2,74 @@ | |
|
|
||
| ## Setup | ||
|
|
||
| - Local Claude Code agents: run `make claude` after cloning to wire the [skills](#skills) under `.claude/`. | ||
| - Local OpenAI Codex agents: run `make codex` after cloning to wire the [skills](#skills) under `.agents/`. | ||
| We recommend developing in a virtual environment managed by [uv](https://docs.astral.sh/uv/): | ||
|
|
||
| ## Coding style | ||
| ```bash | ||
| uv venv && source .venv/bin/activate | ||
| uv pip install -e . # provides diffusers-cli | ||
| ``` | ||
|
|
||
| Strive to write code as simple and explicit as possible. | ||
| List the available skills, and what each one is for, with: | ||
|
|
||
| - Prefer inlining small helper/utility functions over factoring them out — a reader should be able to follow the full flow without jumping between functions. If a private helper has only one caller, inlining it at the call site is usually the cleaner choice. | ||
| - No defensive code, unused code paths, or legacy stubs — do not add fallback paths, safety checks, or configuration options "just in case"; do not carry unused method parameters "for API consistency", backwards-compatibility aliases for names that never shipped, or deprecation shims for code that was never released. When porting from a research repo, delete training-time code paths, experimental flags, and ablation branches entirely — only keep the inference path you are actually integrating. | ||
| - Do not guess user intent and silently correct behavior. Make the expected inputs clear in the docstring, and raise a concise error for unsupported cases rather than adding complex fallback logic. | ||
| ```bash | ||
| diffusers-cli skills list | ||
| ``` | ||
|
|
||
| --- | ||
| Install them with: | ||
|
|
||
| ## Code formatting | ||
| ```bash | ||
| diffusers-cli skills add <skill name> # install one, or --all for every skill | ||
| # --claude / --codex / --cursor to pick one target | ||
| ``` | ||
|
|
||
| - `make style` and `make fix-copies` should be run before opening a PR | ||
| `diffusers-cli skills update` refreshes what you installed. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this handled?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DN6 👀 |
||
|
|
||
| Skills used to be installed through the `Makefile`, which symlinked the project-level `.claude/skills` and | ||
| `.agents/skills` at `.ai/skills` in this repo. Remove those links if they exist — otherwise the install writes through | ||
| them into `.ai/` itself: | ||
|
|
||
| ```bash | ||
| rm -f .claude/skills .agents/skills | ||
| ``` | ||
|
|
||
| At the start of a session, confirm the setup and tell the user what you find: | ||
|
|
||
| ```bash | ||
| python utils/check_ai.py # guides and skills are consistent | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it runs via |
||
| diffusers-cli skills list # which skills are installed | ||
| ``` | ||
|
|
||
| ### Copied Code | ||
| Claude Code and Codex can also install via plugins | ||
|
|
||
| - Many classes are kept in sync with a source via a `# Copied from ...` header comment | ||
| - Do not edit a `# Copied from` block directly — run `make fix-copies` to propagate changes from the source | ||
| - Remove the header to intentionally break the link | ||
| ```bash | ||
| claude plugin marketplace add huggingface/diffusers | ||
| claude plugin install diffusers@diffusers-skills --scope project | ||
|
|
||
| codex plugin marketplace add huggingface/diffusers # then install from the Plugins Directory | ||
| ``` | ||
|
|
||
|
|
||
| ## Code formatting | ||
|
|
||
| - `make style` and `make fix-copies` should be run before opening a PR | ||
|
|
||
| ## Reference guides | ||
|
|
||
| - **Models** — see [models.md](models.md) for model conventions, attention pattern, implementation rules, dependencies, and gotchas. For adding or converting a model, use the [model-integration](./skills/model-integration/SKILL.md) skill. | ||
| - **Pipelines** — see [pipelines.md](pipelines.md) for pipeline conventions, patterns, and gotchas. | ||
| - **Modular pipelines** — see [modular.md](modular.md) for modular pipeline conventions, patterns, and gotchas. | ||
| - **Tests** — see [testing.md](testing.md) for test conventions: required test layers, tester mixins, and dummy-component rules. | ||
| - **Coding style** — see [code_style.md](references/code_style.md) for how code should read, and the `# Copied from` rules. | ||
| - **Models** — see [models.md](references/models.md) for model conventions, attention pattern, implementation rules, dependencies, and gotchas. For adding or converting a model, use the [model-integration](skills/model-integration/SKILL.md) skill. | ||
| - **Pipelines** — see [pipelines.md](references/pipelines.md) for pipeline conventions, patterns, and gotchas. | ||
| - **Modular pipelines** — see [modular.md](references/modular.md) for modular pipeline conventions, patterns, and gotchas. | ||
| - **Tests** — see [testing.md](references/testing.md) for test conventions: required test layers, tester mixins, and dummy-component rules. | ||
|
|
||
| ## Skills | ||
|
|
||
| Task-specific guides live in `.ai/skills/` and are loaded on demand by AI agents. Available skills include: | ||
|
|
||
| - [model-integration](./skills/model-integration/SKILL.md) (adding/converting pipelines) | ||
| - [custom-blocks](./skills/custom-blocks/SKILL.md) (packaging a `ModularPipelineBlocks` subclass for the Hub) | ||
| - [diffusers-cli](./skills/diffusers-cli/SKILL.md) (running pipelines, inspecting schemas, and using the Diffusers CLI) | ||
| - [self-review](./skills/self-review/SKILL.md) (pre-PR self-review against the project rules) | ||
| - [model-integration](skills/model-integration/SKILL.md) (adding/converting pipelines) | ||
| - [custom-blocks](skills/custom-blocks/SKILL.md) (packaging a `ModularPipelineBlocks` subclass for the Hub) | ||
| - [diffusers-cli](skills/diffusers-cli/SKILL.md) (running pipelines, inspecting schemas, and using the Diffusers CLI) | ||
| - [self-review](skills/self-review/SKILL.md) (pre-PR self-review against the project rules) | ||
|
|
||
| ## Self-review before a PR | ||
|
|
||
| Before opening a PR, run self-review against [review-rules.md](review-rules.md). The [self-review skill](skills/self-review/SKILL.md) runs this as the same pass the `@claude` CI reviewer uses. Share the final report on the PR (description or comment) — see the skill for details. | ||
| Before opening a PR, run self-review against [review-rules.md](references/review-rules.md). The [self-review skill](skills/self-review/SKILL.md) runs this as the same pass the `@claude` CI reviewer uses. Share the final report on the PR (description or comment) — see the skill for details. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", | ||
| "name": "diffusers", | ||
| "description": "Conventions and task skills for contributing to diffusers", | ||
| "author": { | ||
| "name": "The Hugging Face team" | ||
| }, | ||
| "homepage": "https://huggingface.co/docs/diffusers/main/en/conceptual/contribution#coding-with-ai-agents", | ||
| "repository": "https://github.com/huggingface/diffusers", | ||
| "license": "Apache-2.0", | ||
| "keywords": [ | ||
| "diffusers", | ||
| "diffusion-models", | ||
| "contributing" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Coding style and copied code | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this being factored out? Nice. |
||
|
|
||
| Shared reference for how diffusers code should read, and for the `# Copied from` mechanism. | ||
|
|
||
| ## Coding style | ||
|
|
||
| Strive to write code as simple and explicit as possible. | ||
|
|
||
| - Prefer inlining small helper/utility functions over factoring them out — a reader should be able to follow the full flow without jumping between functions. If a private helper has only one caller, inlining it at the call site is usually the cleaner choice. | ||
| - No defensive code, unused code paths, or legacy stubs — do not add fallback paths, safety checks, or configuration options "just in case"; do not carry unused method parameters "for API consistency", backwards-compatibility aliases for names that never shipped, or deprecation shims for code that was never released. When porting from a research repo, delete training-time code paths, experimental flags, and ablation branches entirely — only keep the inference path you are actually integrating. | ||
| - Do not guess user intent and silently correct behavior. Make the expected inputs clear in the docstring, and raise a concise error for unsupported cases rather than adding complex fallback logic. | ||
|
|
||
| ## Copied code | ||
|
|
||
| - Many classes are kept in sync with a source via a `# Copied from ...` header comment | ||
| - Do not edit a `# Copied from` block directly — run `make fix-copies` to propagate changes from the source | ||
| - Remove the header to intentionally break the link | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(curiosity): why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It enables installation via Claude's plugin management system.