Vibe Coding: Agentic System Prompt Analysis 🌟

June 4, 2025 (3d ago)

this article is Arno's learn from https://github.com/SurfaceW/system-prompts-and-models-of-ai-tools Arno wrote its research notes and Gemini and Jules helped to write this article. Enjoy for the BP of writing system prompt for AI vibe-coding assistants.

Crafting Effective System Prompts for Agentic AI Coding Assistants: A Best Practices Guide

1. Introduction

AI-assisted coding tools, often dubbed "vibe-coding" systems or agentic AI, are transforming software development. These systems, powered by Large Language Models (LLMs) and sophisticated tooling, can understand user intent, generate code, automate complex tasks, and even engage in iterative problem-solving. At the heart of such a system lies the system prompt: a carefully crafted set of instructions, context, and guidelines that defines the AI's persona, capabilities, operational procedures, and interaction model.

This guide synthesizes insights and best practices from various AI system designs (including concepts observed in systems like VS Code Copilot, Manus, v0, Replit, and Lovable, as documented in research.learn.md) to provide a comprehensive overview of how to design effective system prompts for agentic AI coding assistants. A well-architected system prompt is paramount for creating AI agents that are reliable, predictable, safe, and genuinely helpful in the software development lifecycle.

This article will cover core design principles, key dimensions a robust prompt should address, specific patterns for enabling agentic behavior, best practices in prompt engineering for coding tasks, and learnings from existing systems, providing a holistic view for developers and prompt engineers.

2. Core Principles of System Prompt Design

