End-to-end bug fix workflow for the Ktor project. Accepts a GitHub issue (#NUMBER), YouTrack issue (KTOR-NUMBER), or YouTrack URL (https://youtrack.jetbrains.com/issue/KTOR-NUMBER). Fetches the issue, creates a failing reproducer test, commits on a new branch, implements the fix, validates, and opens a PR. Use this skill whenever the user wants to fix a bug from an issue tracker, mentions a KTOR issue number, or references a GitHub issue to fix.
Automates the full bug-fix lifecycle for the Ktor project: understand issue, reproduce, fix, validate, and open a PR.
The user provides one of:
#123 — GitHub issue in ktorio/ktorKTOR-9352 — YouTrack issue IDhttps://youtrack.jetbrains.com/issue/KTOR-9352 or https://youtrack.jetbrains.com/issue/KTOR-9352/some-slug — YouTrack URLParse the input to determine the source:
gh issue view NUMBER --repo ktorio/ktorKTOR-\d+): Fetch via the YouTrack MCP (see below)KTOR-XXXX ID from the URL, then fetch via the YouTrack MCP (see below)Use the YouTrack MCP tools to fetch issue details. Call with the issue ID (e.g., ).
mcp__youtrack__get_issueKTOR-9352If the YouTrack MCP server is not configured (tool calls fail), instruct the user to set it up:
claude mcp add --header "Authorization: Bearer <token>" --transport http youtrack https://youtrack.jetbrains.com/mcp
The permanent token can be created in JetBrains Hub account security settings (linked from YouTrack profile).
From the issue, extract:
KTOR-9352 or #123)For YouTrack issues only, update the issue status to reflect that work is starting:
mcp__youtrack__get_current_user to get the current user's login.mcp__youtrack__change_issue_assignee to assign the issue to the current user.mcp__youtrack__update_issue with customFields: {"State": "In Progress"} to mark work as started.If any of these calls fail because the YouTrack MCP is not configured, inform the user how to set it up (see "Fetching YouTrack Issues" section above) and continue with the rest of the workflow — issue tracking updates are not blocking.
Skip this step for GitHub-only issues.
Before creating a branch, understand the affected area:
ktor-client/ktor-client-curl → :ktor-client-curl)Use the Explore agent or direct file reads to understand:
Determine the base branch:
release/3.x for bug fixes that do not introduce new public APIs (patch release)main for fixes that require new public APIs or are targeted at the next minor releasegit checkout <base-branch> && git pull && git checkout -b claude/<issue-id>-<short-description>
Branch naming rules:
claude/KTOR-9352-short-descriptionclaude/123-short-descriptionWrite a test that demonstrates the bug as described in the issue. The goal is:
`KTOR-9352 request with empty body causes NPE`)Place the test appropriately:
jvm/test, posix/test)common/test so it runs on all platformsAfter writing the test, run it to confirm it fails:
./gradlew :module-name:jvmTest --tests "fully.qualified.TestClassName.methodName"
If the test is in common/test or touches multiplatform code, also run on other affected platforms:
./gradlew :module-name:allTests
If the test passes (bug is already fixed or test doesn't reproduce correctly):
Stage and commit the failing test:
git add <test-file>
git commit -m "<ISSUE-ID> Add failing test for <short bug description>
Co-Authored-By: Claude Opus 4.6 <[email protected]>"
For GitHub issues, use #NUMBER in the commit message. For YouTrack, use KTOR-XXXX.
Analyze the bug based on what you learned from the issue and the reproducer test:
Implement the fix directly — do not present the plan to the user for approval. Keep changes minimal and focused:
Run the reproducer test to confirm it passes:
./gradlew :module-name:jvmTest --tests "fully.qualified.TestClassName.methodName"
Then run the full test suite for the affected module. Choose the scope based on where the changes are:
jvm/):
./gradlew :module-name:jvmTest
common/, or the bug affects multiple platforms):
./gradlew :module-name:allTests
If any tests fail, investigate and fix. Do not skip or disable tests.
./gradlew :module-name:formatKotlin :module-name:lintKotlin
Fix any lint issues before proceeding.
If the fix changed any public or protected API (new methods, changed signatures, etc.):
./gradlew :module-name:checkLegacyAbi
If it fails, update the ABI dumps:
./gradlew :module-name:updateLegacyAbi
Stage the updated .api files along with the fix.
If no public API changed, skip this step.
git add <changed-files>
git commit -m "<ISSUE-ID> <Imperative description of the fix>
Co-Authored-By: Claude Opus 4.6 <[email protected]>"
Push the branch and create a PR:
git push -u origin claude/<issue-id>-<short-description>
Create the PR targeting the base branch chosen in Step 3 (main or release/3.x):
gh pr create --title "<ISSUE-ID> <Short fix description>" --body "$(cat <<'EOF'
## Summary
- Fixes <link-to-issue>
- <1-2 bullet points describing the root cause and fix>
Closes <issue-reference>
## Test plan
- Added failing reproducer test that validates the fix
- All existing tests in the module continue to pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
The Closes line auto-closes the issue when the PR is merged for GitHub issues only:
Closes #NUMBERKTOR-XXXX as a plain cross-reference (GitHub will not close YouTrack tickets automatically)Report the PR URL to the user when done.
After the PR is created, for YouTrack issues only, update the issue state:
Call mcp__youtrack__update_issue with customFields: {"State": "Ready for Review"} to signal the fix is ready for code review.
If the YT MCP call fails, skip silently — the status update is not blocking.
Assess whether the fix changes behavior that users rely on or that is described in the Ktor documentation. A documentation update is needed when:
If none of the above apply (e.g., an internal-only fix, a crash fix with no API change), skip this step.
When documentation is needed, create a GitHub issue in the ktorio/ktor-documentation repository:
gh issue create --repo ktorio/ktor-documentation \
--title "Document behavior change: <ISSUE-ID> <short description>" \
--body "$(cat <<'EOF'
## Context
PR: <link-to-the-PR-created-in-step-11>
Issue: <link-to-the-original-issue>
## What changed
<1-3 sentences explaining what behavior changed and why>
## What should be documented
<Describe specifically what a technical writer should add or update in the docs.
Include the affected API, module, and any relevant configuration options.>
## Suggested code snippet
```kotlin
// Include a short usage example if relevant, showing the correct new usage
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
Report the documentation issue URL to the user alongside the PR URL.