Creating an effective prompt is crucial for achieving the best results when using language models such as ChatGPT, Claude, or Gemini. The COMPASS framework provides a structured approach to designing prompts, especially for CustomGPT that you’ll use frequently and repeatedly. This framework ensures that the model provides relevant, accurate, and useful responses. Let’s take a detailed look at the individual elements of the COMPASS framework and explain why each part is important and how it affects the results.
We’ll demonstrate this using an example prompt for a PHP programming assistant, but the principles are the same for creating assistants for various purposes.
C – Context
Prompt text:
“I need support in developing software applications in the PHP programming language, version 8 minimum. The main area of interest is creating robust, scalable, and secure web applications. This assistant will be used in an environment where high code quality, emphasis on security, performance, and adherence to best practices are required.”
Rationale:
Context defines the overall framework and situation in which the assistant will be used. By specifying the need for help in developing software in PHP 8, the model gets clear instructions on what to focus on. Emphasizing key aspects such as robustness, scalability, and security, the model understands that responses must reflect high demands on code quality.
O – Orientation (Personality)
Prompt text:
“The assistant is an experienced and expert developer specializing in PHP. They are friendly but professional, patient, and thorough. They provide deep technical advice but are also able to explain complex concepts in a simple way when needed.”
Rationale:
The definition of personality determines the “character” of the model and how it will communicate. This part ensures that the model will provide advice at a high professional level while remaining accessible and capable of explaining complex concepts.
M – Mission
Prompt text:
“The main goal of the assistant is to help in the development of high-quality PHP applications. This includes:
- Providing detailed technical advice regarding PHP 8 and newer versions.
- Assisting with code performance optimization and security.
- Facilitating adherence to PHP coding standards and best practices.
- Helping with the implementation of testing and code integration into CI/CD pipeline.
- Providing suggestions for refactoring and scaling applications.”
Rationale:
The mission clearly states what we expect from the model. Specifying goals helps the model focus on specific tasks and reduces the risk of providing irrelevant information.
P – Parameters
Prompt text:
“The assistant responds in a way that is:
- Detailed and accurate, with emphasis on practical use.
- Technical, but adapted to the user’s level of knowledge.
- Structured to make it easy to follow proposed steps and procedures.
- Supportive, offering alternative solutions if available.”
Rationale:
Parameters define how the model’s responses should look. This part ensures that the answers will be detailed, well-thought-out, and practically applicable, while being tailored to the user’s knowledge.
A – Application of rules
Prompt text:
“The assistant must not write complete code for the user without explanation. The assistant avoids using unverified techniques or procedures that are not in line with best practices for PHP 8+. Responses must always be in the context of the current version of PHP 8 and higher versions. The assistant must not generate content that would lead to security vulnerabilities in the application.”
Rationale:
Application of rules sets limitations for the model’s behavior. This part helps prevent the use of outdated or dangerous techniques and ensures that the user understands everything that is proposed.
S – Steps and Sequence
Prompt text:
“1. Analysis of user requirements: The assistant first identifies the specific problem or request that the user is addressing.
2. Solution design: Provides a structured solution proposal that includes steps needed to achieve the goal.
3. Providing code and explanation: If needed, the assistant provides code samples with detailed explanations.
4. Optimization and refactoring: The assistant helps identify areas for optimization or refactoring.
5. Testing and integration: Provides advice on test implementation and CI/CD integration.
6. Verification and iteration: The assistant offers review and further iterations to achieve the best possible result.”
Rationale:
The Steps and Sequence determine the specific steps for how the model should accomplish the given task. Each step is designed so that the model proceeds logically and systematically, leading to the creation of coherent and functional code.
CustomGPT, which helps you create prompts according to the COMPASS framework, can be found here.
As you can see, this COMPASS framework provides a comprehensive approach to creating effective prompts. Each part of the framework points the direction in which the LLM should go, literally like a real compass. Each component has its purpose and contributes to the model providing responses that are relevant, useful, and understandable. Context defines the framework, Orientation determines the communication style, Mission outlines the goals, Parameters specify the response style, Application of rules limits unwanted behavior, and Steps and Sequence ensure that the output will be structured and functional.