decorators

Build and stack Vovk.ts decorators for Next.js route handlers.

52|Updated Jul 12, 2023
One-click install
npx skills add https://github.com/finom/vovk --skill decorators
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: decorators
Source: https://github.com/finom/vovk/tree/main/packages/claude-plugin/skills/decorators
Command: npx skills add https://github.com/finom/vovk --skill decorators

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing router logic in Vovk.ts can become error-prone when mixing HTTP decorators, metadata, and custom wrappers. This skill standardizes how decorators are defined, stacked, and consumed, reducing boilerplate and ensuring consistent auth and state sharing across controllers.

Core Features & Use Cases

  • Built-in HTTP decorators (@get, @post, etc.) and metadata decorators (@prefix, @operation) for clean route definitions.
  • Custom decorator patterns via createDecorator for pre- and post-handler logic, including auth guards and timing.
  • Shared per-request state via req.vovk.meta() enabling safe cross-decorator communication.
  • Support for local vs HTTP contexts with guidance on using next/headers to access request data.

Quick Start

Wrap a controller method with @prefix and an HTTP decorator, apply an auth wrapper, and read req.vovk.meta<AuthMeta>() inside the handler to enforce access.

Frequently Asked Questions about decorators

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

FAQPage Schema
How do I share authentication state across Vovk.ts decorators in Next.js?

You can share authentication state across Vovk.ts decorators by using req.vovk.meta() to store and retrieve per-request metadata. This enables safe cross-decorator communication, allowing auth guards to pass access data directly to your route handlers.

What is the best way to stack custom decorators and HTTP methods in Vovk.ts?

The best way to stack decorators in Vovk.ts is to apply @prefix and HTTP decorators like @get or @post to controller methods, then wrap them with custom auth guards using createDecorator, ensuring a consistent wrapper order for pre- and post-handler logic.

Does Vovk.ts require experimentalDecorators to build custom route wrappers?

Vovk.ts does not strictly require experimentalDecorators to build custom wrappers. You can use the decorate() function as an alternative approach to define and consume custom decorators without relying on experimental TypeScript features.

Can I access Next.js request headers inside a local Vovk.ts decorator context?

Yes, you can access Next.js request data inside a local Vovk.ts decorator context by using next/headers. This allows your decorators to read header information directly when operating outside of a standard HTTP decorator context.

How do I add OpenAPI metadata to Next.js route handlers using Vovk.ts?

You can add OpenAPI metadata to Next.js route handlers by applying Vovk.ts metadata decorators like @operation alongside HTTP decorators on your controller methods, ensuring your API routes are cleanly defined and properly documented.