Agent skill

Git Facade Test Conventions

by ruby-git in ruby-git/ruby-git

Conventions for writing and reviewing unit and integration tests of Git::Repository facade methods in the ruby-git project, covering setup, cases, grouping and scope.

MITAuto-check passedTesting & QA

Install Git Facade Test Conventions

skills CLI
$ npx skills add ruby-git/ruby-git --skill facade-test-conventions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ruby-git/ruby-git facade-test-conventions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ruby-git/ruby-git.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/facade-test-conventions .claude/skills/facade-test-conventions && rm -rf skills-src

Use ~/.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/

Facts

Skill name
facade-test-conventions
GitHub stars
1.8k
Token cost
~4.2k tokens
SKILL.md length
1,668 words
Files
1
Skills in repo
30
Repo updated
First seen
Licence
MIT

At a glance

Conventions for writing and reviewing unit and integration tests of Git::Repository facade methods in the ruby-git project, covering setup, cases, grouping and scope.

  • Works in 5 steps: The facade constructs each command class… → Each command's #call is invoked with the… → For multi-command sequences, the calls… → …
  • Scaffolding specs for a new Git::Repository facade module
  • SKILL.md covers Contents, How to use this skill, Related skills and Input, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

This skill sets the conventions for testing the facade methods in the `Git::Repository` modules under `lib/git/repository/`. You attach it to a Copilot Chat session together with the spec files to write or review and, ideally, the matching facade module so that delegation contracts and option forwarding can be checked. It builds on a baseline RSpec unit testing standards skill.

The reference covers unit tests (a setup pattern, the cases to cover, expectations for command invocation, what not to test and how to group examples) and integration tests (when to write them, when to skip them, how to group them, and what they do and do not assert). The output differs for scaffolding new facade tests and for reviewing existing ones. Related skills cover facade implementation, YARD documentation and command-class tests.

When your agent uses it

  • Scaffolding specs for a new Git::Repository facade module
  • Auditing existing facade specs for gaps and over-testing
  • Deciding whether a facade method needs an integration test

Example prompts

  • “Using the facade test conventions, scaffold tests for Git::Repository::Staging.”
  • “Review spec/unit/git/repository/committing_spec.rb against the facade test conventions.”
  • “Does the Committing facade need an integration spec for the new amend option, or do unit tests cover it?”

Requirements

  • The ruby-git repository with its RSpec suite
  • The RSpec Unit Testing Standards skill

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. The facade constructs each command class with the injected
  2. Each command's #call is invoked with the expected positional and keyword
  3. For multi-command sequences, the calls happen in the documented order.
  4. The parser/result-class is invoked with the command's stdout (when applicable).
  5. The facade returns the value its public contract documents.

What it can do on your machine

Read from SKILL.md and the folder at commit f3bf20f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are ruby).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Git Facade Test Conventions loads about 4.2k tokens when it runs. Until then it costs about 73 tokens; SKILL.md has 1,668 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~4.2k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from ruby-git/ruby-git at commit f3bf20f, republished under its MIT licence (© ruby-git). 1,668 words, ~4,155 tokens.

