Guidelines
akash-network/node
Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.
Preserve observable behavior when splitting files, moving members, consolidating helpers, or simplifying TestFx code.
$ npx skills add microsoft/testfx --skill behavior-preserving-refactor -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install microsoft/testfx behavior-preserving-refactor --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/microsoft/testfx.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/behavior-preserving-refactor .claude/skills/behavior-preserving-refactor && 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 "behavior-preserving-refactor" agent skill from https://github.com/microsoft/testfx/tree/main/.github/skills/behavior-preserving-refactor into .claude/skills/behavior-preserving-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "behavior-preserving-refactor", 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/microsoft/testfx/tree/main/.github/skills/behavior-preserving-refactorType 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 microsoft/testfx --skill behavior-preserving-refactor -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install microsoft/testfx behavior-preserving-refactor --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/microsoft/testfx.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.github/skills/behavior-preserving-refactor .agents/skills/behavior-preserving-refactor && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "behavior-preserving-refactor" agent skill from https://github.com/microsoft/testfx/tree/main/.github/skills/behavior-preserving-refactor into .agents/skills/behavior-preserving-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "behavior-preserving-refactor", 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 microsoft/testfx --skill behavior-preserving-refactor -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install microsoft/testfx behavior-preserving-refactor --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/microsoft/testfx.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.github/skills/behavior-preserving-refactor .cursor/skills/behavior-preserving-refactor && 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 "behavior-preserving-refactor" agent skill from https://github.com/microsoft/testfx/tree/main/.github/skills/behavior-preserving-refactor into .cursor/skills/behavior-preserving-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "behavior-preserving-refactor", 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/microsoft/testfx.git --path .github/skills/behavior-preserving-refactor--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 microsoft/testfx --skill behavior-preserving-refactor -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install microsoft/testfx behavior-preserving-refactor --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/microsoft/testfx.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.github/skills/behavior-preserving-refactor .gemini/skills/behavior-preserving-refactor && 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 "behavior-preserving-refactor" agent skill from https://github.com/microsoft/testfx/tree/main/.github/skills/behavior-preserving-refactor into .gemini/skills/behavior-preserving-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "behavior-preserving-refactor", 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 microsoft/testfx behavior-preserving-refactorInstalls 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 microsoft/testfx --skill behavior-preserving-refactor -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/microsoft/testfx.git skills-src && mkdir -p .github/skills && cp -r skills-src/.github/skills/behavior-preserving-refactor .github/skills/behavior-preserving-refactor && 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 "behavior-preserving-refactor" agent skill from https://github.com/microsoft/testfx/tree/main/.github/skills/behavior-preserving-refactor into .github/skills/behavior-preserving-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "behavior-preserving-refactor", 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 microsoft/testfx --skill behavior-preserving-refactor -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install microsoft/testfx behavior-preserving-refactor --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/microsoft/testfx.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.github/skills/behavior-preserving-refactor .opencode/skills/behavior-preserving-refactor && 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 "behavior-preserving-refactor" agent skill from https://github.com/microsoft/testfx/tree/main/.github/skills/behavior-preserving-refactor into .opencode/skills/behavior-preserving-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "behavior-preserving-refactor", 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.
behavior-preserving-refactorPreserve observable behavior when splitting files, moving members, consolidating helpers, or simplifying TestFx code.
Behavior Preserving Refactor is an agent skill from microsoft/testfx, published by the product's own GitHub organization. Preserve observable behavior when splitting files, moving members, consolidating helpers, or simplifying TestFx code. Use for structural refactors and file-diet implementation; inventory baseline semantics and consumers, then run focused equivalence checks.
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. The repository describes itself as: This repository holds the source code of Microsoft.Testing.Platform (MTP), a lightweight alternative to VSTest, as well as MSTest adapter and framework. The licence is MIT.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 19d717a. 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.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
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.
Behavior Preserving Refactor loads about 2k tokens when it runs. Until then it costs about 72 tokens; SKILL.md has 1,009 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 microsoft/testfx at commit 19d717a, republished under its MIT licence (© microsoft). 1,009 words, ~1,959 tokens.
.claude/skills/behavior-preserving-refactor/SKILL.md (or your agent's skills folder).Use this recipe for the specific code being refactored, not a repository-wide
audit. Read .github/copilot-instructions.md and applicable directory rules.
Preserve existing behavior, including surprising reachable cases; a bug fix or
modernization needs separate authorization and validation.
An issue-generation workflow's bounded inspection is not implementation preflight. For example, Daily File Diet inspects only the first 100 lines and up to 50 declaration lines of one file. Keep that budget when proposing work, label unverified assumptions, and include this recipe for the later implementer. Do not claim equivalence, tested behavior, or complete consumer coverage from that sample.
Identify the exact methods or declarations to move or extract, their callers, existing focused tests, and owning projects. Read the complete affected bodies and relevant context, not just signatures or similar-looking helpers. For each existing implementation that might share a helper, record:
| Boundary | What must remain unchanged |
|---|---|
| Selection | Iteration order, first versus last match, first matching name versus first matching typed value, exact type tests, casts, defaults, and missing-value handling. |
| Evaluation | Short-circuit operand order, which callbacks run and how often, enumeration count, laziness, mutation, and side effects before return or failure. |
| Results and failures | Return values, diagnostics and locations, output ordering, exception type and timing, cancellation, and cleanup/disposal order where affected. |
| Compilation | Namespaces, accessibility, attributes, overload binding, target-framework guards, and native interop signatures and marshalling. |
| Cost | Allocations, materialization, boxing, repeated scans, and algorithmic complexity on affected hot paths. |
Inventory reachable empty, duplicate, malformed, null, and wrong-type inputs. Do not add support for impossible states, but do not assume compiler or user input is always valid: analyzer inputs can be incomplete or contain errors. Name the existing guard that makes a case unreachable if excluding it. Use existing behavior as the oracle, not the intended behavior of a new helper.
Compile items, shared
source, globs, explicit includes, and packaging rules. Find every consuming
project, including source-only packages; a build of the original owner does
not prove that a new file is included by another consumer.DllImport, change marshalling, or adopt APIs unavailable on older targets.PublicAPI and InternalAPI shipped/unshipped baselines.
Prefer unchanged signatures and accessibility; do not expose a helper just
to share it. Record required newly tracked declarations without rewriting
shipped API history.Move existing bodies unchanged first, preserving attributes, guards, resource access, and file encoding. Keep unrelated renaming, formatting, LINQ rewrites, interop modernization, new validation, and behavior fixes out of the change.
Before consolidating helpers, compare every caller's baseline. Similar names or happy-path outputs do not establish equivalence. If callers differ in selection, evaluation, or failure behavior, keep separate implementations or use the smallest explicit helper that preserves each contract; do not invent a configurable abstraction merely to eliminate duplication.
Do not replace a loop with a dictionary, eager projection, sort, or single-match operator without proving duplicate handling, enumeration, and failure behavior. On hot paths, preserve allocation and complexity characteristics. Use existing allocation/performance checks when the extraction could change them; do not introduce a benchmark project for a pure move.
If the size target requires behavior changes or unsafe fragmentation, stop that part of the refactor and report the remaining line count and concrete constraint. Do not alter semantics just to meet a file-size goal.
These are examples to adapt to the actual baseline, not new product semantics:
| Baseline | Focused case | Required observation |
|---|---|---|
| A loop overwrites its result for every matching name. | Matching values 1, then 2. | Result remains 2; returning the first match is not equivalent. |
A loop returns the first matching name whose value is an int. | Same-name string "bad", integer 7, then integer 9. | Result remains 7; taking the first name then casting, or taking the last integer, is not equivalent. |
Exact int type matching. | Same-name long value 7L, followed by int value 8. | Result remains 8; numeric conversion changes type selection. |
ShouldRun() && Execute(). | ShouldRun returns false; Execute records a call or throws. | Only ShouldRun runs; reordering operands or evaluating both eagerly is not equivalent. |
| A guarded interop declaration moves to another file. | Build every source-linked consumer and affected supported TFM/platform path. | Declaration, guards, accessibility, and marshalling remain unchanged; no new runtime API requirement. |
Also cover the actual missing/empty and malformed-only outcomes, not just malformed input followed by a valid value. Assert observable values, diagnostic locations, exception behavior, and ordered side-effect traces where applicable. Pin expectations to the baseline; comparing two paths that both call the new helper is not an equivalence test.
Before editing, run the existing focused checks when feasible and add any necessary distinguishing cases against the original implementation. After the change, rerun the same checks. Explain pre-existing failures or unavailable checks; do not report unrun checks as passed.
Use the repo-local toolchain and documented filtered build/test commands from
.github/copilot-instructions.md. Build the owning and linked consuming
projects for affected target frameworks. Run directly related tests, escalating
only when dependencies or failures justify it. A pure file move needs inclusion
and compilation checks plus relevant existing tests, not the full solution.
If shipping package/source inclusion changes, validate the packed consumer
layout using existing acceptance infrastructure.
Review the final diff for changed expressions, ordering, signatures, attributes, guards, includes, tracked APIs, and unintended adjacent edits. Measure resulting file sizes rather than assuming the split meets its target.
Report the moved/extracted responsibility, baseline invariants and distinguishing cases, affected consumers/TFMs and API surfaces, exact checks and outcomes, and resulting line counts when size is the goal. Identify any remaining uncertainty or blocked target explicitly. Compilation alone does not prove runtime equivalence, and passing happy-path tests does not settle first/last selection or short-circuit behavior.
© microsoft, 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/behavior-preserving-refactor of microsoft/testfx.
Open the folder on GitHubat commit 19d717a
Behavior Preserving Refactor 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 |
|---|---|---|---|---|---|---|
| Behavior Preserving Refactor this skillmicrosoft/testfx | 1k | — | ~2k | Automated safety check: Pass | MIT | |
| Guidelinesakash-network/node | 1.1k | 20 repos | ~577 | Automated safety check: Pass | MIT | |
| Component Refactoringlangflow-ai/langflow | 155k | — | ~3.5k | Automated safety check: Pass | MIT | |
| Migrate Core Code to Submodulestinyhumansai/openhuman | 42k | — | ~2.6k | Automated safety check: Pass | GPL-3.0 | |
| ast-grep Structural Searchcode-yeongyu/oh-my-openagent | 70k | — | ~3.3k | Automated safety check: Pass | MIT | |
| Systematic Code Refactoringluongnv89/claude-howto | 42k | — | ~3k | Automated safety check: Pass | MIT |
akash-network/node
Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.
langflow-ai/langflow
Refactor high-complexity React components in Langflow frontend.
tinyhumansai/openhuman
Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.
code-yeongyu/oh-my-openagent
Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.
luongnv89/claude-howto
Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.
skills-directory/skill-codex
A skill your agent uses when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing
microsoft/testfx
Guide for organizing MSBuild infrastructure with Directory.Build.props, Directory.Build.targets, Directory.Packages.props, and Directory.Build.rsp.
microsoft/testfx
Project-wide code coverage and CRAP (Change Risk Anti-Patterns) score analysis for .NET projects.
microsoft/testfx
Guide for optimizing MSBuild incremental builds. An agent skill from microsoft/testfx.
microsoft/testfx
Validate TestFx shipping paths and capable CI execution using packed consumers, package/cache provenance, exact exits and artifacts, and selected-versus-executed test evidence.
microsoft/testfx
Guide for modernizing and migrating MSBuild project files to SDK-style format.
microsoft/testfx
Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries.
Categories
Preserve observable behavior when splitting files, moving members, consolidating helpers, or simplifying TestFx code. Behavior Preserving Refactor is an agent skill from microsoft/testfx, published by the product's own GitHub organization. Preserve observable behavior when splitting files, moving members, consolidating helpers, or simplifying TestFx code.
Behavior Preserving Refactor fits situations like: structural refactors and file-diet implementation; inventory baseline semantics and consumers; then run focused equivalence checks.
Run `npx skills add microsoft/testfx --skill behavior-preserving-refactor -a claude-code`. Or copy the skill folder (.github/skills/behavior-preserving-refactor in microsoft/testfx) into .claude/skills/behavior-preserving-refactor in your project. Claude Code loads it when a task matches its description.
Run `npx skills add microsoft/testfx --skill behavior-preserving-refactor -a codex`. Or copy the skill folder (.github/skills/behavior-preserving-refactor in microsoft/testfx) into .agents/skills/behavior-preserving-refactor 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 microsoft/testfx --skill behavior-preserving-refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/behavior-preserving-refactor, .gemini/skills/behavior-preserving-refactor, .github/skills/behavior-preserving-refactor and .opencode/skills/behavior-preserving-refactor in your project.
SKILL.md names no scripts, command-line tools or credentials: Behavior Preserving Refactor is instructions for the agent only.
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.
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.
Behavior Preserving Refactor 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 Behavior Preserving Refactor: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 155k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars) and ast-grep Structural Search (code-yeongyu/oh-my-openagent, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
microsoft (a GitHub organization, an official publisher) maintains it in microsoft/testfx, which has 1,047 GitHub stars. The repository holds 50 skills in this directory. The repository was last updated on October 9, 2026.
Source: microsoft/testfx on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.