From java-skills
Use when initializing or auditing a Java project's .gitignore, or when the wrong files were committed — build output, IDE files, OS cruft, or (worst) secrets/local config. Covers what must and must NOT be ignored, a ready Maven+Gradle template, and how to find and un-track files already checked in by mistake (git rm --cached) including the secrets-in-history caveat.
How this skill is triggered — by the user, by Claude, or both
Slash command
/java-skills:java-gitignoreThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Two jobs: **initialize** a correct `.gitignore` for a Java project, and **audit** a repo that has
Two jobs: initialize a correct .gitignore for a Java project, and audit a repo that has
already committed things it shouldn't. The expensive failure is a secret checked in — fixing the
.gitignore after the fact does NOT remove it from history.
| Category | Patterns |
|---|---|
| Secrets / local config (the costly leak) | *.env, application-local.*, *-secret*.*, *.pem, *.p12, *.jks, *.keystore, credentials*, .envrc |
| Build output | target/, build/, out/, bin/, *.class |
| Packaged artifacts | *.jar, *.war, *.ear (except wrappers — below) |
| IDE files | .idea/, *.iml, *.ipr, *.iws, .vscode/, .settings/, .classpath, .project, .metadata, nbproject/ |
| OS cruft | .DS_Store, Thumbs.db, Desktop.ini |
| Logs / crash dumps | *.log, hs_err_pid*, replay_pid* |
| Git/merge backups | *.orig, *.BACKUP.*, *.LOCAL.*, *.REMOTE.* |
Drop in references/java.gitignore as a starting point (Maven + Gradle + IDE + OS + secrets).
Wrapper files — keep gradle/wrapper/gradle-wrapper.jar, gradle/wrapper/gradle-wrapper.properties,
and .mvn/wrapper/maven-wrapper.properties committed so ./gradlew / ./mvnw work for everyone.
A broad *.jar or build/ rule can swallow these — add negations:
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
Source, pom.xml/build.gradle, and .mvn/ config (other than timing.properties).
One .gitignore at the repo root; module-specific files only if a module genuinely differs.
Copy references/java.gitignore, then trim to the project's build tool (Maven vs Gradle).
OS/IDE cruft is per-developer — a global excludes file keeps it out of every repo:
git config --global core.excludesfile ~/.gitignore_global # .DS_Store, .idea/, *.iml, etc.
.gitignore only affects untracked files — anything already committed keeps being tracked even
if it now matches a pattern. To find and fix what was checked in by mistake:
# List tracked files that SHOULD be ignored (already committed but match .gitignore)
git ls-files --cached --ignored --exclude-standard
# Un-track exactly those files WITHOUT deleting your working copy, then commit.
# Drive git rm from the list above (don't guess paths — a non-tracked path aborts the whole command):
git ls-files --cached --ignored --exclude-standard -z | xargs -0 git rm --cached
git commit -m "chore: stop tracking ignored files"
Files covered by a global excludes file (
.idea/,.DS_Store) won't appear here — that's fine.
Sanity sweeps for common mistakes:
git ls-files | grep -E '\.(class|jar|war|log|iml)$|(^|/)(target|build|out|bin)/|\.idea/'
git ls-files | grep -iE 'secret|credential|\.env$|application-local|\.(pem|p12|jks|keystore)$'
git rm --cached removes a file from the current commit, not from history — the secret is
still recoverable from earlier commits. If a real secret was committed:
git filter-repo (or BFG), and force-push (coordinate with the team)..gitignore so it can't recur.target//build//.class/.idea/ showing up in git status as tracked*.env, application-local.*, keystore, or credentials* file staged or committed*.jar, build/) with no negation for the wrapper jargit rm --cached the secret" — that doesn't remove it from history; rotate itnpx claudepluginhub mtkhawaja/java-skills --plugin java-skillsProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.