Skip to content

Commit fca5de1

Browse files
labudisCopilot
andauthored
Improve github-issues skill: fix MCP tools, add search reference, fix sub-issues docs (#888)
* Add advanced search reference with query syntax guide Covers search qualifiers, boolean logic, date ranges, missing metadata filters, common patterns, and when to use search vs list_issues. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add issue fields search support to search and issue-fields references - Add Advanced Search Mode section to search.md covering field: qualifier, has:field: syntax, REST advanced_search=true, and GraphQL ISSUE_ADVANCED - Add Searching by Field Values section to issue-fields.md with REST/GraphQL examples and qualifier reference table - Note MCP search_issues limitation (no advanced_search support) - Update SKILL.md capability table to mention issue field filters Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Clarify three search approaches: list_issues vs search_issues vs advanced search Replace the simple two-column comparison with a capability matrix showing what each approach supports (field filters, boolean logic, scope, etc.) and a decision guide for when to use each one. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix issue field search syntax: use dot notation (field.name:value) The colon notation (field:Name:Value) is silently ignored by the API. The correct syntax is dot notation (field.priority:P0) which works in REST (advanced_search=true), GraphQL (ISSUE_ADVANCED), and web UI. Also supports has:field.name, no:field.name, and date comparisons. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix github-issues skill: correct MCP tools and add gh api workflows The skill listed 5 MCP tools that don't exist (create_issue, update_issue, get_issue, add_issue_comment, list_issue_types), causing tool-not-found errors when agents tried to follow the skill instructions. Changes: - Split tools table into MCP (read ops) and CLI/API (write ops) - Add gh api commands for creating, updating, commenting on issues - Document that gh issue create doesn't support --type flag - Add GraphQL query for discovering issue types - Remove redundant [Bug]/[Feature] title prefixes (use type param instead) - Update examples to use gh api instead of non-existent MCP tools Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix sub-issues reference: add gh api examples and integer gotcha The sub_issue_id parameter requires an integer but gh api -f sends strings, causing 422 errors. Updated all REST examples to use --input with raw JSON. Also added: - Recommended two-step workflow (create issue, then link) - Explicit warning about -f vs --input for integer params - Proper gh api command syntax instead of raw HTTP notation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review: fix search docs accuracy and broken link - Fix misleading claim about full boolean logic support (implicit AND only) - Remove sort:updated from query example (it's an API param, not a qualifier) - Clarify -linked:pr comment to avoid confusion with authoring status - Fix relative link in issue-fields.md (sibling file, not nested path) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Improve projects reference: scope warning, gh api examples, issue-side queries From hands-on usage: hit INSUFFICIENT_SCOPES trying to update project status because token had read:project but not project write scope. Added: - OAuth scope requirements table with gh auth refresh workaround - How to find an issue's project item ID (query from issue side) - All GraphQL examples now use gh api graphql (copy-paste ready) - End-to-end example: set issue status to In Progress Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add images-in-issues reference: hosting methods, pitfalls, screenshots Documents three approaches for embedding images in issue comments via CLI: Contents API with github.com/raw/ URLs, browser drag-drop for permanent user-attachments URLs, and gist hosting limitations. Includes puppeteer screenshot recipe and comparison table. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update README.skills.md with images reference Run npm run build to regenerate skill listing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix issue-fields search: add GraphQL bulk query, caveat search syntax The field.name:value search qualifier is unreliable via API (returns 0 results even when matching issues exist). Added a recommended GraphQL approach that fetches issues and filters by issueFieldValues client-side. Documented the correct IssueFieldSingleSelectValue schema (name, not value). Marked search qualifier syntax as experimental with a reliability warning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs(github-issues): improve project discovery guidance The projectsV2 query param does keyword search, not exact match, and sorts by recency. For large orgs like github, common words like 'issue' return 400+ results and bury the target project. Added a priority-ordered discovery strategy: 1. Direct lookup by number (instant) 2. Reverse lookup from a known issue's projectItems (most reliable) 3. GraphQL name search with client-side jq filtering (fallback) 4. MCP tool (small orgs only) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1b15663 commit fca5de1

7 files changed

Lines changed: 718 additions & 96 deletions

File tree

docs/README.skills.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-skills) for guidelines on how to
122122
| [git-commit](../skills/git-commit/SKILL.md) | Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping | None |
123123
| [git-flow-branch-creator](../skills/git-flow-branch-creator/SKILL.md) | Intelligent Git Flow branch creator that analyzes git status/diff and creates appropriate branches following the nvie Git Flow branching model. | None |
124124
| [github-copilot-starter](../skills/github-copilot-starter/SKILL.md) | Set up complete GitHub Copilot configuration for a new project based on technology stack | None |
125-
| [github-issues](../skills/github-issues/SKILL.md) | Create, update, and manage GitHub issues using MCP tools. Use this skill when users want to create bug reports, feature requests, or task issues, update existing issues, add labels/assignees/milestones, set issue fields (dates, priority, custom fields), set issue types, or manage issue workflows. Triggers on requests like "create an issue", "file a bug", "request a feature", "update issue X", "set the priority", "set the start date", or any GitHub issue management task. | `references/dependencies.md`<br />`references/issue-fields.md`<br />`references/issue-types.md`<br />`references/projects.md`<br />`references/sub-issues.md`<br />`references/templates.md` |
125+
| [github-issues](../skills/github-issues/SKILL.md) | Create, update, and manage GitHub issues using MCP tools. Use this skill when users want to create bug reports, feature requests, or task issues, update existing issues, add labels/assignees/milestones, set issue fields (dates, priority, custom fields), set issue types, or manage issue workflows. Triggers on requests like "create an issue", "file a bug", "request a feature", "update issue X", "set the priority", "set the start date", or any GitHub issue management task. | `references/dependencies.md`<br />`references/images.md`<br />`references/issue-fields.md`<br />`references/issue-types.md`<br />`references/projects.md`<br />`references/search.md`<br />`references/sub-issues.md`<br />`references/templates.md` |
126126
| [go-mcp-server-generator](../skills/go-mcp-server-generator/SKILL.md) | Generate a complete Go MCP server project with proper structure, dependencies, and implementation using the official github.com/modelcontextprotocol/go-sdk. | None |
127127
| [image-manipulation-image-magick](../skills/image-manipulation-image-magick/SKILL.md) | Process and manipulate images using ImageMagick. Supports resizing, format conversion, batch processing, and retrieving image metadata. Use when working with images, creating thumbnails, resizing wallpapers, or performing batch image operations. | None |
128128
| [import-infrastructure-as-code](../skills/import-infrastructure-as-code/SKILL.md) | Import existing Azure resources into Terraform using Azure CLI discovery and Azure Verified Modules (AVM). Use when asked to reverse-engineer live Azure infrastructure, generate Infrastructure as Code from existing subscriptions/resource groups/resource IDs, map dependencies, derive exact import addresses from downloaded module source, prevent configuration drift, and produce AVM-based Terraform files ready for validation and planning across any Azure resource type. | None |

skills/github-issues/SKILL.md

Lines changed: 95 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,63 +7,81 @@ description: 'Create, update, and manage GitHub issues using MCP tools. Use this
77

88
Manage GitHub issues using the `@modelcontextprotocol/server-github` MCP server.
99

10-
## Available MCP Tools
10+
## Available Tools
11+
12+
### MCP Tools (read operations)
1113

1214
| Tool | Purpose |
1315
|------|---------|
14-
| `mcp__github__create_issue` | Create new issues |
15-
| `mcp__github__update_issue` | Update existing issues |
16-
| `mcp__github__get_issue` | Fetch issue details |
17-
| `mcp__github__search_issues` | Search issues |
18-
| `mcp__github__add_issue_comment` | Add comments |
19-
| `mcp__github__list_issues` | List repository issues |
20-
| `mcp__github__list_issue_types` | List available issue types for an organization |
21-
| `mcp__github__issue_read` | Read issue details, sub-issues, comments, labels |
16+
| `mcp__github__issue_read` | Read issue details, sub-issues, comments, labels (methods: get, get_comments, get_sub_issues, get_labels) |
17+
| `mcp__github__list_issues` | List and filter repository issues by state, labels, date |
18+
| `mcp__github__search_issues` | Search issues across repos using GitHub search syntax |
2219
| `mcp__github__projects_list` | List projects, project fields, project items, status updates |
2320
| `mcp__github__projects_get` | Get details of a project, field, item, or status update |
2421
| `mcp__github__projects_write` | Add/update/delete project items, create status updates |
2522

23+
### CLI / REST API (write operations)
24+
25+
The MCP server does not currently support creating, updating, or commenting on issues. Use `gh api` for these operations.
26+
27+
| Operation | Command |
28+
|-----------|---------|
29+
| Create issue | `gh api repos/{owner}/{repo}/issues -X POST -f title=... -f body=...` |
30+
| Update issue | `gh api repos/{owner}/{repo}/issues/{number} -X PATCH -f title=... -f state=...` |
31+
| Add comment | `gh api repos/{owner}/{repo}/issues/{number}/comments -X POST -f body=...` |
32+
| Close issue | `gh api repos/{owner}/{repo}/issues/{number} -X PATCH -f state=closed` |
33+
| Set issue type | Include `-f type=Bug` in the create call (REST API only, not supported by `gh issue create` CLI) |
34+
35+
**Note:** `gh issue create` works for basic issue creation but does **not** support the `--type` flag. Use `gh api` when you need to set issue types.
36+
2637
## Workflow
2738

2839
1. **Determine action**: Create, update, or query?
2940
2. **Gather context**: Get repo info, existing labels, milestones if needed
3041
3. **Structure content**: Use appropriate template from [references/templates.md](references/templates.md)
31-
4. **Execute**: Call the appropriate MCP tool
42+
4. **Execute**: Use MCP tools for reads, `gh api` for writes
3243
5. **Confirm**: Report the issue URL to user
3344

3445
## Creating Issues
3546

36-
### Required Parameters
47+
Use `gh api` to create issues. This supports all parameters including issue types.
3748

38-
```
39-
owner: repository owner (org or user)
40-
repo: repository name
41-
title: clear, actionable title
42-
body: structured markdown content
49+
```bash
50+
gh api repos/{owner}/{repo}/issues \
51+
-X POST \
52+
-f title="Issue title" \
53+
-f body="Issue body in markdown" \
54+
-f type="Bug" \
55+
--jq '{number, html_url}'
4356
```
4457

4558
### Optional Parameters
4659

60+
Add any of these flags to the `gh api` call:
61+
4762
```
48-
labels: ["bug", "enhancement", "documentation", ...]
49-
assignees: ["username1", "username2"]
50-
milestone: milestone number (integer)
51-
type: issue type name (e.g., "Bug", "Feature", "Task", "Epic")
63+
-f type="Bug" # Issue type (Bug, Feature, Task, Epic, etc.)
64+
-f labels[]="bug" # Labels (repeat for multiple)
65+
-f assignees[]="username" # Assignees (repeat for multiple)
66+
-f milestone=1 # Milestone number
5267
```
5368

54-
**Issue types** are organization-level metadata. Before using `type`, call `mcp__github__list_issue_types` with the org name to discover available types. If the org has no issue types configured, omit the parameter.
69+
**Issue types** are organization-level metadata. To discover available types, use:
70+
```bash
71+
gh api graphql -f query='{ organization(login: "ORG") { issueTypes(first: 10) { nodes { name } } } }' --jq '.data.organization.issueTypes.nodes[].name'
72+
```
5573

5674
**Prefer issue types over labels for categorization.** When issue types are available (e.g., Bug, Feature, Task), use the `type` parameter instead of applying equivalent labels like `bug` or `enhancement`. Issue types are the canonical way to categorize issues on GitHub. Only fall back to labels when the org has no issue types configured.
5775

5876
### Title Guidelines
5977

60-
- Start with type prefix when useful: `[Bug]`, `[Feature]`, `[Docs]`
6178
- Be specific and actionable
6279
- Keep under 72 characters
80+
- When issue types are set, don't add redundant prefixes like `[Bug]`
6381
- Examples:
64-
- `[Bug] Login fails with SSO enabled`
65-
- `[Feature] Add dark mode support`
66-
- `Add unit tests for auth module`
82+
- `Login fails with SSO enabled` (with type=Bug)
83+
- `Add dark mode support` (with type=Feature)
84+
- `Add unit tests for auth module` (with type=Task)
6785

6886
### Body Structure
6987

@@ -77,46 +95,72 @@ Always use the templates in [references/templates.md](references/templates.md).
7795

7896
## Updating Issues
7997

80-
Use `mcp__github__update_issue` with:
98+
Use `gh api` with PATCH:
8199

82-
```
83-
owner, repo, issue_number (required)
84-
title, body, state, labels, assignees, milestone (optional - only changed fields)
100+
```bash
101+
gh api repos/{owner}/{repo}/issues/{number} \
102+
-X PATCH \
103+
-f state=closed \
104+
-f title="Updated title" \
105+
--jq '{number, html_url}'
85106
```
86107

87-
State values: `open`, `closed`
108+
Only include fields you want to change. Available fields: `title`, `body`, `state` (open/closed), `labels`, `assignees`, `milestone`.
88109

89110
## Examples
90111

91112
### Example 1: Bug Report
92113

93114
**User**: "Create a bug issue - the login page crashes when using SSO"
94115

95-
**Action**: Call `mcp__github__create_issue` with:
96-
```json
97-
{
98-
"owner": "github",
99-
"repo": "awesome-copilot",
100-
"title": "[Bug] Login page crashes when using SSO",
101-
"body": "## Description\nThe login page crashes when users attempt to authenticate using SSO.\n\n## Steps to Reproduce\n1. Navigate to login page\n2. Click 'Sign in with SSO'\n3. Page crashes\n\n## Expected Behavior\nSSO authentication should complete and redirect to dashboard.\n\n## Actual Behavior\nPage becomes unresponsive and displays error.\n\n## Environment\n- Browser: [To be filled]\n- OS: [To be filled]\n\n## Additional Context\nReported by user.",
102-
"type": "Bug"
103-
}
116+
**Action**:
117+
```bash
118+
gh api repos/github/awesome-copilot/issues \
119+
-X POST \
120+
-f title="Login page crashes when using SSO" \
121+
-f type="Bug" \
122+
-f body="## Description
123+
The login page crashes when users attempt to authenticate using SSO.
124+
125+
## Steps to Reproduce
126+
1. Navigate to login page
127+
2. Click 'Sign in with SSO'
128+
3. Page crashes
129+
130+
## Expected Behavior
131+
SSO authentication should complete and redirect to dashboard.
132+
133+
## Actual Behavior
134+
Page becomes unresponsive and displays error." \
135+
--jq '{number, html_url}'
104136
```
105137

106138
### Example 2: Feature Request
107139

108140
**User**: "Create a feature request for dark mode with high priority"
109141

110-
**Action**: Call `mcp__github__create_issue` with:
111-
```json
112-
{
113-
"owner": "github",
114-
"repo": "awesome-copilot",
115-
"title": "[Feature] Add dark mode support",
116-
"body": "## Summary\nAdd dark mode theme option for improved user experience and accessibility.\n\n## Motivation\n- Reduces eye strain in low-light environments\n- Increasingly expected by users\n- Improves accessibility\n\n## Proposed Solution\nImplement theme toggle with system preference detection.\n\n## Acceptance Criteria\n- [ ] Toggle switch in settings\n- [ ] Persists user preference\n- [ ] Respects system preference by default\n- [ ] All UI components support both themes\n\n## Alternatives Considered\nNone specified.\n\n## Additional Context\nHigh priority request.",
117-
"type": "Feature",
118-
"labels": ["high-priority"]
119-
}
142+
**Action**:
143+
```bash
144+
gh api repos/github/awesome-copilot/issues \
145+
-X POST \
146+
-f title="Add dark mode support" \
147+
-f type="Feature" \
148+
-f labels[]="high-priority" \
149+
-f body="## Summary
150+
Add dark mode theme option for improved user experience and accessibility.
151+
152+
## Motivation
153+
- Reduces eye strain in low-light environments
154+
- Increasingly expected by users
155+
156+
## Proposed Solution
157+
Implement theme toggle with system preference detection.
158+
159+
## Acceptance Criteria
160+
- [ ] Toggle switch in settings
161+
- [ ] Persists user preference
162+
- [ ] Respects system preference by default" \
163+
--jq '{number, html_url}'
120164
```
121165

122166
## Common Labels
@@ -148,8 +192,10 @@ The following features require REST or GraphQL APIs beyond the basic MCP tools.
148192

149193
| Capability | When to use | Reference |
150194
|------------|-------------|-----------|
195+
| Advanced search | Complex queries with boolean logic, date ranges, cross-repo search, issue field filters (`field.name:value`) | [references/search.md](references/search.md) |
151196
| Sub-issues & parent issues | Breaking work into hierarchical tasks | [references/sub-issues.md](references/sub-issues.md) |
152197
| Issue dependencies | Tracking blocked-by / blocking relationships | [references/dependencies.md](references/dependencies.md) |
153198
| Issue types (advanced) | GraphQL operations beyond MCP `list_issue_types` / `type` param | [references/issue-types.md](references/issue-types.md) |
154199
| Projects V2 | Project boards, progress reports, field management | [references/projects.md](references/projects.md) |
155200
| Issue fields | Custom metadata: dates, priority, text, numbers (private preview) | [references/issue-fields.md](references/issue-fields.md) |
201+
| Images in issues | Embedding images in issue bodies and comments via CLI | [references/images.md](references/images.md) |
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Images in Issues and Comments
2+
3+
How to embed images in GitHub issue bodies and comments programmatically via the CLI.
4+
5+
## Methods (ranked by reliability)
6+
7+
### 1. GitHub Contents API (recommended for private repos)
8+
9+
Push image files to a branch in the same repo, then reference them with a URL that works for authenticated viewers.
10+
11+
**Step 1: Create a branch**
12+
13+
```bash
14+
# Get the SHA of the default branch
15+
SHA=$(gh api repos/{owner}/{repo}/git/ref/heads/main --jq '.object.sha')
16+
17+
# Create a new branch
18+
gh api repos/{owner}/{repo}/git/refs -X POST \
19+
-f ref="refs/heads/{username}/images" \
20+
-f sha="$SHA"
21+
```
22+
23+
**Step 2: Upload images via Contents API**
24+
25+
```bash
26+
# Base64-encode the image and upload
27+
BASE64=$(base64 -i /path/to/image.png)
28+
29+
gh api repos/{owner}/{repo}/contents/docs/images/my-image.png \
30+
-X PUT \
31+
-f message="Add image" \
32+
-f content="$BASE64" \
33+
-f branch="{username}/images" \
34+
--jq '.content.path'
35+
```
36+
37+
Repeat for each image. The Contents API creates a commit per file.
38+
39+
**Step 3: Reference in markdown**
40+
41+
```markdown
42+
![Description](https://github.com/{owner}/{repo}/raw/{username}/images/docs/images/my-image.png)
43+
```
44+
45+
> **Important:** Use `github.com/{owner}/{repo}/raw/{branch}/{path}` format, NOT `raw.githubusercontent.com`. The `raw.githubusercontent.com` URLs return 404 for private repos. The `github.com/.../raw/...` format works because the browser sends auth cookies when the viewer is logged in and has repo access.
46+
47+
**Pros:** Works for any repo the viewer has access to, images live in version control, no expiration.
48+
**Cons:** Creates commits, viewers must be authenticated, images won't render in email notifications or for users without repo access.
49+
50+
### 2. Gist hosting (public images only)
51+
52+
Upload images as files in a gist. Only works for images you're comfortable making public.
53+
54+
```bash
55+
# Create a gist with a placeholder file
56+
gh gist create --public -f description.md <<< "Image hosting gist"
57+
58+
# Note: gh gist edit does NOT support binary files.
59+
# You must use the API to add binary content to gists.
60+
```
61+
62+
> **Limitation:** Gists don't support binary file uploads via the CLI. You'd need to base64-encode and store as text, which won't render as images. Not recommended.
63+
64+
### 3. Browser upload (most reliable rendering)
65+
66+
The most reliable way to get permanent image URLs is through the GitHub web UI:
67+
68+
1. Open the issue/comment in a browser
69+
2. Drag-drop or paste the image into the comment editor
70+
3. GitHub generates a permanent `https://github.com/user-attachments/assets/{UUID}` URL
71+
4. These URLs work for anyone, even without repo access, and render in email notifications
72+
73+
> **Why the API can't do this:** GitHub's `upload/policies/assets` endpoint requires a browser session (CSRF token + cookies). It returns an HTML error page when called with API tokens. There is no public API for generating `user-attachments` URLs.
74+
75+
## Taking screenshots programmatically
76+
77+
Use `puppeteer-core` with local Chrome to screenshot HTML mockups:
78+
79+
```javascript
80+
const puppeteer = require('puppeteer-core');
81+
82+
const browser = await puppeteer.launch({
83+
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
84+
defaultViewport: { width: 900, height: 600, deviceScaleFactor: 2 }
85+
});
86+
87+
const page = await browser.newPage();
88+
await page.setContent(htmlString);
89+
90+
// Screenshot specific elements
91+
const elements = await page.$$('.section');
92+
for (let i = 0; i < elements.length; i++) {
93+
await elements[i].screenshot({ path: `mockup-${i + 1}.png` });
94+
}
95+
96+
await browser.close();
97+
```
98+
99+
> **Note:** MCP Playwright may not connect to localhost due to network isolation. Use puppeteer-core with a local Chrome installation instead.
100+
101+
## Quick reference
102+
103+
| Method | Private repos | Permanent | No auth needed | API-only |
104+
|--------|:---:|:---:|:---:|:---:|
105+
| Contents API + `github.com/raw/` |||||
106+
| Browser drag-drop (`user-attachments`) |||||
107+
| `raw.githubusercontent.com` | ❌ (404) ||||
108+
| Gist | Public only ||| ❌ (no binary) |
109+
110+
## Common pitfalls
111+
112+
- **`raw.githubusercontent.com` returns 404 for private repos** even with a valid token in the URL. GitHub's CDN does not pass auth headers through.
113+
- **API download URLs are temporary.** URLs returned by `gh api repos/.../contents/...` with `download_url` include a token that expires.
114+
- **`upload/policies/assets` requires a browser session.** Do not attempt to call this endpoint from the CLI.
115+
- **Base64 encoding for large files** can hit API payload limits. The Contents API has a ~100MB file size limit but practical limits are lower for base64-encoded payloads.
116+
- **Email notifications** will not render images that require authentication. If email readability matters, use the browser upload method.

0 commit comments

Comments
 (0)