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 skills/emillindfors/a2a-rs/refactor_to_hexagonalnpx skills add EmilLindfors/a2a-rs --skill refactor_to_hexagonalgit clone --depth 1 https://github.com/EmilLindfors/a2a-rsWrote 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/emillindfors/a2a-rs/refactor_to_hexagonal)<a href="https://agentmods.dev/skills/emillindfors/a2a-rs/refactor_to_hexagonal"><img src="https://agentmods.dev/badge/skills/emillindfors/a2a-rs/refactor_to_hexagonal.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.00067 | $0.01507 |
| Opus 5 | $0.00034 | $0.00754 |
| Sonnet 5 | $0.00013 | $0.00301 |
| Haiku 4.5 | $0.00007 | $0.00151 |
Grade A, and why
refactor_to_hexagonal 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 — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor to Hexagonal (Rust)
Drive an incremental migration from a flat or layered-by-framework Rust codebase to one organized by ports and adapters. The goal is small, reviewable PRs — never a big-bang rewrite.
Read rules/hexagonal_architecture.md first; this skill operationalizes those rules into a migration sequence.
When to recommend this refactor
Recommend hex when you see at least two of:
- Business logic interleaved with HTTP handlers or DB queries.
- A test suite that needs a running database or HTTP mock to exercise core logic.
- Difficulty swapping infrastructure (e.g. "we want to try Postgres alongside SQLite" or "we want a CLI version of this service").
- Errors from
sqlx,reqwest,axum, etc. propagating up through what should be business code.
Do not recommend it for:
- Small CLIs or scripts where there is no real "domain."
- Pure libraries that already have no I/O.
- Codebases where the dominant problem is something else (perf, concurrency, type safety) — fix that first.
Migration sequence
Drive the refactor in this order. Each step should be a separate, mergeable change.
Step 1 — Carve out a domain/ module
- Find the data types the business cares about (entities, value objects, status enums) and move them into
domain/. - Strip framework attributes from these types (
#[derive(sqlx::FromRow)],#[serde(rename_all)]for HTTP,axumextractors). If serialization is needed in every adapter, keepserdederives; if it's only the HTTP adapter, define a DTO there and map. - Introduce newtypes for primitive-typed identifiers and bounded values (
struct TaskId(String),struct Port(u16)). Parse at construction. - Define a single
DomainErrorenum withthiserror. Initially it can have a catch-all variant; tighten over time.
Done when: cargo check -p <crate> --no-default-features compiles the domain module in isolation, with no third-party I/O crates pulled in.
Step 2 — Extract one port
Pick the smallest, highest-pain capability first. Storage is usually a good first target.
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 · 102 lines · 67 tokens per session scan A 4730556c6f68
refactor_to_hexagonal is a skill published in the GitHub repository EmilLindfors/a2a-rs (87 stars, last pushed yesterday), licensed MIT. It adds 67 tokens to every session and 1,507 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 skills, from other repositories
azure-eventhub-rust
Azure Event Hubs library for Rust. Send and receive events for streaming data ingestion and batch processing. Triggers: "event hubs rust", "ProducerClient rust", "ConsumerClient rust", "send event rust", "streaming rust", "eventhub rust".
rust-engineer
Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions. Implements ownership patterns, manages lifetimes, designs trait hierarchies, builds async applications with tokio, and structures error handling with Result/Option. Use when building Rust applications, solving ownership or…
azure-eventhub-rust
Client library for Azure Event Hubs — big data streaming platform and event ingestion service.
cloudflare-workers-multi-lang
Multi-language Workers development with Rust, Python, and WebAssembly. Use when building Workers in languages other than JavaScript/TypeScript, or when integrating WASM modules for performance-critical code.
actix-web
Actix Web is a powerful, high-performance web framework for Rust. It provides async handlers, type-safe extractors, middleware, and integrates with the Rust ecosystem for building fast, reliable, and memory-safe web services.
axum
You are an expert in Axum, the web framework built on top of Tokio and Tower by the Tokio team. You help developers build high-performance, type-safe APIs and web services using Axum's extractor-based handler system, middleware via Tower layers, WebSocket support, and compile-time route validation — achieving C-level…