Works everywhere: These prompting techniques apply to both CLI and Factory App.
Universal Prompting Principles
These principles work across all models:Be specific about the outcome
Be specific about the outcome
Weak: “Fix the bug in auth”Strong: “Fix the login timeout bug where users get logged out after 5 minutes of inactivity. The session should persist for 24 hours.”
Provide context before instructions
Provide context before instructions
Weak: “Add error handling”Strong: “This API endpoint handles payment processing. It currently crashes silently on network errors. Add error handling that logs the error, returns a user-friendly message, and triggers an alert.”
Include acceptance criteria
Include acceptance criteria
Weak: “Make it faster”Strong: “Optimize the search query. Success criteria: query time under 100ms for 10k records, no change to result accuracy, passes existing tests.”
Specify constraints explicitly
Specify constraints explicitly
Weak: “Refactor this code”Strong: “Refactor this code to use the repository pattern. Constraints: don’t change the public API, maintain backward compatibility, keep the same test coverage.”
Claude Models (Opus, Sonnet, Haiku)
Claude models excel with structured, explicit instructions and respond particularly well to certain formatting patterns.Key Techniques for Claude
1
Use XML tags for structure
Claude responds exceptionally well to XML-style tags for organizing complex prompts:
2
Put examples in dedicated sections
When you want specific output formats, show examples:
3
Use thinking prompts for complex reasoning
For complex decisions, ask Claude to think through options:
Claude Prompt Refiner Skill
Create~/.factory/skills/prompt-refiner-claude/SKILL.md:
GPT Models (GPT-5, GPT-5.1, Codex)
GPT models excel with clear system-level context and benefit from explicit role framing.Key Techniques for GPT
1
Frame the role explicitly
GPT models respond well to clear role definitions:
2
Use numbered steps for procedures
GPT follows numbered instructions reliably:
3
Be explicit about output format
Specify exactly what you want:
GPT Prompt Refiner Skill
Create~/.factory/skills/prompt-refiner-gpt/SKILL.md:
- Check for proper input validation on all endpoints
- Verify secrets are not hardcoded or logged
- Review authentication and authorization logic
- Check for SQL injection and XSS vulnerabilities
- Verify proper error handling that doesn’t leak sensitive info
- Critical: Issues that must be fixed before deployment
- High: Significant risks that should be addressed soon
- Medium: Improvements to consider
- Recommendations: General security enhancements
- File and line number
- Description of the vulnerability
- Recommended fix with code example
Gemini Models
Gemini models handle long context well and work effectively with structured reasoning.Key Techniques for Gemini
1
Leverage long context
Gemini can handle extensive context—don’t be afraid to include more background:
2
Use reasoning levels effectively
Gemini supports Low and High reasoning. Use High for:
- Architecture decisions
- Complex debugging
- Multi-step planning
- Straightforward implementations
- Code generation from specs
- Routine refactoring
Model Selection Strategy
Match the model to the task:| Task Type | Recommended Model | Reasoning Level |
|---|---|---|
| Complex architecture | Opus 4.5 | Medium-High |
| Feature implementation | Sonnet 4.5 or GPT-5.1-Codex | Medium |
| Quick edits, formatting | Haiku 4.5 | Off/Low |
| Code review | GPT-5.1-Codex-Max | High |
| Bulk automation | GLM-4.6 (Droid Core) | None |
| Research/analysis | Gemini 3 Pro | High |
Creating Your Own Prompt Refiner
For team-specific needs, create a custom prompt refiner:Quick Reference Card
Claude (Opus/Sonnet/Haiku)
- ✅ XML tags for structure
- ✅ Context before instructions
- ✅ Examples in dedicated sections
- ✅ “Think through…” for reasoning
GPT (GPT-5/Codex)
- ✅ Role framing (“You are a…”)
- ✅ Numbered step procedures
- ✅ Explicit output format
- ✅ “Step by step” for reasoning
Gemini
- ✅ Extensive context inclusion
- ✅ Low/High reasoning levels
- ✅ Structured output requests
