pw-url-routing

pw-url-routing is a skill for Claude Code, Codex from trk/processwire-boost. It costs 38 tokens per session (1,504 once invoked), scanned A, original, MIT.

A ProcessWire development skill for creating custom URL paths, virtual pages, and API endpoints with hooks.

In plain words
What is it for?
Use it to build custom routing, virtual pages, or API endpoints in ProcessWire.
Why use it?
It helps handle requests that do not map to physical backend templates in a ProcessWire site.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build custom routing, virtual pages, or API endpoints in ProcessWire.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/trk/processwire-boost/pw-url-routing
Install

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.

Any agent
npx skills add trk/processwire-boost --skill pw-url-routing
Clone the repo
git clone --depth 1 https://github.com/trk/processwire-boost

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for pw-url-routing

README.md
[![agentmods](https://agentmods.dev/badge/skills/trk/processwire-boost/pw-url-routing/github.svg)](https://agentmods.dev/skills/trk/processwire-boost/pw-url-routing)
Your own site
<a href="https://agentmods.dev/skills/trk/processwire-boost/pw-url-routing"><img src="https://agentmods.dev/badge/skills/trk/processwire-boost/pw-url-routing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pw-url-routing

Your own site · 80×15
<a href="https://agentmods.dev/skills/trk/processwire-boost/pw-url-routing"><img src="https://agentmods.dev/badge/skills/trk/processwire-boost/pw-url-routing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,504 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.01504
Opus 5.5 $0.00015 $0.00602
Sonnet 5.5 $0.00008 $0.00301
Haiku 4.5 $0.00004 $0.00150

Measured 12d ago against content hash f1dbc1b82537, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pw-url-routing 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 12d 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.

resources/boost/skills/pw-url-routing/SKILL.md · 150 lines

How it starts

The opening of the file, as written. The whole thing — 150 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ProcessWire URL/Path Hooks (pw-url-routing)

Register URL/Path hooks in site/init.php (recommended, runs before page rendering) or site/ready.php, or inside a module's init() method to handle virtual paths and JSON endpoints without creating templates or pages in the admin tree.

Documentation Reference (Source of Truth)

  • Core CLI: php index.php docs get-text WireHooks
  • Core Markdown: wire/core/WireHooks/API.md

1. Route Patterns & Argument Extraction

Exact Routes & JSON Responses

Returning an array from a URL hook automatically sets Content-Type: application/json and encodes the payload as JSON:

<?php

declare(strict_types=1);

namespace ProcessWire;

$wire->addHook('/api/health', function(HookEvent $event): array {
	return [
		'ok' => true,
		'timestamp' => time(),
	];
});

Named Parameters ({param}) & Inline Regex Constraints ((name:pattern))

// Named parameter: /api/products/{sku}
$wire->addHook('/api/products/{sku}', function(HookEvent $event): array|bool {
	$sanitizer = $event->wire()->sanitizer;
	$pages = $event->wire()->pages;

	$sku = $sanitizer->selectorValue((string) $event->arguments('sku'));
	if ($sku === '') {
		return false; // Triggers ProcessWire 404 response
	}

	$product = $pages->findOne("template=product, sku={$sku}");
	if (!$product->id || !$product->viewable()) {
		return false;
	}

	return [
		'id' => $product->id,
		'title' => (string) $product->title,
		'sku' => (string) $product->get('sku'),
		'url' => $product->url,
	];
});

// Constrained parameter: only matches numeric IDs
$wire->addHook('/orders/(id:[0-9]+)', function(HookEvent $event): Page|bool {
	$orderId = (int) $event->arguments('id');
	$order = $event->wire()->pages->findOne("template=order, id={$orderId}");

	return $order->id ? $order : false;
});

2. Return Value Semantics

Return Value ProcessWire Behavior
string Outputs the string directly as the response body.
array Sets Content-Type: application/json header and outputs json_encode($return).
Page Sets the returned Page as the active $page and renders its template normally.
true Indicates the callback already sent headers/output manually (e.g., via echo).
false or null Aborts the route and delegates to ProcessWire's standard 404 handler.

Read the full file on GitHub · 150 lines

Changes

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.

  1. 12d ago Changed · +35 lines f1dbc1b82537
  2. 29d ago Changed · -29 lines · +9 tokens per session 164320a9058d
  3. 1mo ago Changed · +3 lines 162860c9a607
  4. 3mo ago First seen · 141 lines · 29 tokens per session scan A 5a1bc350ea99

Subscribe to this mod's changes

pw-url-routing is a skill published in the GitHub repository trk/processwire-boost (5 stars, last pushed 13d ago), licensed MIT. It adds 38 tokens to every session and 1,504 once invoked, about $0.0002 per session on Opus 5.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-31.

Related

pw-url-routing compared with skills from other repositories

pw-url-routing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pw-url-routingtrk/processwire-boostSkill513d agoMITA38Claude Code, Codex
sandbox-stablecloudflare/skillsSkill3.5k6d agoApache-2.0A39Claude Code
sandbox-nextcloudflare/skillsSkill3.5k6d agoApache-2.0A39Claude Code
durable-objectscloudflare/skillsSkill3.5k6d agoApache-2.0A22Claude Code
cloudflarecloudflare/skillsSkill3.5k6d agoApache-2.0A103Claude Code
cloudflare-email-servicecloudflare/skillsSkill3.5k6d agoApache-2.0A21Claude Code
workers-best-practicescloudflare/skillsSkill3.5k6d agoApache-2.0A25Claude Code