AgentSkillsCN

code-checklist

基于实际构建失败经验提炼出的关键代码需求清单。适用于提交代码前,或在排查编译错误时使用。

SKILL.md
--- frontmatter
name: code-checklist
description: Critical code requirements checklist derived from actual build failures. Use before committing code or when troubleshooting compilation errors.

Code Requirements Checklist

Exceptions and Constructors

  • NEVER throw checked exceptions from constructors calling super() — use factory methods or composition
  • ALWAYS wrap parseInt/parseLong/new BigDecimal() in try-catch with defaults

Comments and Encoding

  • NEVER use Unicode box-drawing characters (┌ ─ │) in Javadoc — use ASCII (+, -, |)
  • NEVER nest /* */ comments inside Javadoc — use - instead

File Editing

  • ALWAYS include complete method context when doing string replacements
  • ALWAYS compile immediately after edits (mvn clean compile)
  • Count { and } — they must match after every edit

Common Error Solutions

ErrorCauseFix
illegal start of expressionMissing closing }Count braces, add missing ones
unreported exception IOExceptionChecked exception in super()Use factory method pattern
String index out of rangeWrong substring indicesUse substring(start, start+length)
NumberFormatExceptionInvalid numeric stringWrap in try-catch with default
class, interface, enum expectedUnicode in comments or corrupted fileUse ASCII only in comments

Pre-Commit Sequence

bash
mvn clean compile     # Must succeed, zero errors
mvn package           # Must create JAR
# If DataGenerator exists:
java -cp target/classes com.ibm.pl1ref.util.DataGenerator
java -cp target/psam-translation-0.1.0.jar com.ibm.pl1ref.Main