Automated summary
Generates a PSR-13 compliant PHP 8.4 hypermedia link implementation (Link, EvolvableLink, LinkProvider) plus PHPUnit tests for HATEOAS REST APIs.
Strengths
- Ships immutable `final readonly` classes with the PSR-13 `with*`/`without*` methods already implemented
- Automatically treats hrefs containing braces as templated links
- The LinkProvider offers `getLinksByRel()` as a generator, which is handy for filtering by relation
- File layout is explicit for both source and tests (src/Infrastructure/Http/Link, tests/Unit/...)
Limitations
- Templates assume an App/src directory and namespace convention, so they need adapting for Symfony, Laravel or custom layouts
- The resource-with-links template is cut off and installing the psr/link dependency is not covered
- Unit tests are advertised but no test code is actually provided
- Does not address wiring links into real HTTP responses (serialization, Link headers)
Use it when starting a PHP REST API that should expose PSR-13 hypermedia links and you want a compliant skeleton without hand-writing the boilerplate.
Skip it if the project does not use PSR-13, or if you expect a generator that also covers HTTP serialization and full test coverage.
Security analysis
SafeThe skill only provides PHP code templates and instructions for generating PSR-13 hypermedia link implementations. It does not declare or use any tools, execute commands, or handle secrets. No destructive or exfiltrating actions are present.
No concerns found
How this analysis is madeExamples
Create a PSR-13 hypermedia link implementation for my PHP 8.4 REST API: the Link, LinkProvider classes and their unit tests.Generate a PSR-13 LinkProvider with rels like self, next and edit, then show how to attach it to my User API resource.Using PSR-13, build an evolvable Link for a URI template like /users/{id} and add a unit test checking isTemplated() returns true.name: create-psr13-link description: Generates PSR-13 Hypermedia Links implementation for PHP 8.4. Creates LinkInterface, EvolvableLinkInterface, and LinkProviderInterface for HATEOAS support. Includes unit tests. metadata: author: dykyi-roman
PSR-13 Hypermedia Links Generator
Overview
Generates PSR-13 compliant hypermedia link implementations for HATEOAS REST APIs.
When to Use
- Building REST APIs with HATEOAS
- Creating hypermedia-driven resources
- Link relation management
- URI templates
Generated Components
| Component | Description | Location |
|-----------|-------------|----------|
| Link | LinkInterface impl | src/Infrastructure/Http/Link/ |
| LinkProvider | Provider impl | src/Infrastructure/Http/Link/ |
| Unit Tests | PHPUnit tests | tests/Unit/Infrastructure/Http/Link/ |
Template: Link
<?php
declare(strict_types=1);
namespace App\Infrastructure\Http\Link;
use Psr\Link\EvolvableLinkInterface;
use Stringable;
final readonly class Link implements EvolvableLinkInterface
{
/** @param string[] $rels */
public function __construct(
private string $href,
private array $rels = [],
private array $attributes = [],
private bool $templated = false,
) {
}
public function getHref(): string
{
return $this->href;
}
public function isTemplated(): bool
{
return $this->templated || str_contains($this->href, '{');
}
public function getRels(): array
{
return $this->rels;
}
public function getAttributes(): array
{
return $this->attributes;
}
public function withHref(string|Stringable $href): static
{
return new self((string) $href, $this->rels, $this->attributes, $this->templated);
}
public function withRel(string $rel): static
{
$rels = [...$this->rels, $rel];
return new self($this->href, array_unique($rels), $this->attributes, $this->templated);
}
public function withoutRel(string $rel): static
{
$rels = array_filter($this->rels, fn($r) => $r !== $rel);
return new self($this->href, array_values($rels), $this->attributes, $this->templated);
}
public function withAttribute(string $attribute, string|Stringable $value): static
{
$attributes = $this->attributes;
$attributes[$attribute] = (string) $value;
return new self($this->href, $this->rels, $attributes, $this->templated);
}
public function withoutAttribute(string $attribute): static
{
$attributes = $this->attributes;
unset($attributes[$attribute]);
return new self($this->href, $this->rels, $attributes, $this->templated);
}
}
Template: Link Provider
<?php
declare(strict_types=1);
namespace App\Infrastructure\Http\Link;
use Psr\Link\EvolvableLinkProviderInterface;
use Psr\Link\LinkInterface;
final readonly class LinkProvider implements EvolvableLinkProviderInterface
{
/** @param LinkInterface[] $links */
public function __construct(
private array $links = [],
) {
}
public function getLinks(): iterable
{
return $this->links;
}
public function getLinksByRel(string $rel): iterable
{
foreach ($this->links as $link) {
if (in_array($rel, $link->getRels(), true)) {
yield $link;
}
}
}
public function withLink(LinkInterface $link): static
{
return new self([...$this->links, $link]);
}
public function withoutLink(LinkInterface $link): static
{
$links = array_filter(
$this->links,
fn($l) => $l !== $link,
);
return new self(array_values($links));
}
}
Template: Resource with Links
<?php
declare(strict_types=1);
namespace App\Presentation\Api\Resource;
use App\Domain\User\Entity\User;
use App\Infrastructure\Http\Link\Link;
use App\Infrastructure\Http\Link\LinkProvider;
use Psr\Link\LinkProviderInterface;
final readonly class UserResource implements LinkProviderInterface
{
private LinkProvider $linkProvider;
public function __construct(
public string $id,
public string $email,
public string $name,
) {
$this->linkProvider = new LinkProvider([
(new Link("/api/users/{$this->id}"))->withRel('self'),
(new Link("/api/users/{$this->id}/posts"))->withRel('posts'),
(new Link('/api/users'))->withRel('collection'),
]);
}
public static function fromEntity(User $user): self
{
return new self(
$user->getId()->toString(),
$user->getEmail()->toString(),
$user->getName(),
);
}
public function getLinks(): iterable
{
return $this->linkProvider->getLinks();
}
public function getLinksByRel(string $rel): iterable
{
return $this->linkProvider->getLinksByRel($rel);
}
public function toArray(): array
{
$data = [
'id' => $this->id,
'email' => $this->email,
'name' => $this->name,
'_links' => [],
];
foreach ($this->getLinks() as $link) {
foreach ($link->getRels() as $rel) {
$data['_links'][$rel] = [
'href' => $link->getHref(),
'templated' => $link->isTemplated(),
];
}
}
return $data;
}
}
Usage Example
<?php
use App\Infrastructure\Http\Link\Link;
use App\Infrastructure\Http\Link\LinkProvider;
// Create links
$selfLink = (new Link('/api/users/123'))
->withRel('self')
->withAttribute('title', 'User Profile');
$collectionLink = (new Link('/api/users'))
->withRel('collection');
$templateLink = (new Link('/api/users/{id}'))
->withRel('user');
// Create provider
$provider = (new LinkProvider())
->withLink($selfLink)
->withLink($collectionLink)
->withLink($templateLink);
// Get links by relation
foreach ($provider->getLinksByRel('self') as $link) {
echo $link->getHref(); // /api/users/123
}
Requirements
{
"require": {
"psr/link": "^2.0"
}
}
<!-- tomevault:4.0:skill_md:2026-04-11 -->Converted and distributed by TomeVault — claim your Tome and manage your conversions.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/psr-13-hypermedia-links-generator-mt87688k/download' --output '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md.part' && mv '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md.part' '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Original excerpt: Requirements
{
"require": {
"psr/link": "^2.0"
}
}
<!-- tomevault:4.0:skill_md:2026-04-11 -->Converted and distributed by TomeVault — claim your Tome and manage your conversions.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md' && test -s '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/create-psr13-link' && cp -R '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k' '.claude/skills/create-psr13-link'Cursor
test -f '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md' && test -s '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/create-psr13-link' && cp -R '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k' '.cursor/skills/create-psr13-link'Codex
test -f '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md' && test -s '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/create-psr13-link' && cp -R '.skill-downloads/psr-13-hypermedia-links-generator-mt87688k' '.agents/skills/create-psr13-link'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/psr-13-hypermedia-links-generator-mt87688k'openskills read 'psr-13-hypermedia-links-generator-mt87688k'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/psr-13-hypermedia-links-generator-mt87688k/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.