AI Skill Report Card

Generating Delete Controllers

A-82·May 6, 2026·Source: Web
15 / 15
TypeScript
export const deleteExampleController = async ( id: Example.Entity['id'], ): Promise<AxiosResponse<null, any>> => { const url = `/api/example/entity/${id}/`; const instance = genRequestInstance(); try { const response = await instance.delete(url); return response; } catch (error) { return Promise.reject(error); } };
Recommendation
Remove the 'Setup Questions' section and integrate those considerations directly into the workflow steps
13 / 15

Setup Questions:

  1. What is the entity name you want to delete?
  2. What URL path should be used? (e.g., /api/module/entity/)
  3. What parameters are needed? (0 or more: id, versao, etc.)
  4. What should the return type be? (default: null, or specify custom type)
  5. What namespace/type should be used for parameter typing?

Generation Steps:

  • Define function name as delete{EntityName}Controller
  • Set up parameter types using provided namespaces
  • Construct URL with parameters
  • Create axios instance with genRequestInstance()
  • Implement try-catch with standard error handling
  • Set return type (default: AxiosResponse<null, any>)
Recommendation
Condense the 'Identified Patterns' section by removing redundant information already covered in examples
20 / 20

Example 1: Simple ID deletion Input: Entity "Usuario", path "/api/auth/usuario/", parameter "id" of type "Auth.Usuario.Usuario['id']" Output:

TypeScript
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) { return Promise.reject(error); } };

Example 2: Multiple parameters Input: Entity "Tarefa", path "/api/projeto/versao/{versao}/tarefa/", parameters "versao" and "id" Output:

TypeScript
export const deleteTarefaController = async ( versao: Projeto.Versao.Versao['id'], id: Projeto.Tarefa.Tarefa['id'], ): Promise<AxiosResponse<null, any>> => { const url = `/api/projeto/versao/${versao}/tarefa/${id}/`; const instance = genRequestInstance(); try { const response = await instance.delete(url); return response; } catch (error) { return Promise.reject(error); } };

Example 3: No parameters Input: Entity "Cache", path "/api/sistema/cache/" Output:

TypeScript
export const deleteCacheController = async (): Promise<AxiosResponse<null, any>> => { const url = `/api/sistema/cache/`; const instance = genRequestInstance(); try { const response = await instance.delete(url); return response; } catch (error) { return Promise.reject(error); } };
Recommendation
Streamline the workflow checklist to focus on the core generation steps without explaining obvious implementation details

URL Structure:

  • Always ends with trailing slash /
  • Parameters interpolated directly: ${param}/
  • Format: /api/{module}/{entity}/{param1}/{param2}/

Function Naming:

  • Convention: delete{EntityName}Controller
  • CamelCase for entity names

Parameter Typing:

  • Use namespace notation: Module.SubModule.Entity['id']
  • Common pattern: ['id'] for ID fields
  • Parameters appear in URL path order

Error Handling:

  • Standard try-catch pattern
  • Promise.reject(error) in catch block
  • Axios handles HTTP status errors (>=400)

Return Type:

  • Default: Promise<AxiosResponse<null, any>>
  • First generic is response data type (usually null for deletes)
  • Always use genRequestInstance() for axios instance
  • Include trailing slash in URLs
  • Order parameters logically (parent → child relationships)
  • Use descriptive parameter names matching the entity structure
  • Maintain consistent async/await pattern
  • Forgetting trailing slash in URL
  • Incorrect parameter order in URL construction
  • Missing namespace in type definitions
  • Using wrong return type generic
  • Not following camelCase convention for function names
0
Grade A-AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
15/15
Workflow
13/15
Examples
20/20
Completeness
16/20
Format
15/15
Conciseness
13/15