Add sub issue

From qauth-labs/qauth · View interactive version

Add sub issue is an AI agent skill from the GitHub repository qauth-labs/qauth. Link GitHub issues in parent-child (sub-issue) relationships using GraphQL

How to use this skill

Skill file

Add Sub-Issue (Parent/Child Relationship)

Create parent-child relationships between GitHub issues.

Your Task

Link issues in a hierarchical structure using GitHub's sub-issues feature.

Prerequisites

Sub-issues require the GraphQL API with a feature flag.

Get Issue IDs

First, get the internal IDs for both issues:

# Get parent issue ID
PARENT_ID=$(gh issue view {parent_number} --json id --jq ".id")
echo "Parent ID: $PARENT_ID"

# Get child issue ID
CHILD_ID=$(gh issue view {child_number} --json id --jq ".id")
echo "Child ID: $CHILD_ID"

Add Sub-Issue

gh api graphql \
  -H "GraphQL-Features: sub_issues" \
  -f query='
    mutation($parentId: ID!, $childId: ID!) {
      addSubIssue(input: { issueId: $parentId, subIssueId: $childId }) {
        issue { title number }
        subIssue { title number }
      }
    }
  ' \
  -f parentId="$PARENT_ID" \
  -f childId="$CHILD_ID"

Remove Sub-Issue

gh api graphql \
  -H "GraphQL-Features: sub_issues" \
  -f query='
    mutation($parentId: ID!, $childId: ID!) {
      removeSubIssue(input: { issueId: $parentId, subIssueId: $childId }) {
        issue { title }
        subIssue { title }
      }
    }
  ' \
  -f parentId="$PARENT_ID" \
  -f childId="$CHILD_ID"

List Sub-Issues of a Parent

PARENT_ID=$(gh issue view {parent_number} --json id --jq ".id")

gh api graphql \
  -H "GraphQL-Features: sub_issues" \
  -f query='
    query($id: ID!) {
      node(id: $id) {
        ... on Issue {
          title
          number
          subIssues(first: 50) {
            nodes {
              number
              title
              state
            }
          }
        }
      }
    }
  ' \
  -f id="$PARENT_ID"

Workflow: Create Epic with Sub-Issues

  1. Create the parent (epic) issue and the child issues with the create-issue

skill (which follows github-conventions for titles/labels/milestones).

  1. Fetch each issue's internal ID and link children to the parent with the

addSubIssue mutation above.

Limits

Instructions

  1. Get the parent and child issue numbers from the user
  2. Fetch the internal IDs for both issues
  3. Execute the GraphQL mutation to link them
  4. Confirm the relationship was created
  5. Optionally list all sub-issues to verify
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.