Guides
Secure coding skills
CodexGuild's own security skills teach coding agents what to check before they write an endpoint, a query, auth code, an upload or an outbound request — matched to the project's framework, proposed by sync and advise, and reinforced by the pre-write hook.
Most vulnerabilities in agent-written code aren't exotic. An endpoint returns another user's record because the
lookup uses only the id from the URL. A query is built from a string. A request body is passed straight into an
update, so the client can set role or ownerId. The code works in the happy path, so nothing flags it.
CodexGuild attacks this at three points:
- Before the code is written — security skills the agent reads when it works on that kind of code.
- While it is written — the
pre-writehook gives a short checklist the first time a session writes an endpoint, a query, auth code, an upload or an outbound request, and warns on known vulnerability patterns. - Before the agent says "done" — the stop hook asks for
codexguild_scan_securityafter code changes.
The skills
| Skill | For | What it covers |
|---|---|---|
codexguild-secure-coding | any web or API project | the per-handler checklist; access control and IDOR, input validation and mass assignment, SQL/NoSQL/command injection, XSS, CSRF, CORS, cookies, secrets and passwords, JWT, uploads, path traversal, SSRF — with a reference file per topic |
codexguild-secure-nestjs | NestJS | global guards, ValidationPipe with whitelist/forbidNonWhitelisted, DTOs, ownership-scoped Prisma/TypeORM queries, $queryRaw vs $queryRawUnsafe, response shaping, throttling, uploads |
codexguild-secure-nextjs | Next.js App Router | Server Actions and Route Handlers as public endpoints, auth in a data access layer (not only middleware/proxy), zod validation, keeping server data out of client props, dangerouslySetInnerHTML, open redirects |
codexguild-secure-express | Express (not inside NestJS) | middleware order, Helmet, body limits, schema validation, auth middleware, ownership-scoped queries, sessions, sendFile with root, error handling |
codexguild-secure-django | Django / DRF | get_queryset scoping, explicit serializer fields, raw SQL with params, CSRF, mark_safe, production settings and check --deploy |
codexguild-secure-fastapi | FastAPI | auth dependencies on routers, ownership in SQLAlchemy queries, Pydantic extra="forbid", response_model, PyJWT with pinned algorithms, uploads, proxy headers |
They are written and maintained by CodexGuild, pass the same security scan as every
skill in the registry, and are served at https://api.codexguild.com/.well-known/skills/<name>/. Names start with
codexguild-, so a registry skill can never take their place.
How an agent gets them
-
Sync lists the ones that fit the project's stack in
securitySkills, each withinstalled: true|false:json"securitySkills": [ { "name": "codexguild-secure-coding", "matches": ["nestjs"], "installed": true, "reason": "…", "url": "…" }, { "name": "codexguild-secure-nestjs", "matches": ["nestjs"], "installed": false, "reason": "…", "url": "…" } ] -
Advise (
codexguild_advise) proposes installing the missing ones, with the exact commands for the agent's harness. Like every advise proposal, nothing is installed without your OK. -
Installed ones are checked on every sync like any other skill, against the server's own scan.
The pre-write briefing
With the hooks set up, the first time in a session a write adds one of these, the agent gets the rules for it before it continues:
| Kind of code | Recognized by | The briefing asks for |
|---|---|---|
| Endpoint | @Get()/@Post(), router.post(, "use server", export async function POST, DRF views, controller/route files | server-side auth, ids scoped to the caller, schema validation that rejects unknown fields, explicit response fields |
| Query | Prisma/TypeORM/SQLAlchemy/Django ORM calls, raw SQL | parameters only, owner/tenant filter, allowlisted ORDER BY, capped page size |
| Auth | password hashing, JWT, sessions, cookies, auth-named files | argon2id/bcrypt, CSPRNG tokens stored hashed, pinned JWT algorithms, cookie flags, rate limits |
| Upload | multer, FileInterceptor, UploadFile, FileField | size limits, type from the file bytes, generated names outside the web root |
| Outbound request | fetch(variable), axios, requests, httpx | SSRF: host allowlist or private-address block, timeouts, no forwarded credentials |
It names the skills to read — with their path when installed, or a pointer to codexguild_advise when not. Each kind
is briefed once per session, it never blocks a write, and it runs locally (works without a key, sends nothing).
What it doesn't do
The skills and the briefing make an agent ask the right questions; they don't prove the code is safe. Pattern
checks (codexguild_scan_security) find common shapes of a problem, not every instance. Keep code review and tests
that prove the negative — another user's id returns 404, an unknown field is rejected — for anything that matters.