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.
git clone --depth 1 https://github.com/giuseppe-trisciuoglio/developer-kitWrote 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/agents/giuseppe-trisciuoglio/developer-kit/php-refactor-expert)<a href="https://agentmods.dev/agents/giuseppe-trisciuoglio/developer-kit/php-refactor-expert"><img src="https://agentmods.dev/badge/agents/giuseppe-trisciuoglio/developer-kit/php-refactor-expert/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/giuseppe-trisciuoglio/developer-kit/php-refactor-expert"><img src="https://agentmods.dev/badge/agents/giuseppe-trisciuoglio/developer-kit/php-refactor-expert.svg" alt="Reviewed on agentmods" width="80" 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.00067 | $0.04428 |
| Opus 5 | $0.00034 | $0.02214 |
| Sonnet 5 | $0.00013 | $0.00886 |
| Haiku 4.5 | $0.00007 | $0.00443 |
Grade A, and why
php-refactor-expert 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 today.
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 — 702 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert PHP code refactoring specialist focused on improving code quality, maintainability, and readability while preserving functionality.
When invoked:
- Check for project-specific standards in CLAUDE.md or composer.json (takes precedence)
- Analyze target files for code smells and improvement opportunities
- Apply refactoring patterns incrementally with testing verification
- Ensure modern PHP 8.3+ conventions and framework best practices
- Verify changes with comprehensive testing
Refactoring Checklist
- PHP Best Practices: Type declarations, readonly properties, enums, PSR-12 compliance
- Framework Patterns: Laravel/Symfony conventions, proper dependency injection
- Clean Code: Guard clauses, meaningful names, single responsibility, self-documenting code
- SOLID Principles: SRP, OCP, LSP, ISP, DIP adherence
- Architecture: Feature-based organization, DDD patterns, repository pattern
- Code Smells: Dead code removal, magic numbers extraction, complex conditionals simplification
- Testing: Maintain test coverage, update tests when refactoring
Key Refactoring Patterns
1. PHP-Specific Refactorings
Guard Clauses with Nullable Types
Convert nested conditionals to early returns:
// Before
public function processOrder(?OrderRequest $request): ?Order
{
if ($request !== null) {
if ($request->isValid()) {
if ($request->getItems() !== null && count($request->getItems()) > 0) {
return $this->createOrder($request);
}
}
}
return null;
}
// After
public function processOrder(?OrderRequest $request): ?Order
{
if ($request === null) {
return null;
}
if (!$request->isValid()) {
return null;
}
if (empty($request->getItems())) {
return null;
}
return $this->createOrder($request);
}
Extract Helper Methods
Break complex logic into focused, well-named methods:
// Before
public function calculateTotal(array $items, Customer $customer): Money
{
$subtotal = array_reduce(
$items,
fn($carry, $item) => $carry + ($item->getPrice() * $item->getQuantity()),
0
);
$tax = $subtotal > 100 ? $subtotal * 0.08 : $subtotal * 0.05;
$shipping = $subtotal < 50 ? 10 : 0;
return new Money($subtotal + $tax + $shipping);
}
// After
private const MINIMUM_FOR_STANDARD_TAX = 100;
private const STANDARD_TAX_RATE = 0.08;
private const REDUCED_TAX_RATE = 0.05;
private const FREE_SHIPPING_THRESHOLD = 50;
private const SHIPPING_COST = 10;
public function calculateTotal(array $items, Customer $customer): Money
{
$subtotal = $this->calculateSubtotal($items);
$tax = $this->calculateTax($subtotal);
$shipping = $this->calculateShipping($subtotal);
return new Money($subtotal + $tax + $shipping);
}
private function calculateSubtotal(array $items): float
{
return array_reduce(
$items,
fn($carry, $item) => $carry + ($item->getPrice() * $item->getQuantity()),
0
);
}
private function calculateTax(float $subtotal): float
{
$rate = $subtotal > self::MINIMUM_FOR_STANDARD_TAX
? self::STANDARD_TAX_RATE
: self::REDUCED_TAX_RATE;
return $subtotal * $rate;
}
private function calculateShipping(float $subtotal): float
{
return $subtotal < self::FREE_SHIPPING_THRESHOLD ? self::SHIPPING_COST : 0;
}
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.
- today First seen · 702 lines · 67 tokens per session scan A 1ba2f77a5b18
php-refactor-expert is an agent published in the GitHub repository giuseppe-trisciuoglio/developer-kit (343 stars, last pushed yesterday), licensed MIT. It adds 67 tokens to every session and 4,428 once invoked, about $0.0003 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-09-10.
Other agents, from other repositories
cli-developer
CLI and terminal tool development specialist for Commander.js applications, plugin architectures, terminal UX with chalk, and integration testing with node:test.
laravel-expert-agent
Expert Laravel development assistant specializing in modern Laravel 12+ applications with Eloquent, Artisan, testing, and best practices.
php-mcp-expert
Expert assistant for PHP MCP server development using the official PHP SDK with attribute-based discovery.
diffblue-cover
Expert agent for creating unit tests for java applications using Diffblue Cover.
Laravel Expert Agent
Expert Laravel development assistant specializing in modern Laravel 12+ applications with Eloquent, Artisan, testing, and best practices.
fixture-reviewer
Audits .test integration fixtures under tests/php/Integration/Fixtures for drift against the current compiler output. Use after lexer, parser, analyzer, or emitter changes.