Get the FREE Ultimate OpenClaw Setup Guide →

Gh Api Scripts

npx machina-cli add skill rjroy/vibe-garden/gh-api-scripts --openclaw
Files (1)
SKILL.md
8.4 KB

GitHub API Scripts Skill

Overview

This skill provides Python scripts for reliable GitHub Project API operations. It replaces embedded GraphQL guidance in command markdown files with tested, reusable abstractions.

Configuration

Operations require a configuration file at .compass-rose/config.json:

{
  "project": {
    "owner": "<org-or-username>",
    "owner_type": "user",
    "number": <project-number>
  }
}

Required Fields

FieldTypeDescription
ownerstringGitHub username or organization name
owner_typestringEither "user" or "organization"
numberintegerProject number (from project URL)

Owner Type

  • Use "user" for personal projects: github.com/users/<name>/projects/<n>
  • Use "organization" for org projects: github.com/orgs/<name>/projects/<n>

Operations

list-issues

List all open issues in the configured project with automatic pagination.

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh list-issues

Example Output:

{
  "success": true,
  "data": {
    "issues": [
      {
        "number": 42,
        "title": "Fix login timeout",
        "body": "Users experiencing timeouts after 30 seconds...",
        "url": "https://github.com/my-org/my-repo/issues/42",
        "state": "OPEN",
        "labels": ["bug", "priority-high"],
        "status": "Ready",
        "priority": "P0",
        "size": "S"
      },
      {
        "number": 58,
        "title": "Add user preferences panel",
        "body": "Feature request for user settings...",
        "url": "https://github.com/my-org/my-repo/issues/58",
        "state": "OPEN",
        "labels": ["feature"],
        "status": "To Do",
        "priority": "P1",
        "size": "M"
      }
    ],
    "count": 2
  }
}

Notes:

  • Automatically paginates through projects with >100 items
  • Only returns issues in OPEN state
  • Field values (status, priority, size) are extracted from project custom fields

get-issue

Get a single issue by number with full project field values.

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh get-issue <number>

Example:

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh get-issue 42

Example Output:

{
  "success": true,
  "data": {
    "issue": {
      "number": 42,
      "title": "Fix login timeout",
      "body": "Users experiencing timeouts after 30 seconds...",
      "url": "https://github.com/my-org/my-repo/issues/42",
      "state": "OPEN",
      "labels": ["bug", "priority-high"],
      "status": "Ready",
      "priority": "P0",
      "size": "S"
    }
  }
}

Error Cases:

  • ISSUE_NOT_FOUND - Issue number doesn't exist in the repository
  • ISSUE_NOT_IN_PROJECT - Issue exists but isn't linked to the configured project

set-status

Update the Status field of an issue in the project.

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh set-status <number> "<status>"

Example:

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh set-status 42 "In progress"

Example Output:

{
  "success": true,
  "data": {
    "issue_number": 42,
    "previous_status": "Ready",
    "new_status": "In progress"
  }
}

Notes:

  • Status value must match one of the project's configured status options (case-sensitive)
  • Common status values: "Ready", "In progress", "Done", "To Do"

Error Cases:

  • STATUS_INVALID - Provided status value doesn't match project options
  • FIELD_NOT_FOUND - Project doesn't have a Status field configured

add-to-project

Add an existing repository issue to the configured project.

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh add-to-project <number>

Example:

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh add-to-project 156

Example Output:

{
  "success": true,
  "data": {
    "issue_number": 156,
    "item_id": "PVTI_lADOBQ..."
  }
}

Notes:

  • Issue must exist in the repository before adding to project
  • The returned item_id can be used for subsequent field updates

Error Cases:

  • ISSUE_NOT_FOUND - Issue number doesn't exist in the repository

set-priority

Update the Priority field of an issue in the project.

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh set-priority <number> "<priority>"

Example:

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh set-priority 42 "P1"

Example Output:

{
  "success": true,
  "data": {
    "number": 42,
    "previous_priority": null,
    "new_priority": "P1"
  }
}

Notes:

  • Priority value must match one of the project's configured priority options (case-sensitive)
  • Common priority values: "P0", "P1", "P2", "P3"

Error Cases:

  • STATUS_INVALID - Provided priority value doesn't match project options
  • FIELD_NOT_FOUND - Project doesn't have a Priority field configured
  • ISSUE_NOT_IN_PROJECT - Issue is not linked to the configured project

set-size

Update the Size field of an issue in the project.

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh set-size <number> "<size>"

Example:

