Skip to content

Prompt Files

youBencha supports loading prompts from external files for better organization, reusability, and version control.

BenefitDescription
OrganizationKeep complex prompts separate from configuration
ReusabilityShare prompts across multiple suites
Version ControlTrack prompt changes with meaningful diffs
Editor SupportUse markdown editors with syntax highlighting
CollaborationNon-developers can edit prompts without touching YAML

Load the agent’s task prompt from a file:

suite.yaml
agent:
type: copilot-cli
config:
prompt_file: ./prompts/add-auth.md
prompts/add-auth.md
# Add JWT Authentication
Implement JWT-based authentication for the API:
1. Add a login endpoint at POST /api/auth/login
2. Generate JWT tokens with 24-hour expiration
3. Add middleware to protect /api/users/* routes
4. Handle token refresh at POST /api/auth/refresh
## Requirements
- Use the jsonwebtoken package
- Store JWT secret in environment variable JWT_SECRET
- Return appropriate HTTP status codes (401, 403)

Load custom instructions for the agentic-judge evaluator:

suite.yaml
evaluators:
- name: agentic-judge
config:
type: copilot-cli
prompt_file: ./prompts/strict-eval.txt
assertions:
security: "Authentication is secure. Score 1 if yes, 0 if no."
prompts/strict-eval.txt
You are a senior security engineer reviewing code changes.
Be strict about security best practices.
Score 0 for any potential security vulnerabilities.

Prompt files can use any text format:

ExtensionUse CaseSyntax Support
.mdComplex prompts with formattingMarkdown headers, lists, code blocks
.txtSimple promptsPlain text
.promptCustom conventionPlain text
prompts/add-auth.md
# Add JWT Authentication
Implement JWT-based authentication for the API.
## Requirements
1. Add a login endpoint at `POST /api/auth/login`
2. Generate JWT tokens with 24-hour expiration
3. Add middleware to protect `/api/users/*` routes
## Technical Details
- Use the `jsonwebtoken` package
- Store JWT secret in `JWT_SECRET` environment variable
- Return 401 for invalid tokens, 403 for insufficient permissions
## Expected Files
- `src/middleware/auth.ts`
- `src/routes/auth.ts`
- `src/types/auth.ts`

Paths are resolved relative to the suite configuration file:

project/
├── suite.yaml
├── prompts/
│ ├── task.md
│ └── eval.txt
└── evaluators/
└── security.yaml
suite.yaml
agent:
config:
prompt_file: ./prompts/task.md # Relative to suite.yaml

You cannot specify both prompt and prompt_file:

# ❌ Invalid - both specified
agent:
config:
prompt: "Inline prompt"
prompt_file: ./prompts/task.md
# ✅ Valid - only prompt_file
agent:
config:
prompt_file: ./prompts/task.md
prompts/
├── add-jwt-auth.md
├── refactor-database.md
└── add-unit-tests.md
prompts/add-tests.md
# Add Unit Tests
## Context
This is a Node.js Express application using Jest for testing.
## Task
Add unit tests for the UserService class.
## Requirements
- Test all public methods
- Mock database calls
- Achieve 80% coverage

Track prompts in git alongside your configuration:

Terminal window
git add prompts/
git commit -m "Add authentication evaluation prompts"
prompts/
├── auth/
│ ├── add-jwt.md
│ └── add-oauth.md
├── testing/
│ ├── add-unit-tests.md
│ └── add-e2e-tests.md
└── refactoring/
└── improve-error-handling.md

The yb validate command checks that prompt files exist:

Terminal window
yb validate -c suite.yaml -v

Output:

✅ Prompt file: ./prompts/task.md (exists)

If a file is missing:

❌ Prompt file: ./prompts/missing.md (not found)
Add tests to the project.

Include relevant background for the AI agent:

prompts/fix-bug.md
# Fix Authentication Bug
## Context
Users report being logged out randomly. Investigation shows:
- JWT tokens expire correctly (24 hours)
- Refresh tokens work when called
- Issue occurs during active sessions
## Root Cause
The `auth.middleware.ts` doesn't handle clock skew between servers.
## Fix Required
Add a 5-minute grace period when validating token expiration.
## Files to Modify
- `src/middleware/auth.ts`
- `src/utils/jwt.ts`

Use markdown structure for readability:

prompts/complex-task.md
# Task: Implement Feature X
## Overview
Brief description of what needs to be done.
## Requirements
- [ ] Requirement 1
- [ ] Requirement 2
- [ ] Requirement 3
## Technical Constraints
- Must use existing patterns
- Performance target: <100ms response time
- Backward compatible with v1 API
## Success Criteria
The implementation is complete when:
1. All tests pass
2. Documentation is updated
3. No new linting errors