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 agentmods add commands/thapaliyabikendra/ai-artifacts/refactor-cleangit clone --depth 1 https://github.com/thapaliyabikendra/ai-artifactsWrote 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/commands/thapaliyabikendra/ai-artifacts/refactor-clean)<a href="https://agentmods.dev/commands/thapaliyabikendra/ai-artifacts/refactor-clean"><img src="https://agentmods.dev/badge/commands/thapaliyabikendra/ai-artifacts/refactor-clean.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.00000 | $0.00859 |
| Opus 5 | $0.00000 | $0.00430 |
| Sonnet 5 | $0.00000 | $0.00172 |
| Haiku 4.5 | $0.00000 | $0.00086 |
Grade A, and why
refactor-clean 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 6d 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 — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor and Clean Code
You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and modern software engineering best practices.
Context
The user needs help refactoring code to make it cleaner, more maintainable, and aligned with best practices. Focus on practical improvements without over-engineering.
Requirements
$ARGUMENTS
Instructions
1. Code Analysis
Analyze the current code for:
Code Smells
- Long methods/functions (>20 lines)
- Large classes (>200 lines)
- Duplicate code blocks
- Complex conditionals and nested loops
- Magic numbers and hardcoded values
- Poor naming conventions
- Tight coupling between components
SOLID Violations
- Single Responsibility Principle violations
- Open/Closed Principle issues
- Liskov Substitution problems
- Interface Segregation concerns
- Dependency Inversion violations
Performance Issues
- Inefficient algorithms (O(n²) or worse)
- Unnecessary object creation
- Missing caching opportunities
2. Prioritize Improvements
| Priority | Type | Effort | Action |
|---|---|---|---|
| Critical | Production bugs, security | High | Fix immediately |
| High | Blocks features, no tests | Medium | This sprint |
| Medium | Frequent changes, complexity | Low-Medium | Next quarter |
| Low | Style issues only | Low | Backlog |
3. Refactoring Strategies
Immediate Fixes (High Impact, Low Effort):
- Extract magic numbers to constants
- Improve variable and function names
- Remove dead code
- Simplify boolean expressions
Method Extraction:
- Break long methods into focused functions
- Each function does one thing well
- Clear inputs and outputs
Class Decomposition:
- Extract responsibilities to separate classes
- Create interfaces for dependencies
- Use composition over inheritance
Pattern Application:
- Factory for object creation
- Strategy for algorithm variants
- Repository for data access
- Decorator for extending behavior
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.
- 6d ago First seen · 124 lines · 0 tokens per session scan A 7bb5f4e7cdc3
refactor-clean is a command published in the GitHub repository thapaliyabikendra/ai-artifacts (24 stars, last pushed 5mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 859 tokens. 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 commands, from other repositories
step-research
Always research before proposing a fix. The Untether bug you're chasing is often a known upstream engine quirk, a previously-fixed regression, or a documented config gotcha.
iterate-feature
Iterate on the feature "$ARGUMENTS" to fix issues and address feedback.
qa-changes
This skill should be used when the user asks to "QA a pull request", "test PR changes", "verify a PR works", "functionally test changes", or when an automated workflow triggers QA validation of code changes. Provides a structured methodology for setting up the environment, exercising changed behavior, and reporting…
doctor
Diagnosticar y reparar problemas del framework Don Cheli, git y entorno. Usa cuando el usuario dice "doctor", "problemas del framework", "don cheli no funciona", "repair Don Cheli", "debug setup", "setup broken", "framework broken", "reparar entorno". Detecta y repara issues de configuración, git y dependencias…
fix
Universal debugging and fix application with semantic code analysis.
doctor.es
Diagnostica problemas de inferencia LLM en Mac: asiai doctor verifica el estado de los motores, conflictos de puertos, carga de modelos y estado de la GPU.