بنقرة واحدة
java
Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow).
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow).
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Create structured analyses with numbered findings, execution plans, and task materialization
Author a rulebook task spec interactively — research, draft, ask the user clarifying questions, confirm, then create the tasks in rulebook ready for /rulebook-driver. Use when the user wants to plan/spec a feature before implementing.
Spec-driven task management for features and breaking changes with OpenSpec-compatible format
Tool: Anthropic Claude Code CLI (`npm install -g @anthropic-ai/claude-code`)
Behavioral guidelines to reduce common LLM coding mistakes — overcomplication, sloppy refactors, hidden assumptions, weak goals. Use when writing, reviewing, or refactoring code. Auto-applies; invoke explicitly via /karpathy-guidelines or 'follow karpathy discipline'.
Accessibility audit for WCAG compliance and usability
| name | Java |
| description | Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow). |
| version | 1.0.0 |
| category | languages |
| author | Rulebook |
| tags | ["languages","language"] |
| dependencies | [] |
| conflicts | [] |
CRITICAL: Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow).
# Maven projects:
mvn spotless:check # Format check
mvn checkstyle:check # Linting
mvn test # All tests (100% pass)
mvn package -DskipTests # Build
mvn jacoco:check # Coverage (95%+ required)
# Security audit:
mvn dependency:analyze # Dependency check
mvn versions:display-dependency-updates # Outdated deps
# Gradle projects:
./gradlew spotlessCheck # Format check
./gradlew checkstyleMain # Linting
./gradlew test # All tests
./gradlew build -x test # Build
./gradlew jacocoTestCoverageVerification # Coverage
CRITICAL: Use Java 17 LTS or Java 21 LTS for modern features and long-term support.
Maven configuration (pom.xml):
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.40.0</version>
<configuration>
<java>
<googleJavaFormat>
<version>1.17.0</version>
<style>GOOGLE</style>
</googleJavaFormat>
</java>
</configuration>
</plugin>
Gradle configuration (build.gradle):
plugins {
id 'com.diffplug.spotless' version '6.23.0'
}
spotless {
java {
googleJavaFormat('1.17.0').aosp()
}
}
checkstyle.xml, pmd.xmlsrc/test/javaExample test structure:
package com.example.myapp;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import static org.assertj.core.api.Assertions.*;
class UserServiceTest {
private UserService userService;
@BeforeEach
void setUp() {
userService = new UserService();
}
@Test
@DisplayName("Should create user with valid data")
void shouldCreateUserWithValidData() {
// Given
UserInput input = new UserInput("test@example.com", "password");
// When
User user = userService.createUser(input);
// Then
assertThat(user).isNotNull();
assertThat(user.getEmail()).isEqualTo("test@example.com");
}
@Test
@DisplayName("Should throw exception for invalid email")
void shouldThrowExceptionForInvalidEmail() {
// Given
UserInput input = new UserInput("invalid", "password");
// When/Then
assertThatThrownBy(() -> userService.createUser(input))
.isInstanceOf(ValidationException.class)
.hasMessageContaining("Invalid email");
}
}
CRITICAL: Use Maven or Gradle with dependency management.
<properties>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
</dependencies>
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.0'
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testImplementation 'org.assertj:assertj-core:3.24.2'
}
test {
useJUnitPlatform()
}
Check for latest versions:
Version Management:
Example:
public class UserService {
public User createUser(UserInput input) throws ValidationException {
if (input.getEmail() == null || input.getEmail().isEmpty()) {
throw new ValidationException("Email is required");
}
try {
return userRepository.save(input);
} catch (DataAccessException e) {
throw new ServiceException("Failed to create user", e);
}
}
}
public class ValidationException extends RuntimeException {
public ValidationException(String message) {
super(message);
}
}
package-info.javamvn javadoc:javadoc or ./gradlew javadocExample:
/**
* Processes user data and returns validated result.
*
* <p>This method validates the input data according to business rules
* and returns a validated User object. If validation fails, it throws
* a ValidationException with details about the failure.
*
* @param input the user input data to process
* @return validated User object
* @throws ValidationException if input validation fails
* @throws ServiceException if database operation fails
*
* @see UserInput
* @see ValidationException
*
* @since 1.0.0
*/
public User processUser(UserInput input) throws ValidationException {
// Implementation
return null;
}
project/
├── pom.xml # Maven config (or build.gradle)
├── README.md # Project overview (allowed in root)
├── CHANGELOG.md # Version history (allowed in root)
├── AGENTS.md # AI assistant rules (allowed in root)
├── LICENSE # Project license (allowed in root)
├── CONTRIBUTING.md # Contribution guidelines (allowed in root)
├── CODE_OF_CONDUCT.md # Code of conduct (allowed in root)
├── SECURITY.md # Security policy (allowed in root)
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/example/
│ │ │ ├── Application.java
│ │ │ ├── controller/
│ │ │ ├── service/
│ │ │ └── repository/
│ │ └── resources/
│ │ └── application.properties
│ └── test/
│ ├── java/
│ │ └── com/example/
│ │ ├── service/
│ │ └── repository/
│ └── resources/
├── target/ # Build output (gitignored)
└── docs/ # Documentation
public record User(String email, String name, LocalDateTime createdAt) {
// Compact constructor
public User {
if (email == null || email.isEmpty()) {
throw new IllegalArgumentException("Email required");
}
}
}
public String processValue(Object value) {
return switch (value) {
case String s -> "String: " + s;
case Integer i -> "Integer: " + i;
case null -> "Null value";
default -> "Unknown type";
};
}
public sealed interface Result<T, E> permits Success, Failure {
// Interface definition
}
public record Success<T, E>(T value) implements Result<T, E> {}
public record Failure<T, E>(E error) implements Result<T, E> {}
Must include GitHub Actions workflows for:
Testing (java-test.yml):
Linting (java-lint.yml):
Build (java-build.yml):
Prerequisites:
io.github.username)Maven (pom.xml) Configuration:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.your-username</groupId>
<artifactId>your-library</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Your Library</name>
<description>A concise description of your library</description>
<url>https://github.com/your-org/your-library</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
<developers>
<developer>
<name>Your Name</name>
<email>your.email@example.com</email>
<organization>Your Organization</organization>
<organizationUrl>https://your-org.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/your-org/your-library.git</connection>
<developerConnection>scm:git:ssh://github.com:your-org/your-library.git</developerConnection>
<url>https://github.com/your-org/your-library/tree/main</url>
</scm>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<!-- Source JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- GPG Signing -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Gradle (build.gradle.kts) Configuration:
plugins {
`java-library`
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
group = "io.github.your-username"
version = "1.0.0"
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("Your Library")
description.set("A concise description of your library")
url.set("https://github.com/your-org/your-library")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("your-username")
name.set("Your Name")
email.set("your.email@example.com")
}
}
scm {
connection.set("scm:git:git://github.com/your-org/your-library.git")
developerConnection.set("scm:git:ssh://github.com:your-org/your-library.git")
url.set("https://github.com/your-org/your-library")
}
}
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
Publishing Workflow:
Update version in pom.xml/build.gradle
Update CHANGELOG.md
Run quality checks:
# Maven
mvn clean test
mvn checkstyle:check
mvn pmd:check
# Gradle
./gradlew test
./gradlew checkstyleMain
./gradlew pmdMain
Create git tag: git tag v1.0.0 && git push --tags
GitHub Actions automatically publishes to Maven Central
Or manual publish:
# Maven
mvn clean deploy -P release
# Gradle
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
Publishing Checklist:
GitHub Secrets:
Add these secrets to your repository:
MAVEN_USERNAME: Sonatype usernameMAVEN_PASSWORD: Sonatype passwordGPG_PRIVATE_KEY: Your GPG private key (exported as ASCII)GPG_PASSPHRASE: GPG key passphraseAlternative: GitHub Packages
For simpler setup, publish to GitHub Packages:
<distributionManagement>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/your-org/your-library</url>
</repository>
</distributionManagement>
Users can then add to their pom.xml:
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/your-org/*</url>
</repository>
</repositories>