Junie guidelines examples work best when they encode repo-specific contracts that Junie can load while planning and editing—not one-off prompt fluff. This page shows Markdown under a typical .junie/rules/ (guidelines) tree, copy-ready snippets, and a practical division of labor with rootAGENTS.md. Treat every path here as illustrative—Junie and JetBrains IDE builds change discovery—so re-check official Junie docs on your installed surface before treating any example as permanent. We deliberately skip plugin install, license, and Settings walkthroughs; those belong in JetBrains documentation.
01
Independence note
02
What Junie guidelines are for (vs AGENTS.md & prompts)
Guidelines describe coding standards and team contracts that should stay true across Junie sessions. Put durable house style in guidelines; put this ticket’s goal in the session brief; keep secrets out of both.
- .junie/rules (guidelines): Junie-oriented project standards expected as agent context (build/test commands, module layout, forbidden paths).
- AGENTS.md: portable root agent brief many tools (and some Junie builds) also read—good for cross-tool contracts. See how to write AGENTS.md.
- Session prompts: this ticket’s objective, acceptance checks, and temporary non-goals.
- Neither: API keys, production credentials, or one-off customer data.
Prefer one clear statement of each convention. Thin Junie-specific deltas in .junie/rules/; shared multi-tool facts inAGENTS.md. For JetBrains AI Assistant (non-Junie) project rules, see JetBrains AI Assistant rules examples. Compare packaging with cursor rules examples, amazon q rules examples, and cline rules examples. Multi-file choice notes live in AGENTS.md vs CLAUDE.md vs Cursor rules.
03
File layout & relationship to AGENTS.md
A common layout places guideline Markdown underproject-root/.junie/rules/ (naming varies slightly across docs and community repos—confirm on your build). Prefer one concern per file. Exact auto-load behavior can differ between Junie agent runs and other JetBrains AI surfaces—do not assume identical loading with.aiassistant/rules.
project/
AGENTS.md # portable cross-tool brief (optional but useful)
.junie/
rules/
01-general.md # always-on house style
02-build-test.md # how to build and verify
03-module-layout.md # where new code belongs
04-no-deploy.md # forbid prod changes unless asked
src/
...AGENTS.md division of labor: keep facts that every coding agent should know in a short root AGENTS.md. Keep Junie-flavored or IDE-stack specifics in .junie/rules/. When the same team also uses JetBrains AI Assistant chat, Cursor, or Cline, put the canonical sentence in AGENTS.md once and keep Junie guidelines as thin deltas. Deeper comparison: AGENTS.md vs rules.
This page does not walk through Junie plugin install, activation, or IDE Settings—those change often and are covered by JetBrains / Junie documentation.
04
Copy-ready junie guidelines examples
Adapt these templates. Replace stack names, commands, and non-goals with your repo’s truth. Keep them short enough that a human will maintain them.
Always-on project conventions
# Project conventions
- Indent with 4 spaces; do not reformat unrelated files.
- Prefer extending an existing module pattern over inventing a parallel layout.
- Run the project’s documented test / build command before claiming done.
- Do not change production deploy pipelines, DNS, or payment config unless the user explicitly asks.
- Never print or commit secrets, access keys, or session tokens.Build and verify
# Build and verify
- Default verify command: ./gradlew test (replace with this repo’s truth).
- Prefer incremental changes that keep the main branch green.
- Do not delete or skip failing tests to force a green build unless asked.
- When changing public APIs, update callers and tests in the same change set when practical.Module layout
# Module layout
- New feature code belongs under the existing package tree for that domain—do not invent a parallel root.
- Prefer small, reviewable diffs; avoid drive-by renames across unrelated packages.
- Match existing naming for DTOs, repositories, and service layers already in the module.
- Document non-obvious invariants next to the code they protect, not only in guidelines.Safety / no-prod-change
# Deploy and secrets
- Do not run production deploys, mutate live cloud accounts, or edit payment / DNS config unless asked.
- Never commit .env, credentials.json, or long-lived tokens into guidelines or chat history.
- Prefer short-lived roles and documented secret managers over pasting keys into the session.When tools live outside the IDE, pair guidelines with a clear tool policy in the prompt. For MCP host pitfalls, see the MCP server tutorial and MCP server best practices.
05
Writing patterns that stick
- Imperative and testable. “Run
./gradlew test” beats “ensure quality.” - Name artifacts. Paths, modules, and tasks beat vibes.
- State non-goals. Forbid prod deploys, drive-by refactors, and secret echo.
- One concern per file. Split build/verify from layout and safety.
- Separate AGENTS.md from Junie guidelines. Shared facts once; Junie deltas thin.
- Prefer portable wording when the same contract should also help AI Assistant / Cursor teammates.
- Point at exemplars. “Match the existing repository layer” beats reinventing access patterns.
Guidelines degrade when they become a wishlist. If Junie still violates a rule after two sessions, either the guideline is vague, the file is outside the discovered path, AGENTS.md was assumed loaded when it was not, or a stronger nearby example is missing—verify discovery on your IDE surface first.
06
Anti-patterns
- Novel-length always-on guidelines: crowd context and get sampled inconsistently.
- Mirroring install / Settings steps inside guidelines: install paths belong in docs, not committed contracts.
- Contradictions: “always open network” next to “least privilege.”
- Secrets in guidelines: guidelines are often committed; use secret managers instead.
- Copying .aiassistant/rules wholesale without remapping: wrong directory, wrong host assumptions—see JetBrains AI rules examples.
- Duplicating the same wall into AGENTS.md and every .junie file: sync cost explodes; pick one canonical layer per concern.
- Assuming Junie and AI Assistant load identical context: verify each surface you ship.
Related reading: JetBrains AI Assistant rules examples · How to write AGENTS.md · AGENTS.md vs CLAUDE.md vs Cursor rules · Amazon Q rules examples · Kilo code rules examples · Cursor rules examples · Windsurf rules examples · Cline rules examples · Continue rules examples · Antigravity rules examples · copilot-instructions.md examples · How to write CLAUDE.md · Good agent prompts · Cursor agent tips · Agent engineering notes
07
FAQ
Where should I put junie guidelines examples in a repo?
Most teams use a .junie/rules/ (or documented guidelines) tree at the project root with small, focused Markdown files. Exact discovery depends on your Junie / IDE version—confirm in current product docs. This site’s examples are unofficial templates, not a product catalog.
How should .junie/rules relate to AGENTS.md?
Put portable, cross-tool contracts in AGENTS.md and keep Junie-specific deltas in .junie/rules/. Multi-tool teams often keep a short root AGENTS.md and thinner IDE rules. See AGENTS.md vs CLAUDE.md vs Cursor rules.
How do Junie guidelines relate to JetBrains AI Assistant rules?
Same job—durable repo contracts—different loaders and directories. Prefer one canonical sentence in AGENTS.md when both surfaces are in play. See JetBrains AI Assistant rules examples.
Is this a Junie install or Settings guide?
No. This page only covers copy-ready guideline writing and AGENTS.md division of labor. Install, activation, and Settings steps belong in official JetBrains / Junie documentation—re-check those after upgrades.
Is this official JetBrains documentation?
No. Unofficial practice notes from 墨码 / codemo.fun—not affiliated with JetBrains. Treat templates as starting points and re-verify paths after upgrades.