AI Skill Report Card
Generating Delete Controllers
Quick Start15 / 15
TypeScriptexport 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
Workflow13 / 15
Setup Questions:
- What is the entity name you want to delete?
- What URL path should be used? (e.g.,
/api/module/entity/) - What parameters are needed? (0 or more: id, versao, etc.)
- What should the return type be? (default:
null, or specify custom type) - 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
Examples20 / 20
Example 1: Simple ID deletion Input: Entity "Usuario", path "/api/auth/usuario/", parameter "id" of type "Auth.Usuario.Usuario['id']" Output:
TypeScriptexport 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:
TypeScriptexport 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:
TypeScriptexport 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
Identified Patterns
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
nullfor deletes)
Best Practices
- 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
Common Pitfalls
- 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