Skip to main 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โ€‹

<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โ€‹

<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โ€‹

<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โ€‹

<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โ€‹

#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โ€‹

<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โ€‹

<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โ€‹

<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โ€‹

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

Security Fixesโ€‹

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

Database Toolsโ€‹

Query Console Templatesโ€‹

-- 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โ€‹

<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โ€‹

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โ€‹

<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โ€‹

<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:

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