Before diving into specific components, it's essential to understand the foundational principles that underpin effective system prompt engineering:

  • Clarity and Precision: Instructions must be unambiguous and explicit. The AI should not have to guess the intended meaning. Use clear language, define terms where necessary, and avoid jargon or overly complex sentence structures.
  • Comprehensiveness: The prompt should cover all critical aspects of the AI's desired behavior, from its identity and core goals to detailed error handling protocols and output constraints. Leaving gaps can lead to unpredictable or undesirable outcomes.
  • Consistency: Instructions within the prompt must be internally consistent. Contradictory rules or guidelines will confuse the AI, degrade performance, and erode reliability.
  • Modularity: Organizing the prompt into logical, well-defined sections or modules (e.g., using XML tags as seen in VS Code Copilot, or distinct Markdown headings as in v0's prompt) makes it easier to manage, update, and reason about. This is crucial as prompt complexity grows.
  • Iterative Refinement: System prompt design is rarely a one-shot process. It requires continuous testing, critical observation of the AI's behavior in diverse scenarios, and refinement based on those observations to achieve the desired level of performance and reliability.

3. Key Dimensions of a Robust System Prompt

A comprehensive system prompt addresses multiple facets of the AI's operation. The following 13 dimensions, derived from analyzing various AI system prompts, provide a framework for designing such prompts:

3.1. Identity and Persona

  • What it is: Defines the AI's character, role, name, and overall mission (e.g., "You are an AI programming assistant named GitHub Copilot"). It also includes aspects of its desired communication style or tone.
  • Importance: Sets user expectations, makes interactions more consistent and natural, and guides the AI in its tone and how it frames its responses.
  • Example: VS Code Copilot's <identity> block establishes its name ("GitHub Copilot") and purpose. Manus's <intro> describes its areas of expertise, shaping its persona as a multi-talented agent.

3.2. Core Instructions & Goals

  • What it is: High-level directives and primary objectives the AI must follow. These are the fundamental principles guiding all actions.
  • Importance: Keeps the AI focused on its main tasks and aligned with the user's overarching requirements.
  • Example: VS Code Copilot: <identity>...Follow the user's requirements carefully & to the letter.</identity>. The implicit goal in most coding assistants is to produce correct, efficient, and maintainable code or solutions.

3.3. Capabilities & Boundaries

  • What it is: Explicit statements of what the AI system can and cannot do. This includes the scope of its functionalities (e.g., languages supported, types of tasks) and any known limitations.
  • Importance: Manages user expectations, prevents misuse, and helps the AI decline out-of-scope requests appropriately.
  • Example: v0's "Capabilities" section details its UI interactions, code execution abilities, and deployment options. Manus's <system_capability> lists its access to a Linux sandbox, shell, text editor, browser, and its ability to write and run code in various languages.

3.4. Tool Definition and Usage Protocols

  • What it is: Detailed descriptions of available tools, functions, or APIs the AI can use. This includes their names, specific functionalities, parameters (with types and descriptions), expected input/output formats, and precise instructions on when and how to use them.
  • Importance: Enables reliable interaction with external systems and the execution of specific, non-trivial actions. Clear usage protocols prevent errors and ensure tools are used effectively and safely.
  • Example: VS Code Copilot's <functions> block provides JSON schemas for tools like create_new_workspace, and its <tool_format> specifies how to structure tool calls. Lovable lists specific commands like <lov-write> and <lov-rename>.

3.5. Agentic Flow & Process Management

  • What it is: Defines how the AI system manages tasks iteratively, processes events, plans sequences of actions, and maintains state across multiple steps. (This is covered in more detail in Section 4).
  • Importance: Allows the AI to handle complex, multi-step tasks autonomously, adapt to changing information, and work systematically towards a goal.
  • Example: Manus's <agent_loop>, <event_stream>, and <planner_module> provide a detailed framework for its agentic behavior. Replit's organizational keywords like <Iteration Process> also point to this dimension.

3.6. Context Provisioning & Management

  • What it is: Instructions on how the AI receives, interprets, and utilizes contextual information. This can include static context (like current date, OS version) and dynamic context (like workspace structure, open files, project dependencies, linter errors, conversation history).
  • Importance: Context is vital for the AI to generate relevant, accurate, and useful responses. Effective context management ensures the AI is "aware" of the current working environment and user needs.
  • Example: VS Code Copilot's <context> section includes date, OS, and workspace information. same.dev is described as providing project state like version numbers and linter errors. Manus's <event_stream> is a key mechanism for feeding dynamic context.

3.7. Output Formatting & Constraints

  • What it is: Specifies requirements for the AI's output, including language style (e.g., formal, informal), tone (e.g., impersonal, empathetic), length, use of specific formats (e.g., Markdown, JSON, XML), and things to avoid (e.g., excessive apologies, unrequested lists).
  • Importance: Ensures that the AI's responses are presented in a manner that is useful, consistent, and appropriate for the user or downstream automated processes.
  • Example: VS Code Copilot: "Keep your answers short and impersonal." v0 utilizes MDX for dynamic rendering of responses. Manus specifies in <language_settings> to "Avoid using pure lists and bullet points format" and in <writing_rules> to "Write content in continuous paragraphs."

3.8. Error Handling & Refusal Protocols

  • What it is: Defines how the AI should react to internal errors (e.g., tool execution failures, unexpected API responses) or to user requests that it cannot or should not fulfill (e.g., requests for harmful content, tasks outside its capabilities).
  • Importance: Robust error handling and clear refusal protocols are essential for creating a safe, reliable, and user-friendly AI. They prevent unexpected behavior and manage inappropriate interactions gracefully.
  • Example: v0's "Refusals" section specifies a REFUSAL_MESSAGE and dictates that the AI "MUST NOT apologize or provide an explanation." Manus's <error_handling> section details steps like verifying tool names and arguments upon failure.

3.9. Policies & Operational Guidelines

  • What it is: Broader rules governing the AI's behavior. This includes adherence to external content policies (e.g., Microsoft's), security best practices (e.g., OWASP), data privacy considerations, copyright respect, and specific operational procedures for various tasks like file management, coding standards, or deployment processes.
  • Importance: These guidelines ensure the AI operates responsibly, securely, and in accordance with established standards, ethical considerations, or legal requirements.
  • Example: VS Code Copilot is instructed to "Follow Microsoft content policies. Avoid content that violates copyrights." Manus has extensive _rules sections such as <coding_rules>, <file_rules>, and <shell_rules>.

