drogon-claude-plugin: Instructions file for Claude Code

CLAUDE.md

drogon-claude-plugin CLAUDE.md is an instructions file for Claude Code from voidvec/drogon-claude-plugin. It costs 2,424 tokens per session, scanned A, original, MIT.

Project instructions for building Drogon backends with C++, covering asynchronous request handling, the Trantor event-loop system, and routing work to related skills. Drogon is a C++ web framework, while an event loop runs network work without blocking its processing thread.

In plain words
What is it for?
Use it when writing Drogon request handlers, choosing callbacks or coroutines, handling errors, avoiding blocking database or file operations, and finding the right detailed coding guide.
Why use it?
It helps avoid common failures such as sending a response twice, leaving a request without a response, blocking the event loop, or allowing exceptions to escape a handler.

Instructions file for Claude Code

Written for Claude Code: PostToolUse hook event. Also seen: mentions Claude Code.

This is voidvec/drogon-claude-plugin's own configuration. It tells Claude Code how to work on drogon-claude-plugin itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything drogon-claude-plugin configures →

Reuse

Borrowing it

Nothing to install: this file belongs to voidvec/drogon-claude-plugin. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/voidvec/drogon-claude-plugin/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/voidvec/drogon-claude-plugin

Made for: Claude Code.

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 drogon-claude-plugin CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/voidvec/drogon-claude-plugin/claude-md/github.svg)](https://agentmods.dev/instructions/voidvec/drogon-claude-plugin/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/voidvec/drogon-claude-plugin/claude-md"><img src="https://agentmods.dev/badge/instructions/voidvec/drogon-claude-plugin/claude-md/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 drogon-claude-plugin CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/voidvec/drogon-claude-plugin/claude-md"><img src="https://agentmods.dev/badge/instructions/voidvec/drogon-claude-plugin/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,424 This file is loaded in full into every session.
When invoked 2,424 The same file — it is already loaded in full.
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.02424 $0.02424
Opus 5.5 $0.00970 $0.00970
Sonnet 5.5 $0.00485 $0.00485
Haiku 4.5 $0.00242 $0.00242

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

Security

Grade A, and why

drogon-claude-plugin CLAUDE.md 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 26d 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.

CLAUDE.md · 74 lines

How it starts

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

Drogon 后端开发规则

本文件由 drogon 插件提供(Claude Code / ZCode 双宿主)。规则针对 drogon v1.9.13。

本文只列顶层纪律(跨所有任务的高频陷阱)+ Skill 路由表。具体模板、API 速查、配置格式等详细知识已下沉到各 Skill 的 references/code-guide.md,按需加载——遇到对应任务时主动调用对应 Skill,不要凭记忆写代码。

A. 异步回调模型(所有 handler 的最高纪律)

Drogon 的每个 handler 接收一个 std::function<void(const HttpResponsePtr &)> 回调。响应的发出只与回调是否被调用有关,与 handler 是否 return 无关。

  1. 恰好一次:每个 handler 必须在所有代码路径(含错误/异常/提前返回)上恰好调用一次 callback。
  2. 绝不重复:禁止第二次调用 callback(未定义行为,可能重复响应或连接污染)。
  3. 禁止 handler 内同步阻塞:不得在 handler 内做阻塞式同步 I/O(同步读 DB、sleep、长计算、阻塞文件读写)后再 callback。改用 drogon 异步 API,或丢到线程池,完成处就近 callback。
  4. 按值捕获回调:异步/延迟场景下 callback 必须按值捕获进闭包,确保生命周期超出 handler 栈帧;悬空回调会崩溃。
  5. 异常不得逃逸 handler:用 try/catch 包裹业务逻辑,每个 catch 路径都调 callback(错误响应)。框架默认异常处理器只是兜底,不能替代你对 callback 的保证。全局兜底用 app().setExceptionHandler(不替代各 handler 自身的纪律)。
  6. 优先协程:__cpp_impl_coroutine 已定义且 CMake USE_COROUTINE=ON 时,优先用协程 handler(Task<HttpResponsePtr>,框架负责异常与响应交付)。AsyncTask 抛未处理异常会 std::terminate,用时必须 try/catch。裸协程 handler 的 req/callback 参数必须按值传递(挂起恢复后引用悬空)。协程细节用 drogon-gen-coroutine-handler skill。

B. 事件循环模型(Trantor IO)

Drogon 跑在 trantor 的事件循环上;配置项 number_of_threads 决定循环数(值为 0 表示按 CPU 硬件并发数自动设置),每条连接钉在某个循环上。

  1. 事件循环线程不可阻塞:禁止在事件循环线程做任何阻塞工作(同步 DB 调用、sleep、长计算、阻塞文件 I/O)——会拖死同一循环上所有其他连接。
  2. 重/阻塞活儿走线程池:把重活儿交给独立线程池;完成后用 runInLoop 派回连接所属的事件循环,再在那里 callback。长周期任务可建专属 trantor::EventLoopThread(见 drogon-gen-plugin skill)。
  3. 跨循环共享状态加锁:跨循环共享的状态必须加锁;更优是保持状态"循环局部"(IOThreadStorage<T>),或用 runInLoop 派发到归属循环访问。跨线程操作连接对象(如 WebSocketConnection)必须先派发回其所属循环。

Skill 路由表

遇到下列任务时,主动调用对应 Skill——详细模板、API 签名、禁止模式清单都在 skill 的 references/code-guide.md 里,按需加载以节省上下文。

任务 Skill 说明
创建控制器(.h+.cc) drogon-create-controller simple/http/websocket;含路径前缀差异、:param、WebSocket 宏、自动注册、生命周期纪律
现代 lambda 内联路由 drogon-gen-lambda-handler app().registerHandler + {N} 参数绑定;与经典宏二选一不混用
ORM CRUD 代码 drogon-gen-orm-crud 回调式 + 协程式;含禁 execSqlSync、双回调、事务纪律
从数据库生成 ORM 模型 drogon-gen-orm-model drogon_ctl create model 全参数;生成物约定、CMake 接入、MSVC/C++20 codecvt shim、禁止手改生成文件
数据库配置 drogon-gen-db-config PG/MySQL/SQLite;含键名黑名单、loadConfigFile 异常、运行期 DrogonDbException、SQL 注入防护
Redis 配置 + 用法 drogon-gen-redis-config 配置 + 单例/异步/异常/订阅防泄漏;execCommandAsync 双回调、格式化参数、协程
通用配置文件 drogon-setup-config listeners/app/SSL/静态文件/会话;含 custom_config+getCustomConfig、loadConfigJson、多环境
CMake 构建 drogon-gen-cmake find_package/ORM/协程;含 Conan 2、drogon_create_views、drogon_ctl 模型接入、MSVC 专项
协程 handler/中间件 drogon-gen-coroutine-handler Task/AsyncTask 语义、参数按值生命周期、forwardCoro
HTTP 出站请求 drogon-gen-http-client 异步/协程/反向代理 forward;含同步 sendRequest 死锁保护、timeout
CSP 视图模板 drogon-gen-csp-view 语法速查、布局、HttpViewData;含 drogon_ctl create view 管线、禁拼 HTML
Filter(请求拦截) drogon-gen-filter 认证/限流/输入校验;含 doFilter(fcb,fccb)、AutoCreation=false
Middleware(全局处理链) drogon-gen-middleware 日志/CORS/性能计时;含 invoke(nextCb,mcb)
Plugin(系统级扩展) drogon-gen-plugin 连接池/第三方 SDK 初始化;含生命周期与 shutdown() 排水、专属 EventLoopThread、静态库注册丢失对策
Advice(AOP 切面) drogon-gen-advice 11 个内建切面;含拦截型 vs 观察型、注册时机
文件上传 drogon-gen-file-upload MultiPart 解析+校验+落盘;含 setClientMaxBodySize、路径穿越
流式上传/下载 drogon-gen-stream RequestStream 三回调流式上传;chunked 流式响应;大文件不占内存
Session 登录鉴权 drogon-gen-session-auth 登录/登出/鉴权;含 changeSessionIdToClient 防 fixation、Cookie 安全(HttpOnly/Secure/SameSite)
WebSocket 长连接 drogon-gen-websocket WS 控制器宏、连接管理/广播、跨线程 send 安全、心跳
限流 drogon-gen-rate-limiter Hodor 插件配置 + 自定义 429;编程式 RateLimiter/SafeRateLimiter;Redis 分布式限流
监控指标 drogon-gen-monitoring PromExporter 插件 + Counter/Gauge/Histogram 采集;禁手写 /metrics
测试 drogon-gen-test DROGON_TEST;含断言宏、异步测试、CMake 扫描、自定义 main 与端口隔离

Read the full file on GitHub · 74 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. 26d ago Changed · +13 lines · +625 tokens per session 8d7239b9d82f
  2. 1mo ago First seen · 61 lines · 1,799 tokens per session scan A f4eae212034d

Subscribe to this mod's changes

drogon-claude-plugin CLAUDE.md is an instructions file published in the GitHub repository voidvec/drogon-claude-plugin (1 stars, last pushed 20d ago), licensed MIT. It adds 2,424 tokens to every session, about $0.0097 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

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,649 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,257 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 4,159 tokens