fastify-url-special-characters

Diagnose Fastify routing versus validation failures from special characters in route parameters.

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/cajias/claude-skills --skill fastify-url-special-characters
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastify-url-special-characters
Source: https://github.com/cajias/claude-skills/tree/main/skills/fastify-url-special-characters
Command: npx skills add https://github.com/cajias/claude-skills --skill fastify-url-special-characters

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you fix failing Fastify tests when special characters in route parameters are stripped or interpreted before your handler runs, causing unexpected 404s instead of the validation errors you intended.

Core Features & Use Cases

  • Diagnose routing vs validation failures: Distinguish cases where Fastify never matches the route from cases where your parameter validation is correctly rejecting input.
  • Choose safe test inputs: Replace problematic characters like # and ? with pass-through characters such as dots or spaces encoded in the URL.
  • Validate route parameter rules: Test regex, length, and format constraints for IDs in dynamic routes like /gateways/:gatewayId/mcp.
  • Use Case: A Fastify endpoint returns 404 for a malformed gateway ID test, and this Skill shows how to rewrite the test so the request reaches the handler and returns the expected 400.

Quick Start

Ask for help rewriting your Fastify route parameter test so it uses URL characters that reach the handler and trigger validation instead of routing-level 404s.

Frequently Asked Questions about fastify-url-special-characters

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Fastify test return a 404 instead of a validation error for a malformed ID?

Fastify test failures occur when special characters in route parameters are consumed or stripped before validation runs. Characters like # or ? break URL parsing, causing the router to miss the dynamic route and return a 404 instead of reaching your handler.

How do I test Fastify dynamic routes with special characters?

To test Fastify dynamic routes with special characters, replace problematic characters like # and ? with pass-through characters such as dots or spaces encoded in the URL. This ensures the request reaches the handler to trigger validation rather than failing at the routing level.

What is the difference between routing failures and validation failures in Fastify URL parsing?

Routing failures happen when Fastify never matches the route due to URL parsing rules, returning a 404. Validation failures occur when the parameter reaches the handler but is rejected by format constraints, correctly returning a 400.

Which URL characters are safe to use when testing Fastify route parameters?

Safe URL characters for testing Fastify route parameters include pass-through characters like dots or spaces encoded in the URL. These comply with RFC 3986 parsing rules and safely reach the handler without being stripped or interpreted by the router.

How do I validate regex and length constraints for IDs in Fastify dynamic routes?

Validate regex and length constraints for IDs by rewriting tests to use URL-encoded pass-through characters. This allows malformed IDs in dynamic routes like /gateways/:gatewayId/mcp to reach the handler, triggering the expected 400 validation failure.

Does Fastify support RFC 3986 encoding for dynamic route testing?

Fastify supports RFC 3986 encoding rules for URL parsing, but characters like # and ? are consumed before reaching handlers. Testing dynamic routes requires using URL-encoded pass-through characters to ensure the request triggers validation instead of routing 404s.