shopify-admin-discount-hygiene-cleanup
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "shopify-admin-discount-hygiene-cleanup" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-b898717897727a762901c70cbd76000c89f6ba696785eef513ac41c9c5b5e7aa. Verify the upstream source and version against https://github.com/40RTY-ai/shopify-admin-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Find expired, zero-use, or duplicate discount codes and optionally disable or delete them.
Introduction source: third_party · 40RTY-ai · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Finds expired, zero-usage, or duplicate discount codes and optionally deactivates or deletes them.
- Inputs and outputs
- CSV file `discount_cleanup_<YYYY-MM-DD>.csv` with columns: `discount_id`, `title`, `status`, `created_at`, `ends_at`, `usage_count`, `usage_limit`, `flag_reason`, `action`
- Software, accounts and paid services
- Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_discounts,write_discounts` API scopes: `read_discounts`, `write_discounts`
- Testing
- Not tested
Browse files
Frontmatter
name: shopify-admin-discount-hygiene-cleanup
role: store-management
description: "Finds expired, zero-usage, or duplicate discount codes and optionally deactivates or deletes them."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
- discountNodes:query
- discountCodeDelete:mutation
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLIPurpose
Audits the discount catalog for expired codes, codes with zero redemptions, and duplicate code prefixes. Discount sprawl accumulates over months of campaigns and makes the admin difficult to navigate. Optionally deletes flagged codes. Replaces manual discount cleanup and builds on the discount-ab-analysis skill with a write step.
Prerequisites
- Authenticated Shopify CLI session:
shopify store auth --store <domain> --scopes read_discounts,write_discounts - API scopes:
read_discounts,write_discounts
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| store | string | yes | — | Store domain (e.g., mystore.myshopify.com) |
| flag_expired | bool | no | true | Flag/delete discounts past their end date |
| flag_zero_usage | bool | no | true | Flag/delete discounts with 0 redemptions older than N days |
| zero_usage_min_age_days | integer | no | 30 | Age threshold for zero-usage flags |
| dry_run | bool | no | true | Preview without executing mutations |
| format | string | no | human | Output format: human or json |
Safety
⚠️
discountCodeDeletepermanently removes discount codes. Deleted codes cannot be recovered. Customers who received a deleted code will find it invalid. Run withdry_run: trueto review the flagged list before committing. Always check that expired codes are not referenced in active email campaigns before deleting.
Workflow Steps
-
OPERATION:
discountNodes— query Inputs:first: 250, selectdiscount { ... on DiscountCodeBasic { codes, usageLimit, asyncUsageCount, endsAt, status } }, pagination cursor Expected output: All discount codes with usage and expiry data; paginate untilhasNextPage: false -
Flag discounts matching:
flag_expired(status = EXPIRED) and/orflag_zero_usage(asyncUsageCount == 0 AND created >zero_usage_min_age_daysago) -
OPERATION:
discountCodeDelete— mutation Inputs:id: <discount_node_id>Expected output:deletedCodeDiscountId,userErrors
GraphQL Operations
# discountNodes:query — validated against api_version 2025-01
query DiscountAudit($after: String) {
discountNodes(first: 250, after: $after) {
edges {
node {
id
discount {
... on DiscountCodeBasic {
title
status
createdAt
endsAt
asyncUsageCount
usageLimit
codes(first: 5) {
edges {
node {
id
code
}
}
}
}
... on DiscountCodeBxgy {
title
status
createdAt
endsAt
asyncUsageCount
usageLimit
}
... on DiscountCodeFreeShipping {
title
status
createdAt
endsAt
asyncUsageCount
usageLimit
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
# discountCodeDelete:mutation — validated against api_version 2025-01
mutation DiscountCodeDelete($id: ID!) {
discountCodeDelete(id: $id) {
deletedCodeDiscountId
userErrors {
field
message
}
}
}
Session Tracking
Claude MUST emit the following output at each stage. This is mandatory.
On start, emit:
╔══════════════════════════════════════════════╗
║ SKILL: Discount Hygiene Cleanup ║
║ Store: <store domain> ║
║ Started: <YYYY-MM-DD HH:MM UTC> ║
╚══════════════════════════════════════════════╝
After each step, emit:
[N/TOTAL] <QUERY|MUTATION> <OperationName>
→ Params: <brief summary of key inputs>
→ Result: <count or outcome>
If dry_run: true, prefix every mutation step with [DRY RUN] and do not execute it.
On completion, emit:
For format: human (default):
══════════════════════════════════════════════
OUTCOME SUMMARY
Discounts scanned: <n>
Expired: <n>
Zero usage (> <n> days): <n>
Total flagged: <n>
Deleted: <n>
Errors: <n>
Output: discount_cleanup_<date>.csv
══════════════════════════════════════════════
For format: json, emit:
{
"skill": "discount-hygiene-cleanup",
"store": "<domain>",
"started_at": "<ISO8601>",
"dry_run": true,
"outcome": {
"scanned": 0,
"flagged_expired": 0,
"flagged_zero_usage": 0,
"deleted": 0,
"errors": 0,
"output_file": "discount_cleanup_<date>.csv"
}
}
Output Format
CSV file discount_cleanup_<YYYY-MM-DD>.csv with columns:
discount_id, title, status, created_at, ends_at, usage_count, usage_limit, flag_reason, action
Error Handling
| Error | Cause | Recovery |
|---|---|---|
THROTTLED |
API rate limit exceeded | Wait 2 seconds, retry up to 3 times |
userErrors on delete |
Discount already deleted or active order using it | Log error, skip, continue |
| No discounts flagged | Clean discount catalog | Exit with ✅ no cleanup needed |
Best Practices
- Run quarterly — discount code sprawl accumulates quickly with seasonal campaigns.
- Check with your email marketing team before deleting zero-usage codes — they may be in a scheduled campaign that hasn't launched yet.
- Keep
flag_zero_usageage at 30+ days to avoid deleting codes from recently launched campaigns. - Automatic/percentage discounts (not code-based) are not cleaned up by this skill — those are managed separately.
Version history
-
v1.1.0
GitHub ↗
Original release notes
## 🤖 New category: Agentic Commerce Readiness The fix-it side of the [**agentiq.report**](https://agentiq.report) audit. The audit tells operators *where* AI shopping agents (ChatGPT, Gemini, Perplexity, agentic checkout) can't find, read, or recommend their store. This release adds **10 skills that remediate those findings** via the native Shopify Admin GraphQL toolkit — closing the loop: **audit finds the gap → run the matching skill → re-audit confirms.** Every skill declares the audit **signals** it fixes (`audit_signals` frontmatter), so a finding in the report maps directly to the skill that resolves it. ### Skills - **`agentic-readiness-audit`** — flagship, read-only store-side scorecard that routes each gap to its fix skill - **`agentic-product-jsonld-backfill`** — barcode/GTIN, vendor, product type for complete Product JSON-LD - **`agentic-image-alt-text`** — descriptive alt text on product media - **`agentic-description-enrichment`** — fact-rich descriptions for AI quoting - **`agentic-metafields-setup`** — define + populate agentic metafields for filtering - **`agentic-product-taxonomy`** — Shopify Standard Product Taxonomy categories - **`agentic-crawler-access`** — allow GPTBot/ClaudeBot/PerplexityBot… in `robots.txt.liquid` - **`agentic-llms-txt`** — publish a curated `/llms.txt` for AI assistants - **`agentic-organization-schema`** — Organization JSON-LD (sameAs, contactPoint) into the theme - **`agentic-policy-readability`** — machine-readable shipping/returns policies Plus a weekly **`agentic-readiness-monitor`** routine that re-audits and alerts on regressions. ### Stats **116 skills across 11 categories** (was 106/10), **21 routines** (was 20). All GraphQL validated against the live Admin 2025-01 schema; `pnpm validate:index` passes (116 skills, 64 operations). ### Notes Theme-editing and policy skills default to `dry_run`/`audit` mode, write inside managed `# BEGIN/END` blocks, and recommend duplicating the theme first.
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决 Shopify 商家折扣码积压的实际痛点
- 提供过期/零使用/重复折扣码的自动化审计与清理能力
- 属于明确场景的通用工具,受众广泛
Highlights
- description 清晰描述功能,边界清晰
- frontmatter 中 description 完整
- 覆盖核心场景
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档未明确说明典型使用场景(如季度清理、活动后清理等)
Recommendation: 建议补充 When to Use 章节,列举典型使用场景
-
文档较长 Reported severity: Minor
文档内容较长,部分细节可拆分到附录
Recommendation: 建议将部分细节(如 GraphQL 操作详情)拆分到附录,保持主文档简洁
Areas to improve
-
缺少端到端完整示例 Reported severity: Minor
文档缺少完整的端到端示例(如 CSV 输出样例、完整执行日志)
Recommendation: 建议补充端到端完整示例,包括 CSV 输出样例和完整执行日志
Highlights
- 工具来源明确(Shopify Admin API)
- 参数正确,覆盖主要异常
- 不可逆操作有确认机制(dry_run 模式、Safety 警告)
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_discounts,write_discounts` API scopes: `read_discounts`, `write_discounts`
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.