Critical Standard Bottom-Up Self-Check (check-standards, Convergence Gate) after Java backend code generation/modification. **This skill must be loaded after any Java code is written or modified—including scattered coding that does not follow the complete development process (e.g., "write an XX interface"/"write a Controller"/"help me write this code"): this skill must be loaded and verified before delivering code products to users**. It uses grep/ast-grep to actually scan and verify each standard—comments (class/field/method Javadoc/step comments, including private and extracted methods), logs (full class @Slf4j, each business method has logs, ERROR exceptions with stack traces), transaction rollbackFor, constructor injection, layered boundaries, SQL in XML, unified return body, pagination limit, password encryption, SQL comments/injection/WHERE, and all other verification items, with "File:Line Number" evidence attached to each item; **No level distinction—any item that is not implemented properly (regardless of importance) will be listed in the pending confirmation list to confirm with the user whether to complete it**. **Correct intermediate product naming and paths before verification** (Technical Solution 3.x.1 / Interface List 3.x.2 / Standard Verification Report 5.2.x / Acceptance Report 5.3.x, remove the task ID prefix T0xx from file names and move to the module version directory). Trigger scenarios: after writing code, after code generation, after modifying code, **before delivering code**, pre-submission check, code standard verification/review, comment and log verification, code review, standard self-check, bottom-up check, acceptance review, product file naming correction, file renaming and relocation, **perform standard scanning on specified directories/modules/packages (e.g., "run check-standards on xx directory"/"verify order module standards"/"only scan the code modified this time")**. It can be used with ai-dev-workflow 5.2 standard verification node / 5.3 acceptance, or triggered independently (output the report in the dialogue and prompt the user for confirmation when there are no docs/no process).
Automatic Critical Standard Verification (Check Standards)
Bottom-up gate after Java code generation/modification: There are many standard items scattered across multiple standard skills, and AI coding may miss execution. This skill uses grep / ast-grep to actually scan and generate results, verifies key standards item by item, and is prohibited from answering ✅ based on memory.
This skill can be triggered independently and does not rely on the ai-dev-workflow full process: Whether you follow the complete spec process or directly "write an interface/modify a section of code", as long as Java code is produced, you should load this skill for bottom-up self-check at the end.
Mode Judgment and Verification Basis (Must Read Before Execution, Judge Mode First Then Verify)
Verification judgment is based on project constraints, and default values of standard skills are only for bottom-up purposes:
(Technical architecture table includes selected items confirmed by ★ personnel); If this file does not exist → Judge according to the default values of standard skills, and note "2.1 constraints not found, judged according to standard default values" in the report
Judge according to the selected items confirmed by 2.1 personnel (e.g., Log4j2 → check according to Log4j2, do not enforce logback-spring.xml)
Existing Adaptation Mode (Legacy project)
docs/0.5-Existing Code Scan.md
+
2.1-Project Constraints-Existing Adaptation.md
(Actual agreements of legacy projects); If this file does not exist → If it is obviously a legacy project, confirm with the user "whether to judge according to the existing adaptation caliber", and mark selection-sensitive items as "pending confirmation" before confirmation
Judge according to the agreements of legacy projects (e.g., if the legacy project uses R<T> return body → do not judge Response<T>; if Apifox is used without writing annotations → follow the old agreement)
Unjudgeable
Stop and confirm the project mode with personnel (prohibit guessing according to default values)
—
Selection-sensitive verification items (Interface documentation / Log framework / SQL in XML / Unified return body, i.e., #6/#7/#8/#20 below): Judgment standards change with project modes, read 2.1 constraints / 0.5 scan first then judge; Other verification items (SQL comments / DDL comments / Transactions / Injection / WHERE / Password / Pagination / Method comments / Method logs, etc.) are general hard rules, and are judged according to standards in any mode.
Step 0: Correct Intermediate Product Naming and Paths (Must Do Before Verification, Prevent Missing Scans/Broken Acceptance References)
Why: Verification commands scan products according to standard naming (e.g.,
docs/*/3.*.1-Technical Solution*.md
,
3.*.2-Interface List*.md
); If product naming is non-standard (Technical Solution missing
.1
, file name with task ID prefix
T02-01
, 5.2/5.3 reports missing function serial numbers) or paths are not in the module version directory, verification will miss scans and acceptance references will break. Scan and correct before executing verification:
Target Naming Rules (Consistent with ai-dev-workflow "Unified Product Naming Rules", Single Source of Truth)
Product
Standard Naming
Common Errors → Correction
Technical Solution
3.<Function Item Serial Number>.1-<Function Name>-Technical Solution.md
3.1-Service Product Classification and BANNER-Technical Solution.md
→
3.1.1-…
(missing
.1
);
3.6-T02-01-Frontend Product List and Details-Technical Solution.md
→
3.6.1-…
(missing
.1
+ task ID prefix)
Interface List
3.<Function Item Serial Number>.2-<Function Name>-Interface List (Universal for Frontend and Backend).md
3.6.2-T02-01-Frontend Product List and Details-Interface List (Universal for Frontend and Backend).md
→
3.6.2-…
(task ID prefix)
Task Breakdown
4.1.<Function Item Serial Number>-<Function Name>-Task Breakdown.md
4.1-Frontend Product List and Details-Task Breakdown.md
→
4.1.6-…
(Add function serial number, consistent with 3.x); Remove task ID prefix
Contract Test
(Test code product, non-md)
src/test/java/.../Test<Function Name>.java
Follow the project test directory structure, no md numbering involved
Standard Verification Report (Product of this skill)
5.2.<Function Item Serial Number>-<Function Name>-Standard Verification Report.md
5.2-T02-01-Frontend Product List and Details-Standard Verification Report.md
→
5.2.6-…
(Add function serial number: Derive from the corresponding technical solution
3.6.x-Frontend Product List and Details-…
→ 6)
Acceptance Report
5.3.<Function Item Serial Number>-<Function Name>-Acceptance Report.md
5.3-T02-01-Frontend Product List and Details-Acceptance Report.md
→
5.3.6-…
(Same as above)
How to derive function item serial number: Take the serial number from the technical solution file name of the same function name (
(scattered in docs root directory / other directories)
List correction list (
Old Path → New Path
+ reason) → Confirm with the user first (The principle that this skill does not modify files also applies: only take action after confirmation)
Correct: Use
mv
(or
git mv
to retain history in git repositories) to move to the correct directory + rename files; Update references: If other md files (constraints/solutions/acceptance reports) reference the old file name → Update references synchronously
Record the correction result in the "Product Correction Record" section of the verification report (Old→New + reason) for reference in 5.3 acceptance review
[!NOTE] Correction Scope Boundary
Only correct file names and directories of intermediate product md files (products under docs/), do not touch source code/test code (src/ is checked by verification items); If there is no corresponding function name → Do not force renaming (stop and ask)
Execution Method (Core Rules)
Correct product naming and paths first (See "Step 0" section for execution rules): Scan intermediate products in docs/, if naming/paths are non-compliant → List correction list → User confirmation → Correction → Then enter verification
Define verification scope first (See "Verification Scope Definition" section below, read before execution): User-specified directory → Use the specified path; User says "a certain requirement/this round of changes" → Use git diff to define files → Use this path; No specification → Whole project. Replace the default path
src/main/java
in each check command with the defined scope
Judge mode first (See "Mode Judgment and Verification Basis" above), read the corresponding constraint file, determine the judgment caliber for selection-type verification items
For each item below, actually execute the "standard check command" (grep/ast-grep, use the scope defined in Step 1 for paths), paste the command + hit lines (File:Line Number) as evidence
No hits → Record
✅
; Hit violations → Record
❌
(attach evidence)
All unimplemented items (all verification items, no level distinction) → Unifiedly list in the "Pending User Confirmation List" and confirm with the user whether to complete them together: Show all ❌ items' evidence to personnel (Confirm once, not item by item repeatedly), ask "The following N items are not implemented properly, whether to complete them according to standards?" → User confirms item by item (complete / skip) → Only execute completion for items confirmed as "complete" → Re-run the item's command + new evidence (fixed); If still unable to meet requirements after completion → Escalate to manual verification (mark "needs manual verification"). Prohibit modifying code automatically without user confirmation, prohibit silently skipping any ❌ items as "unimportant" (There is a personnel confirmation gate throughout the completion process)
Output the 《Critical Standard Verification Report》 (mark verification scope; item-by-item ✅/❌ + evidence + pending user confirmation list), and summarize the results into the "Critical Standard Implementation Verification Table" in the acceptance report
[!WARNING] Mandatory Evidence + User Confirmation Gate (All unimplemented items are confirmed together, no level distinction)
Each item must provide the actually executed grep/ast-grep command and hit lines. Only writing ✅/❌ without evidence = No verification, return for re-run. Prohibit "claiming to have done it without doing it".
All unimplemented items (all verification items, no level distinction) → Must stop and let the user confirm whether to complete them together (Only modify code after personnel confirmation), do not automatically complete silently, do not skip confirmation due to "non-blocking/unimportant/for reference only". No matter how many unimplemented items there are, confirmation is required—even if 1 ❌ item is found, stop for confirmation, and do not bring ❌ items into acceptance.
Verification Scope Definition (Must Do Before Execution——Determine "Where to Scan" First, Then Run Commands)
The default path
src/main/java
is written in all standard check commands (sample value). Before execution, determine the actual scanning path according to the following rules, and replace the path in each command with the defined scope——Avoid "wanting to only scan the code modified this time but scanning all existing violations in the whole project".
Three scenarios (Choose one according to user intent, default to Scenario 1):
Scenario A: User-specified directory/module/package (Most common——"Scan xx directory"/"Verify order module")
User provides path → Path of all check commands = This path (
grep ... <Specified Path>
, e.g.,
src/main/java/com/xxx/order
), not the whole project
Mark "Verification Scope: <Specified Path>" in the report; Files outside the scope are not scanned and not counted as ❌
If the specified is a module name (e.g., "order module") instead of a path → Locate the module root directory first (
src/main/java/**/order
), confirm then scan according to this path
Scenario B: User says "a certain requirement/code modified this time/this round of changes"
First define "which files were modified this time" (by priority):
git status
+
git diff --stat
(uncommitted changes)——Java files added/modified in working directory/staging area
Last commit (
git diff HEAD~1 --name-only
)——If just committed
User-provided file list verbally
Check command path = Directory where these files belong (If files are scattered, check each file individually, or check according to their common parent directory)
The report distinguishes two types of ❌: Introduced by this round of changes (blocking, enter pending confirmation list) / Existing historical violations (not introduced this time——Only prompt "Existing issues: N (not introduced this time, can be handled by gen-comments/gen-logs separately"), does not block this round)
Unable to determine change scope (git unavailable/user cannot explain clearly) → Stop and ask the user, do not guess
Scenario C: User has no specification, only "run check-standards" (Whole project check-up)
Scan the whole project (default path of commands); The report separates this round of changes vs existing violations (Distinguish by diff in Scenario B if git is available; Mark "Full check-up, no distinction between existing/new" if git is not available)
[!NOTE] Relationship Between Scope Definition and Product Correction
Step 0 (Product Correction) targets intermediate products in docs/; This definition targets the verification scope of src/ code. They are independent: Even if only scanning code in a certain directory, product correction in docs/ is still executed in full (to prevent broken acceptance references)
Verification Item List
All verification items have no level distinction: Each item is a hard rule, and any unimplemented item will be marked as ❌ and entered into the pending user confirmation list (confirm with the user whether to complete/skip), there is no distinction between "HIGH must be modified / INFO can be skipped". Selection-sensitive items ⚠️ are judged according to 2.1 constraints/0.5 scan caliber (See "Mode Judgment"), others are judged according to standards. Verification scope is executed according to the above "Verification Scope Definition" (Three types: specified directory / this round of changes git diff / whole project)——Paths such as
src/main/java
in the commands below are examples, replace with the defined scope during actual execution.
1. Method and Log Coverage (Must Verify for New Code——Comments/Logs Must Cover All Code, Including Extracted Private Methods)
Root cause of pain points: No logs in ServiceImpl methods, large sections of private methods extracted from Controller have no comments or logs, and old verification only scans public methods so misses checks. This group verifies mechanically at the "method level", covering public + private + extracted methods.
#
Verification Item
Standard Check Command (Actual Execution)
Judgment Standard (All Must Be Met to Get ✅)
1
Full Coverage of Method-Level Comments
Use ast-grep to list all method nodes (
$MOD $RET $NAME($$$) { $$$ }
, including public/private/protected/static), and check one by one whether there is
/** */
Javadoc above the method declaration
All methods (public + private + extracted methods, including test methods) have Javadoc: Function + @param/@return write business meaning; Private auxiliary methods extracted from Controller/ServiceImpl must also have class comments + method Javadoc (Follow the full comment rules in comment-standards, no exemptions)
2
Full Coverage of Method-Level Logs
Use grep/ast-grep to check one by one whether the method body contains
log.info
/
log.warn
/
log.error
calls (
log.debug
does not count——Not output online, regarded as no logs); Then judge whether key stages are covered for methods with logs
Each business method (public + private extracted methods) in Controller/Service/ServiceImpl/Job/Listener has ≥1 INFO/WARN/ERROR business log in the method body (Entry parameter summary / key branches / before result return); No INFO/WARN/ERROR in the method body (even if there is log.debug) → ❌; Large sections of logic (≥10 lines) without INFO/WARN/ERROR → ❌; Methods with ≥2 business stages (database query/status change/circulation assembly, etc.) but only 1 log at the beginning and no INFO in key intermediate logic → ❌ ("Partial coverage" missed form); Pure getter/setter/single-line pass-through can be exempted (note exemption reason); ERROR in exceptions with stack traces
3
Step Comments + WHY
grep -rn "// 1\." src/main/java
spot check + Read each method through (Must check long methods section by section, cannot judge ✅ only by grep hit count)
Method bodies with ≥2 logical steps have numbered comments (
// 1.
// 2.
…, covering the last section of logic in the method); Each business section (query/verification/circulation/status change/assembly) in the method has step comments, cannot have the first half with comments and the second half bare; Complex logic has
// WHY:
; No ≥10 consecutive lines of logical code with zero comments; Long methods (>20 lines) are checked section by section (including the second half of the method); Comments are added before deeply nested (≥3 layers) branches (Same requirement for existing mode)
4
Prohibit Translation-Style Comments
Spot check comments
No line-by-line translation-style comments; Comments write business meaning instead of repeating code
5
Full Class @Slf4j + No System.out
grep -rln "@Slf4j" src/main/java
;
grep -rn "System.out" src/main/java
Controller/Service/ServiceImpl/Job/Listener have full class @Slf4j, no System.out, no scattered Logger mixed use
2. Framework and Products (Selection-Sensitive ⚠️ Judged According to Project Mode)
Judge according to 2.1 selection/old agreement (springdoc → dependency + @Tag/@Operation + @Schema; legacy project Swagger2 → @Api system; pure Apifox follows old agreement)
7
Log Framework Support ⚠️
ls src/main/resources/logback*.xml src/main/resources/log4j2*.xml
;
grep -n "log4j2|logback" pom.xml
Judge according to 2.1 selection/old agreement: Logback → logback-spring.xml exists (console+rolling+environment-level level); Log4j2 → Configuration exists and no coexistence with logback
Pagination input parameter pageSize has @Max/limit verification
23
Specificity of Verification message
grep -rn 'message = "' src/main/java
spot check + Locate verification annotations such as @NotBlank/@NotNull/@Size/@Pattern/@Min/@Max
Verification annotation message must be specific: Include business field name + specific reason ("Mobile number cannot be empty"/"Quantity must be greater than 0"); Prohibit generic copy without field semantics——If message value only consists of generic words (prefix
Consumption idempotency; Retry has upper limit + dead letter queue; No silent catch
26
File Upload Security
grep -rln "MultipartFile" src/main/java
has hits
Double whitelist of extension+MIME; UUID renaming; Size limit
27
Idempotency of Write Interfaces (HTTP)
Controller has POST/PUT write interfaces
Write interfaces have idempotency solutions (unique key/token/Redis SETNX), idempotency key is in the same transaction as business (Difficult to check automatically via grep → Manual spot check marked "needs manual verification")
28
Sensitive Information in Logs
grep -rn "password|token|secret" src/main/java
Logs/exceptions/responses do not contain plaintext password/token (Check whether desensitized if hit)
to list log lines with placeholder parameters → Manual confirmation one by one (Heuristic, need human judgment after hit): Whether parameters contain method calls such as
.getXxx(
/
.getName(
/
.get(0
/ chained
.getUser().
and the caller has not been judged null first
Log parameters cannot write calls that may cause NPE:
.getId()
before null judgment, any link in chained value retrieval may be null,
list.get(0)
for empty collection,
map.get(k).xxx()
with null value (eager evaluation, log line crashes first, null judgment later cannot save)——See logging-standards §6; If grep hits parameters containing method calls and the object has no null judgment before the log line → ❌ Attach evidence; If unable to determine → Mark "needs manual verification" (Prohibit judging ✅ based on guess)
33
Duplicate Mapping of Same Table
grep -rhn '@TableName("[^"]*")' src/main/java
to count the occurrence times of each table name → List tables with occurrence >1
Only one Entity mapping is allowed for one table in the whole project (Unique mapping for the same table, see entity-standards §1): If
@TableName("x")
occurs >1 times → ❌ Attach evidence (Duplicate table name + each mapped Entity class File:Line Number); Confirm N-1 of them have no business references (grep reference points) → Prompt to delete/converge
[!WARNING] #1/#2/#3 Method-Level Verification Must Read Each Method Through (Prevent "Long Code Focus Loss")
grep/ast-grep can only list methods and "where comments/logs exist", but cannot prove "which method is missing". #1 (Method Javadoc), #2 (Method Logs), #3 (Step Comments) must read each method of each Java file generated/modified in this round through:
Extracted methods (private auxiliary methods) are high-risk areas for missing comments/logs——Check one by one whether verification/conversion methods extracted from Controller, assembly/query methods extracted from ServiceImpl have method Javadoc and ≥1 INFO/WARN/ERROR log in the method body
#2 Prevent "Partial Coverage" Missing: Method starts with 1
log.debug
(or 1 INFO) but has 10+ lines of database query/circulation/assembly logic in the middle without INFO/WARN/ERROR → ❌ (debug does not count as logs, methods must have INFO in key stages)
Read from the first line to the last line of the method, focus on the second half of the method and deeply nested branches; For long methods (>20 lines), confirm section by section that numbered comments cover the last step and each business logic section has logs
Prohibit judging ✅ only by grep hit count; Methods not read through are treated as "not verified" and returned for re-verification
Output Format
text
=== Critical Standard Verification Report (5.2.<Function Item Serial Number>-<Function Name>-Standard Verification Report) ===
Project: <Path> Time: <Timestamp> Mode: Standard/Existing Adaptation Verification Scope: Whole Project / <Specified Directory> / This Round of Changes (Defined by git diff)
Product Correction Record (Step 0, if none → "None, naming/paths are compliant"):
docs/3.1-Service Product Classification and BANNER-Technical Solution.md → docs/<Module>V<Version>-<Timestamp>/3.1.1-Service Product Classification and BANNER-Technical Solution.md (missing .1)
docs/<Module>…/5.2-T02-01-Frontend Product List and Details-Standard Verification Report.md → …/5.2.6-Frontend Product List and Details-Standard Verification Report.md (add function serial number + remove task ID)
[✅] 1 Full Coverage of Method-Level Comments Evidence: UserController.java:12 login has Javadoc; OrderServiceImpl.java:8 buildVO private has Javadoc (12/12 methods passed after reading through)
[❌] 2 Full Coverage of Method-Level Logs Evidence: OrderServiceImpl.java:33 getOrderList method body has no log calls (zero logs); :41 buildOrderVO private has no logs
[✅] 5 Full Class @Slf4j Evidence: Full class @Slf4j, no System.out
[❌] 14 Transaction rollbackFor Evidence: OrderServiceImpl.java:45 @Transactional (no rollbackFor)
[❌] 27 Sensitive Information in Logs Evidence: AuthController.java:60 log.info contains plaintext token
...
Conclusion: 33 verification items: X Passed / Y Failed
⚠️ Pending User Confirmation List (All unimplemented items, confirm once, no level distinction):
#2 Full Coverage of Method-Level Logs, #14 Transaction rollbackFor, #27 Sensitive Information in Logs …
(Item by item: Complete/Skip)
Save the report:
docs/<Module Name>V<Version Number>-<YYYYMMDDHHMMSS>/5.2.<Function Item Serial Number>-<Function Name>-Standard Verification Report.md
(When following ai-dev-workflow process, function item serial number is consistent with 3.x technical solution, e.g., function item 6 →
5.2.6-Frontend Product List and Details-Standard Verification Report.md
, task ID is prohibited in file name; When triggered independently without docs directory → Output the report directly in the dialogue + prompt the user whether to save it); Summarize all verification item conclusions (including #1 method comments / #2 method logs item-by-item verification results) into the Critical Standard Implementation Verification Table in the acceptance report
All unimplemented items (no level distinction) → Confirm with the user whether to complete them together (Show evidence → Personnel confirm item by item complete/skip → Execute completion for confirmed items → Re-run)
[!NOTE] Distinction Between Two "Personnel" Actions
User Confirmation Gate (Before execution): If unimplemented items are found → Confirm with the user "whether to complete" (complete/skip), AI takes action only after confirmation——Decide "whether to complete"
Escalate to Manual Verification (After execution): If still ❌ after completion and re-run, or user chooses to skip → Mark the item as "needs manual verification", and personnel intervene to judge——Decide "what to do"
Both require personnel presence, but at different times: Confirmation is before taking action, manual verification is when still failing after taking action.
Completion Standards
Product naming and paths have been corrected (Step 0): Intermediate product naming in docs/ complies with standards (Technical Solution 3.x.1 / Interface List 3.x.2 / Verification Report 5.2.x / Acceptance Report 5.3.x, no task ID prefix), paths are in the module version directory; Correction list has been confirmed with the user, correction records are written into the report
Verification scope has been defined (One of the three types: specified directory / this round of changes git diff / whole project), verification scope has been marked in the report; Check command path = defined scope (not whole project default)
Mode has been judged (Standard/Existing Adaptation, read corresponding constraint files; If no constraint files, caliber has been noted in the report), selection-sensitive items (#6/#7/#8/#20) are judged according to project constraints/legacy project agreements, not one-size-fits-all with standard default values
All 33 verification items have actually executed check commands and attached evidence (File:Line Number)——Including #1 method-level comments (public + private + extracted methods), #2 method-level logs, #3 step comments, #23 verification message specificity, #32 log parameter NPE, #33 duplicate mapping of same table
#1/#2/#3 have been verified by reading each method through (Read each Java file generated/modified in this round from method head to method tail, focus on verifying comment and log coverage of private/extracted methods, second half of methods and deeply nested branches, did not judge ✅ only by grep hit count)
All unimplemented items (no level distinction) have been confirmed with the user whether to complete them together——Items confirmed as "complete" have been completed and re-run successfully; Items selected as "skip" by user or still ❌ after completion → Have been marked as "needs manual verification" (not swallowed silently)
Verification report has been output (Saved to
docs/<Module Name>V<Version Number>-<YYYYMMDDHHMMSS>/5.2.<Function Item Serial Number>-<Function Name>-Standard Verification Report.md
when following process)
All verification item results have been summarized into the acceptance report verification table
Relationship with Other Skills
Skill
Relationship
ai-dev-workflow
This skill undertakes the bottom-up self-check of its 5.2 standard verification node (mandatory independent verification after coding); The
/check-standards
command of ai-dev-workflow loads this skill for execution. This skill can also be triggered independently without ai-dev-workflow
java-code-standards
Source of standards for verification items (naming/layering/injection/exceptions/logs/transactions/security/performance)
comment-standards
Source of standards for comment standards (full comments: all classes/fields/methods including private/extracted methods/step comments/prohibit translation-style, see
standards/comment-standards.md
)
database-standards
Source of standards for SQL/DDL/index/data security verification items
build-standards
Source of standards for dependency (springdoc/knife4j, logback) verification items