${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh set-size 42 "M"

Example Output:

{
  "success": true,
  "data": {
    "number": 42,
    "previous_size": null,
    "new_size": "M"
  }
}

Notes:

  • Size value must match one of the project's configured size options (case-sensitive)
  • Common size values: "S", "M", "L", "XL"

Error Cases:

  • STATUS_INVALID - Provided size value doesn't match project options
  • FIELD_NOT_FOUND - Project doesn't have a Size field configured
  • ISSUE_NOT_IN_PROJECT - Issue is not linked to the configured project

Output Format

All operations return JSON with a consistent envelope:

Success:

{
  "success": true,
  "data": { ... }
}

Error:

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable message",
    "details": "Actionable remediation guidance"
  }
}

Error Codes

CodeWhenRemediation
CONFIG_MISSINGConfig file not foundCreate .compass-rose/config.json
CONFIG_INVALIDRequired fields missing or invalidCheck owner, owner_type, number fields
AUTH_REQUIREDgh CLI not authenticatedRun gh auth login
AUTH_SCOPE_MISSINGproject scope not authorizedRun gh auth refresh -s project
ISSUE_NOT_FOUNDIssue number doesn't existVerify issue number
ISSUE_NOT_IN_PROJECTIssue not linked to projectAdd issue to project first
STATUS_INVALIDStatus value not validCheck project's status options
FIELD_NOT_FOUNDStatus field not in projectAdd Status field to project
RATE_LIMITEDAPI rate limit exceededWait and retry
API_ERROROther API errorsCheck error details

Requirements

  • Python 3.12+ (stdlib only, no pip dependencies)
  • gh CLI installed and authenticated
  • project scope authorized (gh auth refresh -s project)

Usage in Commands

This skill is used by Compass Rose commands to interact with GitHub Projects:

CommandOperations Used
/backloglist-issues
/next-itemlist-issues
/start-workget-issue, set-status
/add-itemadd-to-project, set-status, set-priority, set-size
/reprioritizelist-issues, set-priority, set-status

Common Patterns

Check for errors before processing:

RESPONSE=$(${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh list-issues)

if echo "$RESPONSE" | jq -e '.success == false' > /dev/null; then
  echo "$RESPONSE" | jq -r '.error.details'
  exit 1
fi

# Process successful response
echo "$RESPONSE" | jq '.data.issues'

Filter by status:

# Get only "Ready" items
echo "$RESPONSE" | jq '[.data.issues[] | select(.status == "Ready")]'

Sort by priority:

# Sort by priority (P0 first)
echo "$RESPONSE" | jq '.data.issues | sort_by(.priority)'

Related Documentation

  • Spec: .sdd/specs/2025-12-24-compass-rose-gh-api-scripts.md
  • Plan: .sdd/plans/2025-12-24-compass-rose-gh-api-scripts-plan.md
  • Tasks: .sdd/tasks/2025-12-25-compass-rose-gh-api-scripts-tasks.md

Source

git clone https://github.com/rjroy/vibe-garden/blob/main/compass-rose/skills/gh-api-scripts/SKILL.mdView on GitHub

Overview

This skill provides Python scripts for reliable GitHub Project API operations. It replaces embedded GraphQL guidance in command markdown files with tested, reusable abstractions.

How This Skill Works

The tooling reads a single configuration file at .compass-rose/config.json containing project owner, owner_type, and number. It exposes commands like list-issues, get-issue, set-status, and add-to-project, which call the GitHub API and return structured results. It handles pagination automatically and derives fields such as status, priority, and size from project custom fields.

When to Use It

  • List all open issues in the configured project with automatic pagination.
  • Fetch a single issue by number with its complete project field values.
  • Update an issue's Status field to reflect progress in the project.
  • Add an existing repository issue to the configured project.
  • Validate configuration and operate safely when issues are missing or not linked to the project.

Quick Start

  1. Step 1: Create .compass-rose/config.json with fields: owner, owner_type ('user' or 'organization'), and number.
  2. Step 2: Run a command, e.g. ${CLAUDE_PLUGIN_ROOT}/skills/gh-api-scripts/scripts/gh_project.sh list-issues.
  3. Step 3: Use get-issue, set-status, or add-to-project to manage and verify issues.

Best Practices

  • Store project ownership and number in .compass-rose/config.json using owner, owner_type, and number.
  • Ensure Status values match the project's configured options exactly (case-sensitive).
  • Rely on the list-issues operation for projects with more than 100 items to appreciate automatic pagination.
  • Use get-issue before set-status to confirm the issue exists and its field values load correctly.
  • Test changes in a staging/projectless environment before applying to production projects.

Example Use Cases

  • List open issues in owner 'my-org' project number 123 and verify pagination.
  • Get issue #42 to retrieve its title, body, URL, and project field values.
  • Set issue #42 status from 'Ready' to 'In progress'.
  • Add issue #156 to the configured project from another repository.
  • Handle ISSUE_NOT_FOUND when attempting to fetch a non-existent issue.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers