Skip to content

JetBrains IDE Rules Template (IntelliJ IDEA, WebStorm, PyCharm, etc.)

Generated by MCP ADR Analysis Server

Purpose: Configure JetBrains IDEs for {PROJECT_NAME} with intelligent code analysis and architectural compliance.

Project Configuration

Code Style Settings

xml
<code_scheme name="ProjectScheme" version="1">
  <option name="LINE_SEPARATOR" value="&#10;" />
  <option name="RIGHT_MARGIN" value="120" />
  <JavaCodeStyleSettings>
    <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
    <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
  </JavaCodeStyleSettings>
  <TypeScriptCodeStyleSettings>
    <option name="USE_SEMICOLON_AFTER_STATEMENT" value="true" />
    <option name="FORCE_SEMICOLON_STYLE" value="true" />
  </TypeScriptCodeStyleSettings>
</code_scheme>

Inspection Profiles

xml
<profile version="1.0">
  <option name="myName" value="Project Architecture" />
  <inspection_tool class="ArchitectureViolation" enabled="true" level="ERROR" />
  <inspection_tool class="SecurityVulnerability" enabled="true" level="WARNING" />
  <inspection_tool class="TestCoverage" enabled="true" level="WARNING">
    <option name="minimumCoverage" value="80" />
  </inspection_tool>
</profile>

Live Templates

ADR Template

xml
<template name="adr" value="# $TITLE$&#10;&#10;## Status&#10;$STATUS$&#10;&#10;## Context&#10;$CONTEXT$&#10;&#10;## Decision&#10;$DECISION$&#10;&#10;## Consequences&#10;$CONSEQUENCES$" description="Create ADR" toReformat="true" toShortenFQNames="true">
  <variable name="TITLE" expression="" defaultValue="&quot;Decision Title&quot;" alwaysStopAt="true" />
  <variable name="STATUS" expression="" defaultValue="&quot;Proposed&quot;" alwaysStopAt="true" />
  <variable name="CONTEXT" expression="" defaultValue="&quot;Context&quot;" alwaysStopAt="true" />
  <variable name="DECISION" expression="" defaultValue="&quot;Decision&quot;" alwaysStopAt="true" />
  <variable name="CONSEQUENCES" expression="" defaultValue="&quot;Consequences&quot;" alwaysStopAt="true" />
</template>

Test Template

xml
<template name="test" value="@Test&#10;public void should$METHOD_NAME$() {&#10;    // Given&#10;    $GIVEN$&#10;    &#10;    // When&#10;    $WHEN$&#10;    &#10;    // Then&#10;    $THEN$&#10;}" description="Test method" toReformat="true">
  <variable name="METHOD_NAME" expression="camelCase()" defaultValue="" alwaysStopAt="true" />
  <variable name="GIVEN" expression="" defaultValue="" alwaysStopAt="true" />
  <variable name="WHEN" expression="" defaultValue="" alwaysStopAt="true" />
  <variable name="THEN" expression="" defaultValue="" alwaysStopAt="true" />
</template>

File and Code Templates

Service Class Template

java
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")

import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
@RequiredArgsConstructor
public class ${NAME} {
    
    // Dependencies injected via constructor
    
    public void execute() {
        log.info("Executing ${NAME}");
        // Implementation following architectural patterns
    }
}

Run Configurations

Architecture Validation

xml
<configuration name="Validate Architecture" type="ShConfigurationType">
  <option name="SCRIPT_TEXT" value="mcp-adr-tool validate-rules --project $PROJECT_DIR$" />
  <option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>

Test Coverage

xml
<configuration name="Test with Coverage" type="JUnit">
  <option name="TEST_OBJECT" value="directory" />
  <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
  <option name="VM_PARAMETERS" value="-ea" />
  <option name="PARAMETERS" value="" />
  <patterns>
    <pattern testClass=".*Test" />
  </patterns>
</configuration>

External Tools

MCP ADR Analysis

xml
<toolSet name="MCP ADR Tools">
  <tool name="Analyze Ecosystem" showInMainMenu="true" showInEditor="true">
    <exec>
      <option name="COMMAND" value="mcp-adr-tool" />
      <option name="PARAMETERS" value="analyze-ecosystem --path $FilePath$" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>
  <tool name="Generate ADR" showInMainMenu="true">
    <exec>
      <option name="COMMAND" value="mcp-adr-tool" />
      <option name="PARAMETERS" value="generate-adr --context $Prompt$" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>
</toolSet>

Intentions and Quick Fixes

Architecture Compliance

xml
<intentionAction>
  <className>com.project.intentions.FixArchitectureViolation</className>
  <category>Architecture</category>
  <description>Fix architecture layer violation</description>
</intentionAction>

Security Fixes

xml
<intentionAction>
  <className>com.project.intentions.SecureCodePattern</className>
  <category>Security</category>
  <description>Apply secure coding pattern</description>
</intentionAction>

Database Tools

Query Console Templates

sql
-- Analyze table performance
EXPLAIN ANALYZE
SELECT *
FROM ${TABLE_NAME}
WHERE ${CONDITION};

-- Migration template
BEGIN;
-- Migration: ${DESCRIPTION}
${MIGRATION_SQL}
COMMIT;

Version Control Integration

Commit Templates

[${TYPE}] ${SUBJECT}

${BODY}

Related ADR: ${ADR_NUMBER}
Closes: ${ISSUE_NUMBER}

Pre-commit Checks

xml
<vcs-settings>
  <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
  <option name="CHECK_CODE_SMELLS_BEFORE_COMMIT" value="true" />
  <option name="CHECK_NEW_TODO_BEFORE_COMMIT" value="true" />
  <option name="FORCE_NON_EMPTY_COMMENT" value="true" />
</vcs-settings>

AI Assistant Configuration

Context Rules

yaml
ai_assistant:
  include_context:
    - current_class
    - related_tests
    - architectural_patterns
    - project_conventions
  
  code_generation:
    - follow_existing_patterns
    - maintain_layer_boundaries
    - include_logging
    - handle_exceptions
  
  suggestions:
    - performance_optimizations
    - security_improvements
    - test_coverage_gaps

Project Structure

Module Templates

src/
├── main/
│   ├── java/
│   │   └── ${PACKAGE}/
│   │       ├── domain/
│   │       ├── application/
│   │       ├── infrastructure/
│   │       └── presentation/
│   └── resources/
└── test/
    ├── java/
    └── resources/

Custom Actions

Keyboard Shortcuts

xml
<keymap version="1" name="Project Keymap">
  <action id="AnalyzeArchitecture" class="com.project.actions.AnalyzeArchitecture">
    <keyboard-shortcut first-keystroke="ctrl shift A" />
  </action>
  <action id="GenerateTests" class="com.project.actions.GenerateTests">
    <keyboard-shortcut first-keystroke="ctrl shift T" />
  </action>
  <action id="ValidateDeployment" class="com.project.actions.ValidateDeployment">
    <keyboard-shortcut first-keystroke="ctrl shift D" />
  </action>
</keymap>

IDE Scopes

Architecture Scopes

xml
<scope name="Domain Layer" pattern="file:src/main/java/*/domain//*" />
<scope name="Application Layer" pattern="file:src/main/java/*/application//*" />
<scope name="Infrastructure Layer" pattern="file:src/main/java/*/infrastructure//*" />
<scope name="Tests" pattern="file:src/test//*" />

Custom Configuration

Add your JetBrains IDE specific customizations:

xml
<!-- Your project-specific configurations -->

Released under the MIT License.