Skip to content
Back to skills

Extension Scripting

ASecurity

"Author, debug, and package stable-diffusion-webui scripts and

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
developmentjavascriptjavaapisecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill extension-scripting --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Extension Scripting?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Extension Scripting
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-extension-scripting/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-extension-scripting)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: extension-scripting
description: "Author, debug, and package stable-diffusion-webui scripts and
  extensions, including Script classes, postprocessing scripts, callbacks,
  metadata ordering, preload hooks, UI component hooks, and API-visible script
  args."
disable-model-invocation: true
metadata:
  disco-role: operating
license: AGPL 3.0
---

# Extension Scripting

Use this sub-skill when building or diagnosing a Stable Diffusion WebUI script or extension: selectable scripts, always-on scripts, postprocessing scripts for Extras, callback-only extensions, JavaScript UI hooks, `metadata.ini` load/callback ordering, or `preload.py` command-line options.

## Start Here

1. Choose the extension shape:
   - Selectable generation script: `scripts/<name>.py` with a `modules.scripts.Script` subclass, `show()` returning `True`, `ui()` returning a list of Gradio controls, and `run(p, *args)` returning a `Processed` result.
   - Always-on generation script: same subclass, `show()` returning `scripts.AlwaysVisible`, and lifecycle methods such as `setup()`, `before_process()`, `process()`, `process_batch()`, `postprocess_image()`, or `postprocess()`.
   - Extras postprocessing operation: `scripts/<name>.py` with a `modules.scripts_postprocessing.ScriptPostprocessing` subclass, `name`, optional `order`, `ui()` returning a dict of controls, and `process(pp, **args)`.
   - Callback-only extension: register functions from `modules.script_callbacks` at module import time and omit a `Script` subclass if no script UI is needed.
2. Generate a safe starter skeleton with [scripts/make_extension_template.py](scripts/make_extension_template.py); it writes an extension directory but imports only stdlib while generating.
3. Use [references/script-api-reference.md](references/script-api-reference.md) for `Script` and postprocessing method contracts, argument slices, API metadata, and file layout.
4. Use [references/callbacks-and-lifecycle.md](references/callbacks-and-lifecycle.md) for callback names, callback order, `metadata.ini`, `preload.py`, and UI hook timing.
5. Use [references/troubleshooting.md](references/troubleshooting.md) when scripts are not listed, API args are missing, callbacks run in the wrong order, component hooks miss `elem_id`, or imports fail.

## Safe Defaults

- Keep extension generation tools outside WebUI runtime imports; only generated runtime files should import `modules.*`.
- Give every Gradio control that future code must target a stable `elem_id`, preferably via `self.elem_id("field_name")` inside `Script.ui()`.
- Return controls from `ui()` in the exact order expected by lifecycle methods and API `args` arrays.
- Add API-visible labels/defaults through returned Gradio controls; WebUI derives `ScriptInfo.args` from each control's `label`, `value`, `minimum`, `maximum`, `step`, and `choices`.
- Avoid arbitrary code execution patterns. The built-in custom-code script is gated by `--allow-code`; do not copy that pattern into extensions unless the user explicitly accepts the security risk.

## Routing Notes

- Route Lora asset formats, tags, and model-file semantics to `assets-and-models`.
- Route `/sdapi/v1/txt2img`, `/sdapi/v1/img2img`, and general API automation to `api-automation`.
- Route launch flags, extension enable/disable flags, and environment install flags to `launch-and-config`.
- Route training datasets and postprocessing-for-training workflows to `training-and-postprocessing`.

Files in this skill

  • SKILL.md3.4 KB
  • references/callbacks-and-lifecycle.md8 KB
  • references/script-api-reference.md11.2 KB
  • references/troubleshooting.md8.3 KB
  • scripts/make_extension_template.py7.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.