Agent Skills: nginx.org C Module Development Best Practices

nginx C module development guidelines based on the official nginx development guide. This skill should be used when writing, reviewing, or refactoring nginx C modules to ensure correct memory management, request lifecycle handling, and event-driven patterns. Triggers on tasks involving nginx module development, ngx_http_module_t, handler/filter/upstream implementation, pool allocation, or nginx configuration directives.

UncategorizedID: pproenca/dot-skills/nginx-c-modules

Install this agent skill to your local

pnpm dlx add-skill https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/nginx-c-modules

Skill Files

Browse the full folder contents for nginx-c-modules.

Download Skill

Loading file tree…

skills/.experimental/nginx-c-modules/SKILL.md

Skill Metadata

Name
nginx-c-modules
Description
nginx C module development guidelines based on the official nginx development guide. This skill should be used when writing, reviewing, or refactoring nginx C modules to ensure correct memory management, request lifecycle handling, and event-driven patterns. Triggers on tasks involving nginx module development, ngx_http_module_t, handler/filter/upstream implementation, pool allocation, or nginx configuration directives.

nginx.org C Module Development Best Practices

Comprehensive development guide for nginx C modules, derived from the official nginx development documentation and community expertise. Contains 49 rules across 8 categories, prioritized by impact to guide correct module implementation and prevent common crashes, memory leaks, and undefined behavior.

When to Apply

Reference these guidelines when:

  • Writing new nginx C modules (handlers, filters, upstream, load-balancers)
  • Implementing configuration directives and merge logic
  • Managing memory with nginx pools and shared memory zones
  • Handling the HTTP request lifecycle (body reading, subrequests, finalization)
  • Working with nginx's event loop, timers, and thread pools

Rule Categories by Priority

| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Memory Management | CRITICAL | mem- | | 2 | Request Lifecycle | CRITICAL | req- | | 3 | Configuration System | HIGH | conf- | | 4 | Handler Development | HIGH | handler- | | 5 | Filter Chain | MEDIUM-HIGH | filter- | | 6 | Upstream & Proxy | MEDIUM | upstream- | | 7 | Event Loop & Concurrency | MEDIUM | event- | | 8 | Data Structures & Strings | LOW-MEDIUM | ds- |

Quick Reference

1. Memory Management (CRITICAL)

2. Request Lifecycle (CRITICAL)

3. Configuration System (HIGH)

4. Handler Development (HIGH)

5. Filter Chain (MEDIUM-HIGH)

6. Upstream & Proxy (MEDIUM)

7. Event Loop & Concurrency (MEDIUM)

8. Data Structures & Strings (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

| File | Description | |------|-------------| | references/_sections.md | Category definitions and ordering | | assets/templates/_template.md | Template for new rules | | metadata.json | Version and reference information |