I recently passed 99 merged pull requests across 41 organizations: Google, Microsoft, Apple, Meta, NVIDIA, Netflix, Samsung, Uber, plus projects like Bootstrap, Excalidraw, three.js, MUI, Tailwind CSS and Puppeteer.
None of them is a big feature. Almost all are small bug fixes, often under 15 lines including the test. This post is about how that works in practice: how I pick bugs, how I write a PR a maintainer can merge in two minutes, and the lessons I got from the times a maintainer said "not like this".
Pick bugs you can prove
The best contributions I made all had one thing in common: before touching the code, I could write a test that failed.
I look for bugs in the boring places:
Parsers and formatters. Edge cases like empty input, a trailing separator, a negative number, a character that needs escaping.
Boundaries. < versus <=, off by one, a range that is empty.
Unit conversions. Nanoseconds versus microseconds, rounding, sign handling.
Places where two code paths should agree but don't. One branch escapes a value and the other one forgets.
These bugs are small, but they are real, and someone somewhere is hitting them.
Five bugs I enjoyed fixing
An HTML entity inside a regular expression (Red Hat, vscode-yaml). The auto indentation rule for YAML was supposed to indent after a key with an anchor, like base: &base. It never did. The pattern in language-configuration.json contained & instead of &, so it was looking for the literal text &. A one character fix, plus a test that reads the real config file. Then a maintainer found that &ref-erance still failed, because the pattern only allowed word characters after &. YAML anchors can contain almost anything, so the second commit fixed that too.
One character in a drag and drop check (Meta, Lexical). Dropping dragged text exactly on the edge of its own selection deleted the text. The check used < where it needed <=. The maintainer extended the fix before merging, and the boundary change and the test stayed.
"60.0s" in a build log (ByteDance, Rsbuild). A build that took 59.96 seconds was logged as 60.0s, and one that took 119.96 seconds as 1m 60.0s. The function checked < 60 and split minutes and seconds on the raw value, and only rounded at the very end. Rounding first fixed both. Tiny, visible, and easy to test.
Decimal breakpoints in Tailwind CSS. Breakpoints in the same unit were compared with parseInt, which drops the fractional part, so 40.25rem and 40.5rem looked equal. min-[40.5rem] could be emitted before min-[40.25rem], and the smaller breakpoint won in the cascade. Switching to parseFloat fixed the order, with a test for decimal values.
A three.js geometry edge case. Line3.distanceSqToLine3() also writes the two closest points into optional targets. When both segments were degenerate (start equal to end), an early return computed the distance with c1.sub( c2 ), so c1 ended up holding a difference vector instead of a point. A previous fix had covered the general case but missed this branch. The test now checks both points for two degenerate segments.
How I write the pull request
Maintainers of big projects review a lot of PRs. Mine follow the same shape every time:
Root cause first. One or two sentences that explain why the bug happens, not just what changed. "The pattern contains &, so it never matches &" is better than "Fix indentation".
The fix. What I changed and why it is the smallest correct change.
The test. A test that fails before the change and passes after it. I say that explicitly in the description, and I run it both ways before opening the PR.
I also follow each repository's own conventions: commit message style, PR template, changelog or changeset files, CLA or DCO. Reading CONTRIBUTING.md before writing any code saves a round of review.
Keep the diff small. A five line fix with a test gets merged in days. A refactor that "cleans things up while I'm here" sits for months.
What maintainers taught me
The most useful part of this was not the merges. It was the reviews.
"Fix the cause, not the symptom." In one project I made a duration formatter handle negative values. The maintainer replied that negative durations should be impossible at that point and should never reach the formatter. They were right: the real issue was a function that passed a signed difference between two durations. I moved the fix there and left the formatter alone.
"A narrow fix is not always worth the review." I fixed a host parsing bug for IPv6 addresses in a networking library. The maintainer explained that a one off IPv6 fix does not help much if the rest of the stack cannot run over IPv6 yet, and every PR costs review and CI time. That was a fair point, so I closed the PR. Sometimes the right contribution is an issue with a plan, not code.
Maintainers often improve your fix. In Lexical the maintainer extended my change before merging. In Adobe's Spectrum Web Components a maintainer carried two of my fixes into their own PRs with co-author credit. In DataComPy the maintainer wrote an extra test for a two column key case. None of that is a rejection. It is how you learn how a codebase is meant to work.
Small process details matter. One PR was approved and then blocked because the repository requires signed commits. Setting up commit signing took five minutes and unblocked it.
A checklist you can steal
Read CONTRIBUTING.md and the PR template before writing code.
Search open and closed PRs and issues for the bug first. Someone may already be on it.
Reproduce it with a failing test.
Make the smallest change that fixes the root cause.
Run the test without your change, then with it.
Run the project's linters and formatters on the files you touched.
Explain the root cause in the first lines of the description.
Answer review comments quickly, and say thanks.
Why bother
Open source is one of the few places where you can learn directly from engineers who maintain software used by millions of people, and where your work is public and verifiable. Every one of these PRs is a small, reviewed piece of evidence of how you write code.
If you want to see the full list, it is on my GitHub profile: github.com/kwy404.
If you have never contributed to a big project before: pick one you use every day, find one small bug you can prove with a test, and send it. The first merge is the hardest one.
Top comments (0)