Borrowing it
Nothing to install: this file belongs to glyahh/ai-generate-code. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/glyahh/ai-generate-code/master/.cursor/skills/backend-design/SKILL.mdgit clone --depth 1 https://github.com/glyahh/ai-generate-codeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/glyahh/ai-generate-code/backend-design)<a href="https://agentmods.dev/skills/glyahh/ai-generate-code/backend-design"><img src="https://agentmods.dev/badge/skills/glyahh/ai-generate-code/backend-design/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/glyahh/ai-generate-code/backend-design"><img src="https://agentmods.dev/badge/skills/glyahh/ai-generate-code/backend-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00080 | $0.02758 |
| Opus 5.5 | $0.00032 | $0.01103 |
| Sonnet 5.5 | $0.00016 | $0.00552 |
| Haiku 4.5 | $0.00008 | $0.00276 |
Grade A, and why
backend-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.
项目上下文与总原则
- 遵循本项目既有分层架构:
controller → service 接口 → serviceImpl → mapper / entity / DTO / VO,以及core下的「门面 + 执行器 + 解析器/模板」模式(参考AiCodeGeneratorFacade、CodeParserExecutor、CodeFileSaverExecutor)。 - 所有 Web 接口统一返回
BaseResponse<T>,优先通过ResultUtils.success/ResultUtils.error构建响应;需要自定义提示时可以使用new BaseResponse<>(code, data, message)。 - 参数校验、业务前置校验、权限校验统一使用
ThrowUtils.throwIf(...)搭配ErrorCode/MyException,不要在 Controller 中随意使用if (...) return之类的早退返回。 - 依赖注入优先使用构造器注入 + Lombok:在
controller、serviceImpl中使用@RequiredArgsConstructor,同时配合@Slf4j打日志。 - 全局异常通过
GlobalExceptionHandler兜底,业务代码中抛出MyException或通过ThrowUtils.throwIf抛出,不在控制层/服务层到处写 try-catch 吃掉异常。 - 统一使用 Hutool 工具类,如
StrUtil做字符串判空,BeanUtil做对象属性拷贝。 - 绝对不要修改前端目录:禁止改动
ai-generate-code-frontend/**下的任何文件,仅操作 Java 后端、SQL、Maven、YAML 等后端相关内容。
统一响应与异常处理风格
- 所有对外接口(
@RestController下的方法)返回类型统一为BaseResponse<T>:- 正常成功:
return ResultUtils.success(data); - 需要自定义提示:
return new BaseResponse<>(20000, data, "自定义提示"); - 特殊业务分支可以按现有风格使用
new BaseResponse<>(code, data, message),但保持与项目已有语义一致(例如管理员已存在等场景)。
- 正常成功:
- 参数 & 状态校验:
- 统一使用
ThrowUtils.throwIf(condition, ErrorCode.PARAMS_ERROR, "具体错误信息"); - 登录态校验:
ThrowUtils.throwIf(user == null || user.getId() == null, ErrorCode.NOT_LOGIN_ERROR, "用户未登录或会话失效"); - 资源不存在:
ThrowUtils.throwIf(entity == null, ErrorCode.NOT_FOUND_ERROR, "xxx 不存在"); - 权限不足:
ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR, "无权限/只能操作自己的资源"); - 通用系统错误:使用
ErrorCode.SYSTEM_ERROR或ErrorCode.OPERATION_ERROR,语义同项目现有代码。
- 统一使用
GlobalExceptionHandler行为:MyException:记录错误日志,包装为ResultUtils.error(e.getCode(), e.getMessage());- 其他
RuntimeException:记录堆栈,包装为ResultUtils.error(ErrorCode.SYSTEM_ERROR, "系统错误"); - 编写新的异常/错误处理逻辑时,保持与此模式兼容,不破坏现有异常分层。
针对「修改」场景的行为规范
当用户指令中包含**「修改」**字样时,执行以下策略:
- 最小修改原则
- 只在必要的最小范围内修改代码,尽量局部变更,避免重排大段结构。
- 保持方法签名、入参与返回类型不变,除非用户明确要求调整接口。
- 保持现有风格与语义
- 继续使用
ThrowUtils.throwIf做参数与权限校验,沿用现有错误码与错误信息风格。 - 控制器里依旧通过
ResultUtils.success返回统一响应。 - 日志继续采用当前格式:
log.info("xxx, param={}", param);或log.error("xxx, appId={}, userId={}", appId, userId, e);
- 继续使用
- 保留原有实现思路
- 若只做 Bug 修复或小优化,直接在原逻辑上微调即可。
- 若必须大幅重构单个方法,也要优先采用「提取新私有方法 + 旧方法委托调用新方法」的方式,保持原方法作为入口存在,以便回滚。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 129 lines · 80 tokens per session scan A f45b00b05476
backend-design is a skill published in the GitHub repository glyahh/ai-generate-code (10 stars, last pushed 1mo ago), licensed MIT. It adds 80 tokens to every session and 2,758 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
backend-design compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| backend-designglyahh/ai-generate-code | Skill | 10 | 1mo ago | MIT | A | 80 | Cursor |
| java-springWrongStack/WrongStack | Skill | 404 | yesterday | MIT | A | 91 | Claude Code |
| wxjava-api-contributorbinarywang/WxJava | Skill | 33k | 4d ago | Apache-2.0 | A | 68 | Codex |
| azure-communication-callautomation-javamicrosoft/skills | Skill | 3.2k | yesterday | MIT | A | 49 | Claude Code |
| azure-communication-chat-javamicrosoft/skills | Skill | 3.2k | yesterday | MIT | A | 41 | Claude Code |
| azure-communication-common-javamicrosoft/skills | Skill | 3.2k | yesterday | MIT | A | 35 | Claude Code |
| azure-communication-sms-javamicrosoft/skills | Skill | 3.2k | yesterday | MIT | A | 36 | Claude Code |