copilot-setting: Instructions file for GitHub Copilot

.github/instructions/java.instructions.md

copilot-setting java.instructions.md is an instructions file for GitHub Copilot from zexion7873/copilot-setting. It costs 1,160 tokens per session, scanned A, original, MIT.

A set of Java 8 coding rules for syntax, exceptions, logging, concurrency, and resource handling.

In plain words
What is it for?
Use it when writing or reviewing .java files, especially code involving collections, strings, optional values, JDBC resources, or logging.
Why use it?
It prevents newer Java features and APIs from being introduced into a Java 8 project, including features that are difficult for the build to catch.

Instructions file for GitHub Copilot

Written for GitHub Copilot: a Copilot instructions file.

This is zexion7873/copilot-setting's own configuration. It tells GitHub Copilot how to work on copilot-setting itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything copilot-setting configures →

Reuse

Borrowing it

Nothing to install: this file belongs to zexion7873/copilot-setting. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/zexion7873/copilot-setting/main/.github/instructions/java.instructions.md
Clone the repo
git clone --depth 1 https://github.com/zexion7873/copilot-setting

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for copilot-setting java.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/zexion7873/copilot-setting/java/github.svg)](https://agentmods.dev/instructions/zexion7873/copilot-setting/java)
Your own site
<a href="https://agentmods.dev/instructions/zexion7873/copilot-setting/java"><img src="https://agentmods.dev/badge/instructions/zexion7873/copilot-setting/java/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for copilot-setting java.instructions.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/zexion7873/copilot-setting/java"><img src="https://agentmods.dev/badge/instructions/zexion7873/copilot-setting/java.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,160 This file is loaded in full into every session.
When invoked 1,160 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01160 $0.01160
Opus 5.5 $0.00464 $0.00464
Sonnet 5.5 $0.00232 $0.00232
Haiku 4.5 $0.00116 $0.00116

Measured 1mo ago against content hash 7f84fcc10a34, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

copilot-setting java.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/instructions/java.instructions.md · 69 lines

How it starts

The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Java 8 Conventions

This project is Java 8. AI models default to modern Java, and that pull is strong — treat it as a bias to correct, not a preference to follow. A newer-version symbol won't compile, but the convention and correctness rules below fail only at review or runtime — don't lean on the build to catch them. If you are not certain something exists in Java 8, verify against this file before writing it — never guess.

Language Boundary (Java 9+ Forbidden)

  • var, records, sealed classes, text blocks, pattern matching
  • List.of(), Map.of(), Set.of() — use Arrays.asList() / Collections.unmodifiableMap() (note: Arrays.asList is fixed-size but element-mutable and allows nulls, unlike List.of — wrap in Collections.unmodifiableList when true immutability matters)
  • String.isBlank(), String.strip() — use StringUtils or .trim().isEmpty()
  • Optional.ifPresentOrElse(), Optional.stream()
  • Module system (module-info.java)
  • try-with-resources on a pre-declared effectively-final variable (Java 9) — declare the resource inside the try (...) parentheses instead; try-with-resources itself is Java 7 and stays mandatory for JDBC (instructions/sql.instructions.md)

Optional

  • Return type only — never field, parameter, or collection element
  • orElseThrow(SomeException::new) over .get() — .get() throws cryptic NoSuchElementException. Note: Java 8 requires the supplier form orElseThrow(() -> new ...) — the no-arg orElseThrow() is Java 10+.
  • orElse() for cheap defaults; orElseGet() for expensive computation

Streams

  • One operation per line; break chain at .collect()
  • Never modify external state inside forEach / map / filter
  • Prefer for loop for simple iterations with side effects

Date and Time

  • Use java.time (LocalDate, LocalDateTime, ZonedDateTime, Instant, Duration) for business logic, computation, and internal date handling — a Java 8 feature and the default for new code
  • Two hard exceptions on this stack — Hibernate 4.2 has no java.time support (that arrived in Hibernate 5's hibernate-java8 module) and JSTL 1.2 <fmt:formatDate> accepts only java.util.Date:
    • hbm.xml-mapped entity date fields stay java.util.Date / java.sql.Timestamp — a LocalDateTime field has no Hibernate 4.2 type mapping (fails, or silently persists as a serialized BLOB)
    • dates passed to a JSP for <fmt:formatDate> stay java.util.Date (instructions/jsp.instructions.md)
  • Convert at the service boundary with Date.from(instant) / Date.toInstant() between java.time logic and the persistence / view layers
  • Still avoid java.util.Calendar (mutable, error-prone) in new code

Read the full file on GitHub · 69 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +9 lines · +97 tokens per session 7f84fcc10a34
  2. 1mo ago Changed · -17 lines · -263 tokens per session 10b8f622b416
  3. 2mo ago First seen · 77 lines · 1,326 tokens per session scan A e67f462e1e44

Subscribe to this mod's changes

copilot-setting java.instructions.md is an instructions file published in the GitHub repository zexion7873/copilot-setting (1 stars, last pushed 1mo ago), licensed MIT. It adds 1,160 tokens to every session, about $0.0046 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

copilot-setting java.instructions.md compared with instructions from other repositories

copilot-setting java.instructions.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
copilot-setting java.instructions.mdzexion7873/copilot-settingInstructions file11mo agoMITA1,160GitHub Copilot
ai-agent-rules-generator copilot.instructions.mdsavedpixel/ai-agent-rules-generatorInstructions file86mo agoMITA3,431GitHub Copilot
ai-agent-rules-generator agent-observations.instructions.mdsavedpixel/ai-agent-rules-generatorInstructions file86mo agoMITA1,787GitHub Copilot
ai-agent-rules-generator task.instructions.mdsavedpixel/ai-agent-rules-generatorInstructions file86mo agoMITA1,703GitHub Copilot
ai-agent-rules-generator doc-sync.instructions.mdsavedpixel/ai-agent-rules-generatorInstructions file86mo agoMITA1,652GitHub Copilot
ai-agent-rules-generator browsetools.instructions.mdsavedpixel/ai-agent-rules-generatorInstructions file86mo agoMITA490GitHub Copilot
ai-agent-rules-generator devtools.instructions.mdsavedpixel/ai-agent-rules-generatorInstructions file86mo agoMITA399GitHub Copilot