Command Palette

Search for a command to run...

Back to skills
skill № 40069

sparkx-delete-ai-group

Delete (archive) an AI managed group (托管组) itself - SD, SP, or SB - releasing its campaigns or migrating them to another group. Use when the user wants to…

FreeNo executable scripts
infometaby infometa★ 475 GitHub stars

Install sparkx-delete-ai-group in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Delete AI Managed Group

Delete (archive) a managed group via delete_ai_managed_group. This is destructive and cannot be undone (destructiveHint=true) - treat it with more care than any read or edit. Read references/platform-notes.md once first (auth, response envelope, generic errors, the separate delete scope).

Scope: amazon_sa_managed_group_delete:write - separate from the create/edit scope (amazon_sa_managed_group:write). A token that can create and edit groups may still be unable to delete one; if the call fails on permissions, name this scope to the user rather than retrying.

Routing is fail-fast. The tool reads the group's campaignType to pick its delete path (SP/SB and SD go to different backends). If that type can't be determined or isn't one of sponsoredProducts / sponsoredBrands / sponsoredDisplay, the call is rejected with a fail-fast error and nothing is archived. Treat that error as "the group couldn't be identified", not as "the group was partially deleted": re-read the group with get_entity_metadata(entity='aiGroup') and confirm its state before doing anything else.

What "delete" does - and the campaign disposal choice

Deleting archives the group. Its campaigns don't vanish - you must say what happens to them via type:

type Behavior When
1 (release) Unbind all campaigns from the group, then archive it The campaigns should go back to being unmanaged
2 (migrate) Move campaigns to targetAiGroupId, then archive this group The campaigns should keep being AI-managed under a different group

type=2 requires targetAiGroupId (an existing group). Always confirm the disposal with the user - "release" and "migrate" have very different consequences for their live campaigns.

Parameters

Field Type Required Notes
profileId long Yes Shop ID from get_user_authorized_context
aiGroupId long Yes The group to delete
type int Yes 1=release (unbind), 2=migrate to target
targetAiGroupId long type=2 only, required Destination group for migration; must exist

Delete is one group per call - there is no ids / batch parameter (confirmed against the current tool schema, incl. the forward-looking version). aiGroupId is a single id. To wind down several groups, loop over single deletes serially - see Deleting more than one group. Never assume a batch delete exists or construct an ids array.

type has no safe default. type=2 without targetAiGroupId is rejected by the backend - do not silently fall back to type=1 (release) and do not guess a migration target. If the user hasn't said release-vs-migrate, ask.

Workflow

  1. Resolve the group to an ID. Users refer to groups by name - look it up with get_entity_metadata(profileIds=[...], entity='aiGroup', filters={"aiGroupName": {"like": "%<name>%"}}, userContext='...') (every get_entity_metadata call requires profileIds, entity, userContext). The aiGroupName filter is a substring like - exact-match the name in the returned rows. Get its aiGroupId, and read aiStatus, numCampaign, campaignType for the checks below. If more than one group matches, list the candidates and let the user pick - never guess which one to delete.
    • Also capture the group's full campaign list. Query entity='campaign' filtered by this aiGroupId (server-side filterable for campaigns), fully paginate, and save the campaign IDs - you need the actual IDs (not just numCampaign) to verify the disposal after deleting.
  2. Pre-flight checks:
    • AI must not be running. A running group can't be deleted. aiStatus: 1=running, 2=turned off, 0=never enabled - only 1 blocks deletion. If it's running, see "When AI is on" below.
    • type=2 (migrate) - validate the target, not just its existence:
      • targetAiGroupId exists (another full-signature entity='aiGroup' lookup);
      • it belongs to the same profileId;
      • it is not the source group itself;
      • its campaignType is compatible with the campaigns being moved. If target capacity or another acceptance rule is not exposed by the read tool, do not claim it was pre-validated; let the backend gate it and verify every campaign after the call. Also make the user aware the migrated campaigns will adopt the target group's optimization config, not keep the source group's.
  3. Confirm before deleting. Echo back exactly what will happen - the group's name and id, and the disposal ("release N campaigns" or "migrate N campaigns to group X"). By default, get an explicit yes; this is irreversible, and a vague "yes go ahead" earlier in the conversation is not enough. If a valid waive
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • references/enum-i18n.md
  • references/platform-notes.md

FAQ

What does the sparkx-delete-ai-group skill do?

Delete (archive) an AI managed group (托管组) itself - SD, SP, or SB - releasing its campaigns or migrating them to another group. Use when the user wants to delete / 删除 / 归档 a managed group (the group container) or wind one down. Destructive and irreversible. This archives the GROUP - it is NOT for removing a single campaign from a group (use sparkx-edit-ai-group), editing config (use sparkx-edit-ai-group), or creating a group (use sparkx-create-ai-group).

How do I install the sparkx-delete-ai-group skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the sparkx-delete-ai-group skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare sparkx-delete-ai-group with