From c99ee9335bde578f7be8d8de57d16157d340252e Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 14 Apr 2026 12:20:54 -0400 Subject: [PATCH 1/2] feat: add Java development skill for monorepo --- .agents/skills/java-development/SKILL.md | 67 ++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .agents/skills/java-development/SKILL.md diff --git a/.agents/skills/java-development/SKILL.md b/.agents/skills/java-development/SKILL.md new file mode 100644 index 000000000000..561a8b79099f --- /dev/null +++ b/.agents/skills/java-development/SKILL.md @@ -0,0 +1,67 @@ +--- +name: java-development +description: General guidance on Java development practices, building, testing, and style in the monorepo. Use this skill when working on Java code across the repository. +--- + +# Java Development Guide + +This skill provides general guidelines for Java development inside the monorepo. It covers building, formatting, testing, and style conventions to ensure consistency across modules. + +## Workflow + +### 1. Building the Project + +The repository uses Maven as its primary build system. + +* **Build All Modules**: To build all modules from the root of the repository, run: + ```bash + mvn install -T 1C -P quick-build + ``` + > [!TIP] + > Use `-T 1C` to build modules in parallel (one thread per CPU core) and `-P quick-build` to skip unnecessary plugins for faster builds. +* **Build a Specific Module**: You can also run Maven commands within a specific module directory (e.g., `java-bigquery`) to build only that module. + +### 2. Code Formatting + +Code formatting is enforced using the `fmt-maven-plugin`. + +* **Check Formatting**: To check for formatting issues without modifying files, run: + ```bash + mvn fmt:check -T 1C + ``` +* **Apply Formatting**: To automatically format the code according to the project style, run: + ```bash + mvn fmt:format -T 1C + ``` + > [!TIP] + > To save time, run `mvn fmt:format` within the specific module directory you are working on, rather than at the root. + > [!NOTE] + > Always run `mvn fmt:format` before committing changes to avoid build failures due to formatting. + +### 3. Testing Strategy + +* **Unit Tests**: Traditional unit tests should be added for individual classes and methods. Run them using: + ```bash + mvn test -T 1C + ``` +* **Integration Tests**: Many modules have integration tests that run against live services or emulators. These may require specific profiles or environment variables. Refer to the specific module's README for details. + +### 4. Style Guide + +Follow these general rules to maintain code quality and consistency: + +1. **Minimize Visibility**: Default to the most restrictive access level possible. Avoid using `public` unless the class or method is intended to be part of the public API. +2. **Short Names**: Prefer short names over fully qualified names when importing classes. +3. **Avoid Obsolete APIs**: Do not call methods marked with `@ObsoleteApi` or `@Deprecated` unless there are no viable alternatives. +4. **Clean Diffs**: Avoid unnecessary formatting changes or whitespace modifications to keep diffs clean and easy to review. + +### 5. Dependency Management + +* **Version Bumps**: Try not to bump any external dependency versions unless there is a known security vulnerability (CVE) or a critical bug fix. +* **New Dependencies**: Avoid introducing new external dependencies. If a new dependency is required, provide a strong justification in the pull request. +* **Standard Library First**: Prefer to use features from the Java standard library, followed by existing dependencies in the project (preferably Google-managed dependencies). + +### 6. Contribution Guidelines + +* **Commit Messages**: Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. Include the module as the scope (e.g., `feat(spanner): ...`, `fix(bigquery): ...`). +* **Pull Requests**: All code changes must be submitted via a pull request and require review. Ensure you pull the latest changes from `main` and resolve any conflicts before submitting. From 654b278951db364199f4574f4028d932d8d345fc Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 14 Apr 2026 12:51:31 -0400 Subject: [PATCH 2/2] chore: Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- .agents/skills/java-development/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/java-development/SKILL.md b/.agents/skills/java-development/SKILL.md index 561a8b79099f..0b929dec6cd0 100644 --- a/.agents/skills/java-development/SKILL.md +++ b/.agents/skills/java-development/SKILL.md @@ -51,7 +51,7 @@ Code formatting is enforced using the `fmt-maven-plugin`. Follow these general rules to maintain code quality and consistency: 1. **Minimize Visibility**: Default to the most restrictive access level possible. Avoid using `public` unless the class or method is intended to be part of the public API. -2. **Short Names**: Prefer short names over fully qualified names when importing classes. +2. Avoid Fully Qualified Names: Use imports to keep class names short and readable, rather than using fully qualified names in the code. 3. **Avoid Obsolete APIs**: Do not call methods marked with `@ObsoleteApi` or `@Deprecated` unless there are no viable alternatives. 4. **Clean Diffs**: Avoid unnecessary formatting changes or whitespace modifications to keep diffs clean and easy to review.