AGENT SKILL

alibaba-java-coding-guidelines-skill

Use when 需要按 Alibaba Java Coding Guidelines(阿里巴巴 Java 编码规范)审查、生成或重构 Java、Spring、MyBatis、Maven、MySQL、SQL、日志、异常、安全或数据库相关代码。

License 许可
Apache-2.0
所属仓库
bg-szy/TOP-SKILLS
最近更新
2026-11-15
Stars
★ 6
Forks
0

01 前言 Front Matter

name
alibaba-java-coding-guidelines-skill
description
Use when 需要按 Alibaba Java Coding Guidelines(阿里巴巴 Java 编码规范)审查、生成或重构 Java、Spring、MyBatis、Maven、MySQL、SQL、日志、异常、安全或数据库相关代码。

02 资源文件 4

03 SKILL.md 正文

阿里巴巴 Java 开发规约

概览

使用本 skill 时,把《阿里巴巴 Java 开发手册》当作 Java 代码生成、重构和审查的默认质量基线。优先处理强制规则,再处理推荐规则;如果项目本地约定和规约冲突,说明冲突点并以用户或项目约定为准。

详细规则摘要见 references/alibaba-java-rules.md。需要精确出处或完整条文时,打开官方页面:https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/。

兼容性

这是通用 Agent Skill,不绑定单个应用或运行器。Claude Code、Codex 以及其他支持 Agent Skills 目录规范的工具都应只依赖 SKILL.md 和按需读取的 references/ 内容。

agents/openai.yaml 只是 OpenAI/Codex UI 元数据,属于可选增强;不应作为 Claude Code 或其他 agent 使用本 skill 的前提。

校验入口提供 Python、Node.js、Go 三种等价实现:scripts/validate_skill.py、scripts/validate_skill.mjs、scripts/validate_skill.go。使用者可以按本地运行时任选其一;需要验证三者一致时运行 tests/test_validators.sh。

使用场景

  • 审查 Java、Spring、MyBatis、Maven、SQL、DDL、日志、异常处理或安全相关改动。
  • 生成新类、接口、DTO、VO、DO、枚举、异常类、测试类、Mapper、Service、DAO 或 SQL。
  • 重构命名、常量、集合、并发、控制流、日志、异常和数据库访问代码。
  • 给出代码评审意见、整改清单、规范符合性报告或自动修复建议。

工作流程

  1. 先识别任务类型:代码生成、代码审查、重构、SQL/DDL 审查、依赖治理、安全检查。
  2. 读取当前项目的已有风格、包结构、测试框架和持久层写法,避免只按通用规约硬套。
  3. 按严重级别处理:
    • 强制:发现违反时必须指出或修复。
    • 推荐:默认遵循;如果不采用,说明权衡。
    • 参考:作为设计建议,不阻塞交付。
  4. 针对相关模块读取 references/alibaba-java-rules.md 中对应小节。
  5. 输出结果时按影响排序:正确性和安全性、稳定性和性能、可维护性、风格一致性。

代码生成规则

  • 命名必须清晰准确:类名用 UpperCamelCase,方法、参数、成员变量和局部变量用 lowerCamelCase,常量用大写加下划线。
  • 代码注释使用中文;公开 API、复杂业务规则、异常含义和空值语义要写清楚。
  • 不使用魔法值;固定范围值优先使用枚举。
  • 日志使用 SLF4J 门面,不直接绑定具体日志实现;低级别日志使用占位符或级别判断。
  • 资源关闭优先使用 try-with-resources;不要在 finally 中 return 或抛出新异常。
  • MyBatis 参数默认使用 #{},禁止把用户输入拼进 SQL。
  • Web、Open API、SQL、HTML 输出和用户输入必须做权限、参数校验、转义或脱敏。

代码审查输出

审查时优先给出可执行意见。每条意见包含:

  • 级别:强制、推荐或参考。
  • 位置:文件和行号,能定位就定位。
  • 问题:违反了哪类规约。
  • 风险:可能造成的错误、安全、性能或维护成本。
  • 建议:给出可落地的改法。

如果没有发现问题,说明已检查的范围,并点出仍未覆盖的风险,例如没有运行测试、没有看到数据库索引信息、没有线上日志配置等。

常见误区

  • 不要只检查格式;命名、空值、异常边界、日志上下文、事务、SQL 注入和权限校验同样重要。
  • 不要把推荐规则包装成强制缺陷;推荐项要讲清收益和代价。
  • 不要为了规约牺牲项目一致性;本地架构分层、包名和框架约束要先看再改。
  • 不要依赖某个 agent 产品的专属工具、路径或配置;只把它们作为可选增强。
  • 不要大段复述官方文档;只加载和任务相关的规则摘要。

04 同仓库更多 Skills

bg-szy
bg-szy/TOP-SKILLS

serpmaven

Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.

★ 6
bg-szy
bg-szy/TOP-SKILLS

revnu-landing-page-audit

Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: "audit my landing page", "why isn't this page converting", "review my homepage", "my ads get clicks but no signups", "people bounce from the pricing page", "CRO review", "improve conversion rate", "is my hero section clear", "roast my landing page", "rewrite my headline", "what's wrong with this page", "landing page feedback", "make the signup page convert better". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.

★ 6
bg-szy
bg-szy/TOP-SKILLS

revnu-growth-context

Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents/revnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says "set up our marketing context", "who is our ideal customer", "write our ICP", "describe the product for marketing", "positioning doc", "what's our brand voice", "remember this about our customers", "log what we tried", "what have we learned from marketing", "we changed pricing, update the context", "update our growth notes", "summarize the business for the agent", "import my product-marketing.md", "start a growth doc", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.

★ 6
bg-szy
bg-szy/TOP-SKILLS

revnu-get-listed

Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: "best X" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says "get us listed", "which directories should we submit to", "how do we get into best-of lists", "why does ChatGPT recommend competitors and not us", "get mentioned in AI answers", "submit to awesome lists", "get on G2", "where are our competitors listed", "pitch listicle authors", "find backlink opportunities", "launch directories", "get into roundups", "Product Hunt alternatives", "where should we be listed", "get cited by Perplexity". Never submits, pays or posts without a yes. Works without a Revnu account.

★ 6
bg-szy
bg-szy/TOP-SKILLS

revnu-ai-readiness-audit

Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks "is my site ready for AI search", "audit my site for AI answers", "AEO audit", "GEO audit", "why doesn't ChatGPT quote our pricing", "make our pages citable by AI", "do I need llms.txt", "does schema help with ChatGPT", "check our structured data", "is our content visible without JavaScript", "AI SEO audit", "optimize our homepage for AI answers", "LLM SEO check", "why does AI get our product wrong", "fix our site for AI Overviews". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.

★ 6
bg-szy
bg-szy/TOP-SKILLS

proxy-troubleshooting

Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.

★ 6