hateoas
>
pinned to #72ed30aupdated 2 weeks ago
Ask your AI client: “install skills/hateoas”.
Requires the metahub MCP server installed in your client. Set up MCP.
mh install skills/hateoasmetahub onboarded this repo on the author's behalf.
If you own github.com/rrezartprebreza/spring-boot-skills on GitHub, claim the listing to take over publishing. Your claim preserves the existing eval history and badges; only the curator label is replaced with verified-publisher on your next publish.
Stars
144
Last commit
2 weeks ago
Latest release
published
- #ai-coding-agent
- #claude
- #claude-ai
- #claude-code
- #claude-plugin
- #claude-skill
- #claude-skills
- #codex
- #codex-skills
- #developer-tools
- #java
- #mcp
- #spring-ai
- #spring-boot
Evaluation report
WarningsAutomated checks the publisher passed at publish time — structure, docs, safety, and whether the artifact behaves as claimed.72ed30a· 2 weeks ago
Documentation
41Description qualitywarn
10 words · 72 chars — skills use the description as their trigger; aim higher — manifest description is empty; graded the GitHub repo description instead
Aim for 15+ words and include trigger phrases like “use this skill when …”.
README is present and substantial
17,305 chars · 12 sections · 13 code blocks
Tags / topics declared
14 total — ai-coding-agent, claude, claude-ai, claude-code, claude-plugin, claude-skill (+8)
README has usage / example sections
no labeled section but 13 code blocks document usage
Homepage / docs URL declared
no homepage declared (registry will use the repo URL) — info-only, not blocking
Release history
1- releasecurrent72ed30awarn2 weeks ago
Contents
Dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
When to Add Links
self— always, on every resource responsecollection— link back to the list endpointrelated resources— when a client commonly needs to navigate to themactions— links to state transitions (e.g.,cancel,ship) when valid for current state
Resource Model
public class OrderModel extends RepresentationModel<OrderModel> {
private final UUID id;
private final String status;
private final String customerEmail;
private final Instant createdAt;
// Static factory with links
public static OrderModel from(Order order) {
OrderModel model = new OrderModel(
order.getId(), order.getStatus().name(),
order.getCustomerEmail(), order.getCreatedAt()
);
// Self link — always
model.add(linkTo(methodOn(OrderController.class).getById(order.getId())).withSelfRel());
// Collection link
model.add(linkTo(methodOn(OrderController.class).list(null)).withRel("orders"));
// Conditional action links based on state
if (order.getStatus() == OrderStatus.PENDING) {
model.add(linkTo(methodOn(OrderController.class)
.cancelOrder(order.getId())).withRel("cancel"));
}
if (order.getStatus() == OrderStatus.PROCESSING) {
model.add(linkTo(methodOn(OrderController.class)
.shipOrder(order.getId())).withRel("ship"));
}
return model;
}
}
Controller
@RestController
@RequestMapping("/api/v1/orders")
public class OrderController {
@GetMapping("/{id}")
public ResponseEntity<OrderModel> getById(@PathVariable UUID id) {
Order order = orderService.findById(id);
return ResponseEntity.ok(OrderModel.from(order));
}
@GetMapping
public ResponseEntity<CollectionModel<OrderModel>> list(Pageable pageable) {
Page<Order> orders = orderService.findAll(pageable);
List<OrderModel> models = orders.getContent().stream()
.map(OrderModel::from)
.toList();
CollectionModel<OrderModel> collection = CollectionModel.of(models,
linkTo(methodOn(OrderController.class).list(pageable)).withSelfRel()
);
// Pagination links
if (orders.hasNext()) {
collection.add(linkTo(methodOn(OrderController.class)
.list(pageable.next())).withRel(IanaLinkRelations.NEXT));
}
if (orders.hasPrevious()) {
collection.add(linkTo(methodOn(OrderController.class)
.list(pageable.previousOrFirst())).withRel(IanaLinkRelations.PREV));
}
return ResponseEntity.ok(collection);
}
}
Response Shape
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "PENDING",
"customerEmail": "[email protected]",
"_links": {
"self": { "href": "http://api.example.com/api/v1/orders/550e8400" },
"orders": { "href": "http://api.example.com/api/v1/orders" },
"cancel": { "href": "http://api.example.com/api/v1/orders/550e8400/cancel" }
}
}
RepresentationModelAssembler Pattern
- Spring's recommended way to build HATEOAS models from entities
- Implements
RepresentationModelAssembler<Entity, Model>— reusable across controllers - Inject the assembler into controllers instead of calling
Model.from()directly
@Component
public class OrderModelAssembler implements RepresentationModelAssembler<Order, EntityModel<OrderResponse>> {
@Override
public EntityModel<OrderResponse> toModel(Order order) {
EntityModel<OrderResponse> model = EntityModel.of(OrderResponse.from(order),
linkTo(methodOn(OrderController.class).getById(order.getId())).withSelfRel(),
linkTo(methodOn(OrderController.class).list(null)).withRel("orders"));
if (order.getStatus() == OrderStatus.PENDING) {
model.add(linkTo(methodOn(OrderController.class)
.cancelOrder(order.getId())).withRel("cancel"));
}
return model;
}
}
PagedModel for Paginated Collections
- Use
PagedResourcesAssemblerfor automatic pagination links (first, prev, next, last) - Inject
PagedResourcesAssembler<Order>into controllers — Spring creates it automatically
@GetMapping
public ResponseEntity<PagedModel<EntityModel<OrderResponse>>> list(
Pageable pageable, PagedResourcesAssembler<Order> pagedAssembler) {
Page<Order> orders = orderService.findAll(pageable);
PagedModel<EntityModel<OrderResponse>> pagedModel =
pagedAssembler.toModel(orders, orderModelAssembler);
return ResponseEntity.ok(pagedModel);
}
Gotchas
- Agent adds all links regardless of state — only add action links when the action is valid
- Agent hardcodes URLs in links — always use
linkTo(methodOn(...))for type-safe links - Agent returns plain DTO — wrap in
EntityModel.of(dto, links...)or extendRepresentationModel - Agent puts link logic in controller — extract to
RepresentationModelAssembler - Agent manually builds pagination links — use
PagedResourcesAssemblerinstead - Agent forgets
selflink — every resource must have aselflink
Reviews
No reviews yet. Be the first.
Related
Frontend Slides
Create beautiful slides on the web using Claude's frontend skills
Planning With Files
Claude Code skill implementing Manus-style persistent markdown planning — the workflow pattern behind the $2B acquisition.
Guizang Ppt Skill
AI-agent Skill for generating polished HTML slide decks: editorial magazine and Swiss layouts, image prompts, social covers, and a WebGL/low-power presentation runtime.
mh install skills/hateoas