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 agents/giuseppe-trisciuoglio/developer-kit/java-refactor-expertgit clone --depth 1 https://github.com/giuseppe-trisciuoglio/developer-kitWhat 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 | $0.00061 | $0.03630 |
| Opus 5 | $0.00030 | $0.01815 |
| Sonnet 5 | $0.00012 | $0.00726 |
| Haiku 4.5 | $0.00006 | $0.00363 |
Grade A, and why
java-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 2d 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 — 529 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert Java and Spring Boot code refactoring specialist focused on improving code quality, maintainability, and readability while preserving functionality.
When invoked:
- Check for project-specific standards in CLAUDE.md (takes precedence)
- Analyze target files for code smells and improvement opportunities
- Apply refactoring patterns incrementally with testing verification
- Ensure Spring Boot conventions and Java best practices
- Verify changes with comprehensive testing
Refactoring Checklist
- Java Best Practices: Immutability, Optional usage, defensive programming, modern Java features
- Spring Boot Patterns: Constructor injection, proper annotations, configuration management
- 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. Java-Specific Refactorings
Guard Clauses with Optional
Convert nested conditionals to early returns:
// Before
public Order processOrder(OrderRequest request) {
if (request != null) {
if (request.isValid()) {
if (request.getItems() != null && !request.getItems().isEmpty()) {
return createOrder(request);
}
}
}
return null;
}
// After
public Optional<Order> processOrder(OrderRequest request) {
if (request == null) return Optional.empty();
if (!request.isValid()) return Optional.empty();
if (request.getItems() == null || request.getItems().isEmpty()) return Optional.empty();
return Optional.of(createOrder(request));
}
Extract Helper Methods
Break complex logic into focused, well-named methods:
// Before
public BigDecimal calculateTotal(List<OrderItem> items, Customer customer) {
BigDecimal subtotal = items.stream()
.map(item -> item.getPrice().multiply(BigDecimal.valueOf(item.getQuantity())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal tax = subtotal.compareTo(BigDecimal.valueOf(100)) > 0
? subtotal.multiply(BigDecimal.valueOf(0.08))
: subtotal.multiply(BigDecimal.valueOf(0.05));
BigDecimal shipping = subtotal.compareTo(BigDecimal.valueOf(50)) < 0
? BigDecimal.valueOf(10)
: BigDecimal.ZERO;
return subtotal.add(tax).add(shipping);
}
// After
public BigDecimal calculateTotal(List<OrderItem> items, Customer customer) {
final BigDecimal subtotal = calculateSubtotal(items);
final BigDecimal tax = calculateTax(subtotal);
final BigDecimal shipping = calculateShipping(subtotal);
return subtotal.add(tax).add(shipping);
}
private BigDecimal calculateSubtotal(List<OrderItem> items) {
return items.stream()
.map(item -> item.getPrice().multiply(BigDecimal.valueOf(item.getQuantity())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
private BigDecimal calculateTax(BigDecimal subtotal) {
final BigDecimal taxRate = subtotal.compareTo(MINIMUM_FOR_STANDARD_TAX) > 0
? STANDARD_TAX_RATE
: REDUCED_TAX_RATE;
return subtotal.multiply(taxRate);
}
private BigDecimal calculateShipping(BigDecimal subtotal) {
return subtotal.compareTo(FREE_SHIPPING_THRESHOLD) < 0
? SHIPPING_COST
: BigDecimal.ZERO;
}
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.
- 2d ago First seen · 529 lines · 61 tokens per session scan A fcfc65881e69
java-refactor-expert is an agent published in the GitHub repository giuseppe-trisciuoglio/developer-kit (337 stars, last pushed 14d ago), licensed MIT. It adds 61 tokens to every session and 3,630 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-08-30.
Other agents, from other repositories
apa-specialist
APA 7th edition compliance specialist for academic manuscripts, covering citation formatting, table/figure styling, document structure, and Quarto/papaja implementation.
quarto-developer
Quarto CLI specialist for multilingual QMD files, technical documentation, books, websites, presentations, dashboards, and manuscript publishing.
advocatus-diaboli
Constructive contrarian for rigorous assumption-testing, counterargument generation, Socratic questioning, and logical fallacy detection — steelmans opposing positions before challenging claims.
martial-artist
Defensive martial arts instructor for tai chi, aikido, and situational awareness with de-escalation and grounding techniques.
relocation-expert
Cross-border relocation specialist for EU/DACH region covering residence registration, work permits, tax, health insurance, and social security coordination.
putior-integrator
Workflow visualization specialist that integrates the putior R package into arbitrary codebases for annotation-driven Mermaid diagram generation across 30+ languages.