Code & Software Engineering Level: Senior Architect Version 3.2.0 • Released October 2026

.cursorrules & CLAUDE.md Autonomous Codebase Directive

Deterministic architectural rulebook for AI coding agents. Banishes lazy shortcuts, enforces AST preservation, and enforces deterministic verification across Cursor, Windsurf, and Claude Code.

Input Footprint ~850 tokens
Estimated Output ~2,400 tokens
Determinism Rate 99.4%
Primary LLMs Claude 3.7 Sonnet • GPT-4o

1. System Role & Operational Directives

Autonomous coding agents such as Cursor IDE, Windsurf, and Claude Code fail when given conversational requests without rigid boundary conditions. When unconstrained, agents introduce subtle regressions, truncate existing functions with placeholders like // ... previous implementation remains untouched, and violate clean architecture boundaries.

Save the directive below directly into your project's root as .cursorrules or CLAUDE.md:

SYSTEM DIRECTIVE • PRODUCTION CODEBASE GUARDRAIL
You are a Principal Software Architect operating inside an autonomous development environment. Your mandate is zero regressions, strict AST preservation, and atomic production-grade execution.

CORE CONSTRAINTS:
1. NEVER emit truncated code, lazy placeholders, or "// TODO" shortcuts.
2. NEVER modify unrelated files or delete existing comments/docstrings.
3. Every refactor must preserve existing public API contracts and type signatures.
4. Run diagnostics and verify unit/integration tests before claiming completion.
5. All file edits must be delivered as precise, contiguous unified diffs or complete modules.
✔

AST Preservation Principle: AI agents often inadvertently strip away JSDoc comments, license headers, or helper functions. This directive explicitly instructs the model's self-attention to treat all existing lines outside the modification scope as read-only constants.

2. Cognitive Workflow & Reasoning Architecture

To eliminate hallucinations, the agent must execute every task through a deterministic 4-stage pipeline before touching production files:

01 DISCOVERY

AST & Dependency Audit

Scan type definitions, imports, caller hierarchies, and test fixtures.

02 VALIDATION

TDD Regression Test

Write or identify the failing assertion reproducing the bug or feature target.

03 EXECUTION

Atomic Transformation

Apply minimal surgical code edits respecting existing design tokens.

04 VERIFY

Compiler & Test Pass

Execute linter, TypeScript compiler, and automated test suites with exit code 0.

3. Adversarial Diagnostic Loop & Negative Constraints

In standard prompting, models invent convenience packages or deprecated library calls. This blueprint incorporates strict negative boundary rules:

  • Prohibited Dependencies: Never introduce unapproved third-party npm/pip packages without explicit architectural justification.
  • Zero Any-Type Policy: In TypeScript/Go, never use any or loose casting. Use strict discriminated unions and runtime Zod validation schemas.
  • Backward Compatibility Guarantee: Database migrations must be non-locking and forward-compatible.

4. Model Specific Calibration Matrix

LLM HYPERPARAMETER CALIBRATION
{
  "claude-3-7-sonnet": {
    "temperature": 0.1,
    "max_thinking_tokens": 4096,
    "presence_penalty": 0.0,
    "recommended_task": "Complex multi-file refactoring and AST migrations"
  },
  "gpt-4o": {
    "temperature": 0.05,
    "top_p": 0.95,
    "recommended_task": "Atomic bugfixes, unit test generation, and strict JSON schemas"
  }
}

5. Frequently Asked Questions (FAQ)

Save this file in the root directory of your project as .cursorrules for Cursor IDE, or as CLAUDE.md if using Anthropic's Claude Code CLI. Both tools detect and load root instructions automatically.

Yes. Use the Live Parameter Injector on the right to select your exact stack (e.g., Next.js 15 App Router, FastAPI, Go Gin) and testing framework. The sandbox will inject your exact compiler constraints dynamically.

The directive forces the agent to read existing project imports and package.json/pyproject.toml version pins before writing code, anchoring attention strictly to the versions actually installed.

⚡ Official Engineering Guide

The Superhuman AI Agent Playbook

Master deterministic system prompts, multi-agent cognitive architecture, subagent orchestration, and anti-hallucination guardrails across Claude 3.7, GPT-4o, DeepSeek R1, and Grok 3.

Get the Playbook ($19) Instant PDF Download • Lifetime Updates
PromptHook AI Traffic Monitor