with one click
fix-issue
// Analyze a GitHub issue, explore related code, and propose or implement a fix. Use when the user asks to investigate, fix, or resolve a GitHub issue.
// Analyze a GitHub issue, explore related code, and propose or implement a fix. Use when the user asks to investigate, fix, or resolve a GitHub issue.
Scaffold a new number system type with all required files, CMake wiring, exception hierarchy, traits, tests, and numeric_limits. Use when adding a new arithmetic type to the Universal library.
Build and test targets with both gcc and clang. Use when you need to build, compile, test, or verify code changes with dual-compiler validation.
| name | fix-issue |
| description | Analyze a GitHub issue, explore related code, and propose or implement a fix. Use when the user asks to investigate, fix, or resolve a GitHub issue. |
| user-invocable | true |
| argument-hint | <issue-number> |
| allowed-tools | Bash, Read, Edit, Write, Glob, Grep, WebFetch, Task |
Given a GitHub issue number, investigate the problem, find the relevant code, and either propose or implement a fix.
$ARGUMENTS — the GitHub issue number (e.g., 509). If not provided, ask the user.
Read the issue and extract key information:
gh issue view $ARGUMENTS --repo stillwater-sc/universal --json title,body,labels,state,comments
From the issue, identify:
Based on the issue analysis, search the codebase:
Find the relevant type's implementation:
include/sw/universal/number/TYPE/TYPE_impl.hpp
Search for keywords from the issue:
Check existing tests for the affected area:
static/{category}/TYPE/api/
static/{category}/TYPE/arithmetic/
static/{category}/TYPE/conversion/
static/{category}/TYPE/math/
Examples: static/fixpnt/binary/api/, static/tapered/posit/api/, static/block/microfloat/api/
Check if there's a related PR or branch:
gh pr list --repo stillwater-sc/universal --state all --search "related keywords"
Classify the fix:
| Complexity | Criteria | Action |
|---|---|---|
| Trivial | Typo, missing include, simple one-line fix | Implement directly |
| Moderate | New function, algorithm fix, test addition (1-3 files) | Implement with user confirmation |
| Significant | Cross-type change, new subsystem, architectural (4+ files) | Present plan, ask user before implementing |
| Epic | Major feature, multi-PR effort | Present roadmap, suggest breakdown into sub-issues |
Create a feature branch:
git checkout -b fix/issue-NNN-short-description
Make the code changes — follow existing patterns in the codebase
Build and test with BOTH compilers:
cmake --build --preset gcc-debug --target TARGETcmake --build --preset clang-debug --target TARGETRun related regression tests to check for regressions
Commit with a descriptive message referencing the issue:
fix(TYPE): description of what was fixed
Resolves #NNN
Push and create a draft PR:
git push -u origin fix/issue-NNN-short-description
gh pr create --draft --title "fix(TYPE): short description" --body "..."
Always create PRs as draft — this skips the expensive CI jobs (sanitizers, coverage,
full 11-platform matrix) and only runs the fast tier (gcc + clang CI_LITE, ~8 min).
When the user is satisfied, they promote with gh pr ready NNN.
Present a structured analysis:
## Issue #NNN: Title
### Root Cause
[explanation]
### Affected Files
- file1.hpp:line — what needs to change
- file2.cpp:line — what needs to change
### Proposed Approach
[step-by-step plan]
### Estimated Scope
[number of files, complexity assessment]
### Risks
[what could go wrong, what to watch for]
Ask the user how to proceed
-j4pgrep -a 'make|cmake|ninja' before buildinguniversal_*, internal blocks inherit std::runtime_errorconstexpr on constructors that call math functionslong double bit-shift division — use std::ldexp()blockbinary temporaries (clang doesn't zero stack)operator long double() on blocksignificandgh issue comment NNN --repo stillwater-sc/universal --body "Working on this. Plan: [brief description of approach]"
gh issue comment NNN --repo stillwater-sc/universal --body "Implemented [summary] in PR #PPP."
Resolves #NNN or Fixes #NNNRelates to #NNN instead| Issue Pattern | Where to Look | Typical Fix |
|---|---|---|
| Wrong arithmetic results | TYPE_impl.hpp operators, blockbinary | Algorithm fix, edge case handling |
| Missing math function | math/TYPE_math.hpp or mathlib.hpp | Implement using existing patterns |
| Precision loss in output | operator<<, to_string() | Use support::decimal for exact conversion |
| Conversion failure | TYPE_impl.hpp assignment operators | Fix the conversion path |
| Build failure on platform X | Compiler-specific code paths | Portability fix with #ifdef or alternative |
| Missing istream support | operator>> in TYPE_impl.hpp | Implement parsing |
| Performance issue | Hot path in arithmetic operators | Profile, optimize inner loop |
| CI test failure | Test expectations vs actual behavior | Fix test or fix implementation |