Senior Developer Code Review
Senior-engineer code review — bugs, performance, security, readability, and best practices, plus an improved version.


This guide outlines a hierarchical framework for advanced reasoning, assigning specific thought processes to different corporate roles. By structuring prompts this way, we can standardize decision-making, planning, and execution across an organization.
**Scenario:** An internal memorandum approving the "Advanced Deliberation Framework" (ADF) based on prompt engineering to standardize the decision-making and intellectual planning process within the company.
| Role | System Thought Process / Instruction (Directive) |
| :--- | :--- |
| **Company Director** | **ADF: Strategic Reflection & Tree of Thoughts (ToT / Reflexion)**.<br> **Directive:** As a senior executive, you must employ multi-step reasoning that requires exploration and strategic foresight. **Generate a Tree of Thoughts**. **First, formulate three (3) distinct intermediate "Thoughts"** that serve as sequential steps toward solving the strategic problem. **Evaluate** each branch of progress (e.g., "feasible," "possible," "unlikely"). After reaching a final conclusion, **perform self-reflection (Reflexion)**: analyze why previous hypotheses failed and generate **verbal feedback** to ensure **self-improvement** for future strategic tasks. |
| **Department Manager** | **ADF: Action Planning & Knowledge Access (ReAct / RAG)**.<br> **Directive:** You are responsible for execution and factual accuracy. When given a task, use the **ReAct** framework, which alternates between **reasoning (Thought)** and **action (Action)**. **Thought:** Plan the next step and identify the necessary information. **Action:** Use external tools, such as a search via RAG (Retrieval Augmented Generation), to retrieve relevant supporting documents. **Observation:** Integrate the results from the external search into your thought process to ensure **factual accuracy** and avoid hallucinations. |
| **Specialist/Developer** | **ADF: Step-by-Step Reasoning & Programmatic Execution (CoT / PAL)**.<br> **Directive:** For complex analytical and arithmetic tasks requiring multiple reasoning steps, first generate an internal reasoning trace (Chain-of-Thought). **Begin the thought process with the phrase: "Let's think step by step."** If the task involves precise calculations or dates (as in Date Understanding), **generate a program** (PAL) as an intermediate reasoning step that can be executed to obtain an exact answer before generating the final response in natural language. |
***
### **System Prompt Rules (A Guide for Prompt Engineers)**
Prompt engineering is a discipline focused on designing and optimizing prompts to effectively leverage Large Language Models (LLMs). To create a robust and effective prompt, consider the following system rules and settings:
1. **Set the Model's Behavior:** Use the `system` role to establish the assistant's overall behavior. While optional, it's a helpful feature in chat models like GPT-3.5-Turbo and later to guide the model's persona and task orientation.
2. **Provide Information:** The quality of the output is directly proportional to the amount and clarity of the information, instructions, or questions provided to the model.
3. **Context and Examples (Few-Shot):** To improve result quality, include context, input data, or examples (demonstrations/exemplars). This method is called **Few-Shot Prompting** and enables the model to perform "in-context learning."
4. **Step-by-Step Thinking (CoT):** For complex tasks requiring reasoning (e.g., arithmetic, symbolic), use the **Chain-of-Thought (CoT)** technique by adding intermediate reasoning steps. This can be triggered with a simple phrase like **"Let's think step by step"** (Zero-shot CoT).
5. **Control Randomness (Temperature/Top P):**
* For tasks requiring precise, factual, and deterministic answers (e.g., Q&A), set a low **Temperature** and/or **Top P**.
* For tasks that require diverse or creative results (e.g., poetry generation), increase the **Temperature** and/or **Top P**.
* It is recommended to alter either **Temperature** or **Top P**, but not both simultaneously.
6. **Control Output Length:** Manage the number of generated tokens by adjusting **Max Length**, or use **Stop Sequences** to control the structure and length of the response.
7. **Reduce Repetition:** Use **Frequency Penalty** (penalizes based on how often a token has already appeared) or **Presence Penalty** (applies a one-time penalty to all repeated tokens) to reduce word or phrase repetition. It is recommended to alter either Frequency or Presence Penalty, but not both.
8. **Combat Hallucinations:** To increase factual consistency and reliability, provide the model with "ground truth" context, such as a paragraph from an article or a Wikipedia entry, within the prompt (e.g., via RAG).Senior-engineer code review — bugs, performance, security, readability, and best practices, plus an improved version.
Complete technical blueprint from a senior platform architect — sitemap, user journeys, data schema, API surface, 30+ UI components, tech stack, and performance…
Meet Astra — your AI web consultant. Answer ~20 simple questions about your brand and get a complete website package (brand guide, copy, structure, assets) read…
Your personal AI advisor — answer a few questions about your role and goals, then get 2 obvious + 2 non-obvious AI workflow integrations tailored specifically t…
Convert any design into production-ready frontend code, component architecture, TypeScript, accessibility, dark mode, tests, and docs all in one structured outp…
I spent 60 hours testing these prompts on real projects.
Browse the full PromptiFex library or get the app for prompts on the go.