ask-github 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81872d8db5d4f3e8a63eed5fb7bb856daa386f447f522331d8c30b97400ad0a5
4
- data.tar.gz: d86d708a8e4fbaac994a2cedaab52458434fae36b08f9c7cae98d8b70b9ae079
3
+ metadata.gz: 61e0c09960d2b923d6209cc171870ccc4517b594fb4764ae7c5ffb611fe09e78
4
+ data.tar.gz: 456ca8833ac0e354809e09d2cf1b84ea7b1354a26589aa74533981ebe63b5c4b
5
5
  SHA512:
6
- metadata.gz: 925160b0799b93e9c2665429c319594913a9346ab461ca9d14ba90809a7e264715c729f5513365681845f48f247ab468f6a91169361089f6346e52c910cf58e1
7
- data.tar.gz: 0f44993f6e054c65512ddbed2a2ea0b2cef9e0436093e9edf0d224b55fbe94872964606ab0099eb0476036eb3adaa6a747e873f9cb2e3736d413f4eac2881c68
6
+ metadata.gz: db1fd215ba903feca7ba4c09fded2c10d7c306b54906224ee3a373f3ef3f0f85708535845d0a7abd46ed09aef82f9c4dfb1943f2b116682a1c085b056ef3dc49
7
+ data.tar.gz: 591f2708a9538d55114a9c6add830b7409f030ab8313dd1a36c68b1cae38900e50c4dd7285a3e84725ccf8c33a38c348f90ed0ec73400bd470f3cc71c607c76f
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module GitHub
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: github.issue_triage
3
+ description: Systematic approach for triaging GitHub issues — reproduce, classify, check duplicates, label, prioritize
4
+ ---
5
+
6
+ Use this skill when asked to handle a new GitHub issue, classify bug reports,
7
+ or organize a queue of unprocessed issues.
8
+
9
+ ## Step 1: Reproduce the Issue
10
+
11
+ If the issue describes a bug, the first step is reproduction:
12
+
13
+ ```ruby
14
+ client = Ask::GitHub.client
15
+ issue = client.issue("owner/repo", ISSUE_NUMBER)
16
+ puts issue.title
17
+ puts issue.body
18
+ ```
19
+
20
+ Extract from the issue body:
21
+ 1. **Steps to reproduce** — are they complete and accurate?
22
+ 2. **Expected behavior** — what should happen
23
+ 3. **Actual behavior** — what happens instead
24
+ 4. **Environment** — OS, version, browser, dependencies
25
+ 5. **Error messages** — exact text, stack traces, screenshots
26
+
27
+ If steps are missing, ask for them. Never triage a bug that can't be reproduced.
28
+
29
+ ## Step 2: Classify the Issue
30
+
31
+ Determine what type of issue it is:
32
+
33
+ **Bug** — Unexpected behavior, crash, error
34
+ - Severity: Critical (production outage) / Major (broken feature) / Minor (cosmetic)
35
+
36
+ **Feature Request** — New capability or enhancement
37
+ - Scope: Small (add param) / Medium (new endpoint) / Large (new subsystem)
38
+
39
+ **Question** — How-to, clarification,usage help
40
+ - Answerable from docs? Redirect to docs first.
41
+
42
+ **Task** — Chore, tech debt, CI fix, dependency update
43
+ - Effort: Small / Medium / Large
44
+
45
+ ## Step 3: Check for Duplicates
46
+
47
+ Search for similar existing issues:
48
+
49
+ ```ruby
50
+ # Search for keywords from the issue title
51
+ similar = client.search_issues("keyword repo:owner/repo is:issue")
52
+ similar.items.each { |i| puts "##{i.number}: #{i.title} (#{i.state})" }
53
+ ```
54
+
55
+ Check both open AND closed issues — a previously closed issue might have been
56
+ reopened in a new form.
57
+
58
+ Mark as duplicate if:
59
+ - Same root cause (different symptom? still a duplicate)
60
+ - Same feature request (even different proposed API shape)
61
+ - References the same error message or stack trace
62
+
63
+ If duplicate found, add a comment:
64
+ ```ruby
65
+ client.add_comment("owner/repo", ISSUE_NUMBER, "Duplicate of #123. Closing.")
66
+ client.update_issue("owner/repo", ISSUE_NUMBER, state: "closed")
67
+ ```
68
+
69
+ ## Step 4: Add Labels
70
+
71
+ Apply appropriate labels based on classification:
72
+
73
+ ```ruby
74
+ labels = []
75
+ labels << "bug" if bug
76
+ labels << "enhancement" if feature
77
+ labels << "question" if question
78
+ labels << priority_label(severity) # "critical", "high", "medium", "low"
79
+ labels << "needs-reproduction" if steps_to_repro_missing
80
+ labels << "good-first-issue" if simple and well-scoped
81
+
82
+ client.add_labels_to_an_issue("owner/repo", ISSUE_NUMBER, labels)
83
+ ```
84
+
85
+ If the issue needs more information to be actionable:
86
+ ```ruby
87
+ labels << "needs-info"
88
+ client.update_issue("owner/repo", ISSUE_NUMBER, labels: labels)
89
+ ```
90
+
91
+ ## Step 5: Prioritize
92
+
93
+ Priority matrix based on:
94
+
95
+ ```
96
+ | Critical | Major | Minor
97
+ User Impact | High | High | Low
98
+ Workaround | None | Some | Has
99
+ Frequency | Always | Often | Rare
100
+ Scope | All | Some | Edge
101
+ ```
102
+
103
+ **Critical** — Fix immediately, patch release: P0
104
+ - Production outage, data loss, security vulnerability
105
+
106
+ **High** — Fix this sprint: P1
107
+ - Feature broken for most users, no workaround
108
+
109
+ **Medium** — Schedule next sprint: P2
110
+ - Feature broken for some users, has workaround
111
+
112
+ **Low** — Backlog, community PR welcome: P3
113
+ - Enhancement, nice-to-have, rare edge case
114
+
115
+ ## Step 6: Add Context
116
+
117
+ If the issue references code, trace through the codebase to add helpful context:
118
+
119
+ ```ruby
120
+ # Search for related code
121
+ search_paths = ["app/", "lib/"] # adjust for repo structure
122
+ Glob.new.call(pattern: "app/**/*.rb") # check the repo structure
123
+ ```
124
+
125
+ Add a triage comment summarizing:
126
+ 1. Brief reproduction status
127
+ 2. Classification
128
+ 3. Priority with reasoning
129
+ 4. Suggested approach (if bug: fix direction; if feature: implementation sketch)
130
+ 5. @mention relevant maintainer if needed
131
+
132
+ ```ruby
133
+ client.add_comment("owner/repo", ISSUE_NUMBER, "Triage summary: ...")
134
+ ```
135
+
136
+ ## Failure Mode Guide
137
+
138
+ | Situation | Action |
139
+ |-----------|--------|
140
+ | Can't reproduce | Label `needs-info`, ask for more details |
141
+ | Incomplete report | Request specific missing information |
142
+ | Security issue | Do NOT file publicly — create private advisory |
143
+ | Controversial feature request | Label `needs-discussion`, ping maintainers |
144
+ | Issue spam | Label `invalid`, close immediately |
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: github.pr_review
3
+ description: Systematic methodology for reviewing GitHub pull requests
4
+ ---
5
+
6
+ Use this skill when asked to review a GitHub pull request. Follow the steps
7
+ in order — each provides context needed for the next.
8
+
9
+ ## Step 1: Understand the Change
10
+
11
+ First, get the big picture:
12
+
13
+ ```ruby
14
+ client = Ask::GitHub.client
15
+ files = client.pull_request_files("owner/repo", PR_NUMBER)
16
+ ```
17
+
18
+ Review the file list:
19
+ - **Total files changed** — is this a reasonable scope?
20
+ - **File types** — config, app code, tests, migrations, docs?
21
+ - **Lines added vs deleted** — is it mostly new code or refactoring?
22
+
23
+ Then get the full diff for each file:
24
+
25
+ ```ruby
26
+ files.each do |f|
27
+ puts "#{f.filename}: +#{f.additions}/-#{f.deletions}"
28
+ end
29
+ ```
30
+
31
+ For large PRs, focus on the core logic files and skip generated/config changes
32
+ unless they're the purpose of the PR.
33
+
34
+ ## Step 2: Read the PR Description and Related Issues
35
+
36
+ ```ruby
37
+ pr = client.pull_request("owner/repo", PR_NUMBER)
38
+ puts pr.title
39
+ puts pr.body
40
+ ```
41
+
42
+ Check for:
43
+ - **Motivation** — is the WHY clear?
44
+ - **Related issues** — does `pr.body` reference #123 or "Closes #123"?
45
+ - **Testing strategy** — does it mention how it was tested?
46
+ - **Deployment considerations** — migrations, config changes, feature flags?
47
+
48
+ If issues are referenced, review them for context:
49
+
50
+ ```ruby
51
+ client.issue("owner/repo", ISSUE_NUMBER)
52
+ ```
53
+
54
+ ## Step 3: Review Tests First
55
+
56
+ Look at the test files changed:
57
+
58
+ ```ruby
59
+ test_files = files.select { |f| f.filename.match?(/_test\.rb|_spec\.rb$/) }
60
+ test_files.each do |f|
61
+ # Read the test content
62
+ client.contents("owner/repo", path: f.filename)
63
+ end
64
+ ```
65
+
66
+ Check:
67
+ - **Coverage** — does every new method/logic path have a test?
68
+ - **Edge cases** — empty state, error handling, boundary conditions?
69
+ - **Test quality** — are they testing the behavior or the implementation?
70
+ - **Setup/teardown** — are shared states properly isolated?
71
+
72
+ ## Step 4: Review Core Logic
73
+
74
+ Review the main implementation files:
75
+
76
+ ```ruby
77
+ app_files = files.reject { |f| f.filename.match?(/_test\.rb|_spec\.rb$/) }
78
+ app_files.each do |f|
79
+ content = client.contents("owner/repo", path: f.filename)
80
+ # Review the content
81
+ end
82
+ ```
83
+
84
+ What to look for:
85
+ - **Security**: SQL injection (raw SQL, string interpolation), mass assignment,
86
+ authentication bypass, exposed credentials
87
+ - **Correctness**: Off-by-one errors, nil checks, edge case handling
88
+ - **Performance**: N+1 queries, missing eager loading, unnecessary allocations
89
+ - **Pattern consistency**: Follows existing code conventions?
90
+ - **Error handling**: What happens when external services fail?
91
+
92
+ ## Step 5: Check for Common Anti-Patterns
93
+
94
+ Scan for these common issues:
95
+
96
+ 1. **Hard-coded values** — should be config or environment variables
97
+ 2. **TODO/FIXME/HACK comments** — left-behind development artifacts
98
+ 3. **Commented-out code** — should be removed before merge
99
+ 4. **Overly complex methods** — more than 10-15 lines suggests refactoring needed
100
+ 5. **Duplicate logic** — extract to shared method or concern
101
+ 6. **Missing validations** — user input not validated before database insert
102
+
103
+ ## Step 6: Assess Test Results and CI
104
+
105
+ If available, check CI status:
106
+
107
+ ```ruby
108
+ # Check commit status
109
+ client.commit_status("owner/repo", pr.head.sha)
110
+ ```
111
+
112
+ If tests are failing or CI is red, DO NOT approve the PR until that's addressed.
113
+
114
+ ## Step 7: Write the Review
115
+
116
+ Structure your review feedback:
117
+
118
+ 1. **Summary** — 2-3 sentences about what the PR does
119
+ 2. **Positive feedback** — what's done well (specific examples)
120
+ 3. **Required changes** — bugs, security issues, breaking tests
121
+ 4. **Suggestions** — improvements that are optional (performance, style)
122
+ 5. **Questions** — anything unclear that the author should clarify
123
+
124
+ Use GitHub's review API:
125
+
126
+ ```ruby
127
+ client.create_pull_request_review(
128
+ "owner/repo",
129
+ PR_NUMBER,
130
+ body: "Summary...",
131
+ event: "COMMENT" # or "APPROVE" or "REQUEST_CHANGES"
132
+ )
133
+ ```
134
+
135
+ ## Failure Mode Guide
136
+
137
+ | Situation | Action |
138
+ |-----------|--------|
139
+ | No test coverage | Request tests before approval |
140
+ | Security vulnerability | Block with clear explanation, suggest fix |
141
+ | PR has merge conflicts | Note that it needs rebase before review |
142
+ | Large PR (>500 lines) | Focus on core logic, note scoping concerns |
143
+ | Missing description | Ask for context before detailed review |
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -137,6 +137,8 @@ files:
137
137
  - lib/ask/github/context.rb
138
138
  - lib/ask/github/error_guide.rb
139
139
  - lib/ask/github/version.rb
140
+ - lib/ask/skills/github.issue_triage/SKILL.md
141
+ - lib/ask/skills/github.pr_review/SKILL.md
140
142
  homepage: https://github.com/ask-rb/ask-github
141
143
  licenses:
142
144
  - MIT