Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
testdino-hq avatar

Java

  • 4 installs
  • 8 repo stars
  • Updated February 25, 2026
  • testdino-hq/google-styleguides-skills

Applies Google's official Java style guide for indentation, naming, imports, Javadoc, and exception handling.

About

Google's official Java style guide covering indentation, line limits, naming, imports, Javadoc, and exception handling. A developer uses it to write and review consistent, maintainable Java code.

  • Google's official Java style guide: 2-space indent, 100-char limit
  • Covers naming, braces, imports, Javadoc, lambdas, and streams

Java by the numbers

  • 4 all-time installs (skills.sh)
  • Ranked #76 of 89 Java & JVM skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/testdino-hq/google-styleguides-skills --skill java

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4
repo stars8
Last updatedFebruary 25, 2026
Repositorytestdino-hq/google-styleguides-skills

What it does

Applies Google's official Java style guide for indentation, naming, imports, Javadoc, and exception handling.

Files

SKILL.mdMarkdownGitHub ↗

Google Java Style Guide

Official Google Java coding standards for consistent, maintainable code.

Golden Rules

1. 2-space indentation — no tabs 2. Column limit: 100 characters 3. Use `@Override` whenever applicable 4. No wildcard imports — import specific types 5. Braces required even for single-statement blocks 6. One top-level class per file 7. Prefer interfaces for type definitions

Quick Reference

Naming Conventions

ElementConventionExample
Packageslowercase.dottedcom.example.project
Classes/InterfacesUpperCamelCaseUserService
MethodslowerCamelCasegetUserById
VariableslowerCamelCaseuserCount
ConstantsUPPER_SNAKE_CASEMAX_RETRIES
Type parametersSingle letterT, RequestT

Classes

// ✓ CORRECT
public class Animal {
    private final String name;

    public Animal(String name) {
        this.name = name;
    }

    public String speak() {
        return name + " makes a sound.";
    }
}

Control Structures

// ✓ CORRECT - braces always required
if (condition) {
    doSomething();
}

// ✗ INCORRECT - no braces
if (condition)
    doSomething();

// ✓ CORRECT - enhanced for loop
for (String item : items) {
    process(item);
}

Exception Handling

// ✓ CORRECT
try {
    processData(input);
} catch (IOException e) {
    logger.error("IO error: {}", e.getMessage());
    throw new ServiceException("Failed", e);
}

// ✓ CORRECT - try-with-resources
try (InputStream in = new FileInputStream(file)) {
    return IOUtils.toByteArray(in);
}

// ✗ INCORRECT
try {
    ...
} catch (Exception e) {    // too broad
    e.printStackTrace();   // don't use printStackTrace
}

Lambdas and Streams

// ✓ CORRECT
List<String> names = users.stream()
    .filter(u -> u.isActive())
    .map(User::getName)
    .sorted()
    .collect(Collectors.toList());

// ✓ CORRECT - method references
users.forEach(System.out::println);

Javadoc

/**
 * Finds a user by their unique identifier.
 *
 * @param userId the user's unique ID
 * @return an Optional containing the user, or empty if not found
 */
public Optional<User> findUserById(long userId) { ... }

Imports

// ✓ CORRECT
import java.util.List;
import java.util.Optional;

// ✗ INCORRECT
import java.util.*;  // no wildcard imports

Common Mistakes

MistakeCorrect Approach
Wildcard importsSpecific imports only
Omitting bracesAlways use braces
Missing @OverrideAlways annotate overridden methods
e.printStackTrace()Use a proper logger
Catching Exception broadlyCatch specific exceptions
4-space indentationUse 2-space indentation

When to Use This Guide

  • Writing new Java code
  • Refactoring existing Java
  • Code reviews
  • Setting up Checkstyle rules
  • Onboarding new team members

Install

npx skills add testdino-hq/google-styleguides-skills/java

Full Guide

See java.md for complete details, examples, and edge cases.

Related skills

Java & JVMbackenddocs

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.