hoc-git-commit-order
The order commits land in once the work has been split: which of a test and the change it checks goes first, and how the rest of a branch is sequenced. Use…
by openreachtech★ 17 GitHub stars
Install hoc-git-commit-order in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Git Commit Order
What belongs in each commit is settled first, by the git commit convention. This settles which of them comes first.
The first commit is the one that turns the suite red
Where a change and the tests that check it are separate commits, whichever of the two makes the suite fail goes first — the red side must come first. This is the basis of test-driven development: the red commit states the claim on its own, and what comes after it is what turns the suite green. A reader stands at the red commit and watches the test fail for the reason it exists; taken the other way round, every step is green and nothing distinguishes a test that checks the change from one that asserts nothing.
Neither side is limited to one commit. Several tests may each be turned red, one commit apiece, before any of them is answered; the fixes then follow, each turning its own test green, in the order the tests went red. A test that fails until two classes are both fixed is answered by one commit per class, and stays red until the last of them lands. The rule is about which side comes first, not about either side fitting in one commit:
Commit Test A Test B Test C Update test A red green green Update test B red red green Update test C red red red Fix A green red red Fix B green green red Fix C green green green
Several classes in one branch stack their tests as a group
Where one branch changes several classes, every test commit comes first, one per class, and the implementation commits follow in the same class order. The table above is not one way among others for such a branch; it is the order. Test and implementation are not paired off class by class.
Update test for AlphaInflator to expect #defineBridgeHandler()
Update test for BetaInflator to expect #defineBridgeHandler()
Update AlphaInflator to define #defineBridgeHandler()
Update BetaInflator to define #defineBridgeHandler()
- The
Update test forsubjects then stand in one run, so a reader finds every test commit of the branch at a glance. Paired off, they are scattered down the log between the implementations. - A commit of another kind does not join the run. A follow-up comment, an export, a class the others are built on: where a branch would hold one of those beside the group, the commits are not of equal standing, and the branch becomes a nested trunk with each kind on a sub-branch of its own. How that trunk is cut and merged belongs to the git branch convention.
Adding puts the tests first
A class, a member or a behavior that is being added has its tests committed before its implementation. The test commit states what the code is expected to do, and the implementation commit is the one that makes the statement true. Committed the other way round, the tests only confirm what already worked, and there is no commit at which the claim stands on its own to be reviewed. This is test-driven development written into the history rather than into the editor.
- A test commit in which nothing fails asserts nothing. It may hold cases that pass —
covering behavior the change leaves alone — but not only those. Which cases fail against the
unchanged code, and which pass, is read as the Jest convention (
/hoc-jest) describes.
Reducing puts the implementation first
Where the work takes something away, the implementation changes first and the tests are
committed second. Deleting a file, a class or a method, or lowering a limit the implementation
enforces, such as the length it allows a description: — taking the tests out, or bringing them
into line, first turns nothing red, because the code they check still satisfies them. So the
implementation goes first and fails the suite, and the commit that brings the tests into line is
the one that clears it.
- In this order the red persists until the correct tests come out. Remove the wrong ones and the suite is still failing, because the tests for the member just deleted are still sitting there. That is the check doing its work.
- The reverse order is green at every step, because a suite with fewer tests still passes. Removing tests first and the member second reports nothing at either commit, whether or not the right tests were taken.
- It is silent exactly where it matters most. Take a member that never had tests of its own. Remove tests first, take another member's by mistake, then remove the member: both commits pass, the other member is now uncovered, and nothing anywhere said so. There was no red to go missing, because there was never a test to turn red.
A test that holds a ceiling
A byte budget, a size limit, a threshold recorded per file: which side goes first follows from the same rule. Raising the ceiling first turns nothing red, because nothing is over it yet. So the change it guards
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the hoc-git-commit-order skill do?
The order commits land in once the work has been split: which of a test and the change it checks goes first, and how the rest of a branch is sequenced. Use when deciding which commit comes first, when tests and implementation change together, or when something is removed or a limit is lowered. What belongs in a single commit belongs to the git commit convention; which test cases fail against the old code, to the Jest convention.
How do I install the hoc-git-commit-order skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the hoc-git-commit-order skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…