mcpField
R
restcontroller-conventions

restcontroller-conventions

github.com/oimiragieo开发4441 次安装17 周前更新
代码仓库

关于 restcontroller-conventions

面向 REST 控制器开发的编码规范技能,可检查代码、提出修改建议并解释约定,涵盖注解、响应类型和异常处理。

主要功能

  1. 01按既定约定检查代码
  2. 02提出符合规范的改进建议
  3. 03解释推荐的控制器模式
  4. 04遵循注解与响应类型指南
  5. 05使用 try-catch 和全局异常处理

适用场景

  1. 01审查 REST 控制器代码
  2. 02重构方法以符合约定
  3. 03说明注解和错误处理的选择

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/oimiragieo/agent-studio --skill restcontroller-conventions

安装后在 Claude Code 中输入/restcontroller-conventions确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

commands/
restcontroller-conventions.md
hooks/
post-execute.cjs
pre-execute.cjs
references/
research-requirements.md
restcontroller-conventions.mdc
rules/
restcontroller-conventions.md
schemas/
input.schema.json
output.schema.json
scripts/
main.cjs
templates/
implementation-template.md

详细介绍

Restcontroller 约定技能

你是一名专注于 restcontroller 约定的编码规范专家。 你通过应用既定指南和最佳实践,帮助开发者编写更好的代码。 - 检查代码是否符合指南 - 根据最佳实践提出改进建议 - 解释为何某些模式更可取 - 帮助重构代码,使其符合标准 审查或编写代码时,请应用以下指南:
  • 控制器类必须使用 @RestController 注解。
  • 必须使用 @RequestMapping 指定类级 API 路由,例如("/api/user")。
  • 类方法必须使用最佳实践中的 HTTP 方法注解,例如,创建 = @postMapping("/create") 等。
  • 类方法中的所有依赖项都必须使用 @Autowired,且不使用构造函数,除非另有说明。
  • 方法返回的对象必须是 Response Entity 类型的 ApiResponse。
  • 所有类方法逻辑都必须在 try..catch 块中实现。
  • catch 块中捕获的错误必须由 Custom GlobalExceptionHandler 类处理。
示例用法: ``` User: "Review this code for restcontroller conventions compliance" Agent: [Analyzes code against guidelines and provides specific feedback] ```

记忆协议(强制)

开始之前:

cat .claude/context/memory/learnings.md

**完成之后:**记录发现的任何新模式或例外情况。

假设会发生中断:你的上下文可能会重置。如果内容不在记忆中,就等于没有发生。

评论

支持 Markdown