context-usage

Automate global CONTEXT setup with database, cache, and JWT middleware.

1|Updated Mar 16, 2024
One-click install
npx skills add https://github.com/tdcare/genies --skill context-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-usage
Source: https://github.com/tdcare/genies/tree/main/.qoder/skills/context-usage
Command: npx skills add https://github.com/tdcare/genies --skill context-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

genies_context is the application context management library for Genies, providing a global CONTEXT singleton, database pools, cache services, and JWT middleware to streamline bootstrapping and cross-service coordination.

Core Features & Use Cases

  • Global context singleton (CONTEXT) to expose a single, thread-safe context across services.
  • Multi-database support via RBatis with automatic driver selection for MySQL, PostgreSQL, SQLite, MSSQL, Oracle, and TDengine.
  • Cache integration with Redis and a standard cache service for fast, scalable data access.
  • JWT verification middleware (Keycloak integration) to protect endpoints and simplify authentication.
  • Cross-service token management using REMOTE_TOKEN to share tokens between services.
  • Kubernetes health probes support for ready/liveness checks to fit cloud-native deployments.
  • Salvo authentication middleware to enforce security policies in HTTP routes.

Quick Start

Initialize the global CONTEXT during application startup to enable database connections, caching, and authentication.

Frequently Asked Questions about context-usage

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

FAQPage Schema
How do I configure a global application context for database and cache services?

To configure a global application context, initialize a thread-safe singleton CONTEXT during application startup. This exposes centralized database pools, Redis cache services, and JWT middleware across multiple services.

How does JWT verification middleware work with Keycloak and salvo_auth?

JWT verification middleware integrates with Keycloak to authenticate tokens and uses salvo_auth middleware to enforce security policies directly within HTTP routes, protecting application endpoints.

Can I use RBatis for multi-database pooling with PostgreSQL and MySQL?

Yes, RBatis supports multi-database pooling with automatic driver selection for PostgreSQL, MySQL, SQLite, MSSQL, Oracle, and TDengine, allowing simultaneous management of multiple database connections.

How do I implement Kubernetes health probes for cloud-native deployments?

Implement Kubernetes health probes by configuring ready and liveness checks within the application context. This ensures your cloud-native deployments properly report service health status to the orchestrator.

What is the best way to manage cross-service tokens for authentication?

Manage cross-service tokens by utilizing the REMOTE_TOKEN feature within the global context. This enables secure token sharing and authentication coordination between multiple distributed services.