Skip to content

Commit 1660ead

Browse files
authored
Added more information to use Skillls (#446)
1 parent b06284b commit 1660ead

7 files changed

Lines changed: 113 additions & 5 deletions

File tree

documentation/GETTING-STARTED-SKILLS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ At its core, a skill is a folder containing a SKILL.md file. This file includes
1212

1313
## How to install the Skills?
1414

15+
### npx skills
16+
1517
Use the following commands to list and install the Skills:
1618

1719
```bash
@@ -22,3 +24,36 @@ sudo apt install nodejs npm
2224
npx skills add jabrena/cursor-rules-java --list
2325
npx skills add jabrena/cursor-rules-java
2426
```
27+
28+
### skillsjars
29+
30+
https://www.skillsjars.com/
31+
https://github.com/skillsjars/skillsjars-maven-plugin
32+
33+
```xml
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>com.skillsjars</groupId>
38+
<artifactId>maven-plugin</artifactId>
39+
<version>0.0.5</version>
40+
<dependencies>
41+
<!-- Your SkillsJars -->
42+
<dependency>
43+
<groupId>com.skillsjars</groupId>
44+
<artifactId>SKILLJAR_ARTIFACT_ID</artifactId>
45+
<version>SKILLJAR_VERSION</version>
46+
</dependency>
47+
</dependencies>
48+
</plugin>
49+
</plugins>
50+
</build>
51+
```
52+
53+
Extract Skills in a directory compatible with your AI Tool like Cursor, Claude Code or Github Copilot:
54+
55+
```bash
56+
./mvnw skillsjars:extract -Ddir=.agents/skills
57+
./mvnw skillsjars:extract -Ddir=.claude/skills
58+
./mvnw skillsjars:extract -Ddir=.github/skills
59+
```

skills

Lines changed: 0 additions & 1 deletion
This file was deleted.

skills-generator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<goal>copy-resources</goal>
8888
</goals>
8989
<configuration>
90-
<outputDirectory>${project.basedir}/../.agents/skills</outputDirectory>
90+
<outputDirectory>${project.basedir}/../skills</outputDirectory>
9191
<resources>
9292
<resource>
9393
<directory>${project.build.directory}/skills</directory>
File renamed without changes.

.agents/skills/110-java-maven-best-practices/references/110-java-maven-best-practices.md renamed to skills/110-java-maven-best-practices/references/110-java-maven-best-practices.md

File renamed without changes.
File renamed without changes.

.agents/skills/111-java-maven-dependencies/references/111-java-maven-dependencies.md renamed to skills/111-java-maven-dependencies/references/111-java-maven-dependencies.md

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Treats the user as a knowledgeable partner in solving problems rather than presc
1818

1919
## Goal
2020

21-
This rule provides a focused approach to adding essential Maven dependencies that enhance code quality and safety, specifically JSpecify for nullness annotations. It asks targeted questions to understand dependency needs and conditionally adds only relevant components.
21+
This rule provides a focused approach to adding essential Maven dependencies that enhance code quality and safety: JSpecify for nullness annotations, Error Prone and NullAway for static analysis, VAVR for functional programming, and ArchUnit for architecture testing. It asks targeted questions to understand dependency needs and conditionally adds only relevant components.
2222

2323
## Constraints
2424

@@ -107,6 +107,18 @@ VAVR is a functional programming library for Java that provides immutable data t
107107

108108
---
109109

110+
**Question 5**: Do you want to add ArchUnit for architecture testing?
111+
112+
ArchUnit lets you write unit tests that enforce architectural constraints — such as layering rules, naming conventions, dependency directions, and package structure — directly in your test suite. It integrates with JUnit 5 and runs as part of the normal test lifecycle.
113+
114+
**Options**:
115+
- **y** - Add ArchUnit JUnit 5 dependency (recommended for architecture governance)
116+
- **n** - Skip ArchUnit dependency
117+
118+
**Recommendation**: Choose 'y' if you want to prevent architecture erosion and enforce design rules automatically on every build.
119+
120+
---
121+
110122
```
111123

112124
#### Step Constraints
@@ -122,7 +134,7 @@ VAVR is a functional programming library for Java that provides immutable data t
122134
- **MUST NOT** ask all questions simultaneously
123135
- **MUST NOT** assume answers or provide defaults
124136
- **MUST NOT** skip questions or change their order
125-
- **MUST** follow question sequence: JSpecify → Enhanced Compiler Analysis (conditional)
137+
- **MUST** follow question sequence: JSpecify → Enhanced Compiler Analysis (conditional) → VAVR → ArchUnit
126138
- **MUST** verify that ALL options from the template are included before asking questions
127139
- **MUST** cross-check question content against the freshly read template file
128140
- **MUST** re-read the template and correct questions if there are discrepancies
@@ -150,6 +162,7 @@ Based on user responses, implement the dependency configuration following this o
150162
<error-prone.version>2.35.1</error-prone.version>
151163
<nullaway.version>0.12.0</nullaway.version>
152164
<vavr.version>0.10.6</vavr.version>
165+
<archunit.version>1.4.1</archunit.version>
153166
</properties>
154167
```
155168

@@ -178,6 +191,18 @@ Based on user responses, implement the dependency configuration following this o
178191
</dependencies>
179192
```
180193

194+
**ArchUnit Dependency** (add only if selected):
195+
```xml
196+
<dependencies>
197+
<dependency>
198+
<groupId>com.tngtech.archunit</groupId>
199+
<artifactId>archunit-junit5</artifactId>
200+
<version>${archunit.version}</version>
201+
<scope>test</scope>
202+
</dependency>
203+
</dependencies>
204+
```
205+
181206
**Enhanced Compiler Configuration** (add only if JSpecify selected):
182207
If user wants enhanced compiler analysis, update the maven-compiler-plugin configuration:
183208

@@ -242,6 +267,8 @@ Create `.mvn/jvm.config` file with:
242267
- **MUST** add only dependencies that were selected by the user
243268
- **MUST** use `provided` scope for JSpecify dependency
244269
- **MUST** use `compile` scope for VAVR dependency (default scope)
270+
- **MUST** use `test` scope for ArchUnit dependency
271+
- **MUST** use `archunit-junit5` artifact when JUnit 5 is the test framework
245272
- **MUST** include full Error Prone and NullAway configuration when selected
246273
- **MUST** include `-Xlint:all` and `-Werror` compiler arguments
247274
- **MUST** include `--should-stop=ifError=FLOW` configuration
@@ -324,6 +351,41 @@ public static void collectionsExample() {
324351
}
325352
```
326353

354+
**ArchUnit Usage Example** (if added):
355+
356+
```java
357+
import com.tngtech.archunit.core.domain.JavaClasses;
358+
import com.tngtech.archunit.core.importer.ClassFileImporter;
359+
import com.tngtech.archunit.lang.ArchRule;
360+
import com.tngtech.archunit.junit.AnalyzeClasses;
361+
import com.tngtech.archunit.junit.ArchTest;
362+
363+
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
364+
import static com.tngtech.archunit.library.Architectures.layeredArchitecture;
365+
366+
@AnalyzeClasses(packages = "com.example.myproject")
367+
public class ArchitectureTest {
368+
369+
@ArchTest
370+
static final ArchRule services_should_not_depend_on_controllers =
371+
noClasses()
372+
.that().resideInAPackage("..service..")
373+
.should().dependOnClassesThat()
374+
.resideInAPackage("..controller..");
375+
376+
@ArchTest
377+
static final ArchRule layered_architecture_is_respected =
378+
layeredArchitecture()
379+
.consideringAllDependencies()
380+
.layer("Controller").definedBy("..controller..")
381+
.layer("Service").definedBy("..service..")
382+
.layer("Repository").definedBy("..repository..")
383+
.whereLayer("Controller").mayNotBeAccessedByAnyLayer()
384+
.whereLayer("Service").mayOnlyBeAccessedByLayers("Controller")
385+
.whereLayer("Repository").mayOnlyBeAccessedByLayers("Service");
386+
}
387+
```
388+
327389
**Build Command Examples** (if enhanced compiler analysis added):
328390
```bash
329391
# Run with enhanced analysis
@@ -332,6 +394,15 @@ public static void collectionsExample() {
332394
# Compile will fail with nullness violations
333395
./mvnw clean compile -Dmaven.compiler.showWarnings=true
334396
```
397+
398+
**Build Command Examples** (if ArchUnit added):
399+
```bash
400+
# Run architecture tests together with unit tests
401+
./mvnw test
402+
403+
# Run only architecture tests
404+
./mvnw test -Dtest="*ArchitectureTest"
405+
```
335406
336407
## Output Format
337408

@@ -341,6 +412,7 @@ public static void collectionsExample() {
341412
- Follow configuration specifications exactly
342413
- Update package names in NullAway configuration
343414
- Add VAVR dependency only if user selected functional programming support
415+
- Add ArchUnit dependency only if user selected architecture testing
344416
- Provide usage examples only for features that were added
345417

346418
## Safeguards
@@ -350,4 +422,6 @@ public static void collectionsExample() {
350422
- Never proceed without user confirmation for each step
351423
- Ensure JSpecify dependency uses `provided` scope
352424
- Ensure VAVR dependency uses default `compile` scope
353-
- Test enhanced compiler analysis with a simple build
425+
- Ensure ArchUnit dependency uses `test` scope
426+
- Test enhanced compiler analysis with a simple build
427+
- Verify architecture tests pass with `./mvnw test` after adding ArchUnit

0 commit comments

Comments
 (0)