puchaczov/musoq/refactoring
Claude Code and agent skill by puchaczov/musoq
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Use when refactoring Musoq code for maintainability: compact code, remove duplication, simplify control flow, apply DRY/SOLID, extract reusable abstractions, improve naming, preserve behavior, and run repo validation.
Install
npx vskill@latest install puchaczov/musoq/refactoringSKILL.md
Refactoring
Outcome
Make existing code smaller, clearer, and easier for humans to review and maintain while preserving behavior unless the user explicitly asks for a behavior change.
Workflow
- Establish the scope: identify the target files, module, code smell, constraints, and behavior that must remain unchanged.
- Load
.copilot_session_summary.md,.github/copilot-instructions.md, and the applicable per-project instructions before editing. Check the worktree so unrelated user changes are preserved. - Read the surrounding code before deciding on a design. Find existing patterns, call sites, tests, and duplicate implementations.
- Map the maintainability problem in concrete terms: duplication, long methods, nested control flow, unclear naming, magic values, dead code, leaky abstractions, mutable state, or oversized responsibilities.
- Choose the smallest refactoring that improves the code at the root cause. Prefer local simplification over new abstractions unless the abstraction removes real duplication or matches an established project pattern.
- Edit in small behavior-preserving steps. Keep the diff focused on the requested area and avoid opportunistic rewrites outside the scope.
- Validate with the narrowest relevant tests first, then run the broader validation required by the repository instructions.
- Re-read
.github/copilot-instructions.mdand verify the modified code follows the repository rules before final validation. - Self-review the diff for readability, duplication, SOLID/DRY fit, naming, control flow, public contract safety, and unnecessary churn.
- Report what changed, how behavior was protected, and any remaining risks or follow-up candidates.
Decision Points
- If the requested refactor would change public APIs, serialized shapes, generated output contracts, or user-visible behavior, ask before making that change.
- If two code blocks look similar but represent different domain concepts, keep them separate or extract only the truly shared primitive.
- If duplication appears for the second time in the same change, extract a method, type, or reusable data structure instead of copying again.
- If a method mixes distinct responsibilities, split it along the natural behavior boundaries rather than introducing flags or boolean parameters.
- If a new abstraction has only one use and does not clarify a boundary, inline or simplify instead.
- If performance optimization becomes part of the refactor, establish a baseline before changing performance-sensitive code and compare after.
- If tests are already failing, determine whether the failures are related to the refactor before treating them as blockers.
Musoq Gates
- Read the relevant project
copilot-instructions.mdbefore touching code insrc/dotnet/Musoq.Parser,Musoq.Evaluator,Musoq.Converter,Musoq.Schema,Musoq.Plugins,Musoq.Playground, orMusoq.Benchmarks. - Read architecture.md before touching IR planner, Execution IR, physical planning, or renderer code.
- Keep optimization decisions in
QueryPlanner, planner-owned helpers, physical planning, or Execution IR. Do not hide query-level strategy choices in renderers or generated C#. - Before final validation, re-read
.github/copilot-instructions.mdand fix any compliance issues found in the changed code. - After code changes, run the relevant focused tests first, then the full solution command unless the user explicitly narrows validation or the environment blocks it:
- For source changes that require compilation before tests, build with:
- Update
.copilot_session_summary.mdat the end with completed work, validation status, next steps, and context notes.
Refactoring Tactics
- Replace nested conditionals with guard clauses and early returns.
- Extract pure functions for repeated calculations, predicates, and conversions.
- Prefer clear domain names over comments that explain unclear variables or methods.
- Replace magic values with named constants or well-named local variables.
- Remove dead code, commented-out code, redundant branches, unused locals, and unnecessary indirection.
- Use parameter objects or records when related values travel together through several calls.
- Keep interfaces small and avoid adding new interfaces for a single implementation without a concrete need.
- Prefer immutable data and readonly state where values do not change after construction.
- Preserve existing style, formatting, dependency choices, and test patterns.
Completion Checks
- The refactor is behavior-preserving unless the requested outcome explicitly says otherwise.
- The code is easier to read in the diff than before: fewer branches, less repetition, clearer names, or a sharper responsibility boundary.
- Any new abstraction has a clear purpose, a good name, and removes meaningful duplication or complexity.
- Public contracts, data shapes, and compatibility assumptions are preserved or explicitly approved by the user.
- Relevant focused tests and the Musoq full validation gate were run according to repository guidance, or any inability to run them is reported.
- Unrelated user changes remain untouched.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/refactoring/SKILL.md
Popularity
- Repository stars
- 505
- Repository forks
- 22
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/puchaczov/musoq/refactoring)