linear-delete-issue
Soft-delete one Linear issue through the direct Linear GraphQL API after read-before-delete and explicit guard checks. Use only as a narrow fallback when the normal Linear connector cannot delete an i
SKILL.mdlinear-delete-issue/SKILL.md
GitHubLinear Delete Issue
Use this skill when the normal Linear connector cannot delete one issue and a narrow, audited GraphQL fallback is needed.
Prefer the official Linear connector for normal issue deletion. This skill is a fallback soft-delete helper, not a general Linear client.
Preconditions
LINEAR_API_KEYis available in the shell,LINEAR_ENV_FILE,--env-file, or a local.env.local.- The key belongs to a Linear user with permission to delete the target issue.
- Network access to
https://api.linear.app/graphqlis allowed. - The target issue was backed up or otherwise verified according to the caller's own project rules.
Non-Negotiable Rules
- Use
scripts/delete_issue.py. - Never print the API key.
- Do not store the API key in the skill directory.
- Delete exactly one issue per invocation.
- Only soft-delete through Linear's normal issue trash flow.
- Do not permanently delete issues.
- Read and verify the target issue before sending the mutation.
- Use
--dry-runfirst for every issue unless the caller has already produced an equivalent checked dry-run. - For live deletion, pass
--confirm <ISSUE-KEY>; the value must match the resolved issue identifier. - Prefer a stable issue key such as
LIN-123when available. A URL or UUID that points to a comment, project, relation, or another workspace is not a valid delete target. - Use guard options such as
--expect-status,--forbid-label,--require-no-children,--require-no-relations, and--require-no-commentswhen the caller has deletion rules. --require-no-relationscovers both directions: outgoingrelationsand incominginverseRelations. An issue that other issues point at is blocked even when it declares no relations of its own. The guard check reportsoutgoing_visible_countandincoming_visible_countseparately.
Codex Permission Rule
When Codex sandboxing asks for approval because the script needs network access, request a persistent command prefix:
sandbox_permissions:require_escalatedprefix_rule:["python3", "linear-delete-issue/scripts/delete_issue.py"]
Keep the command prefix stable by running from the linear-skills repository root. Pass the API key only through the environment or --env-file; never pass the key as a command argument.
Recommended Commands
python3 scripts/delete_issue.py LIN-123 --env-file /path/to/.env.local --dry-run --json
python3 scripts/delete_issue.py LIN-123 --env-file /path/to/.env.local --expect-status Done --forbid-label Idea --require-no-children --require-no-relations --require-no-comments --confirm LIN-123 --json
Output Shape
- Text output: target issue, action, status, labels, and verification status.
--jsonoutput: structured fields forbefore,guard_checks,deleted,verified,action,verification_status, anderror_category.- Failure categories are
missing_api_key,not_found,validation,permission_denied, andnetwork. - Issue lookup failures use
error_category=not_foundanderror_code=issue_not_found, with safelookup,input_kind, andhintfields. No delete mutation is sent in this case.