AI Skill Report Card

Generating TypeScript Delete Controllers

A-82·May 6, 2026·Source: Web
15 / 15
TypeScript
import { genRequestInstance } from '@/request'; import { AxiosResponse } from 'axios'; export const deleteEntityController = async ( id: Entity['id'], ): Promise<AxiosResponse<null, any>> => { const url = `/api/module/entity/${id}/`; const instance = genRequestInstance(); try { const response = await instance.delete(url); return response; } catch (error) { console.error('Erro na requisição:', error); return Promise.reject(error); } };
Recommendation
Add template or framework section with placeholder variables (e.g., {{entityName}}, {{moduleName}}) for easier generation
12 / 15
  1. Determine parameters - Extract entity ID and any additional parameters
  2. Build URL pattern - Follow /api/module/[params]/entity/${id}/ structure
  3. Add imports - Include genRequestInstance and AxiosResponse
  4. Generate function - Create controller with proper typing and error handling
  5. Add JSDoc - Document parameters, returns, and exceptions

Progress:

  • Identify entity name and module
  • Determine additional parameters beyond ID
  • Construct URL pattern
  • Generate function signature with types
  • Add error handling and JSDoc
Recommendation
Include edge cases like handling entities with compound IDs or optional parameters
17 / 20

Example 1: Input: Delete controller for "usuario" entity in "auth" module, no extra parameters Output:

TypeScript
/** * Deleta um usuário * @param id - ID do usuário * @returns Promise com resposta da API * @throws Error quando a requisição falha */ export const deleteUsuarioController = async ( id: Auth.Usuario.Usuario['id'], ): Promise<AxiosResponse<null, any>> => { const url = `/api/auth/usuario/${id}/`; const instance = genRequestInstance(); try { const response = await instance.delete(url); return response; } catch (error) { console.error('Erro na requisição:', error); return Promise.reject(error); } };

Example 2: Input: Delete controller for "folha" in "pessoal" module with "versao" parameter Output:

TypeScript
/** * Deleta uma folha de pagamento * @param versao - ID da versão * @param id - ID da folha * @returns Promise com resposta da API * @throws Error quando a requisição falha */ export const deleteFolhaController = async ( versao: Planejamento.Versao.Versao['id'], id: Pessoal.Folha.Folha['id'], ): Promise<AxiosResponse<null, any>> => { const url = `/api/pessoal/versao/${versao}/folha/${id}/`; const instance = genRequestInstance(); try { const response = await instance.delete(url); return response; } catch (error) { console.error('Erro na requisição:', error); return Promise.reject(error); } };
Recommendation
Expand completeness with more specific typing patterns and error response handling strategies
  • URL structure: Always end with / - /api/module/entity/${id}/
  • Function naming: Use camelCase with "Controller" suffix
  • Parameter order: Additional parameters first, entity ID last
  • Error handling: Use try-catch with console.error and Promise.reject
  • Type safety: Use proper namespace typing (Module.Entity.Entity['id'])
  • JSDoc: Include @param for all parameters, @returns, and @throws
  • Don't forget trailing slash in URLs
  • Don't mix up parameter order - ID should be last
  • Don't omit error handling even though axios handles it
  • Don't use generic types - use specific namespace typing
  • Don't forget to import required dependencies
  • Don't use kebab-case in function names - use camelCase
0
Grade A-AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
15/15
Workflow
12/15
Examples
17/20
Completeness
10/20
Format
15/15
Conciseness
13/15