Agent skill

Cloud Storage Hexagonal Architecture

by macro-inc in macro-inc/macro

Enforce hexagonal architecture in the Rust backend. An agent skill from macro-inc/macro.

AGPL-3.0Auto-check passedBackend & APIs

Install Cloud Storage Hexagonal Architecture

skills CLI
$ npx skills add macro-inc/macro --skill cloud-storage-hexagonal-architecture -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install macro-inc/macro cloud-storage-hexagonal-architecture --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/macro-inc/macro.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/cloud-storage-hexagonal-architecture .claude/skills/cloud-storage-hexagonal-architecture && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cloud-storage-hexagonal-architecture
GitHub stars
4.6k
Token cost
~3k tokens
SKILL.md length
1,043 words
Files
1
Skills in repo
19
Repo updated
First seen
Licence
AGPL-3.0

At a glance

Enforce hexagonal architecture in the Rust backend. An agent skill from macro-inc/macro.

  • Works in 7 steps: Pick the minimum required permission… → In inbound, obtain EntityAccessReceipt… → Pass that receipt to the domain service… → …
  • Tasks that involve Authorization and RBAC
  • SKILL.md covers Non-negotiable dependency rule, Layer responsibilities, Authorization and… and Bad vs good, plus 5 more sections
  • Calls rg

What it does

Cloud Storage Hexagonal Architecture is an agent skill from macro-inc/macro. Enforce hexagonal architecture in the Rust backend. Use before modifying crates or Rust services, especially inbound axum/tool/listener adapters, domain services/ports, outbound adapters, authorization, permissions, database access, or external clients.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Authorization and RBAC. It works with Rust. The repository describes itself as: Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory. The licence is AGPL-3.0.

When your agent uses it

  • Tasks that involve Authorization and RBAC

Example prompts

  • “/cloud-storage-hexagonal-architecture”

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Pick the minimum required permission type for the use case, e.g. ViewAccessLevel, EditAccessLevel, or OwnerAccessLevel.
  2. In inbound, obtain EntityAccessReceipt using the existing entity access boundary.
  3. Pass that receipt to the domain service method.
  4. In the domain service, perform use-case-specific policy that is not captured by the minimum receipt type, e.g. owner-only share changes…
  5. Return a domain error such as Unauthorized, Forbidden, or a typed policy error.
  6. Let inbound map that domain/access error to HTTP/tool/listener semantics.
  7. Unit-test allow and deny cases at the domain service level with fake receipts/ports.

What it can do on your machine

Read from SKILL.md and the folder at commit 49418e7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • rg

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cloud Storage Hexagonal Architecture loads about 3k tokens when it runs. Until then it costs about 73 tokens; SKILL.md has 1,043 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from macro-inc/macro at commit 49418e7, republished under its AGPL-3.0 licence (© macro-inc). 1,043 words, ~3,032 tokens.

