nginx
4
总安装量
2
周安装量
#52601
全站排名
安装命令
npx skills add https://github.com/nejclovrencic/nginx-agent-skills --skill nginx
Agent 安装分布
opencode
2
gemini-cli
2
amp
1
openclaw
1
cursor
1
kimi-cli
1
Skill 文档
Nginx & OpenResty Development
Core Guidance
When writing or reviewing Nginx configuration:
- Always consider the directive inheritance model. Child blocks inherit from parent unless they redefine the directive. For example, adding one
proxy_set_headerin a location block wipes all inheritedproxy_set_headerdirectives from the server block. - Prefer
mapoveriffor conditional logic.ifin location context is dangerous and only reliably supportsreturnandrewrite. See references/nginx-gotchas.md for the full list. - Always clarify
proxy_passtrailing-slash behavior â it is the single most common source of subtle bugs. - When writing
upstreamblocks, always include keepalive configuration and explain connection pooling implications. - When writing Nginx directives, always check docs, specifically module references, to verify that a directive actually exists, and what values it accepts (on/off, variable, fixed values, etc).
When writing OpenResty/Lua code:
- Always check phase restrictions before using cosocket or subrequest APIs. See references/openresty-api.md.
- Prefer
ngx.ctxoverngx.varfor passing data between phases because it’s more performant. - Avoid using ngx.var multiple times for the same variable, as it’s less performant than accessing Lua variable.
- Use
ngx.timer.atfor background/async work, never block the event loop.
When advising on performance:
- Consult references/testing-patterns.md for benchmarking methodology.
- Always consider the full request path: client â Nginx â upstream, and tune each segment.
- Buffer sizing has cascading effects â refer to the buffer tuning section in references/nginx-gotchas.md.
Reference Files
Load these as needed based on the task:
- references/nginx-gotchas.md â Directive behavior gotchas, inheritance rules, location matching, common misconfigurations. Read when writing or debugging any Nginx config.
- references/openresty-api.md â Phase handler reference, shared dict operations. Read when writing Lua/OpenResty code.
- references/testing-patterns.md â Config validation. Read when testing or benchmarking.