# Shopify Admin Url Redirect Audit

> Read-only: lists all URL redirects, flags redirect chains (A→B→C) and duplicate targets.

- **Type:** Skill
- **Install:** `agentstack add skill-40rty-ai-shopify-admin-skills-shopify-admin-url-redirect-audit`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [40RTY-ai](https://agentstack.voostack.com/s/40rty-ai)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [40RTY-ai](https://github.com/40RTY-ai)
- **Source:** https://github.com/40RTY-ai/shopify-admin-skills/tree/main/skills/store-management/shopify-admin-url-redirect-audit
- **Website:** http://skills.40rty.ai

## Install

```sh
agentstack add skill-40rty-ai-shopify-admin-skills-shopify-admin-url-redirect-audit
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## Purpose
Queries all URL redirects in the store and identifies redirect chains (where redirect target A is itself redirected to B), duplicate targets (multiple paths pointing to the same destination), and orphaned redirects (pointing to non-existent pages). Redirect chains add latency and hurt SEO. Read-only — no mutations.

## Prerequisites
- Authenticated Shopify CLI session: `shopify store auth --store  --scopes read_content`
- API scopes: `read_content`

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| store | string | yes | — | Store domain (e.g., mystore.myshopify.com) |
| format | string | no | human | Output format: `human` or `json` |

## Safety

> ℹ️ Read-only skill — no mutations are executed. Safe to run at any time.

## Workflow Steps

1. **OPERATION:** `urlRedirects` — query
   **Inputs:** `first: 250`, pagination cursor
   **Expected output:** All redirects with `fromPath`, `target`; paginate until `hasNextPage: false`

2. Build path map: `fromPath → target`

3. Detect chains: for each redirect, check if `target` appears as a `fromPath` in any other redirect

4. Detect duplicates: targets with more than one source path

## GraphQL Operations

```graphql
# urlRedirects:query — validated against api_version 2025-01
query URLRedirects($after: String) {
  urlRedirects(first: 250, after: $after) {
    edges {
      node {
        id
        path
        target
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
```

## Session Tracking

**Claude MUST emit the following output at each stage. This is mandatory.**

**On start**, emit:
```
╔══════════════════════════════════════════════╗
║  SKILL: URL Redirect Audit                   ║
║  Store:                        ║
║  Started:              ║
╚══════════════════════════════════════════════╝
```

**After each step**, emit:
```
[N/TOTAL]   
          → Params: 
          → Result: 
```

**On completion**, emit:

For `format: human` (default):
```
══════════════════════════════════════════════
URL REDIRECT AUDIT
  Total redirects:    
  Redirect chains:    
  Duplicate targets:  

  Chains:
    /old-page → /intermediate → /final
  Duplicates:
    /path-a → /product/x
    /path-b → /product/x  (same target)
  Output: redirect_audit_.csv
══════════════════════════════════════════════
```

For `format: json`, emit:
```json
{
  "skill": "url-redirect-audit",
  "store": "",
  "total_redirects": 0,
  "chains": 0,
  "duplicate_targets": 0,
  "output_file": "redirect_audit_.csv"
}
```

## Output Format
CSV file `redirect_audit_.csv` with columns:
`redirect_id`, `from_path`, `target`, `issue_type`, `chain_path`

## Error Handling
| Error | Cause | Recovery |
|-------|-------|----------|
| `THROTTLED` | API rate limit exceeded | Wait 2 seconds, retry up to 3 times |
| No redirects | New store or clean setup | Exit with ✅ no redirects found |

## Best Practices
- Redirect chains (A→B→C) add an extra HTTP round-trip — consolidate them to a direct redirect (A→C).
- After fixing chains or removing duplicates, use Shopify Admin → Navigation → URL Redirects to make the corrections. Bulk deletion is not available in the Admin API but individual redirects can be deleted via `urlRedirectDelete` mutation.
- Run after every major store migration or product/collection restructuring where URLs change in bulk.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [40RTY-ai](https://github.com/40RTY-ai)
- **Source:** [40RTY-ai/shopify-admin-skills](https://github.com/40RTY-ai/shopify-admin-skills)
- **License:** MIT
- **Homepage:** http://skills.40rty.ai

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-40rty-ai-shopify-admin-skills-shopify-admin-url-redirect-audit
- Seller: https://agentstack.voostack.com/s/40rty-ai
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
