Skill

Validation

Sync local issue files to GitHub Issues. Use when user asks "sync issues to github" or "push issues to github"

From cc-auto-workflow
Install
1
Run in your terminal
$
npx claudepluginhub nxhung2304/cc-auto-workflow-plugin
Tool Access

This skill is limited to using the following tools:

Bash(gh issue *)Bash(gh issue list)Bash(gh repo view *)Bash(gh label create)Bash(gh auth status)ReadEditGrepWritemcp__github__*mcp__github__create_issuemcp__github__list_issuesBash(gh label create *)
Skill Content

Validation

Before syncing, validate:

  1. specs/issues/ folder exists — Generated issue files
  2. ✅ At least one issue file with Status: approved exists
  3. ✅ GitHub authentication is configured
  4. ✅ Repository exists on GitHub

If validation fails:

❌ Validation failed!
   Issues:
   - No approved issues found in specs/issues/
   - specs/issues/ folder doesn't exist
   - GitHub not authenticated

   Solution:
   1. Run /generate-issues first to create issue files
   2. Review issues and set Status: Approved
   3. Run: gh auth login
   4. Then retry /sync-github-issues

Mục đích

Đọc các file trong specs/issues/, tạo GitHub Issues tương ứng, sau đó cập nhật GitHub Issue number vào từng file.


Điều kiện tiên quyết

  • GitHub MCP → for structured operations (create issue, list issues, create PR)
  • GitHub CLI → for things MCP can't do (labels, advanced queries)

1. Kiểm tra GitHub CLI đã auth chưa

  1. Call mcp__github__list_issues with limit 1
    • If succeeds → MCP auth is OK
    • If fails → tell user to set GITHUB_PERSONAL_ACCESS_TOKEN
  2. If skill needs labels: run gh auth status
    • If fails → tell user to run gh auth login
    • If succeeds → proceed

Các bước thực hiện

1. Tìm các file cần sync

Scan toàn bộ specs/issues/*.md, chỉ xử lý file thỏa mãn CẢ HAI điều kiện:

  • Có: Status: approved
  • Có: GitHub Issue: (to be filled after sync)

→ Bỏ qua: status pending, draft, hoặc đã có issue number

2. Với mỗi file → tạo GitHub Issue

Parse từ file:

  • Title## Metadata > Title
  • Phase## Metadata > Phase → dùng làm label
  • Body → giữ nguyên toàn bộ nội dung file markdown
gh issue create \
  --title "[title]" \
  --body "[nội dung file .md]" \
  --label "phase-[N]"

Nếu label chưa tồn tại → tạo trước:

gh label create "phase-1" --color "#0075ca"
gh label create "phase-2" --color "#e4e669"
gh label create "phase-3" --color "#d93f0b"
gh label create "phase-4" --color "#0e8a16"
gh label create "phase-5" --color "#5319e7"
gh label create "phase-6" --color "#f9d0c4"
gh label create "phase-7" --color "#c2e0c6"
gh label create "phase-8" --color "#bfd4f2"
gh label create "phase-9" --color "#fef2c0"

3. Lấy issue number từ output

gh issue create trả về URL dạng:

https://github.com/[owner]/[repo]/issues/42

→ Parse số cuối URL → issue number

4. Cập nhật file .md

Replace dòng:

**GitHub Issue:** (to be filled after sync)

Thành:

**GitHub Issue:** #42

5. In summary sau khi xong

✅ Đã sync [X] issues lên GitHub:

  #42 — Project Setup
  #43 — Login UI
  #44 — Home Shell
  ...

→ Xem tại: https://github.com/[owner]/[repo]/issues

Quy tắc quan trọng

  • KHÔNG sync file đã có GitHub Issue number — tránh tạo duplicate
  • KHÔNG xóa hoặc đóng GitHub Issue đã tồn tại
  • Nếu gh issue create lỗi 1 file → log lỗi, tiếp tục xử lý file tiếp theo, không dừng toàn bộ
  • Mỗi file tạo xong → cập nhật ngay, không đợi hết batch

Xử lý lỗi

LỗiXử lý
gh chưa authDừng, hướng dẫn gh auth login
Label tạo bị conflictBỏ qua, dùng label đã có
issue create thất bạiLog lỗi + skip file đó
File .md không parse được titleSkip + cảnh báo tên file
Stats
Stars0
Forks0
Last CommitMar 8, 2026