policydb-route-patterns

Enforce literal-first route ordering and PATCH response contracts for PolicyDB FastAPI routes.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/wanderinglantern/policydb --skill policydb-route-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: policydb-route-patterns
Source: https://github.com/wanderinglantern/policydb/tree/main/.claude/skills/policydb-route-patterns
Command: npx skills add https://github.com/wanderinglantern/policydb --skill policydb-route-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PolicyDB route definitions commonly suffer from route conflicts between literal and parameterized paths, poorly defined endpoint patterns, and inconsistent PATCH responses, leading to unpredictable behavior and debugging challenges.

Core Features & Use Cases

  • Route ordering rule: literals must be registered before parameterized routes to prevent misrouting.
  • HTMX row edit pattern: provides endpoint variants for editing rows across client detail, dashboard, and renewals views, with consistent templates.
  • PATCH cell-save response: standard JSON responses for inline edits, including ok and formatted fields, enabling seamless UI updates.
  • Template context and configuration guidance: ensures templates receive required data like renewal_statuses and opportunity_statuses, and that routes use config-derived lists.

Quick Start

Add or modify routes using the provided literals-first rules and HTMX patterns to ensure correct routing and reliable PATCH responses.

Frequently Asked Questions about policydb-route-patterns

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

FAQPage Schema
Why do my FastAPI parameterized routes capture requests meant for literal paths?

FastAPI evaluates routes in registration order, so parameterized paths can shadow literal paths. You must register literal routes before parameterized routes to prevent misrouting and resolve 404 capture issues.

How do I standardize PATCH response contracts for inline HTMX edits?

Standardize PATCH cell-save responses by returning JSON with ok and formatted fields. This provides consistent contracts for inline edits, enabling seamless UI updates without template rendering inconsistencies.

What's the best way to configure HTMX row edit endpoints across different views?

Configure HTMX row edit endpoints by providing endpoint variants for client detail, dashboard, and renewals views. Apply consistent templates across all variants to ensure uniform behavior and UI rendering.

How do I ensure templates receive required context data for policy routes?

Ensure templates receive required context by passing config-derived lists like renewal_statuses and opportunity_statuses. Route handlers must supply this configuration data to templates to avoid rendering errors.

Can I use this route ordering pattern for debugging 404 issues on existing policy routes?

Yes, you can use the literals-first route ordering pattern to debug 404 capture issues on existing policy routes. Reordering routes ensures literal paths are matched before parameterized paths intercept requests.

Do I need specific dependencies to implement these FastAPI endpoint patterns?

No specific external dependencies are required to implement these FastAPI endpoint patterns. The rules apply to standard FastAPI route definitions using built-in routing, HTMX integration, and PATCH response mechanisms.