Skip to content

Commit af2ba1a

Browse files
이영창(piknow)claude
andcommitted
agent: improve make-task-issue with efficient GraphQL and correct API usage
Requirement: Improve make-task-issue command to use efficient project lookup and correct GitHub API field names for issue type assignment. Implementation: - Updated to use GraphQL repository.projectsV2 query for efficient project lookup - Changed from listing all org projects to querying only repository-linked projects - Fixed issue type API field from 'issue_type' to 'type' with capitalized values - Added GraphQL query example and implementation notes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 351df6c commit af2ba1a

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

.claude/commands/make-task-issue.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,33 @@ The following issue templates are available in `.github/ISSUE_TEMPLATE/`:
5252

5353
4. **Set issue type as "Task"**:
5454
- After issue creation, set the GitHub issue type to "Task"
55-
- Use GitHub API via gh CLI: `gh api repos/{owner}/{repo}/issues/{issue-number} -X PATCH -f issue_type='task'`
55+
- Use GitHub API via gh CLI: `gh api repos/{owner}/{repo}/issues/{issue-number} -X PATCH -f type='Task'`
5656
- This categorizes the issue as a "Task" type in GitHub's issue tracking system
57-
- Note: Issue types are an organization-level feature and may not be available in all repositories
57+
- Note: The field name is `type` (not `issue_type`) and the value should be capitalized (e.g., 'Task', 'Bug', 'Feature')
58+
- Issue types are an organization-level feature and may not be available in all repositories
5859

5960
5. **Add to GitHub Project**:
6061
- After issue creation, add the issue to the repository's linked GitHub Project
61-
- First, get the project linked to the repository:
62-
* Use: `gh project list --owner {owner}` to find projects
63-
* Or query linked projects: `gh api repos/{owner}/{repo}/projects`
64-
- Then add the issue to the project:
62+
- Get the project linked to the repository using GraphQL (most efficient):
63+
```bash
64+
gh api graphql -f query='
65+
{
66+
repository(owner: "{owner}", name: "{repo}") {
67+
projectsV2(first: 1) {
68+
nodes {
69+
id
70+
number
71+
title
72+
}
73+
}
74+
}
75+
}'
76+
```
77+
- Extract the project number from the response
78+
- Add the issue to the project:
6579
* Use: `gh project item-add {project-number} --owner {owner} --url {issue-url}`
66-
* Or use GraphQL API for more control
6780
- If no project is linked or command fails, show informative message but don't fail issue creation
81+
- Note: This approach is more efficient than listing all organization projects as it queries only repository-linked projects
6882
6983
## Examples
7084
@@ -88,6 +102,7 @@ Prompts for template selection and title
88102
- All issues created via this command are set to "Task" type
89103
- Issues are automatically added to the repository's linked GitHub Project
90104
- GitHub Project integration:
105+
* Uses GraphQL to efficiently query only repository-linked projects
91106
* Supports both organization and user projects
92107
* Uses `gh project item-add` to add issues to projects
93108
* Gracefully handles cases where no project is linked

0 commit comments

Comments
 (0)