[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEED94AXD41H84BGPV8YX4":3,"skill-same:01M6FEED94AXD41H84BGPV8YX4":48},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":21,"linkOnly":22,"markdownContent":23,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M6FEED94AXD41H84BGPV8YX4","nginx-c-modules",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fnginx-c-modules\u002FSKILL.md",[],[18,19,20],"nginx","modules","nginx c modules","2026-11-10 10:12:30",false,"# nginx.org C Module Development Best Practices\n\nComprehensive 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.\n\n## When to Apply\n\nReference these guidelines when:\n- Writing new nginx C modules (handlers, filters, upstream, load-balancers)\n- Implementing configuration directives and merge logic\n- Managing memory with nginx pools and shared memory zones\n- Handling the HTTP request lifecycle (body reading, subrequests, finalization)\n- Working with nginx's event loop, timers, and thread pools\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Memory Management | CRITICAL | `mem-` |\n| 2 | Request Lifecycle | CRITICAL | `req-` |\n| 3 | Configuration System | HIGH | `conf-` |\n| 4 | Handler Development | HIGH | `handler-` |\n| 5 | Filter Chain | MEDIUM-HIGH | `filter-` |\n| 6 | Upstream & Proxy | MEDIUM | `upstream-` |\n| 7 | Event Loop & Concurrency | MEDIUM | `event-` |\n| 8 | Data Structures & Strings | LOW-MEDIUM | `ds-` |\n\n## Quick Reference\n\n### 1. Memory Management (CRITICAL)\n\n- [`mem-pool-allocation`](references\u002Fmem-pool-allocation.md) - Use Pool Allocation Instead of Heap malloc\n- [`mem-check-allocation`](references\u002Fmem-check-allocation.md) - Check Every Allocation Return for NULL\n- [`mem-pcalloc-structs`](references\u002Fmem-pcalloc-structs.md) - Use ngx_pcalloc for Struct Initialization\n- [`mem-cleanup-handlers`](references\u002Fmem-cleanup-handlers.md) - Register Pool Cleanup Handlers for External Resources\n- [`mem-pnalloc-strings`](references\u002Fmem-pnalloc-strings.md) - Use ngx_pnalloc for String Data Allocation\n- [`mem-pfree-limitations`](references\u002Fmem-pfree-limitations.md) - Avoid Relying on ngx_pfree for Pool Allocations\n- [`mem-shared-slab`](references\u002Fmem-shared-slab.md) - Use Slab Allocator for Shared Memory Zones\n\n### 2. Request Lifecycle (CRITICAL)\n\n- [`req-finalize-once`](references\u002Freq-finalize-once.md) - Finalize Requests Exactly Once\n- [`req-no-access-after-finalize`](references\u002Freq-no-access-after-finalize.md) - Never Access Request After Finalization\n- [`req-body-async`](references\u002Freq-body-async.md) - Handle Request Body Reading Asynchronously\n- [`req-discard-body`](references\u002Freq-discard-body.md) - Discard Request Body When Not Reading It\n- [`req-subrequest-completion`](references\u002Freq-subrequest-completion.md) - Use Post-Subrequest Handlers for Completion\n- [`req-count-reference`](references\u002Freq-count-reference.md) - Increment Request Count Before Async Operations\n- [`req-internal-redirect`](references\u002Freq-internal-redirect.md) - Return After Internal Redirect\n\n### 3. Configuration System (HIGH)\n\n- [`conf-unset-init`](references\u002Fconf-unset-init.md) - Initialize Config Fields with UNSET Constants\n- [`conf-merge-all-fields`](references\u002Fconf-merge-all-fields.md) - Merge All Config Fields in merge_loc_conf\n- [`conf-context-flags`](references\u002Fconf-context-flags.md) - Use Correct Context Flags for Directives\n- [`conf-null-command`](references\u002Fconf-null-command.md) - Terminate Commands Array with ngx_null_command\n- [`conf-custom-handler`](references\u002Fconf-custom-handler.md) - Use Custom Handlers for Complex Directive Parsing\n- [`conf-module-ctx-null`](references\u002Fconf-module-ctx-null.md) - Set Unused Module Context Callbacks to NULL\n- [`conf-build-config`](references\u002Fconf-build-config.md) - Write Correct config Build Script for Module Compilation\n\n### 4. Handler Development (HIGH)\n\n- [`handler-send-header-first`](references\u002Fhandler-send-header-first.md) - Send Header Before Body Output\n- [`handler-last-buf`](references\u002Fhandler-last-buf.md) - Set last_buf Flag on Final Buffer\n- [`handler-phase-registration`](references\u002Fhandler-phase-registration.md) - Register Phase Handlers in postconfiguration\n- [`handler-content-handler`](references\u002Fhandler-content-handler.md) - Use content_handler for Location-Specific Response Generation\n- [`handler-error-page`](references\u002Fhandler-error-page.md) - Return HTTP Status Codes for Error Responses\n- [`handler-empty-response`](references\u002Fhandler-empty-response.md) - Use header_only for Empty Body Responses\n- [`handler-module-ctx`](references\u002Fhandler-module-ctx.md) - Use Module Context for Per-Request State\n- [`handler-add-variable`](references\u002Fhandler-add-variable.md) - Register Custom Variables in preconfiguration\n\n### 5. Filter Chain (MEDIUM-HIGH)\n\n- [`filter-registration-order`](references\u002Ffilter-registration-order.md) - Save and Replace Top Filter in postconfiguration\n- [`filter-call-next`](references\u002Ffilter-call-next.md) - Always Call Next Filter in the Chain\n- [`filter-check-subrequest`](references\u002Ffilter-check-subrequest.md) - Distinguish Main Request from Subrequest in Filters\n- [`filter-buffer-chain-iteration`](references\u002Ffilter-buffer-chain-iteration.md) - Iterate Buffer Chains Using cl->next Pattern\n- [`filter-buffering-flag`](references\u002Ffilter-buffering-flag.md) - Set Buffering Flag When Accumulating Response Data\n\n### 6. Upstream & Proxy (MEDIUM)\n\n- [`upstream-create-request`](references\u002Fupstream-create-request.md) - Build Complete Request Buffer in create_request\n- [`upstream-process-header`](references\u002Fupstream-process-header.md) - Parse Upstream Response Incrementally in process_header\n- [`upstream-peer-free`](references\u002Fupstream-peer-free.md) - Track Failures in Peer free Callback\n- [`upstream-finalize`](references\u002Fupstream-finalize.md) - Clean Up Resources in finalize_request Callback\n- [`upstream-connection-reuse`](references\u002Fupstream-connection-reuse.md) - Enable Keepalive for Upstream Connections\n\n### 7. Event Loop & Concurrency (MEDIUM)\n\n- [`event-no-blocking`](references\u002Fevent-no-blocking.md) - Never Use Blocking Calls in Event Handlers\n- [`event-timer-management`](references\u002Fevent-timer-management.md) - Delete Timers Before Freeing Associated Data\n- [`event-handle-read-write`](references\u002Fevent-handle-read-write.md) - Call ngx_handle_read\u002Fwrite_event After I\u002FO Operations\n- [`event-thread-pool`](references\u002Fevent-thread-pool.md) - Offload Blocking Operations to Thread Pool\n- [`event-posted-events`](references\u002Fevent-posted-events.md) - Use Posted Events for Deferred Processing\n\n### 8. Data Structures & Strings (LOW-MEDIUM)\n\n- [`ds-ngx-str-not-null-terminated`](references\u002Fds-ngx-str-not-null-terminated.md) - Never Assume ngx_str_t Is Null-Terminated\n- [`ds-ngx-str-set-literals`](references\u002Fds-ngx-str-set-literals.md) - Use ngx_string Macro Only with String Literals\n- [`ds-cpymem-pattern`](references\u002Fds-cpymem-pattern.md) - Use ngx_cpymem for Sequential Buffer Writes\n- [`ds-list-iteration`](references\u002Fds-list-iteration.md) - Iterate ngx_list_t Using Part-Based Pattern\n- [`ds-hash-readonly`](references\u002Fds-hash-readonly.md) - Build Hash Tables During Configuration Only\n\n## How to Use\n\nRead individual reference files for detailed explanations and code examples:\n\n- [Section definitions](references\u002F_sections.md) - Category structure and impact levels\n- [Rule template](assets\u002Ftemplates\u002F_template.md) - Template for adding new rules\n\n## Reference Files\n\n| File | Description |\n|------|-------------|\n| [references\u002F_sections.md](references\u002F_sections.md) | Category definitions and ordering |\n| [assets\u002Ftemplates\u002F_template.md](assets\u002Ftemplates\u002F_template.md) | Template for new rules |\n| [metadata.json](metadata.json) | Version and reference information |\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Fnginx-c-modules",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill nginx-c-modules",{"tool":40,"command":41},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill nginx-c-modules",{"tool":43,"command":44},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill nginx-c-modules","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fnginx-c-modules\u002FSKILL.md",true,[],[49,63,73,82,88,95],{"skillNo":50,"name":51,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":59,"publishedAt":21},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[54],{"categoryNo":55,"categoryName":56,"taxonomyType":57,"taxonomyTypeDesc":58},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[60,61,62],"model","model hierarchy","model hierarchy skill",{"skillNo":64,"name":65,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":69,"publishedAt":21},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[68],{"categoryNo":55,"categoryName":56,"taxonomyType":57,"taxonomyTypeDesc":58},[70,71,72],"MCP","zoom","zoom mcp",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":21},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[79,80,81,71],"sdk","zoom apps sdk","apps",{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":21},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[84],{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":94,"publishedAt":21},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[93],{"categoryNo":55,"categoryName":56,"taxonomyType":57,"taxonomyTypeDesc":58},[90],{"skillNo":96,"name":97,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":21},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[97]]