# 📘 SOP: Professional Development with Claude Code

Below is a **Universal Guide for Development Using Claude Code (CLI)**. It is compiled based on the data you provided and adapted for real-world use in a professional environment.

This instruction (SOP) is designed to eliminate "hallucinations," context loss, and the creation of low-quality code ("slop").

---

# 📘 SOP: Professional Development with Claude Code

**Goal:** Creating clean, tested, and maintainable code with minimal errors through strict context management and an iterative approach.

---

## 🏗 Stage 0: Preparation (Pre-flight Check)

Before launching the terminal, make sure you have:

1. **Basic idea:** An `idea.md` or `spec.md` file with a brief description of the application's essence (2-3 paragraphs).
2. **Access:** Claude Code installed and authorized.

---

## 🕵️ Stage 1: Detailed Specification (Interrogation Method)

**Principle:** Never ask the AI to "just write code." You don't know all the constraints, but the AI can predict them. Force it to extract the technical requirements from you.

**Action:** Launch Claude Code and provide it with your idea file. Use a special prompt to initiate the interview.

**📝 Universal Prompt (Copy and paste):**

```text
Read the file [idea_file_name] and interview me in detail using AskUserQuestionTool about literally anything regarding this project: technical implementation stack, UI/UX patterns, edge cases, data handling, error states, and tradeoffs. Do not write any code yet. Just ask questions to build a perfect mental model.
```

**Your task:** Answer questions in as much detail as possible.

- _Technologies:_ (React vs Vue? SQL vs NoSQL?)
- _Edge cases:_ (What if internet is lost? What if API returns 404?)
- _Constraints:_ (Token budget, deadlines, performance).

**Stage result:** Claude has a complete understanding of the task _before_ writing the first line of code.

---

## 🗺 Stage 2: Architecture and Decomposition

**Principle:** Divide and conquer. Monolithic prompts lead to errors.

**Action:** Ask Claude to create a development plan, breaking it down into isolated, independent steps.

**📝 Universal Prompt:**

```text
Based on our interview, create a detailed step-by-step implementation plan (TODO list). Break the project down into isolated features (e.g., 1. Project Setup, 2. Database Schema, 3. Auth Module).
Save this plan to a file named 'implementation_plan.md'.
```

**Stage result:** You have an `implementation_plan.md` file that serves as a roadmap. You will check off items one by one.

---

## 🧱 Stage 3: Modular Development (Build Cycle)

**Principle:** One prompt = One feature. Don't move to step B until step A works perfectly.

**Cycle algorithm:**

1. **Task selection:** Look at `implementation_plan.md`.
2. **Build command:** Give a command to implement _only_ this item.
3. **Testing:** Verify functionality.

**📝 Implementation Prompt (Example for "Authentication" feature):**

```text
Focus ONLY on item #3 from implementation_plan.md ("User Authentication").
1. Implement the necessary backend logic.
2. Create the UI components.
3. Verify that it handles errors (e.g., wrong password) correctly.
DO NOT touch any other features yet.
```

**📝 Testing Prompt (if Claude didn't run tests itself):**

```text
Create and run a test script to verify the feature we just built. Ensure it handles the edge cases we discussed.
```

> **Rule:** If an error occurs, fix it immediately. Don't accumulate technical debt.

---

## 🧠 Stage 4: Context Hygiene (50% Rule)

**Principle:** AI starts to "dumb down" and forget instructions when the context window gets overloaded. You must act preventively.

**Action:** Regularly (every 3-5 requests) check token usage.

**Command:**

```text
/context
```

**Red zone:** As soon as context usage reaches **40-50%** (approximately 80k-100k tokens), code quality drops sharply.

**Reset Procedure (The Reset Protocol):**

1. **Saving knowledge:** Ask Claude to create a memo file for the "next version of itself." **Prompt:**
    
    ```text
    We are resetting the session. Create a file named 'CONTEXT_HANDOVER.md'. Summarize:1. Current project status.2. What was just built and verified.3. What is the immediate next step from implementation_plan.md.4. Important technical decisions made so far.
    ```
    
2. **Reset:** Close the terminal or enter the exit command.
3. **New session:** Open the terminal again.
4. **Recovery:** **Prompt:**
    
    ```text
    Read 'CONTEXT_HANDOVER.md' and 'implementation_plan.md'. We are resuming development. I am ready to start the next feature.
    ```
    

---

## ✅ Developer Checklist (Summary Checklist)

Print out or keep in front of you:

1. [ ] **Start:** Did I use `AskUserQuestionTool` to have the AI "interrogate" me before starting?
2. [ ] **Plan:** Do I have a file with a step-by-step plan (roadmap)?
3. [ ] **Focus:** Am I currently implementing only one isolated feature?
4. [ ] **Context:** Did I check `/context`? If >45%, it's time to restart.
5. [ ] **Handover:** Before restart, did I create a `CONTEXT_HANDOVER.md` file?

### Why does this work?

- **Interview** eliminates AI guesswork.
- **Modularity** simplifies debugging.
- **Context reset** ensures that the AI always operates at peak cognitive capacity, rather than in a state of "digital fatigue."