System Prompt Settings
Overview
This chapter is a collection of know-how for creating clear and reliable "system prompts" for agents used in daily operations.
First, we will explain mainly short templates and checklists so that you understand "what to write".
- You will be able to prepare instructions (prompts) that match the purpose in a short time.
- You will be able to reduce output variability and obtain stable responses.
- You will be able to run the improvement cycle (test → evaluate → improve) during operation.
Recommended Writing Method
First, please use the minimum template below.
Once you become familiar with it, gradually add constraints and examples.
Summary Template
You are the [Role].
Purpose: {Write the result in one sentence here}
Output format: {Example: Markdown heading + bullet points/JSON with keys:..., ...}
Constraints: {Example: Convert technical terms to simple Japanese. Within 400 characters. }
Input Example: {Write a simple sample}
Example:
You are a professional editor.
Objective: Summarize the given text in 300 characters or less.
Output Format: One paragraph in Markdown (no headings).
Constraints: Use proper nouns as they are, and replace technical terms with simpler language.
Input Example: {Body Text}
Points to Consider When Creating
- First, write the "role" and "objective" in one line. This alone will greatly improve the stability of the behavior.
- Specify the output format (e.g., "JSON with keys: title, summary"). Clearly stating the structure makes post-processing easier.
- Refer to long constraints in an external document (keep the main text short).
- Always test with about 10 actual data entries before deploying.
Checklist
- The objective is clear in one sentence.
- The output format is specifically defined (e.g., JSON schema).
- Test data (normal and exceptional cases) is provided.
- There is a mechanism to save execution logs (input + output).
- Version names are assigned to the prompts for management.
Simple Evaluation Method
- Format Check: Automatically determine if the output is in the specified format (JSON, etc.).
- Sample Check: A human judges "satisfied/unsatisfied" for 10 representative cases and calculates the satisfaction rate.
- Cost Confirmation: Record the tokens consumed during testing and compare them with the expected cost.
Example Target: 100% format pass rate, satisfaction rate ≥ 80%.
Common Pitfalls
- Ambiguous Instructions: Adding concrete examples (input and expected output) improves this.
- Making it too long by trying to "write everything": Keep the main body short and externalize the details.
- Do not directly include sensitive information: Mask it if necessary.
- Behavior changes with model updates: Perform periodic re-evaluation.
Example of a System Prompt
Classification (Inquiry)
You are a customer support classifier.
Objective: Classify inquiries into "Urgent/Normal/Low Priority".
Output Format: JSON {"category":"Urgent|Normal|Low"}
Constraint: Provide a one-sentence explanation for the classification.
Structured Extraction (Name Matching)
You are a data extraction engine.
Objective: Extract names and email addresses from the email body.
Output Format: JSON array [{"name":..., "email":...}]
Tips for Practical Operation
- Make small changes: Don't change too much at once; improve one point at a time and evaluate repeatedly.
- Accumulate error patterns: Add common failure examples to the template.
- Prepare a fallback: Create a mechanism to retry with a different prompt if unexpected output is received.
- Always maintain version control and document the reasons for changes.