JetBrains AI Assistant rules examples work best when they encode repo-specific contracts that the assistant can load as project context—not one-off chat fluff. This page shows Markdown under a typical.aiassistant/rules/ tree, copy-ready snippets, and a practical division of labor with root AGENTS.md. Treat every path here as illustrative—JetBrains IDEs and AI Assistant builds change discovery—so re-check official Help on your installed build before treating any example as permanent. We deliberately skip Settings panels, plugin marketplace clicks, and license/activation steps; those belong in JetBrains documentation.

01

Independence note

02

What JetBrains project rules are for (vs AGENTS.md & prompts)

Project rules describe coding standards and team contracts that should stay true across developers and AI sessions. JetBrains AI Assistant can incorporate project-level Markdown rules so answers respect those guidelines. Put durable house style in rules; put this ticket’s goal in the chat brief; keep secrets out of both.

  • .aiassistant/rules: IDE-oriented project standards the assistant is expected to load as context (language defaults, test commands, forbidden paths).
  • AGENTS.md: portable root agent brief many tools 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 JetBrains-specific deltas in .aiassistant/rules/; shared multi-tool facts inAGENTS.md. For JetBrains’ agentic Junie surface, see junie guidelines examples. Compare packaging with cursor rules examples, amazon q rules examples, trae ai rules examples, cline rules examples, and kilo code rules examples. Multi-file choice notes live in AGENTS.md vs CLAUDE.md vs Cursor rules.

03

File layout & relationship to AGENTS.md

A widely documented project-rules layout places Markdown underproject-root/.aiassistant/rules/. Files are usually plain.md (for example kotlin-standards.md orno-deploy.md). Prefer one concern per file so reviews stay focused. Exact auto-load behavior can differ between AI chat, inline completion context, and agent modes—confirm on your IDE build. Global (user-level) rules are a separate surface; this page focuses onproject rules you can commit with the repo.

project/
  AGENTS.md                  # portable cross-tool brief (optional but useful)
  .aiassistant/
    rules/
      01-general.md          # always-on house style
      02-kotlin.md           # language / JVM standards
      03-tests.md            # how to run and structure tests
      04-no-deploy.md        # forbid prod changes unless asked
  src/
  ...

AGENTS.md division of labor: keep facts that every coding agent should know (package manager, test command, forbidden paths) in a short root AGENTS.md. Keep JetBrains AI Assistant–flavored or IDE-stack specifics in .aiassistant/rules/. When teammates also use Cursor, Cline, or Junie, put the canonical sentence inAGENTS.md once and keep IDE rules as thin deltas. Deeper comparison: AGENTS.md vs rules.

This page does not walk through Settings → AI Assistant toggles, plugin install, or license activation—those change often and are covered by JetBrains Help.

04

Copy-ready JetBrains AI Assistant rules 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 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.

Language / JVM standards (Kotlin example)

# Kotlin / JVM standards

- Prefer immutable data where practical; document why a var is mutable.
- Use explicit return types on public APIs; avoid leaking internal DTOs across module boundaries.
- Prefer coroutines patterns already used in the module; do not add a second concurrency style.
- Mirror existing package layout under src/main/kotlin; do not invent a parallel tree.
- Run ./gradlew test (or the repo’s documented task) before claiming done.

Test expectations

# Tests

- Prefer adding or updating tests next to the changed behavior; mirror existing fixture style.
- Name tests by behavior, not by implementation class alone.
- Do not disable or skip failing tests to make the build green unless the user asks.
- Prefer the project’s existing test framework; do not introduce a second runner without asking.

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 rules or chat history.
- Prefer short-lived roles and documented secret managers over pasting keys into the session.

When tools live outside the IDE, pair rules 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

  1. Imperative and testable. “Run ./gradlew test” beats “ensure quality.”
  2. Name artifacts. Paths, module names, and Gradle tasks beat vibes.
  3. State non-goals. Forbid prod deploys, drive-by refactors, and secret echo.
  4. One concern per file. Split language style from deploy guardrails.
  5. Separate AGENTS.md from AI rules. Shared facts once; IDE-specific deltas thin.
  6. Prefer portable wording when the same contract should also help Cursor / Junie teammates.
  7. Point at exemplars. “Match the existing repository layer” beats reinventing access patterns.

Rules degrade when they become a wishlist. If the assistant still violates a rule after two sessions, either the rule is vague, the file is outside the discovered project-rules 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 rules: crowd context and get sampled inconsistently.
  • Mirroring Settings / marketplace install steps inside rules: install paths belong in Help docs, not committed contracts.
  • Contradictions: “always open network” next to “least privilege.”
  • Secrets in rules: rules are often committed; use secret managers instead.
  • Copying Cursor / Cline / Amazon Q rules wholesale without remapping: wrong directory, wrong host assumptions.
  • Duplicating the same wall into AGENTS.md and every .aiassistant file: sync cost explodes; pick one canonical layer per concern.
  • Assuming global and project rules are interchangeable: commit project rules; keep personal prefs out of the shared tree.

Related reading: Junie guidelines examples · How to write AGENTS.md · AGENTS.md vs CLAUDE.md vs Cursor rules · Amazon Q rules examples · TRAE AI rules examples · Kiro steering examples · Augment 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 JetBrains AI Assistant rules examples in a repo?

Most teams use .aiassistant/rules/ at the project root with small, focused Markdown files. Exact auto-load behavior depends on your JetBrains IDE and AI Assistant version—confirm in current Help. This site’s examples are unofficial templates, not a product catalog.

How should .aiassistant/rules relate to AGENTS.md?

Put portable, cross-tool contracts in AGENTS.md and keep JetBrains-specific deltas in.aiassistant/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 these relate to Junie guidelines?

Junie is JetBrains’ agentic coding surface with its own.junie/rules / guidelines patterns. Prefer one canonical contract in AGENTS.md when both AI Assistant and Junie are in play; see junie guidelines examples.

Is this a JetBrains Settings or plugin install guide?

No. This page only covers copy-ready rule writing and AGENTS.md division of labor. Settings panels, marketplace install, and license steps belong in official JetBrains Help—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 IDE upgrades.