Claude Code Prompt Engineering Patterns banner
miloudbelarebia miloudbelarebia

Claude Code Prompt Engineering Patterns

Development community

Description

10 production prompt engineering patterns reverse-engineered from the Claude Code source leak. Python implementation. No proprietary code.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Claude Code Prompt Engineering Patterns

Reverse-engineered from the Claude Code source leak (March 31, 2026). 10 production patterns documented and implemented in Python.

10 Patterns Python MIT License No proprietary code


What Happened

On March 31, 2026, Anthropic accidentally leaked the **entire source code** of Claude Code (512,000 lines of TypeScript) through a misconfigured npm package. Before the DMCA takedowns, I analyzed their prompt engineering architecture and extracted **10 production patterns** that any developer can use.

This repo does **NOT** contain any Anthropic code. It documents the **techniques and patterns** with original Python implementations.


The 10 Patterns

    SYSTEM PROMPT ARCHITECTURE (how Claude Code builds its prompt)
    ================================================================

    ┌──────────────────────────────────────────────────────────────┐
    │  Pattern 1: MODULAR PROMPT                                   │
    │  ┌────────────────────────────────────────────────────────┐  │
    │  │  Identity Section                                      │  │
    │  │  "You are an AI coding assistant..."                   │  │
    │  ├────────────────────────────────────────────────────────┤  │
    │  │  Pattern 3: SECURITY GUARDRAILS                        │  │
    │  │  One paragraph that controls all cyber boundaries      │  │
    │  ├────────────────────────────────────────────────────────┤  │
    │  │  Pattern 2: CONDITIONAL BEHAVIOR                       │  │
    │  │  if user == "internal":