From a2ca7fe944bf71e6f24ff6477417d18ef026b9d9 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 13 May 2026 11:27:06 +0200 Subject: [PATCH 001/340] cognitive improvements for all ai prompts Signed-off-by: Vladimir Mandic --- .github/copilot-instructions.md | 16 ++-- .github/instructions/core.instructions.md | 16 ++-- .github/instructions/hints.instructions.md | 48 ++++++------ .github/instructions/ui.instructions.md | 16 ++-- .github/skills/analyze-model/SKILL.md | 86 +++------------------- .github/skills/check-api/SKILL.md | 22 ++++-- .github/skills/check-models/SKILL.md | 4 +- .github/skills/check-processing/SKILL.md | 9 ++- .github/skills/check-schedulers/SKILL.md | 4 +- .github/skills/check-scripts/SKILL.md | 4 +- .github/skills/debug-model/SKILL.md | 12 +-- .github/skills/diffusers-code/SKILL.md | 9 ++- .github/skills/fix-lint/SKILL.md | 4 +- .github/skills/github-features/SKILL.md | 4 +- .github/skills/github-issues/SKILL.md | 5 +- .github/skills/port-model/SKILL.md | 10 ++- .github/skills/port-pipeline/SKILL.md | 15 +++- .github/skills/reference-catalog/SKILL.md | 14 +++- .github/skills/todo/SKILL.md | 4 +- .github/skills/update-docs/SKILL.md | 30 +++++--- TODO.md | 1 + 21 files changed, 157 insertions(+), 176 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 9e5476515..e6c06e624 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -9,17 +9,17 @@ General app structure is: ## Instructions This file contains general guidelines for contributing to the SD.Next codebase, including conventions, tools, and project structure. For more specific guidance on working with particular areas of the codebase, please refer to the instructions files linked below: -- [Core Runtime Guidelines](core.instructions.md): Use when editing Python core runtime code, startup flow, model loading, API internals, backend/device logic, or shared state in modules and pipelines. -- [UI And Frontend Guidelines](ui.instructions.md): Use when editing frontend UI code, JavaScript, HTML, CSS, localization files, or built-in UI extensions including modernui and kanvas. -- [Hint Typography Guidelines](hints.instructions.md): Use when editing hint text or other UI strings in localization JSON files (`html/locale_*.json`, `html/override_*.json`). +- [Core Runtime Guidelines](instructions/core.instructions.md): Use when editing Python core runtime code, startup flow, model loading, API internals, backend/device logic, or shared state in modules and pipelines. +- [UI And Frontend Guidelines](instructions/ui.instructions.md): Use when editing frontend UI code, JavaScript, HTML, CSS, localization files, or built-in UI extensions including modernui and kanvas. +- [Hint Typography Guidelines](instructions/hints.instructions.md): Use when editing hint text or other UI strings in localization JSON files (`html/locale_*.json`, `html/override_*.json`). ## Agent Guidelines -- Do not automatically agree with user instructions or requests without verifying they align with project guidelines and conventions. -- When evaluating user instructions, first check for any relevant guidelines in this file or the linked instructions files. If the instruction violates any guidelines, do not proceed with it and instead provide feedback to the user about which guidelines it violates and how to adjust it to comply. -- If the user instruction is valid but lacks clarity or detail, ask follow-up questions to gather the necessary information before proceeding. Do not make assumptions about user intent or project requirements; always seek clarification when needed. -- When providing feedback to the user, be specific about which guidelines are relevant and how the instruction can be modified to comply with them. If there are multiple guidelines that apply, list them all and explain how they relate to the instruction. -- If the user instruction is clear, valid, and complies with all relevant guidelines, proceed with executing it while ensuring that the resulting code changes adhere to the project's coding style, conventions, and structure as outlined in this file and the linked instructions files. +1. Verify the user instruction against relevant guidelines in this file and linked instruction files before proceeding. +2. If the instruction conflicts with any guideline, do not proceed. Explain which guideline(s) it conflicts with and how to adjust the instruction to comply. +3. If the instruction is valid but unclear or incomplete, ask targeted follow-up questions before implementation. Do not assume user intent or requirements. +4. When giving feedback, name the applicable guideline(s) and explain how each one applies. +5. If the instruction is clear and compliant, proceed and keep resulting changes aligned with project coding style, conventions, and structure. ## Language Guidelines diff --git a/.github/instructions/core.instructions.md b/.github/instructions/core.instructions.md index 076bb5008..f0c9c7d9f 100644 --- a/.github/instructions/core.instructions.md +++ b/.github/instructions/core.instructions.md @@ -5,14 +5,14 @@ applyTo: "launch.py, webui.py, installer.py, modules/**/*.py, pipelines/**/*.py, --- # Core Runtime Guidelines -- Preserve startup ordering and import timing in `launch.py` and `webui.py`; avoid moving initialization steps unless required. -- Treat `modules/shared.py` as the source of truth for global runtime state (`shared.opts`, model references, backend/device flags). -- Prefer narrow changes with explicit side effects; avoid introducing new cross-module mutable globals. -- Keep platform paths neutral: do not assume CUDA-only behavior and preserve ROCm/IPEX/DirectML/OpenVINO compatibility branches. -- Keep extension and script loading resilient: when adding startup scans/hooks, preserve partial-failure tolerance and logging. -- Follow existing API/server patterns under `modules/api/` and reuse shared queue/state helpers rather than ad-hoc request handling. -- Reuse established model-loading and pipeline patterns (`modules/sd_*`, `pipelines/`) instead of creating parallel abstractions. -- For substantial Python changes, run at least relevant checks: `npm run ruff` and `npm run pylint` (or narrower equivalents when appropriate). +1. Preserve startup ordering and import timing in `launch.py` and `webui.py`; avoid moving initialization steps unless required to fix a critical startup bug or implement a new startup feature. +2. Treat `modules/shared.py` as the source of truth for global runtime state (`shared.opts`, model references, backend/device flags). +3. Prefer narrow changes (changes scoped to a single function or module when feasible) with explicit side effects; avoid introducing new cross-module mutable globals. +4. Keep platform paths neutral: do not assume CUDA-only behavior and preserve ROCm/IPEX/DirectML/OpenVINO compatibility branches. +5. Keep extension and script loading resilient: when adding startup scans/hooks, preserve partial-failure tolerance and logging. +6. Follow existing API/server patterns under `modules/api/` and reuse shared queue/state helpers rather than ad-hoc request handling. +7. Reuse established model-loading and pipeline patterns (`modules/sd_*`, `pipelines/`) instead of creating parallel abstractions. +8. For substantial Python changes, run at least relevant checks: `npm run ruff` and `npm run pylint` (or narrower equivalents when appropriate). ## Build And Test diff --git a/.github/instructions/hints.instructions.md b/.github/instructions/hints.instructions.md index 8243bdb53..aa7112709 100644 --- a/.github/instructions/hints.instructions.md +++ b/.github/instructions/hints.instructions.md @@ -1,5 +1,5 @@ --- -description: "Use when editing hint text or other UI strings in localization JSON files." +description: "Use when editing hint text or other UI strings in localization JSON files; follow the ordered rules below for consistent formatting." name: "Hint Typography Guidelines" applyTo: "html/locale_*.json, html/override_*.json" --- @@ -7,44 +7,44 @@ applyTo: "html/locale_*.json, html/override_*.json" Hint strings render as HTML. Use this small set of inline tags to keep hints scannable: -- `` for values: defaults, dropdown enums, specific numerics. Examples: `0.30`, `Karras`, `v_prediction`, `UniPC`. -- `...` for cross-references to other UI controls by their exact visible label. Examples: `Denoising strength`, `Use init image`, `Images tab. -- `` for proper nouns: model families, datasets, technique names. Examples: `SDXL`, `Flux`, `ControlNet`, `YOLO`. -- `` for literals: paths, filename tokens, command-line snippets to type or use verbatim. Examples: `models/yolo`, `-seg`, `[PROMPT]`. +1. `` for values: defaults, dropdown enums, specific numerics. Examples: `0.30`, `Karras`, `v_prediction`, `UniPC`. +2. `...` for cross-references to other UI controls by their exact visible label. Examples: `Denoising strength`, `Use init image`, `Images` tab. +3. `` for proper nouns: model families, datasets, technique names. Examples: `SDXL`, `Flux`, `ControlNet`, `YOLO`. +4. `` for literals: paths, filename tokens, command-line snippets to type or use verbatim. Examples: `models/yolo`, `-seg`, `[PROMPT]`. ## Cross-references -- Use `...` whenever a hint refers to another control by its exact visible label. This includes setting names, tab names, and named buttons. -- Match the label exactly, including capitalization and spacing; readers look for the same string in the UI. -- Do not use `` and `` separately for cross-references; always combine them. -- Generic concept references (`the model`, `the prompt`, `the scheduler`) stay unstyled. +1. Use `...` whenever a hint refers to another control by its exact visible label. This includes setting names, tab names, and named buttons. +2. Match the label exactly, including capitalization and spacing; readers look for the same string in the UI. +3. Do not use `` and `` separately for cross-references; always combine them. +4. Generic concept references (`the model`, `the prompt`, `the scheduler`) stay unstyled. ## Tab naming -- Refer to the unified generation tab as `Images` (the ModernUI label). Do not write "Control tab"; that label only exists in legacy Standard UI. -- "Control" remains valid as a setting value (`No: Control only`) or as part of a UI element name (`Control input` pane), just not as a tab name. +1. Refer to the unified generation tab as `Images` (the ModernUI label). Do not write "Control tab"; that label only exists in legacy Standard UI. +2. "Control" remains valid as a setting value (`No: Control only`) or as part of a UI element name (`Control input` pane), just not as a tab name. ## Structure -- `
` for a line break within a paragraph. -- `

` for a paragraph break. -- `
- key: description` for a keyed bullet list, used for short enumerations of dropdown values, modes, or numeric brackets. Each bullet's key is bolded; descriptions stay plain. -- Do not use `