Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add GrishaAngelovGH/gemini-cli-agent-skills --skill expert-code-refactoringgit clone --depth 1 https://github.com/GrishaAngelovGH/gemini-cli-agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/grishaangelovgh/gemini-cli-agent-skills/expert-code-refactoring)<a href="https://agentmods.dev/skills/grishaangelovgh/gemini-cli-agent-skills/expert-code-refactoring"><img src="https://agentmods.dev/badge/skills/grishaangelovgh/gemini-cli-agent-skills/expert-code-refactoring.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00038 | $0.01105 |
| Opus 5 | $0.00019 | $0.00553 |
| Sonnet 5 | $0.00008 | $0.00221 |
| Haiku 4.5 | $0.00004 | $0.00111 |
Grade A, and why
expert-code-refactoring scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Skill
This skill guides the agent in refactoring codebases by identifying technical debt and applying industry-standard patterns tailored to the specific technology stack.
General Refactoring Workflow
- Analyze Context: Read the file and its associated tests. Identify dependencies and usage patterns.
- Verify Tests: Before any changes, run existing tests to ensure a stable baseline.
- Identify Smells: Look for long methods, deep nesting, duplicate code, or tight coupling.
- Incremental Changes: Apply transformations in small, verifiable steps.
- Re-verify: Run tests after each significant change.
Architecture & Clean Code (Global)
- Naming: Rename variables, functions, and classes to be descriptive and reveal intent. Avoid abbreviations.
- AHA Programming: Avoid Hasty Abstractions. Only abstract code when the duplication is clear and the abstraction doesn't make the code harder to follow.
- Functions: Keep functions small. Aim for a low number of parameters (prefer objects/records for many parameters).
- Cognitive Load: Reduce nesting levels (aim for max 2-3 deep). Use early returns to keep the "happy path" aligned to the left.
Refactoring for Testability
- Dependency Injection (DI): Replace hardcoded instances or static calls with injected dependencies (via constructor or parameters).
- Interface Segregation: If a class depends on a large interface but only uses one method, extract a smaller interface.
- Pure Functions: Extract business logic into pure functions that don't depend on external state or side effects, making them trivial to unit test.
- Mocking Boundaries: Identify "seams" where you can inject mocks (e.g., Database, Network, System Clock).
Legacy Code Techniques (Safe Changes)
- Characterization Tests: If tests are missing, write "Golden Master" tests that record the current behavior before changing it.
- Sprout Method: When adding a feature to a messy method, write the new logic in a new, clean method and call it from the old one.
- Wrap Method: Add new behavior by creating a new method with the same signature that calls the old method and then adds the new logic.
- Break Dependencies: Use the "Extract and Override" pattern to isolate untestable static calls or constructors in a protected method that can be overridden in a test subclass.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 79 lines · 38 tokens per session scan A b393889052a7
expert-code-refactoring is a skill published in the GitHub repository GrishaAngelovGH/gemini-cli-agent-skills (16 stars, last pushed 6mo ago), licensed MIT. It adds 38 tokens to every session and 1,105 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
verify-change
Use after implementation, before final response.
pr-review
Checklist para abrir ou revisar pull request. Valida qualidade do código, spec, testes e segurança antes de abrir ou aprovar qualquer PR.
coding-standards
Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
code-tour
Create CodeTour .tour files — persona-targeted, step-by-step walkthroughs with real file and line anchors. Use for onboarding tours, architecture walkthroughs, PR tours, RCA tours, and structured "explain how this works" requests.
.claude
Review changes for correctness, tests, and generated-output drift. When Claude specific behavior is relevant, call out the generated .claude surface.
.gemini
Review changes for correctness and test evidence. Keep recommendations concise and reference the generated .gemini surface only when needed.