AI Skill Report Card

Generating TypeScript REST API

B-72·May 6, 2026·Source: Web
8 / 15

I'll help you generate a TypeScript API POST function. First, I need some information:

1. What is the resource/function name? (e.g., "createArea", "updateUser", "processPayment")

2. What are the URL parameters? Format as TypeScript object properties (e.g., versao: string, id?: number). Leave blank if none.

3. What is the BODY type? Paste the TypeScript interface/type for the request body.

4. What is the RETURN type? Paste the TypeScript interface/type for the response data.

Recommendation
Remove the 'I'll help you generate...' opening and jump straight to the requirements list - Claude doesn't need to introduce itself
12 / 15

Progress:

  • Collect function requirements
  • Generate main controller function with JSDoc
  • Generate unit tests
  • Add error handling patterns
  • Validate TypeScript types

Step-by-step Process:

  1. Analyze parameters - Determine if URL params needed
  2. Structure function signature - Single params object if URL params exist
  3. Build URL path - Template literals for dynamic segments
  4. Add error handling - Try-catch with proper error propagation
  5. Generate tests - Success and error scenarios
  6. Add JSDoc - Complete documentation
Recommendation
The Quick Start asks for information but doesn't provide immediate actionable content - include a basic example that works right away
18 / 20

Example 1: No URL Parameters Input:

  • Name: "createArea"
  • URL params: (none)
  • Body: CreateAreaParams
  • Return: Area

Output:

TypeScript
/** * Creates a new area * @param body - Area creation parameters * @returns Promise with area creation response * @throws {Error} When request fails */ export const createAreaController = async ( body: Planejamento.Cadastro.Area.CreateAreaParams, ): Promise<AxiosResponse<Planejamento.Cadastro.Area.Area, any>> => { const url = '/api/planejamento/area/'; const instance = genRequestInstance(); try { const response = await instance.post(url, body); return response; } catch (error) { console.error('Erro na requisição:', error); return Promise.reject(error); } };

Example 2: With URL Parameters Input:

  • Name: "createColaboradorVaga"
  • URL params: versao: string
  • Body: CreateColaboradorVagaParams
  • Return: any

Output:

TypeScript
/** * Creates a new colaborador vaga for specific version * @param params - URL parameters containing version ID * @param body - Colaborador vaga creation parameters * @returns Promise with creation response * @throws {Error} When request fails */ export const createColaboradorVagaController = async ( params: { versao: Planejamento.Versao.Versao['id'] }, body: Pessoal.Colaborador.Vaga.CreateColaboradorVagaParams, ): Promise<AxiosResponse<any, any>> => { const url = `/api/pessoal/versao/${params.versao}/colaborador-vaga/`; const instance = genRequestInstance(); try { const response = await instance.post(url, body); return response; } catch (error) { console.error('Erro na requisição:', error); return Promise.reject(error); } };
Recommendation
Add the promised unit test examples in the Examples section - currently only shows controller functions but mentions test generation in workflow
  • Single params object for URL parameters when they exist
  • Consistent naming ending with "Controller"
  • Proper TypeScript generics for AxiosResponse
  • Template literals for dynamic URL construction
  • Error logging before rejection
  • JSDoc documentation for all parameters and returns
  • Namespace typing following project patterns
  • Don't use query strings - All parameters go in URL path
  • Don't make params optional when URL segments required
  • Don't skip error handling - Always wrap in try-catch
  • Don't forget trailing slashes in URL paths
  • Don't mix param styles - Use object destructuring consistently
  • Don't omit JSDoc - Documentation is mandatory

Please provide the 4 pieces of information above, and I'll generate your complete TypeScript API function with tests!

0
Grade B-AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
8/15
Workflow
12/15
Examples
18/20
Completeness
9/20
Format
15/15
Conciseness
10/15