Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/glyahh/ai-generate-code/backend-designnpx skills add glyahh/ai-generate-code --skill backend-designgit 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.svg" alt="Measured on agentmods" 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 | $0.00080 | $0.02758 |
| Opus 5 | $0.00040 | $0.01379 |
| Sonnet 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 5d 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.
- 5d 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 29d ago), licensed MIT. It adds 80 tokens to every session and 2,758 once invoked, about $0.0004 per session on Opus 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.
Other skills, from other repositories
dd-code-generation
Use pup CLI for immediate Datadog operations or generate code for integration into applications.
java-spring-ai
Use when the user asks to add AI features, integrate Spring AI or LangChain4J, build a chatbot, implement RAG (retrieval-augmented generation), use vector stores, stream LLM responses, or call AI tools/functions in a Spring Boot project.
jbang-mcp-server
Scaffolds and installs zero boilerplate Java-based MCP STDIO servers using JBang and LangChain4j for Gemini CLI. Use this to quickly bootstrap an MCP server from scratch.
azure-security-keyvault-secrets-java
Azure Key Vault Secrets Java SDK for secret management. Use when storing, retrieving, or managing passwords, API keys, connection strings, or other sensitive configuration data.
azure-ai-anomalydetector-java
Build anomaly detection applications with Azure AI Anomaly Detector SDK for Java. Use when implementing univariate/multivariate anomaly detection, time-series analysis, or AI-powered monitoring.
azure-communication-chat-java
Build real-time chat applications with Azure Communication Services Chat Java SDK. Use when implementing chat threads, messaging, participants, read receipts, typing notifications, or real-time chat features.