Download SKILL.mdSave it as .claude/skills/cloud-storage-hexagonal-architecture/SKILL.md (or your agent's skills folder).
name
cloud-storage-hexagonal-architecture
description
Enforce hexagonal architecture in the Rust backend. Use before modifying crates or Rust services, especially inbound axum/tool/listener adapters, domain services/ports, outbound adapters, authorization, permissions, database access, or external clients.

Cloud Storage Hexagonal Architecture Guard

Use this skill whenever you add, change, or review Rust code under crates/** or services/** that touches a crate with src/domain, src/inbound, or src/outbound.

This repository follows the ports-and-adapters / hexagonal style described in Master Hexagonal Architecture in Rust and the howtocodeit/hexarch 3-simple-service branch: domain models + ports + services are the center; inbound and outbound adapters are replaceable shells around that center.

Non-negotiable dependency rule

Dependencies point inward:

text
inbound adapters ──► domain ports/models/services ◄── outbound adapters
composition root ──► inbound + domain service + outbound implementations
  • domain/ must not depend on inbound/, outbound/, axum, HTTP response types, SQLx pools/queries, AWS SDKs, Redis, reqwest, environment variables, or transport DTOs.
  • inbound/ may depend on domain ports/models/services. It must not own business decisions or persistence/external-service implementation details.
  • outbound/ implements domain ports for databases, S3, HTTP clients, queues, metrics, etc. It must not own use-case policy.
  • Wiring concrete adapters into services belongs in the composition root / builder, not inside domain logic or handlers.

Layer responsibilities

Domain (src/domain/**)

Put the following here:

  • Domain models, value objects, command/request types, response types, and domain errors.
  • Service/use-case traits exposed to inbound adapters.
  • Concrete domain service implementations that orchestrate a use case.
  • Port traits for required capabilities: repositories, authorizers, notifiers, event publishers, clocks, ID generators, metrics, external domain services.
  • Business invariants, state transitions, authorization policy, ownership checks, permission-level checks, tenant/team/workspace policy, filtering rules, and side-effect orchestration.
Inbound adapters (src/inbound/**)

Axum handlers, AI tools, Kafka/listener handlers, lambda handlers, and CLI entrypoints are adapters. Keep them thin:

  • Extract authentication/identity from transport (MacroAuthorizationExtractor, OptionalMacroAuthorizationExtractor, JWT, signed internal header, request context).
  • Parse path/query/body/header data and perform transport/syntax validation.
  • Convert transport DTOs into domain request/command types.
  • Call exactly the appropriate domain service/port method.
  • Convert domain success/errors into transport responses/status codes/tool output.

Inbound adapters must not:

  • Decide whether a user may access/edit/delete/share/list an entity.
  • Call entity_access, roles_and_permissions, repositories, SQLx, S3, Redis, SQS, reqwest, or other outbound implementations to make a use-case decision.
  • Branch on AccessLevel, role, owner/admin/member, tenant/team membership, project membership, subscription tier, feature entitlement, entity state, or ownership for business policy.
  • Filter returned entities by permissions or hide fields based on authz rules.
  • Start transactions or compose multiple persistence/external calls as the core use case.
Outbound adapters (src/outbound/**)

Put implementation details here:

  • SQLx queries and transaction mechanics.
  • AWS/Redis/OpenSearch/HTTP client calls.
  • Mapping external errors to domain errors as required by a port contract.
  • Implementing repository/authorizer/client/notifier ports.

Outbound adapters must not:

  • Import crate::inbound::*, axum extractors/responses, or transport DTOs.
  • Invent business policy beyond faithfully implementing the domain port contract.
  • Decide use-case flow; return facts/capabilities/results for the domain service to decide.

Authorization and EntityAccessReceipt rule

Authentication can happen at the edge. Entity access checks should cross the boundary as a typed capability: EntityAccessReceipt<T>.

EntityAccessReceipt<T> means the entity access layer has verified the caller has at least permission T for the entity. Inbound adapters may obtain this receipt through the standard access extractors or by calling the entity access service specifically to mint a receipt. After that, ordinary handlers/tools/listeners must pass the receipt inward instead of re-checking or branching on authorization.

Allowed in inbound:

  • Reject missing/invalid credentials (401 / unauthenticated).
  • Extract actor, request_context, user_id, service identity, internal principal, or a typed EntityAccessReceipt<T>.
  • Use standard access extractors or generate_entity_access_receipt::<RequiredLevel>(...) to mint a receipt.
  • Pass the receipt and parsed request data into the domain service call.
  • Convert domain/access errors into transport responses.

Forbidden in ordinary inbound handlers/tools/listeners:

  • if user_id != owner_id { ... }
  • if access_level < Edit { ... }
  • entity_access_service.get_access_level(...) or can_edit(...) followed by allow/deny branching.
  • Role/team/tenant/project permission checks.
  • Inspecting receipt.entity_permission() to decide use-case business policy.
  • Direct repository/persistence calls for the protected action.

Correct pattern:

  1. Pick the minimum required permission type for the use case, e.g. ViewAccessLevel, EditAccessLevel, or OwnerAccessLevel.
  2. In inbound, obtain EntityAccessReceipt<RequiredLevel> using the existing entity access boundary.
  3. Pass that receipt to the domain service method.
  4. In the domain service, perform use-case-specific policy that is not captured by the minimum receipt type, e.g. owner-only share changes inside an edit operation.
  5. Return a domain error such as Unauthorized, Forbidden, or a typed policy error.
  6. Let inbound map that domain/access error to HTTP/tool/listener semantics.
  7. Unit-test allow and deny cases at the domain service level with fake receipts/ports.
Show full SKILL.md (372 more words)Show less

Bad vs good

Bad: the handler branches on permissions and performs the protected action itself.

rust
pub async fn edit_document_handler(
    State(state): State<DocumentRouterState>,
    Json(args): Json<EditDocumentServiceArgs>,
) -> Result<Json<EditDocumentResponse>, DocumentError> {
    let access_level = state
        .entity_access
        .get_access_level(current_user(), &args.document_id, EntityType::Document)
        .await?
        .ok_or(DocumentError::Unauthorized)?;

    if access_level < AccessLevel::Edit {
        return Err(DocumentError::Unauthorized);
    }

    if args.share_permission.is_some() && access_level != AccessLevel::Owner {
        return Err(DocumentError::Unauthorized);
    }

    state.document_repo.update_document(args).await?;
    Ok(Json(EditDocumentResponse::success()))
}

Good: inbound obtains a typed receipt and forwards it; the domain service owns policy and orchestration.

rust
pub async fn edit_document_handler<T: DocumentService, Svc: EntityAccessService>(
    access: DocumentAccessExtractor<EditAccessLevel, Svc>,
    State(state): State<DocumentRouterState<T, Svc>>,
    document_context: LoadedDocumentBasic,
    project: ProjectBodyAccessLevelExtractor<EditAccessLevel, EditDocumentServiceArgs, Svc>,
) -> Result<Json<EditDocumentResponse>, DocumentError> {
    state
        .service
        .edit_document(
            access.entity_access_receipt,
            document_context.into_inner(),
            project.into_inner(),
        )
        .await?;

    Ok(Json(EditDocumentResponse::success()))
}
rust
async fn edit_document(
    &self,
    receipt: EntityAccessReceipt<EditAccessLevel>,
    document_context: DocumentBasic,
    args: EditDocumentServiceArgs,
) -> Result<(), DocumentError> {
    if let EntityPermission::AccessLevel { access_level } = receipt.entity_permission() {
        if args.project_id.is_some() && *access_level != AccessLevel::Owner {
            return Err(DocumentError::Unauthorized);
        }

        if args.share_permission.is_some() && *access_level != AccessLevel::Owner {
            return Err(DocumentError::Unauthorized);
        }
    }

    let document_id = receipt.entity().entity_id.clone();
    self.repo
        .edit_document_metadata(document_id, document_context, args)
        .await
}

Pre-write checklist

Before editing code, classify each touched file:

  1. Is it domain, inbound, outbound, or composition/wiring?
  2. What use case is being added or changed?
  3. What domain command/model/error represents it?
  4. Which domain service method should inbound call?
  5. Which outbound capabilities are needed, and are they behind domain port traits?
  6. What authorization/policy decisions are needed, and where will domain service tests cover them?

If a step has no answer, stop and design that boundary before writing code.

Review checklist

For every diff under crates/** or services/**, reject or refactor if any of these are true:

  • src/domain/** imports axum, http::StatusCode, IntoResponse, Json, Router, Request, HeaderMap, SQLx pools/queries, AWS SDK clients, Redis clients, reqwest clients, crate::inbound, or crate::outbound.
  • src/inbound/** contains SQLx queries, transaction handling, repository calls, AWS/Redis/OpenSearch/reqwest calls, or direct calls to outbound implementations.
  • Ordinary src/inbound/** handlers/tools/listeners contain authorization decisions (AccessLevel, role checks, owner checks, team/project membership checks, can_*, authorize_*, ensure_*permission*) instead of forwarding a typed EntityAccessReceipt<T> or identity to a service. Dedicated access extractors whose job is to mint receipts are the exception.
  • Handlers return domain-specific decisions not produced by a domain service.
  • Outbound code imports inbound/transport DTOs or axum types.
  • A domain service depends on concrete adapters rather than port traits/generic bounds/trait objects.
  • Tests only cover HTTP status mapping and do not cover service-level allow/deny/business-rule cases.

Useful inspection commands

Set CRATE to the crate you are touching, for example CRATE=crates/documents.

bash
# Domain must not know transport or concrete infrastructure.
rg -n "use (axum|http::StatusCode)|IntoResponse|Json<|Router|HeaderMap|Request<|sqlx::|PgPool|aws_sdk|redis::|reqwest|crate::inbound|crate::outbound" "$CRATE/src/domain" --glob '*.rs'

# Inbound authz/policy hits require inspection. Receipt-minting extractors are allowed;
# ordinary handlers should forward EntityAccessReceipt<T> instead of branching.
rg -n "entity_access|EntityAccessReceipt|roles_and_permissions|AccessLevel|RoleId|owner|admin|member|tenant|team|project|permission|authorize|authz|can_|ensure_.*permission|Forbidden|Unauthorized" "$CRATE/src/inbound" --glob '*.rs'

# Inbound should not do persistence or infrastructure work.
rg -n "sqlx::|query!|query_as!|PgPool|Transaction|aws_sdk|redis::|opensearch|reqwest|S3|Sqs|Dynamo" "$CRATE/src/inbound" --glob '*.rs'

# Outbound must not depend on inbound transport.
rg -n "crate::inbound|axum|IntoResponse|Json<|Router|StatusCode" "$CRATE/src/outbound" --glob '*.rs'

rg hits are not automatically failures, but every hit must be explained by layer responsibilities. When in doubt, move policy inward.

If you find an existing violation

  • Do not add more logic to the violating adapter.
  • If the task touches that use case, prefer moving the policy/orchestration into the domain service as part of the change.
  • If a full refactor is large or risky, stop and ask the user before making sweeping changes. Offer the smallest compliant plan that prevents new violations.

Final response requirement

When you use this skill, explicitly state that the hexagonal boundary was checked and summarize where authz/business policy lives after your change.

© macro-inc, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/cloud-storage-hexagonal-architecture of macro-inc/macro.

Open the folder on GitHubat commit 49418e7

Compare with similar skills

Cloud Storage Hexagonal Architecture next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cloud Storage Hexagonal Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cloud Storage Hexagonal Architecture this skillmacro-inc/macro4.6k—~3kAutomated safety check: PassAGPL-3.0
Ron Authbionic-gpt/bionic-gpt2.4k—~667Automated safety check: PassApache-2.0
Auth Architecturemajiayu000/litellm-rs117—~1.9kAutomated safety check: PassMIT
Tenuo Denial Triagetenuo-ai/tenuo102—~2.3kAutomated safety check: PassApache-2.0
Trust Hmi ContractsjohannesPettersson80/trust-platform221—~611Automated safety check: PassApache-2.0
Smart Contract Auditelophanto/EloPhanto106—~2.7kAutomated safety check: PassCustom licence

Similar skills

  • Ron Auth

    bionic-gpt/bionic-gpt

    Implement identity and authorization boundaries in Rust on Nails applications.

    2.4k GitHub stars~667 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Auth Architecture

    majiayu000/litellm-rs

    LiteLLM-RS Authentication Architecture. An agent skill from majiayu000/litellm-rs.

    117 GitHub stars~1.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Tenuo Denial Triage

    tenuo-ai/tenuo

    Diagnose a denied Tenuo call and make the legitimate call work with the smallest change to authority.

    102 GitHub stars~2.3k tokensUpdated today
    SecurityAuto-check passed
  • Trust Hmi Contracts

    johannesPettersson80/trust-platform

    Implement and review trust-platform HMI schema/value/write contracts with safety guardrails.

    221 GitHub stars~611 tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Smart Contract Audit

    elophanto/EloPhanto

    A skill your agent uses when reviewing a Solidity, Vyper, or Rust (Solana/Anchor) smart contract for paid audit work or pre-launch sanity check.

    106 GitHub stars~2.7k tokensUpdated 7 days ago
    SecurityAuto-check passed
  • Ron Database

    bionic-gpt/bionic-gpt

    Manage PostgreSQL migrations, typed SQL queries, generated Rust bindings, and database authorization in Rust on Nails applications.

    2.4k GitHub stars~721 tokensUpdated yesterday
    DatabasesAuto-check passed

More from macro-inc/macro

All 19 skills in this repo
  • Mintlify API

    macro-inc/macro

    Interact with the Mintlify REST API to manage deployments, trigger builds, and query documentation site metadata programmatically.

    4.6k GitHub starsUsed in 2 repos~333 tokens
    Auto-check passed
  • Add Tour

    macro-inc/macro

    Add or change an in-app feature tour (a view's guided flyover) in the web app.

    4.6k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Define Feature Flag

    macro-inc/macro

    Define a frontend feature flag with defineFlag and wire its readers.

    4.6k GitHub stars~780 tokensUpdated today
    Auto-check passed
  • Run App

    macro-inc/macro

    Run the Macro app on Cursor Cloud and pick up edits. An agent skill from macro-inc/macro.

    4.6k GitHub stars~712 tokensUpdated today
    Auto-check passed
  • Add SDK Endpoint

    macro-inc/macro

    Wrap a new backend endpoint in the TypeScript SDK (packages/sdk), or record it as skipped.

    4.6k GitHub stars~1k tokensUpdated today
    Auto-check: notes
  • Collab Surface Core

    macro-inc/macro

    A skill your agent uses when adding collaborative markdown, notes, or descriptions to a feature with collab surfaces.

    4.6k GitHub stars~639 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Cloud Storage Hexagonal Architecture

What does Cloud Storage Hexagonal Architecture do?

Enforce hexagonal architecture in the Rust backend. An agent skill from macro-inc/macro. Cloud Storage Hexagonal Architecture is an agent skill from macro-inc/macro. Enforce hexagonal architecture in the Rust backend.

When should I use Cloud Storage Hexagonal Architecture?

Cloud Storage Hexagonal Architecture fits situations like: tasks that involve Authorization and RBAC.

How do I install Cloud Storage Hexagonal Architecture in Claude Code?

Run `npx skills add macro-inc/macro --skill cloud-storage-hexagonal-architecture -a claude-code`. Or copy the skill folder (.agents/skills/cloud-storage-hexagonal-architecture in macro-inc/macro) into .claude/skills/cloud-storage-hexagonal-architecture in your project. Claude Code loads it when a task matches its description.

How do I install Cloud Storage Hexagonal Architecture in Codex?

Run `npx skills add macro-inc/macro --skill cloud-storage-hexagonal-architecture -a codex`. Or copy the skill folder (.agents/skills/cloud-storage-hexagonal-architecture in macro-inc/macro) into .agents/skills/cloud-storage-hexagonal-architecture in your project. Codex loads it when a task matches its description.

Can I use Cloud Storage Hexagonal Architecture in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add macro-inc/macro --skill cloud-storage-hexagonal-architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cloud-storage-hexagonal-architecture, .gemini/skills/cloud-storage-hexagonal-architecture, .github/skills/cloud-storage-hexagonal-architecture and .opencode/skills/cloud-storage-hexagonal-architecture in your project.

What does Cloud Storage Hexagonal Architecture need to run?

Going by SKILL.md and its folder, Cloud Storage Hexagonal Architecture needs the command-line tools its instructions call (rg).

Does Cloud Storage Hexagonal Architecture access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Cloud Storage Hexagonal Architecture safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Cloud Storage Hexagonal Architecture use?

Cloud Storage Hexagonal Architecture is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cloud Storage Hexagonal Architecture use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Cloud Storage Hexagonal Architecture?

Skills that share tags, products or a category with Cloud Storage Hexagonal Architecture: Ron Auth (bionic-gpt/bionic-gpt, 2.4k stars), Auth Architecture (majiayu000/litellm-rs, 117 stars), Tenuo Denial Triage (tenuo-ai/tenuo, 102 stars) and Trust Hmi Contracts (johannesPettersson80/trust-platform, 221 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cloud Storage Hexagonal Architecture?

macro-inc (a GitHub organization) maintains it in macro-inc/macro, which has 4,590 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 8, 2026.

Source: macro-inc/macro on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.