This skill should be used when creating, modifying, or reviewing Azure Functions written in TypeScript with the v4 programming model. It covers project structure, HTTP trigger patterns, Cosmos DB integration, authentication, testing, and quality standards for serverless TypeScript development on Azure.
any unless documentednode:fs/promises, node:crypto, native fetch; no axios/lodash/moment@azure/functions@4, app.http() registration patternsrc/functions/<resource>-<verb>.ts| Task | Load reference file |
|---|---|
| Create / scaffold a function |
structure-http-templates.md |
| HTTP verb templates (GET/POST/…) | structure-http-templates.md |
| Cosmos DB CRUD patterns | database-auth-testing.md |
| Auth (Bearer token guard) | database-auth-testing.md |
| Node.js built-in usage | database-auth-testing.md |
| Writing Jest unit tests | database-auth-testing.md |
| Dependency rules / banned pkgs | quality-checklist-antipatterns.md |
| Quality / pre-commit checklist | quality-checklist-antipatterns.md |
| Anti-patterns to avoid | quality-checklist-antipatterns.md |
1. Identify HTTP verb + resource → decide filename: <resource>-<verb>.ts
2. Load structure-http-templates → use correct app.http() template
3. Add Cosmos DB / auth if needed → load database-auth-testing.md
4. Validate with zod → parse body as unknown → ZodSchema.parse()
5. Handle all error branches → 400 / 401 / 403 / 404 / 500
6. Write unit tests → createMockRequest + createMockContext
7. Update docs → OpenAPI + README + CHANGELOG
8. Run quality checklist → quality-checklist-antipatterns.md
File naming: src/functions/<resource>-<verb>.ts
Registration: app.http('<resource>-<verb>', { methods, authLevel, route, handler })
HTTP client: fetch() → no axios / node-fetch
UUID: randomUUID() from node:crypto
File IO: fs.readFile() from node:fs/promises (never sync)
Validation: zod schema → .parse(body) → catch ZodError → 400
Auth: extractBearerToken() → null=401 / validateToken() → false=403
Cosmos init: module-level (init once, reuse across invocations)
Cosmos 404: catch error.code === 404 → return null, re-throw others
Error helper: createErrorResponse(status, error, message?, details?)