neqsim-java8-rules
Skill167 starsChanged 7 months agoApache-2.0View on GitHub
Java 8 compatibility rules for NeqSim. USE WHEN: writing or reviewing any Java code for NeqSim, including tests. Covers forbidden Java 9+ features, replacement patterns, API verification, and JavaDoc requirements. All NeqSim Java code MUST compile with Java 8.
In this repository140 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- analyze-convergenceSkill
- analyze-gibbs-convergenceSkill
- book-creationSkill
- design-flash-benchmarkSkill
- design-reactor-benchmarkSkill
- figure-discussionSkill
- generate-publication-figuresSkill
- journal-formattingSkill
- neqsim-acid-gas-treatingSkill
- neqsim-advanced-control-mpc-and-virtual-sensingSkill
- neqsim-agent-handoffSkill
- neqsim-agentic-process-optimizationSkill
- neqsim-api-patternsSkill
- neqsim-autonomous-investigationSkill
- neqsim-capability-mapSkill
- neqsim-capacity-and-utilization-analysisSkill
- neqsim-capacity-increase-screeningSkill
- neqsim-ccs-hydrogenSkill
- neqsim-code-healthSkill
- neqsim-code-hygieneSkill
- neqsim-code-reviewSkill
- neqsim-column-internals-and-rate-basedSkill
- neqsim-compressor-antisurge-recycleSkill
- neqsim-consequence-analysisSkill
- neqsim-continuous-task-improvementSkill
- neqsim-controllability-operabilitySkill
- neqsim-cooling-waterSkill
- neqsim-cpa-water-boundariesSkill
- neqsim-depressurization-mdmtSkill
- neqsim-distillation-designSkill
- neqsim-document-intelligence-extractionSkill
- neqsim-dynamic-equipment-implementationSkill
- neqsim-dynamic-simulationSkill
- neqsim-electrolyte-systemsSkill
- neqsim-emulsion-separationSkill
- neqsim-energy-systems-and-electrificationSkill
- neqsim-engineering-design-packageSkill
- neqsim-eos-regressionSkill
- neqsim-equipment-cost-estimationSkill
- neqsim-exploration-strategy-selectionSkill
- neqsim-field-developmentSkill
- neqsim-field-economicsSkill
- neqsim-firewater-deluge-designSkill
- neqsim-flow-accelerated-corrosionSkill
- neqsim-flow-assuranceSkill
- neqsim-flow-assurance-study-reportSkill
- neqsim-forward-separator-trainSkill
- neqsim-future-operation-studySkill
- neqsim-hazid-fmea-eta-ftaSkill
- neqsim-heat-integrationSkill
- neqsim-hydrogen-productionSkill
- neqsim-input-validationSkill
- neqsim-integrated-production-and-lifecycleSkill
- neqsim-in-writingSkill
- neqsim-jurisdiction-regulatory-basisSkill
- neqsim-literature-searchSkill
- neqsim-lng-liquefactionSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
All NeqSim Java code — including test classes in src/test/java/ — MUST compile with Java 8.
- Very specific: line 64
Run spotless:apply, then git add the reformatted files, then commit.
- Distinctive: line 65
NEVER bypass the gate with git commit --no-verify.
- Very specific: line 69
Before using any NeqSim class in code or examples:
- Distinctive: line 74
Do NOT assume convenience overloads — check first
- Distinctive: line 84
All classes and methods (public, protected, AND private) require complete JavaDoc:
- Very specific: line 89
No lambda arrows (->) in JavaDoc code examples
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Java 8 Compatibility Rules for NeqSim
All NeqSim Java code — including test classes in src/test/java/ — MUST compile with Java 8. The CI build will FAIL if you use Java 9+ features.
Forbidden Java 9+ Features
| Forbidden | Java 8 Alternative |
var x = ... | Explicit type: String x = ..., Map<String, Object> map = ... |
List.of(a, b) | Arrays.asList(a, b) or Collections.singletonList(a) |
Set.of(a, b) | new HashSet<>(Arrays.asList(a, b)) |
Map.of(k, v) | Collections.singletonMap(k, v) or new HashMap<>() |
"str".repeat(n) | StringUtils.repeat("str", n) (Apache Commons) |
str.isBlank() | str.trim().isEmpty() |
str.strip() | str.trim() |
str.lines() | str.split("\\R") or BufferedReader |
Optional.isEmpty() | !optional.isPresent() |
Text blocks """...""" | Regular strings with \n |
| Records | Regular class with fields, constructor, getters |
Pattern matching instanceof | Traditional instanceof + cast |
Stream.toList() | .collect(Collectors.toList()) |
Common var Replacements
// WRONG (Java 10+):
var map = someMethod.toMap();
var list = getItems();
var result = calculate();
// CORRECT (Java 8):
Map<String, Object> map = someMethod.toMap();
List<String> list = getItems();
CalculationResult result = calculate();Required Import for String Repeat
import org.apache.commons.lang3.StringUtils;
// Usage: StringUtils.repeat("=", 70)Code Formatting (Spotless) — MANDATORY
AI-generated Java is NOT auto-formatted. After creating or editing ANY .java
file, reformat it before committing — do not rely on local pre-commit hooks
being installed:
./mvnw spotless:apply # reformats Java to the project style (Eclipse profile)
./mvnw spotless:check # verifies formatting — this is what CI runs- Formatter profile:
.config/neqsim_formatter.xml(configured inpom.xml), applied tosrc/main/javaandsrc/test/java. - CI runs
./mvnw spotless:checkand FAILS the build on any unformatted file. - Run
spotless:apply, thengit addthe reformatted files, then commit. - NEVER bypass the gate with
git commit --no-verify.
API Verification (MANDATORY)
Before using any NeqSim class in code or examples:
- Search for the class:
file_search("**/ClassName.java") - Read constructor and method signatures from the actual source
- Use only methods that actually exist with correct parameter types
- Do NOT assume convenience overloads — check first
Common API mistakes:
- Assuming
getXxx95()when actual isgetXxx(int percentile) - Assuming 1-arg constructors when 2+ args are required
- Calling methods on wrong class
- Assuming
calculate()when actual iscalculateRisk()orrun()
JavaDoc Requirements
All classes and methods (public, protected, AND private) require complete JavaDoc:
- Class-level: description,
@author,@version - Method-level: description,
@paramfor every parameter,@returnfor non-void,@throwsfor each exception - HTML5 compatible: use
<caption>in tables (nosummaryattribute) - No
@seewith plain text — only valid Java references - No lambda arrows (
->) in JavaDoc code examples
Build Commands
./mvnw install # full build
./mvnw test -Dtest=ClassName # single test class
./mvnw test -Dtest=ClassName#methodName # single method
./mvnw checkstyle:check spotbugs:check pmd:check # static analysis
./mvnw javadoc:javadoc # verify JavaDocSerialization — SE_BAD_FIELD Rule (MANDATORY)
SpotBugs enforces that all instance fields in Serializable classes are either
serializable themselves or marked transient. This applies to any class extending
ProcessEquipmentBaseClass, MeasurementDeviceBaseClass, MechanicalDesign,
thermo phase classes, or any other Serializable class.
When to use transient
Mark a field transient when its type does NOT implement Serializable:
- Functional interfaces:
Function,BiConsumer,Consumer,Supplier - JDBC:
Connection,Statement,ResultSet - Threads:
Thread,ExecutorService - Apache Commons Math:
BicubicInterpolator,BicubicInterpolatingFunction,LinearInterpolator - Inner classes that don't implement
Serializable(e.g.,NetworkNode,GibbsComponent) - External library types not designed for serialization
Correct modifier order
// private fields
private transient MyType field;
private final transient List<NonSerializableInner> items = new ArrayList<>();
// package-private fields
transient SomeType field;Verify with SpotBugs
./mvnw spotbugs:check 2>&1 | Select-String "SE_BAD_FIELD" # should return emptyDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