Download SKILL.mdSave it as .claude/skills/facade-test-conventions/SKILL.md (or your agent's skills folder).
name
facade-test-conventions
description
Conventions for writing and reviewing unit and integration tests for Git::Repository facade methods (modules under lib/git/repository/). Use when scaffolding new facade tests or auditing existing ones in spec/unit/git/repository/ and spec/integration/git/repository/.

Facade Test Conventions

Conventions for writing and reviewing unit and integration tests for facade methods on Git::Repository::* modules.

Contents

How to use this skill

Attach this file to your Copilot Chat context, then invoke with the spec file(s) to write or review. Include the corresponding facade module for context. Examples:

text
Using the Facade Test Conventions skill, scaffold tests for Git::Repository::Staging.
text
Facade Test Conventions review: spec/unit/git/repository/committing_spec.rb.

Input

The invocation needs the unit and/or integration spec file(s) to review. Including the corresponding facade module file (lib/git/repository/<topic>.rb) provides useful context for verifying delegation contracts and option forwarding.

Prerequisite: Read the entire RSpec Unit Testing Standards skill (line 1 through EOF) before beginning. It defines the baseline Rules 1–28 that this skill extends.

Reference

Unit tests

Facade unit tests verify the orchestration contract between the facade method and the components it calls (Git::Commands::*, Git::Parsers::*, Git::ExecutionContext::Repository). They do not run real git.

The collaborators (commands, parsers) are stubbed via instance_double. The unit test asserts:

  1. The facade constructs each command class with the injected @execution_context.
  2. Each command's #call is invoked with the expected positional and keyword arguments (verifying argument pre-processing).
  3. For multi-command sequences, the calls happen in the documented order.
  4. The parser/result-class is invoked with the command's stdout (when applicable).
  5. The facade returns the value its public contract documents.
Setup pattern
ruby
RSpec.describe Git::Repository::Staging do
  let(:execution_context) { instance_double(Git::ExecutionContext::Repository) }
  let(:described_instance) { Git::Repository.new(execution_context: execution_context) }
  let(:command_result) { instance_double(Git::CommandLine::Result, stdout: '') }
  let(:add_command) { instance_double(Git::Commands::Add) }
  let(:add_result) { command_result }

  before do
    allow(Git::Commands::Add).to receive(:new).with(execution_context).and_return(add_command)
  end

  describe '#add' do
    # ...
  end
end

The shared command_result let provides a default empty-stdout result; each per-command alias (add_result, branch_list_result, ...) lets individual tests override stdout in isolation — e.g. let(:add_result) { instance_double(Git::CommandLine::Result, stdout: 'fixture output') } in a nested context — without affecting other tests in the file.

Setup invariants:

  • The subject is an instance of Git::Repository, not the module itself. Modules are mixed into the class; tests must exercise the class to reflect real call sites.
  • execution_context is an instance_double(Git::ExecutionContext::Repository) — never a double('ExecutionContext'). The one exception is a facade whose behavior under test is deriving a new context (dup_with): there a real Git::ExecutionContext::Repository is allowed because it is a value object with no disk access, and a stub of dup_with would re-implement it. Say so in a comment on the let.
  • Each command class is stubbed with allow(Klass).to receive(:new).with(execution_context).and_return(...) so the facade's command construction (with the right execution context) is verified by the stub.
Cover these cases
  • Default invocation — facade called with no arguments (or only required positional args) delegates with the documented defaults. Assert the return value once per facade method to verify pass-through.
  • Each positional argument variation — single value, array, nil where applicable.
  • Each option the facade exposes — including aliases, deprecated keys, and policy defaults the facade applies (no_edit: true, etc.).
  • Multi-command sequences — when the facade calls more than one command, use expect ... receive(:call).with(...).ordered to assert ordering and intermediate-result wiring.
  • Parser invocation — when the facade uses a Git::Parsers::* class, stub the parser and assert it is called with the command's stdout. Assert the facade returns what the parser returned.
  • Raw Git::CommandLine::Result return — when the facade's contract is to return the command's Git::CommandLine::Result directly (not .stdout and not a parser output), assert eq(<command>_result) to verify pass-through.
  • Option whitelisting — when the facade defines a <METHOD>_ALLOWED_OPTS constant and calls Git::Repository::Internal.assert_valid_opts!, test that an unknown key raises ArgumentError and a known key is forwarded.
  • Deprecation handling — when the facade rewrites or warns on deprecated keys, test that the deprecation warning is emitted and the new key is forwarded.
  • Signature compatibility call shapes — when a facade method preserves a legacy public contract, include tests for each call shape the 4.x public API used (positional hash and/or keyword-arg / **opts where applicable).
Expectations for command invocation

Use the standard rspec-mocks form (no command-specific helper exists for the facade layer):

ruby
it 'delegates to Git::Commands::Add#call with the given path' do
  expect(add_command).to receive(:call).with('path/to/file.rb').and_return(add_result)
  described_instance.add('path/to/file.rb')
end

For command + parser orchestration (single command whose stdout is fed to a parser), use .ordered to assert the call sequence:

ruby
it 'lists branches then parses the output' do
  expect(branch_list_command).to(
    receive(:call)
        .with(all: true, format: Git::Parsers::Branch::FORMAT_STRING)
        .and_return(branch_list_result)
        .ordered
  )

  expect(Git::Parsers::Branch).to(
    receive(:parse_list)
        .with(branch_list_result.stdout)
        .and_return(parsed_branches)
        .ordered
  )

  expect(described_instance.branch_list).to eq(parsed_branches)
end

For genuinely multi-command orchestration (the facade calls more than one command), chain .ordered across each command's #call, wiring intermediate results through as needed:

ruby
it 'saves the stash then lists stashes' do
  expect(stash_save_command).to(
    receive(:call).with(message: 'wip').and_return(stash_save_result).ordered
  )

  expect(stash_list_command).to(
    receive(:call).and_return(stash_list_result).ordered
  )

  expect(described_instance.stash_save_and_list(message: 'wip')).to eq(parsed_stashes)
end
What not to test
  • Command argv building. That is the command class's contract and is covered by spec/unit/git/commands/<command>_spec.rb. The facade unit test should stub #call and assert the keyword arguments the facade passes — not assert on the CLI tokens that reach git.
  • Parser internals. Stub the parser class method and assert the facade calls it with the right input. Parser parsing is covered by spec/unit/git/parsers/.
  • Real command execution. Facade unit tests must not run commands through Git::ExecutionContext::Repository. Use instance_double, except for the derived-context case named under "Setup invariants".
  • Multiple input strings exercising the same code path — one test per argument type is sufficient (string vs. array vs. nil), not one per value.
  • #initialize of the facade module. The module is mixed into Git::Repository; constructor coverage belongs to repository_spec.rb.
Unit test grouping

One describe '#<method_name>' block per facade method. Inside, use flat context blocks per argument variation. Optional sections at the end (in order) when present:

  • context 'option whitelisting' — Git::Repository::Internal.assert_valid_opts! raises on unknown keys and forwards known keys unchanged (no slice — the assertion is the only enforcement mechanism)
  • context 'deprecation handling' — Git::Deprecation.warn assertions and key-rewrite tests
  • context 'input validation' — ArgumentError raised by the facade itself (not by the command)
  • context 'signature compatibility' — for legacy-contract methods, exercises required call shapes (legacy positional hash and/or keyword-arg / **opts forms)

The exit code section that command specs use does not apply to facade specs — exit-status handling is the command's concern; the facade's tests assume the command either returns a result or raises.

Show full SKILL.md (675 more words)Show less
Integration tests

Facade integration tests run real git in a temp repository and verify the end-to-end Ruby return value of the facade method.

Each integration spec file tests one facade module (one spec/integration/git/repository/<topic>_spec.rb). Inside, group by facade method.

When to write integration tests

Facade integration tests are the exception, not the default. Most facade behavior is already covered end-to-end by the underlying command's own integration tests; re-running real git through the facade re-exercises the same code path without adding signal.

Write a facade integration test only when the facade adds behavior that is not exercised by any single command's integration tests:

  • Multi-command orchestration — the facade calls more than one command and the integration test confirms the documented end-to-end value emerges from the sequence against real git.
  • Facade-owned post-processing of real git output — the facade itself (not the command) parses, aggregates, or transforms raw command output before returning. A real git invocation proves the post-processing handles actual output rather than a mocked string.
When to skip integration tests

Skip for everything else, including:

  • One-line delegators that pass arguments through to a single command with no pre/post-processing (e.g. Git::Repository::Staging#add, #reset).
  • Single-command facade methods that delegate parsing to a parser or result-class factory — the command's own integration test already exercises that command + parser against real git.
  • Argument pre-processing (path normalization, deprecation key rewrites, option whitelisting) — these are pure-Ruby transforms with no git involvement; unit tests prove them and real git adds no signal.
  • Error-path assertions (raise_error(Git::FailedError)) — these test the command's error wrapping, not the facade.

When skipping, document why with a code comment in the spec file or a # header in spec/integration/git/repository/<topic>_spec.rb explaining which methods are covered exclusively by command integration tests.

Integration test grouping

Mirror the Command Test Conventions integration grouping. Use a multi-command or post-processing facade method — single-command delegators do not warrant integration tests (see When to skip integration tests):

The shared context (e.g. 'in an empty repository') provides repo, repo_dir, and execution_context helpers. Stage any required repository state in a before block inside the spec itself.

ruby
RSpec.describe Git::Repository::Stashing, :integration do
  include_context 'in an empty repository' # provides repo, repo_dir, and execution_context helpers

  let(:described_instance) { Git::Repository.new(execution_context: execution_context) }

  before do
    write_file('README.md', 'initial')
    repo.add('README.md')
    repo.commit('Initial commit')
    write_file('README.md', 'work in progress')
    repo.add('README.md')
  end

  describe '#stash_save_and_list' do
    it 'returns the new stash entry after saving' do
      result = described_instance.stash_save_and_list(message: 'wip')
      expect(result).to all(be_a(Git::StashInfo))
      expect(result.first.message).to include('wip')
    end
  end
end

One context 'when the command succeeds' block (or just it blocks directly under describe) per facade method, with one or more variations that exercise the orchestration sequence or post-processing. Do not add a context 'when the command fails' block — error wrapping is the command's concern and is covered by command integration tests.

What integration tests assert
  • The Ruby return value's structure and key fields (e.g., classes, required attributes, presence of expected entries).
  • Multi-command orchestration produces the documented end-to-end value, not intermediate command results.
  • For signature-compatibility behavior that is user-visible at runtime, integration coverage may assert that legacy call shapes are accepted.
Review checks for signature policy

When reviewing existing facade tests, add these checks:

  1. If the method is legacy-contract, unit tests cover required call shapes.
  2. Test expectations validate public contract behavior, not only command delegation internals.
What integration tests do not assert
  • Specific CLI tokens reaching git (covered by command unit tests).
  • Specific git output formatting (testing git, not the facade).
  • Edge cases that vary between git versions in immaterial ways. Anchor assertions on stable inputs (paths, ref names) the test controls — not on git message phrasing.

Workflow

  1. Load the RSpec Unit Testing Standards skill (line 1 through EOF).
  2. Read the spec file(s) under review and the corresponding facade module (lib/git/repository/<topic>.rb) plus the underlying Git::Commands::* and Git::Parsers::* files the facade calls.
  3. Audit each spec against the rules in Reference, checking unit and integration tests separately.
  4. Produce the Output.

Output

When writing new facade tests

Produce the unit and (when applicable) integration spec files following the patterns above. Then self-verify by running every checklist item in the Reference section against your output.

When reviewing existing facade tests

Provide:

  1. issue table

    CheckStatusIssue
  2. corrected snippets for failing checks

  3. Self-verify before concluding — re-run the reference against your proposed snippets until all checks pass.

Branch workflow: Implement any new or updated tests on a feature branch. Never commit or push directly to main — open a pull request when changes are ready to merge.

© 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

Files

Just SKILL.md in .github/skills/facade-test-conventions of ruby-git/ruby-git.

Open the folder on GitHubat commit f3bf20f

Compare with similar skills

Git Facade Test Conventions 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.

Git Facade Test Conventions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Git Facade Test Conventions this skillruby-git/ruby-git1.8k—~4.2kAutomated safety check: PassMIT
OpenROAD Module Test AdderThe-OpenROAD-Project/OpenROAD3.2k—~1.8kAutomated safety check: PassBSD-3-Clause
Write Testsgrafana/synthetic-monitoring-app171—~1.2kAutomated safety check: PassAGPL-3.0
Write Test389ds/389-ds-base294—~1.8kAutomated safety check: PassCustom licence
Web3 Testingwshobson/agents40k11 repos~2kAutomated safety check: PassMIT
Verify Changesh0x91b/dev-3.0307—~1.7kAutomated safety check: PassApache-2.0

Similar skills

  • OpenROAD Module Test Adder

    The-OpenROAD-Project/OpenROAD

    Adds integration or unit tests to an OpenROAD module: writes the Tcl test, generates golden files and registers it in both CMake and Bazel.

    3.2k GitHub stars~1.8k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Write Tests

    grafana/synthetic-monitoring-app

    Official

    Write Jest integration and unit tests for the Grafana Synthetic Monitoring app using React Testing Library, MSW, and src/test helpers.

    171 GitHub stars~1.2k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Write Test

    389ds/389-ds-base

    Add or extend a pytest integration test for 389 Directory Server under dirsrvtests/.

    294 GitHub stars~1.8k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Web3 Testing

    wshobson/agents

    Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking.

    40k GitHub starsUsed in 11 repos~2k tokens
    Testing & QAAuto-check passed
  • Verify Changes

    h0x91b/dev-3.0

    How to test and verify work in the dev-3.0 repo — which vitest config covers what, how to write a test that fits the house style, mocking Electrobun RPC and i18n providers, what coverage is actually…

    307 GitHub stars~1.7k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Testing Guide

    fullstackhero/dotnet-starter-kit

    Write tests for an FSH feature — xUnit + Shouldly + NSubstitute + AutoFixture, with naming and AAA conventions.

    6.8k GitHub stars~935 tokensUpdated 7 days ago
    Testing & QAAuto-check passed

More from ruby-git/ruby-git

All 30 skills in this repo
  • Addresses unresolved pull request review threads and suppressed (low-confidence) Copilot review comments on the current branch, folds each fix into the…

    1.8k GitHub stars~657 tokensUpdated 6 days ago
    Auto-check passed
  • Breaking Change Analysis

    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.

    1.8k GitHub stars~1.7k tokensUpdated 6 days ago
    Auto-check passed
  • Diagnoses and fixes failing GitHub Actions runs by identifying the failure, fetching only the relevant logs, finding the root cause and reproducing it locally.

    1.8k GitHub stars~1.9k tokensUpdated 6 days ago
    Auto-check passed
  • Scaffolds and reviews `Git::Commands::*` classes in the ruby-git library, with unit tests, integration tests and YARD docs, using the Base command architecture.

    1.8k GitHub stars~3k tokensUpdated 6 days ago
    Auto-check passed
  • Gem Dependency Management

    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.

    1.8k GitHub stars~806 tokensUpdated 6 days ago
    Auto-check passed
  • 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.

    1.8k GitHub stars~4.4k tokensUpdated 6 days ago
    Auto-check passed

Works with

Categories

Questions about Git Facade Test Conventions

What does Git Facade Test Conventions do?

Conventions for writing and reviewing unit and integration tests of Git::Repository facade methods in the ruby-git project, covering setup, cases, grouping and scope. This skill sets the conventions for testing the facade methods in the `Git::Repository` modules under `lib/git/repository/`. You attach it to a Copilot Chat session together with the spec files to write or review and, ideally, the matching facade module so that delegation contracts and option forwarding can be checked.

When should I use Git Facade Test Conventions?

Git Facade Test Conventions fits situations like: scaffolding specs for a new Git::Repository facade module; auditing existing facade specs for gaps and over-testing; deciding whether a facade method needs an integration test.

How do I install Git Facade Test Conventions in Claude Code?

Run `npx skills add ruby-git/ruby-git --skill facade-test-conventions -a claude-code`. Or copy the skill folder (.github/skills/facade-test-conventions in ruby-git/ruby-git) into .claude/skills/facade-test-conventions in your project. Claude Code loads it when a task matches its description.

How do I install Git Facade Test Conventions in Codex?

Run `npx skills add ruby-git/ruby-git --skill facade-test-conventions -a codex`. Or copy the skill folder (.github/skills/facade-test-conventions in ruby-git/ruby-git) into .agents/skills/facade-test-conventions in your project. Codex loads it when a task matches its description.

Can I use Git Facade Test Conventions in Cursor, Gemini CLI or GitHub Copilot?

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 facade-test-conventions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/facade-test-conventions, .gemini/skills/facade-test-conventions, .github/skills/facade-test-conventions and .opencode/skills/facade-test-conventions in your project.

What does Git Facade Test Conventions need to run?

SKILL.md names no scripts, command-line tools or credentials: Git Facade Test Conventions is instructions for the agent only. Our summary lists: The ruby-git repository with its RSpec suite; The RSpec Unit Testing Standards skill.

Does Git Facade Test Conventions access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Git Facade Test Conventions safe to install?

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.

What licence does Git Facade Test Conventions use?

Git Facade Test Conventions is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Git Facade Test Conventions use?

About 4.2k tokens (SKILL.md is roughly 17k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Git Facade Test Conventions?

Skills that share tags, products or a category with Git Facade Test Conventions: OpenROAD Module Test Adder (The-OpenROAD-Project/OpenROAD, 3.2k stars), Write Tests (grafana/synthetic-monitoring-app, 171 stars), Write Test (389ds/389-ds-base, 294 stars) and Web3 Testing (wshobson/agents, 40k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Git Facade Test Conventions?

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.