3.10. Knowledge Injection & Preferences

  • What it is: Providing the AI with specific domain knowledge, technical information (e.g., API documentation snippets), or preferences for certain technologies, libraries (e.g., shadcn/ui), architectural patterns, or coding styles that it should use or be aware of.
  • Importance: Injecting specific knowledge allows the AI to perform better in specialized domains, adhere to particular project requirements, or align with team-specific best practices.
  • Example: v0 is instructed to "use domain knowledge section for domain-specific knowledge, all domain knowledge used by v0 MUST be cited." Manus's <knowledge_module> and <datasource_module> are designed to provide task-relevant knowledge and access authoritative data.

3.11. Interaction Style & Proactiveness

  • What it is: Instructions on how the AI should engage with the user. This includes its level of proactiveness (e.g., suggesting follow-up actions, offering unsolicited help), how it should ask clarifying questions, and the general conversational flow it should maintain.
  • Importance: Guiding the interaction style helps create a more helpful, intuitive, and collaborative user experience, making the AI feel more like an intelligent partner.
  • Example: v0's prompt describes a system for "Suggested Actions" using <Actions> and <Action> components. Manus's <message_rules> detail communication protocols, such as distinguishing between notify (non-blocking) and ask (blocking) message types.

3.12. Emphasis & Attention Directives

  • What it is: Using special keywords (e.g., IMPORTANT:, NOTICE:, NEVER, Always, MUST), formatting conventions (e.g., bolding, all caps), or dedicated sections (like <reminder> in VS Code Copilot) to highlight critical instructions that the AI must pay strict attention to and not overlook.
  • Importance: These directives help ensure that the most crucial constraints, safety protocols, or core instructions are not missed by the AI, leading to more reliable and consistent behavior.
  • Example: The research.learn.md document notes "basic prompting phrases" like IMPORTANT: and NEVER, and also mentions that MUST or !IMPORTANT should be used sparingly for critical information.

3.13. Debugging & Logging

  • What it is: This dimension includes instructions for the AI on how to provide debugging information, log its actions or internal states, or output information that can help developers understand its decision-making process and troubleshoot issues.
  • Importance: While often more for the developers and maintainers of the AI system, clear logging and debugging outputs are crucial for identifying problems, improving the AI, and ensuring it behaves as expected.
  • Example: lovable's best practices state: "Write extensive console logs for debugging." The Lovable prompt also includes a <console-logs> tag for "debugging information."

4. Designing for Agentic Flow

