Skill Writing
millionco/expect
Write and improve agent skills (SKILL.md files). An agent skill from millionco/expect.
Guides the REFACTOR step of the TDD cycle — identifying code smells, applying safe refactoring techniques, cleaning test code, and verifying with rubocop.
$ npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ruby-git/ruby-git tdd-refactor-step --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/ruby-git/ruby-git.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/tdd-refactor-step .claude/skills/tdd-refactor-step && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "tdd-refactor-step" agent skill from https://github.com/ruby-git/ruby-git/tree/main/.github/skills/tdd-refactor-step into .claude/skills/tdd-refactor-step/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "tdd-refactor-step", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/ruby-git/ruby-git/tree/main/.github/skills/tdd-refactor-stepType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ruby-git/ruby-git tdd-refactor-step --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ruby-git/ruby-git.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.github/skills/tdd-refactor-step .agents/skills/tdd-refactor-step && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "tdd-refactor-step" agent skill from https://github.com/ruby-git/ruby-git/tree/main/.github/skills/tdd-refactor-step into .agents/skills/tdd-refactor-step/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "tdd-refactor-step", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ruby-git/ruby-git tdd-refactor-step --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ruby-git/ruby-git.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.github/skills/tdd-refactor-step .cursor/skills/tdd-refactor-step && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "tdd-refactor-step" agent skill from https://github.com/ruby-git/ruby-git/tree/main/.github/skills/tdd-refactor-step into .cursor/skills/tdd-refactor-step/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "tdd-refactor-step", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/ruby-git/ruby-git.git --path .github/skills/tdd-refactor-step--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ruby-git/ruby-git tdd-refactor-step --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ruby-git/ruby-git.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.github/skills/tdd-refactor-step .gemini/skills/tdd-refactor-step && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "tdd-refactor-step" agent skill from https://github.com/ruby-git/ruby-git/tree/main/.github/skills/tdd-refactor-step into .gemini/skills/tdd-refactor-step/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "tdd-refactor-step", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install ruby-git/ruby-git tdd-refactor-stepInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/ruby-git/ruby-git.git skills-src && mkdir -p .github/skills && cp -r skills-src/.github/skills/tdd-refactor-step .github/skills/tdd-refactor-step && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "tdd-refactor-step" agent skill from https://github.com/ruby-git/ruby-git/tree/main/.github/skills/tdd-refactor-step into .github/skills/tdd-refactor-step/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "tdd-refactor-step", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install ruby-git/ruby-git tdd-refactor-step --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ruby-git/ruby-git.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.github/skills/tdd-refactor-step .opencode/skills/tdd-refactor-step && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "tdd-refactor-step" agent skill from https://github.com/ruby-git/ruby-git/tree/main/.github/skills/tdd-refactor-step into .opencode/skills/tdd-refactor-step/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "tdd-refactor-step", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
tdd-refactor-stepGuides the REFACTOR step of the TDD cycle — identifying code smells, applying safe refactoring techniques, cleaning test code, and verifying with rubocop.
TDD Refactor Step is an agent skill from ruby-git/ruby-git. Guides the REFACTOR step of the TDD cycle — identifying code smells, applying safe refactoring techniques, cleaning test code, and verifying with rubocop. Use during RED-GREEN-REFACTOR when deciding what and how to refactor after making a test pass.
Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Refactoring and Test-driven development. The repository describes itself as: Ruby/Git is a Ruby library that can be used to create, read and manipulate Git repositories by wrapping system calls to the git binary. The licence is MIT.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit f3bf20f. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
bundlegitFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
TDD Refactor Step loads about 2k tokens when it runs. Until then it costs about 67 tokens; SKILL.md has 789 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from ruby-git/ruby-git at commit f3bf20f, republished under its MIT licence (© ruby-git). 789 words, ~1,960 tokens.
.claude/skills/tdd-refactor-step/SKILL.md (or your agent's skills folder).Concrete guidance for the REFACTOR step of the RED-GREEN-REFACTOR cycle. Covers code smells to look for, safe refactoring techniques, test code cleanup, rubocop integration, and verification.
Invoke this skill during the REFACTOR step of the TDD cycle, after GREEN (all tests pass). This skill expands the guidance in the Development Workflow REFACTOR step.
Typical invocation:
I just got to green. Walk me through the REFACTOR step using
the TDD Refactor Step skill.Not every GREEN step needs refactoring. Skip when all of the following are true:
If any condition is false, proceed with the relevant technique below.
Check the code written or modified in this task for these smells, in priority order:
| # | Smell | Threshold | Action |
|---|---|---|---|
| 1 | Hardcoded values from GREEN step | Any | Generalize to actual logic |
| 2 | Duplication between new code and existing code | ≥ 3 similar lines | Extract shared method or constant |
| 3 | Long method | > 10 lines (body) | Extract private helper |
| 4 | Long parameter list | > 3 positional params | Convert trailing params to keyword arguments |
| 5 | Inconsistent naming | Deviates from file/module conventions | Rename to match existing patterns |
| 6 | Deeply nested conditionals | > 2 levels | Extract guard clause or helper |
| 7 | Feature envy | Method uses another object's data more than its own | Move method or extract delegator |
| 8 | Dead code | Unreachable branches, unused variables | Remove |
Limit yourself to smells in files you touched this task. Broader cleanup belongs in a separate task (add it during REPLAN).
Apply the simplest technique that resolves the smell:
Split a long method into a public method and one or more private helpers. Name the helper after what it does, not how:
# Before
def call(*, **)
bound = args_definition.bind(*, **)
objects = Array(bound.object).map { |o| "#{o}\n" }.join
with_stdin(objects) { |r| run_batch(bound, r) }
end
# After
def call(*, **)
bound = args_definition.bind(*, **)
with_stdin(stdin_content(bound)) { |r| run_batch(bound, r) }
end
private
def stdin_content(bound)
Array(bound.object).map { |o| "#{o}\n" }.join
endWhen a method accumulates optional trailing positional parameters:
# Before
def initialize(args, options, positionals, exec_names = [], flags = [])
# After
def initialize(args, options, positionals, exec_names: [], flags: [])Update the single call site at the same time.
# Before
def validate(value)
if value
if value.is_a?(String)
process(value)
end
end
end
# After
def validate(value)
return unless value
return unless value.is_a?(String)
process(value)
endWhen a magic value appears in logic:
# Before
raise error if version < Git::Version.parse('2.43.0')
# After
MINIMUM_GIT_VERSION = Git::Version.parse('2.43.0')
raise error if version < MINIMUM_GIT_VERSIONWhen two methods share identical preamble or teardown, extract the shared part. If the duplication is in tests, see Test Code Refactoring below.
Test code deserves the same refactoring attention as production code:
| Smell | Technique |
|---|---|
Duplicated let/before across contexts | Move to nearest shared describe or context |
| Long example bodies (> 5 lines of setup) | Extract to let declarations or before block |
| Repeated literal values | Extract to let or constant at top of file |
| Identical examples across files | Extract to shared example group (shared_examples) |
| Unclear example descriptions | Rewrite to state expected behavior, not implementation |
Follow the RSpec Unit Testing Standards for the resulting test structure.
Run rubocop on changed files after refactoring:
bundle exec rubocop $(git diff --name-only HEAD)Focus on:
Metrics/MethodLength — methods over the configured limitMetrics/ParameterLists — too many parametersMetrics/AbcSize — complexity thresholdStyle cops — naming, formatting consistencyAuto-correct safe offenses when appropriate:
bundle exec rubocop -a $(git diff --name-only HEAD)Do not auto-correct Metrics cops — those require structural changes (extract
method, split class), not formatting fixes.
After refactoring, confirm:
bundle exec rspec <spec_file> for the current task's
test file(s)bundle exec rubocop $(git diff --name-only HEAD)If any test fails after refactoring, the refactoring changed behavior. Revert and try a smaller change.
Patterns specific to this codebase that the REFACTOR step should enforce:
Bound metadata uses keyword arguments — if adding new
metadata fields, follow the keyword argument patternGit::Error — ensure new errors follow the
hierarchy in lib/git/errors.rbfreeze constants — all new constants should be frozen
(CONSTANT = value.freeze)private keyword, not inline
private defThings the REFACTOR step must not do:
© ruby-git, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .github/skills/tdd-refactor-step of ruby-git/ruby-git.
Open the folder on GitHubat commit f3bf20f
TDD Refactor Step next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| TDD Refactor Step this skillruby-git/ruby-git | 1.8k | — | ~2k | Automated safety check: Pass | MIT | |
| Skill Writingmillionco/expect | 3.6k | — | ~1.8k | Automated safety check: Pass | Custom licence | |
| Go Rigmudrii/openclaw-dashboard | 457 | — | ~2.8k | Automated safety check: Pass | MIT | |
| Go Rigmudrii/openclaw-dashboard | 457 | — | ~682 | Automated safety check: Pass | MIT | |
| Py Rigmudrii/hermesd | 119 | — | ~6.3k | Automated safety check: Pass | MIT | |
| Happier Implementhappier-dev/happier | 1.9k | — | ~4.2k | Automated safety check: Pass | MIT |
millionco/expect
Write and improve agent skills (SKILL.md files). An agent skill from millionco/expect.
mudrii/openclaw-dashboard
A skill your agent uses when building, reviewing, or refactoring Go code that must follow strict design discipline — ATDD/TDD workflow, explicit dependency injection, package-boundary discipline…
mudrii/openclaw-dashboard
A skill your agent uses when building, reviewing, or refactoring Go code in this repository.
mudrii/hermesd
A skill your agent uses when building, reviewing, or refactoring Python code that requires strong maintainability discipline: SRP, DRY, OCP, explicit dependency injection, TDD/ATDD workflow, strict…
happier-dev/happier
Implement, change, build, fix, refactor, migrate, or apply accepted review findings in the Happier repositories with canonical-owner discovery, scope-preserving solution economy, TDD, efficient…
KaimingWan/oh-my-kiro
Enforces coding best practices: deep-read before modify, LSP-first navigation, TDD red-green-refactor, minimal changes, self-review, verification.
ruby-git/ruby-git
Addresses unresolved pull request review threads and suppressed (low-confidence) Copilot review comments on the current branch, folds each fix into the…
ruby-git/ruby-git
Assesses what an API change would break before it is made, finds every usage, documents the impact and plans a deprecation or migration path.
ruby-git/ruby-git
Diagnoses and fixes failing GitHub Actions runs by identifying the failure, fetching only the relevant logs, finding the root cause and reproducing it locally.
ruby-git/ruby-git
Scaffolds and reviews `Git::Commands::*` classes in the ruby-git library, with unit tests, integration tests and YARD docs, using the Base command architecture.
ruby-git/ruby-git
Workflow for updating gem dependencies and fixing CVEs in the ruby-git project: assess with bundle outdated and audit, edit the gemspec, test, then commit with conventional messages.
ruby-git/ruby-git
Migrates a direct command call in Ruby Git's Git::Lib to a Git::Commands class, as part of a Strangler Fig redesign, with a plan, legacy tests and a pull request.
Categories
Guides the REFACTOR step of the TDD cycle — identifying code smells, applying safe refactoring techniques, cleaning test code, and verifying with rubocop. TDD Refactor Step is an agent skill from ruby-git/ruby-git. Guides the REFACTOR step of the TDD cycle — identifying code smells, applying safe refactoring techniques, cleaning test code, and verifying with rubocop.
TDD Refactor Step fits situations like: tasks that involve Refactoring; tasks that involve Test-driven development.
Run `npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a claude-code`. Or copy the skill folder (.github/skills/tdd-refactor-step in ruby-git/ruby-git) into .claude/skills/tdd-refactor-step in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a codex`. Or copy the skill folder (.github/skills/tdd-refactor-step in ruby-git/ruby-git) into .agents/skills/tdd-refactor-step in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ruby-git/ruby-git --skill tdd-refactor-step -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/tdd-refactor-step, .gemini/skills/tdd-refactor-step, .github/skills/tdd-refactor-step and .opencode/skills/tdd-refactor-step in your project.
Going by SKILL.md and its folder, TDD Refactor Step needs the command-line tools its instructions call (bundle and git).
SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
TDD Refactor Step is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2k tokens (SKILL.md is roughly 7.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with TDD Refactor Step: Skill Writing (millionco/expect, 3.6k stars), Go Rig (mudrii/openclaw-dashboard, 457 stars), Go Rig (mudrii/openclaw-dashboard, 457 stars) and Py Rig (mudrii/hermesd, 119 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
ruby-git (a GitHub organization) maintains it in ruby-git/ruby-git, which has 1,799 GitHub stars. The repository holds 30 skills in this directory. The repository was last updated on October 2, 2026.
Source: ruby-git/ruby-git on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.