saleor-core — скилл для Claude Code: что делает и как установить
Справочник по внутренним механикам Saleor: скидкам и расчёту остатков. Помогает настроить логику заказов и интерфейс Dashboard без багов.
npx skills add saleor/agent-skills --skill saleor-core -a claude-codeЧто делает saleor-core
Скилл содержит правила и ссылки на исходный код бэкенда Saleor. Он объясняет механику, которой нет в публичной документации API. Внутри разобраны иерархия скидок и два прохода распределения вычета по позициям заказа. Отдельно описано поведение подарочных строк OrderLine.isGift = true.
Второй блок посвящён доступности товаров в версиях от 3.23. Скилл описывает разницу между возможностью покупки и отправки, а также логику флага Shop.useLegacyShippingZoneStockAvailability. Тут же описаны вебхуки PRODUCT_VARIANT_*_IN_CHANNEL.
Без понимания двухпроходного расчёта разложить скидки заказа по позициям не выйдет: API отдаёт только общие суммы, скрывая детализацию отдельных записей по строкам. Правила скилла дают алгоритм восстановления этих данных и защищают от ошибок миграции.
Какие задачи решает
- разобраться в приоритетах и наложении скидок в Saleor
- восстановить распределение скидки заказа по отдельным строкам
- настроить вебхуки наличия вариантов товаров в каналах
- корректно обработать подарочные позиции
OrderLine.isGift
Примеры запросов агенту
- Объясни, почему промокод не применился вместе со скидкой на позицию заказа в Saleor
- Помоги рассчитать распределение общей скидки заказа по строкам с учётом округления
- Проверь, как режим useLegacyShippingZoneStockAvailability влияет на вебхук обновления остатков
Как установить saleor-core
1Через Skills CLI (Vercel)
npx skills add saleor/agent-skills --skill saleor-core -a claude-code2Вручную: положить файлы
~/.claude/skills/saleor-core/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/saleor-core/
1Через Skills CLI (Vercel)
npx skills add saleor/agent-skills --skill saleor-core -a codex2Вручную: положить файлы
.agents/skills/saleor-core/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add saleor/agent-skills --skill saleor-core -a cursor2Вручную: положить файлы
.cursor/skills/saleor-core/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install saleor/agent-skills saleor-core2Вручную: положить файлы
.github/skills/saleor-core/SKILL.md1Через Skills CLI (Vercel)
npx skills add saleor/agent-skills --skill saleor-core -a gemini-cli2Командой платформы
gemini skills install https://github.com/saleor/agent-skills --path skills/saleor-coreВручную: положить файлы
.devin/skills/saleor-core/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add saleor/agent-skills --skill saleor-core -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о saleor-core
Как установить saleor-core в Claude Code?
Выполните команду npx skills add saleor/agent-skills --skill saleor-core -a claude-code. Альтернативный вариант — скопировать файл навыка в ~/.claude/skills/saleor-core/SKILL.md.
Зачем нужен скилл saleor-core?
Он даёт агенту контекст внутренней архитектуры ядра Saleor: порядок применения скидок, нюансы API, логику остатков на складах и правила интерфейса Dashboard.
Почему API Saleor не показывает разбивку скидки заказа по позициям?
Бэкенд объединяет скидки в один subtotal_discount на первом проходе и делит его пропорционально между строками на втором. Наружу отдаются только итоговые суммы строк и общие скидки заказа, поэтому декомпозицию приходится восстанавливать по правилам ядра.
Исходный текст
SKILL.md · MIT
--- name: saleor-core description: > Saleor backend internals and behavior reference. Covers discount precedence, order-level discount allocation across lines (two-pass calculation, what the API does and doesn't expose, gift-line shape gotchas), stock availability modes (legacy vs direct, 3.23+), Dashboard UI rules, webhook trigger conditions, denormalized field semantics, and migration footguns. Use when working with Saleor discounts or stock availability, building Dashboard UI, building price-explanation tooling, or debugging backend behavior. license: MIT metadata: author: saleor version: "1.2.0" --- # Saleor Core Backend behavior reference derived from the Saleor core source code. Covers internal mechanics that aren't fully documented in the public API reference — discount precedence, stock availability modes, denormalized fields, and known Dashboard gotchas. ## When to Apply - Building or debugging discount/promotion UI in the Dashboard - Investigating why a voucher or promotion isn't applying - Understanding order-level vs line-level discount precedence - Working with `OrderDiscount` / `OrderLineDiscount` objects - Debugging `unit_discount_value` on `OrderLine` - Deciding whether discounts stack or suppress each other - Building price-explanation / waterfall tooling on confirmed orders - Reconstructing how an order-level discount distributed across lines - Handling free-gift order lines (`OrderLine.isGift = true`) - Working on stock availability, shipping zones, warehouses, or `Shop.useLegacyShippingZoneStockAvailability` - Debugging why `PRODUCT_VARIANT_*_IN_CHANNEL` webhooks aren't firing - Building diagnostic / "doctor" tooling that explains availability problems - Auditing Dashboard copy that uses "available" / "in stock" / "purchasable" ## Rule Categories | Priority | Category | Impact | Prefix | | -------- | ---------- | -------- | ------------ | | 1 | Discounts | CRITICAL | `discount-` | | 2 | Stock | CRITICAL | `stock-` | ## Quick Reference ### 1. Discounts (CRITICAL) - `discount-precedence` — Full precedence hierarchy, stacking rules, manual vs voucher vs promotion interactions, denormalized field semantics, known Dashboard bug - `order-discount-allocation` — Two-pass calculation of order-level discounts (Pass A collapses records into a single subtotal_discount; Pass B distributes proportionally across lines with last-line absorbing rounding), what the API exposes (per-line totals, per-record-at-order amounts) and what it doesn't (per-record-per-line decomposition), gift-line shape gotcha (`ORDER_PROMOTION` on `OrderLine.discounts[]` when `isGift = true`), reconstruction guidance for consumers ### 2. Stock (CRITICAL) - `stock-availability-modes` — `Shop.useLegacyShippingZoneStockAvailability` (3.23+), purchasability vs shippability, server queryset dispatch, mode-conditional webhooks, Dashboard UI / copy / severity rules, migration footguns, test fixtures ## How to Use Read individual rule files for detailed explanations and source-level evidence: ``` rules/discount-precedence.md rules/order-discount-allocation.md rules/stock-availability-modes.md ``` Each rule file contains: - Precedence hierarchy or computation rules - Source code references from `saleor/` with function names and file paths - Anti-patterns and known bugs
© saleor · MIT · saleor/agent-skills