Agentic AI excels at tasks requiring multi-step execution, planning, and adaptation. System prompts are instrumental in defining these dynamic operational flows:

  • Agentic Loops: The core of agentic behavior is an iterative processing loop. This loop allows the AI to perform a sequence of actions, assess outcomes, and decide on next steps.
    • Pattern: A common sequence within such a loop is: Input/Analyze Events -> Select Tool(s) -> Execute/Wait for Execution -> Assess Outcome & Update State -> Iterate.
    • Example: Manus's <agent_loop> explicitly defines these steps ("Analyze Events", "Select Tools", "Wait for Execution", "Iterate"), emphasizing patient iteration and tool selection based on current state and planning.
  • Event-Driven Processing: Agent actions are often reactions to a chronological stream of events. These events can be user messages, outputs from tools (observations), updates from a planning module, or other system notifications.
    • Example: Manus's <event_stream> details the types of events (Message, Action, Observation, Plan, etc.) that drive its decision-making. This architecture allows the agent to be responsive and adapt its behavior to new information dynamically.
  • Task Management and Planning: For complex tasks, merely iterating is insufficient. Effective agents often separate high-level planning from low-level execution.
    • Separation of Planning and Execution: A dedicated <planner_module> (as described for Manus) can create an overall task plan, often represented as a sequence of steps or pseudocode. This plan is then fed into the agent's execution loop. The planner can dynamically update the plan based on new events or observations, providing crucial flexibility.
    • Dynamic Checklists: To manage detailed steps within a larger plan, systems can use dynamic checklists. Manus's <todo_rules> describe using a todo.md file, which is updated via a text replacement tool, to ensure all sub-tasks are addressed systematically.
    • Thinking Tags: Before undertaking complex generation or actions, a system might employ <Thinking> tags (as seen in v0's process). This allows the AI to outline requirements, consider structure, and identify potential caveatsβ€”a form of inline, localized planning.
  • Policy Integration in Flow: Operational rules (for communication, error handling, tool usage, etc.) should not be static declarations but actively consulted and applied by the AI during each step of its agentic loop. Manus's numerous _rules sections (e.g., <message_rules>, <error_handling>, <shell_rules>) exemplify this tight integration of policies into the dynamic flow of operations.
  • Control Tags and Keywords: Systems utilize specific tags and keywords within the prompt to structure and manage the agentic flow. Examples include the explicit tags like <agent_loop>, <event_stream>, <planner_module> in Manus, and more abstract organizational keywords such as <Iteration Process>, <Workflow Guides>, and <Step Execution> noted in the context of Replit.

5. Best Practices in Prompt Engineering for Coding Agents

Beyond the broad dimensions and agentic flow structures, specific techniques in crafting the prompt can significantly enhance its effectiveness for AI coding assistants:

  • Prompting Techniques for Clarity:
    • Structured Input: For models like Claude, XML-like structures (e.g., VS Code Copilot's use of <identity>, <instructions>) can improve parsing and understanding of distinct prompt sections.
    • Emphasis: Judicious use of keywords like IMPORTANT:, NOTICE:, NEVER, MUST, and formatting like bolding can highlight critical instructions. However, overuse can diminish their impact.
    • Keyword Organization: Grouping related instructions under thematic keywords or tags (e.g., Replit's <Communication Policy>) can improve the prompt's readability and logical structure.
  • Linking Prompt Design to UI/UX:
    • Dynamic Rendering: If the UI supports it, instructing the AI to use formats like MDX (Markdown + JSX), as v0 does, allows for richer and more interactive content presentation.
    • Suggestion Systems: Prompts can enable proactivity, like v0's <Actions> component, which instructs the AI to suggest relevant follow-up actions, enhancing usability.
  • Tool Definition and System Integration:
    • Clear Capability Definition: Explicitly list system capabilities in the prompt (e.g., v0's Capabilities section) so the AI understands its own operational boundaries when deciding on tool use.
    • Environment Context: Provide the AI with relevant context about the coding environment (e.g., same.dev providing version numbers, file structures, linter errors) to inform its actions.
    • Data Schemas for Tools: When defining tools, especially those interacting with structured data, use robust serialization methods or schemas (e.g., zod mentioned in the context of same.dev).
    • Stating Technology Preferences: If the agent should prefer certain libraries or frameworks (e.g., shadcn/ui noted for v0 and lovable), this preference should be clearly stated in the prompt.
  • Guiding Development Practices (AI's Output and Process):
    • Code Editing Protocols: Instruct the AI on best practices for modifying existing code. Examples from VS Code Copilot include reading files before editing, using dedicated tools like insert_edit_into_file, keeping edits concise, and validating changes using tools like get_errors.
    • Adherence to General Coding Standards: Encourage the AI to produce code that adheres to established best practices. lovable's prompt includes guidelines for creating small, focused components, using type safety (TypeScript), following project structure, implementing responsive designs, proper error handling, security considerations (OWASP), testing, and documentation.

6. Practical Examples & Learnings from Existing Systems

The principles and dimensions discussed are not merely theoretical; they are actively employed in various AI coding systems:

  • VS Code Copilot: Exemplifies strong use of XML for structuring its core prompt elements like identity, instructions, tool definitions (<functions> with JSON schemas), and operational context (<context>). It also provides clear refusal messages and adheres to defined content policies.
  • Manus: Offers a highly detailed blueprint for complex agentic behavior through its use of <agent_loop>, <event_stream>, <planner_module>, and an extensive array of _rules sections. This showcases deep modularity and the integration of policies directly into the agent's workflow.
  • v0: Highlights best practices such as explicitly defining Capabilities, establishing clear Refusal message protocols, utilizing <Thinking> tags for pre-generation planning, and enabling proactive user interaction via <Actions>. It also demonstrates embedding preferences for specific technologies like MDX and shadcn/ui.
  • Replit: Illustrates an alternative organizational strategy using keywords (<Iteration Process>, <Communication Policy>) to thematically structure different operational aspects within its system prompt.
  • Lovable: Provides detailed best practices for the AI's code generation process (quality, component design, state management) and employs specific XML-like tags for tool interactions (e.g., <lov-write>) and for structuring its own responses (e.g., <lov-code>).

These diverse systems, while varying in their specific implementation details, collectively underscore the significant value derived from creating detailed, structured, and comprehensive system prompts.

7. Conclusion

Crafting effective system prompts is fundamental to unlocking the full potential of agentic AI coding assistants. A well-designed prompt acts as the AI's "constitution" or operational playbook, guiding its behavior, defining its capabilities, and ensuring it operates reliably, predictably, and safely.

Key takeaways for designing high-quality system prompts include:

  • Be Explicit and Unambiguous: Clarity in instructions is paramount.
  • Strive for Comprehensive Coverage: Address all relevant operational dimensions, from identity and goals to error handling and output formatting.
  • Embrace Structured Design: Utilize modularity through tags, sections, or other organizational principles to manage complexity and enhance readability.
  • Define Agentic Flows Meticulously: Clearly articulate how the AI should plan, act, process information, and iterate towards task completion.
  • Integrate Policies and Guidelines: Embed rules for behavior, safety, and ethics directly into the AI's operational framework.
  • Adopt Iterative Refinement: Treat prompt engineering as an ongoing cycle of design, testing, observation, and improvement.

As AI models continue to evolve in power and sophistication, the art and science of system prompt engineering will become increasingly critical. By focusing on these core principles and detailed dimensions, developers can create more capable, trustworthy, and effective AI partners, ready to tackle the multifaceted challenges of modern software engineering. The future of AI-assisted development will be significantly shaped by our ability to communicate effectively and precisely with these emerging agentic systems.

Appendix

Tool list for example

## VS Code / GitHub Copilot
 
*   **`create_new_workspace`** (`VS Code`): Get steps to help the user create any project in a VS Code workspace. Use this tool to help users set up new projects, including TypeScript-based projects, Model Context Protocol (MCP) servers, VS Code extensions, Next.js projects, Vite projects, or any other project.
*   **`insert_edit_into_file`** (`VS Code`): Tool to edit files. Avoids repeating existing code by using comments like `// ...existing code...`.
*   **`get_errors`** (`VS Code`): Called after editing a file to validate the change and fix errors if relevant.
*   **`<invoke name="[tool_name]">`** (`VS Code`): Generic tool invocation format.
    *   `<parameter name="[param_name]">[param_value]`
 
## v0
 
*   **Node.js Executable code block** (`v0`): Allows users to execute JavaScript code.
*   **Inline SQL code block** (`v0`): Allows users to execute SQL queries directly in chat to query and modify databases.
*   **URL processing** (`v0`): Users can provide URL(s) to websites, and the system will automatically send a screenshot.
*   **"add to codebase" button** (`v0`): Installs Code Projects (code written by the AI) and handles setup of required dependencies in an existing project or helps create a new project.
*   **"Deploy" button** (`v0`): Deploys Code Projects to Vercel.
*   **`<Thinking>` tags** (`v0`): Used by the AI to think through project structure, styling, images, media, formatting, frameworks, libraries, and caveats before creating a Code Project.
*   **`<Actions>` component** (`v0`): Used to suggest relevant follow-up actions to the user.
    *   **`<Action name="..." description="..." />`** (`v0`): Defines a suggested action and its description.
 
## same.dev
 
*   **`web_search`** (`same.dev` - example JSON, platform not explicitly stated but context implies general AI tooling): Search the web for real-time text and image responses.
    *   `fetch_content` (parameter): Whether to crawl and include the content of each search result.
    *   `search_term` (parameter): The search term to look up on the web.
    *   `type` (parameter): The type of search to perform (text or images).
 
## Manus
 
The Manus system describes general capabilities and rules which imply the use of several types of tools:
 
*   **Message tools** (`Manus`): For communication with users. Divided into:
    *   `notify`: Non-blocking, no reply needed from users.
    *   `ask`: Blocking, reply required from users.
*   **Shell tools** (`Manus`): Access to a Linux sandbox environment. Includes ability to:
    *   Install required software packages and dependencies.
    *   Use flags like `-y` or `-f` for automatic confirmation.
    *   Chain commands with `&&`.
    *   Use pipe operator `|`.
    *   **`bc` command** (`Manus`): For simple non-interactive calculations.
    *   **`uptime` command** (`Manus`): For sandbox status check.
*   **Text editor tools** (`Manus`): For file manipulation.
*   **Browser tools** (`Manus`): To access and comprehend URLs, explore links, and extract page content.
*   **Python execution** (`Manus`): To write and run Python code, especially for complex mathematical calculations, analysis, and calling Data APIs.
*   **Deployment tools** (`Manus`): To deploy websites or applications.
    *   **Expose port tool** (`Manus`): For temporary external access to services.
*   **File tools** (`Manus`): For reading, writing, appending, and editing files.
    *   **Text replacement tool** (`Manus`): Implied by `todo_rules` for updating markers in `todo.md`.
    *   **Append mode of file writing tool** (`Manus`): For merging text files.
*   **Search tools** (`Manus`): Preferred over browser access to search engine result pages for information gathering.
*   **Data API interaction** (`Manus`): Called through Python code to access authoritative datasources. (Note: Data APIs themselves are not "tools" in this context but are accessed via Python code).
 
## Lovable
 
*   **File Operations:**
    *   **`<lov-write>`** (`Lovable`): For creating or updating files. Must include complete file contents.
    *   **`<lov-rename>`** (`Lovable`): For renaming files from original path to new path.
    *   **`<lov-delete>`** (`Lovable`): For removing files from the project.
    *   **`<lov-add-dependency>`** (`Lovable`): For installing new packages or updating existing ones.
*   **Code Block Structure:**
    *   **`<lov-code>`** (`Lovable`): To wrap all code changes and technical details.
    *   **`<lov-thinking>`** (`Lovable`): To show your thought process (optional).
    *   **`<lov-error>`** (`Lovable`): To display error messages when they occur.
    *   **`<lov-success>`** (`Lovable`): To confirm successful operations.
*   **Response Format Tags (Informational):**
    *   `<response_format>` (`Lovable`)
    *   `<user_message>` (`Lovable`)
    *   `<ai_message>` (`Lovable`)
    *   `<examples>` (`Lovable`)
    *   `<guidelines>` (`Lovable`)
    *   `<console-logs>` (`Lovable`)
    *   `<useful-context>` (`Lovable`)
    *   `<current-route>` (`Lovable`)
    *   `<instructions-reminder>` (`Lovable`)
    *   `<last-diff>` (`Lovable`)
*   **Shell Commands (Example Setup Guide):**
    *   **`git clone <YOUR_GIT_URL>`** (`Lovable`): Clones a repository.
    *   **`cd <YOUR_PROJECT_NAME>`** (`Lovable`): Navigates to a project directory.
    *   **`npm i`** (`Lovable`): Installs necessary dependencies.
    *   **`npm run dev`** (`Lovable`): Starts the development server.
 
## General / Unspecified Platform
 
*   **`<Thinking> tags`** (General, mentioned for `v0` but a general concept): To outline project requirements, user stories, and acceptance criteria before implementation.
*   **Text replacement tool** (General, implied by Manus `todo_rules`): For updating markers in todo.md or similar checklist files.
*   **File tools for reading, writing, appending, editing** (General, implied by Manus `file_rules`): Basic file operations.
*   **Search tools** (General, implied by Manus `info_rules` and `coding_rules`): For finding solutions or information.
*   **Deployment tools** (General, implied by Manus `coding_rules` and `deploy_rules`): For packaging and deploying applications.
*   **Expose port tool** (General, implied by Manus `deploy_rules`): For making services temporarily accessible.

Arno Crafting Apps

ELABORATION STUDIO πŸ¦„

Elaborate your ideas and solve your problems with AI in fully boosted context way ~