> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zerotwo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Instructions and Patterns

> Create reusable prompt patterns and persistent preferences to improve your ZeroTwo workflow

Custom instructions allow you to set persistent preferences and behaviors that automatically apply to all your conversations in ZeroTwo. Instead of repeating the same context or requirements in every chat, you can define them once and have them consistently applied.

## What are custom instructions?

Custom instructions are persistent prompts that augment every conversation you have with AI models in ZeroTwo. They're added to the system prompt automatically, ensuring your preferences, context, and requirements are always considered.

<Info>
  Think of custom instructions as your personal preferences file that travels with every conversation—like having a configuration file for how the AI should interact with you.
</Info>

## Setting custom instructions

Custom instructions are configured in your ZeroTwo settings and apply across all your conversations unless overridden by specific [assistants](/assistants/overview).

<Steps>
  <Step title="Access settings">
    Navigate to your ZeroTwo settings panel or use the keyboard shortcut to access preferences.
  </Step>

  <Step title="Locate custom instructions">
    Find the custom instructions section where you can define your persistent preferences.
  </Step>

  <Step title="Write your instructions">
    Add instructions that should apply to all your conversations. Be specific and clear.
  </Step>

  <Step title="Save and test">
    Save your instructions and start a new conversation to see them in effect.
  </Step>
</Steps>

<Tip>
  Custom instructions work best when they're specific enough to be useful but general enough to apply across different conversation types.
</Tip>

## Effective custom instruction patterns

### Context about you

Help the AI understand your background and expertise level:

```text theme={null}
About me:
- I'm a senior full-stack developer with 8 years of experience
- I work primarily with React, TypeScript, Node.js, and PostgreSQL
- I'm currently building a SaaS application for project management
- I prefer functional programming patterns and immutable data structures
- I use Visual Studio Code on macOS
```

### Response preferences

Define how you want responses structured:

```text theme={null}
Response preferences:
- Provide TypeScript code by default unless I specify otherwise
- Always include error handling in code examples
- Explain your reasoning briefly before providing solutions
- Use modern ES6+ syntax and avoid deprecated patterns
- Keep explanations concise but comprehensive
- Include inline comments for complex logic
```

### Code style preferences

Specify your coding conventions:

```text theme={null}
Code style preferences:
- Use functional components and hooks (no class components)
- Prefer named exports over default exports
- Use async/await instead of .then() chains
- Follow Airbnb style guide for JavaScript/React
- Use Tailwind CSS for styling
- Write JSDoc comments for all functions
- Prefer const over let, never use var
```

### Framework and tool preferences

Indicate your technology stack:

```text theme={null}
Technology stack:
- Frontend: Next.js 14 with App Router, React 18, TypeScript
- Backend: Node.js with Express, Prisma ORM
- Database: PostgreSQL 15
- Authentication: NextAuth.js
- Styling: Tailwind CSS with shadcn/ui components
- Testing: Jest, React Testing Library, Playwright
- Deployment: Vercel for frontend, AWS for backend
```

### Communication style

Set expectations for tone and detail:

```text theme={null}
Communication preferences:
- Be direct and practical—I prefer actionable advice over theory
- Challenge my assumptions when they might lead to problems
- Suggest better alternatives when you see potential issues
- Point out security vulnerabilities and performance concerns
- Assume I understand basic programming concepts
- Explain advanced concepts with code examples
```

## Pattern categories

### Developer-specific patterns

<AccordionGroup>
  <Accordion title="Junior developer pattern">
    ```text theme={null}
    I'm a junior developer learning web development. I'm comfortable with HTML, CSS, and basic JavaScript, but still learning React and backend concepts.

    Please:
    - Explain concepts clearly with examples
    - Point out common mistakes and best practices
    - Suggest resources for deeper learning
    - Include detailed comments in code
    - Break complex tasks into smaller steps
    ```
  </Accordion>

  <Accordion title="Senior engineer pattern">
    ```text theme={null}
    I'm a senior engineer focused on architecture, performance, and scalability.

    Please:
    - Focus on design patterns and architectural decisions
    - Highlight performance implications
    - Consider scalability and maintainability
    - Point out edge cases and potential issues
    - Suggest testing strategies
    - Keep explanations concise—I can look up details
    ```
  </Accordion>

  <Accordion title="Full-stack pattern">
    ```text theme={null}
    I'm a full-stack developer working on end-to-end features.

    Tech stack: React/Next.js, Node.js/Express, PostgreSQL, Redis
    Current project: B2B SaaS platform with 10K users

    Please:
    - Consider both frontend and backend implications
    - Suggest API design patterns
    - Include database schema considerations
    - Think about authentication and authorization
    - Consider caching strategies when relevant
    ```
  </Accordion>
</AccordionGroup>

### Domain-specific patterns

<Tabs>
  <Tab title="Data Science">
    ```text theme={null}
    Context:
    - Data scientist working with Python, pandas, scikit-learn, TensorFlow
    - Focused on ML model development and data analysis
    - Working with structured and unstructured data

    Preferences:
    - Provide Python code with type hints
    - Include data validation steps
    - Suggest appropriate algorithms for problems
    - Consider computational efficiency
    - Include visualization code when helpful
    - Use modern pandas patterns (avoid deprecated methods)
    ```
  </Tab>

  <Tab title="DevOps">
    ```text theme={null}
    Context:
    - DevOps engineer managing AWS infrastructure
    - Use Terraform for IaC, Docker for containerization
    - Focus on CI/CD, monitoring, and reliability

    Preferences:
    - Provide infrastructure-as-code examples
    - Consider security best practices
    - Think about monitoring and observability
    - Include error handling and rollback strategies
    - Suggest cost optimization opportunities
    - Use AWS best practices and well-architected framework
    ```
  </Tab>

  <Tab title="Mobile Development">
    ```text theme={null}
    Context:
    - Mobile developer working with React Native
    - Building iOS and Android apps
    - Focus on performance and user experience

    Preferences:
    - Provide React Native code examples
    - Consider platform-specific differences
    - Think about offline functionality
    - Optimize for mobile performance
    - Consider battery and data usage
    - Follow platform design guidelines (iOS HIG, Material Design)
    ```
  </Tab>
</Tabs>

### Project-specific patterns

For ongoing projects, include project context:

```text theme={null}
Current project context:
- Building a real-time collaboration platform (think Figma/Google Docs)
- Handling WebSocket connections for real-time updates
- Managing complex state synchronization
- Supporting 100+ concurrent users per session
- Need to ensure data consistency and conflict resolution

Technical constraints:
- Must work in modern browsers (last 2 versions)
- Target load time under 3 seconds
- Support offline mode with sync on reconnect
- GDPR compliant (data stored in EU)

When providing solutions:
- Consider real-time performance implications
- Think about conflict resolution strategies
- Ensure scalability for concurrent users
- Prioritize user experience and responsiveness
```

### Workflow-specific patterns

Optimize for your typical workflow:

```text theme={null}
Typical workflow preferences:
- I'm usually iterating on existing code, not starting from scratch
- I value refactoring suggestions and code improvements
- I want to understand trade-offs between approaches
- I need to balance feature velocity with code quality
- I work in a team—suggest maintainable, readable solutions

Code review mindset:
- Point out potential bugs or edge cases
- Suggest more idiomatic approaches
- Highlight performance concerns
- Note security vulnerabilities
- Recommend better naming or structure
```

## Advanced instruction patterns

### Conditional instructions

Provide guidance for different scenarios:

```text theme={null}
Default behavior:
- Provide TypeScript code with full type safety
- Include error handling
- Follow functional programming patterns

When I ask for "quick prototype" or "MVP":
- Prioritize speed over perfection
- Use simpler implementations
- Skip comprehensive error handling
- Focus on core functionality

When I ask for "production code":
- Include comprehensive error handling
- Add logging and monitoring
- Write unit tests
- Consider edge cases thoroughly
- Include JSDoc documentation
```

### Question-based instructions

Guide the AI to ask clarifying questions:

```text theme={null}
Before providing solutions:
1. If the requirements are ambiguous, ask clarifying questions
2. If multiple approaches exist, briefly outline options before implementing
3. If I haven't specified constraints, ask about performance, scalability, or security requirements
4. If the problem might have edge cases, ask about expected behavior

This helps ensure we're aligned before you invest time in a detailed solution.
```

### Meta-instructions

Provide instructions about how to interpret your prompts:

```text theme={null}
Interpreting my requests:
- When I say "fix this," look for bugs, type errors, and logical issues
- When I say "improve this," consider readability, performance, and maintainability
- When I say "make it production-ready," add error handling, logging, tests, and documentation
- When I paste code without context, assume I want a review or improvements
- When I describe a feature, I usually want a complete implementation including types, error handling, and tests
```

## Combining custom instructions with assistants

Custom instructions serve as your base preferences, while [assistants](/assistants/overview) provide specialized behaviors for specific tasks.

<Info>
  **Hierarchy of instructions:**

  1. Base system prompt (set by ZeroTwo)
  2. Your custom instructions (apply to all conversations)
  3. Assistant-specific instructions (override for specific assistants)
  4. Your current message (immediate request)
</Info>

Example workflow:

```text theme={null}
Custom Instructions (Global):
- Senior developer
- Prefer TypeScript
- Use functional patterns
- Include error handling

Code Review Assistant (Specialized):
- Focus on finding bugs and improvements
- Provide specific, actionable feedback
- Rate issues by severity
- Suggest refactoring opportunities

Documentation Assistant (Specialized):
- Write clear, beginner-friendly explanations
- Include code examples
- Use proper markdown formatting
- Follow documentation best practices
```

## Testing and refining instructions

<Steps>
  <Step title="Start simple">
    Begin with basic preferences and add complexity as needed. Don't over-specify initially.
  </Step>

  <Step title="Test across use cases">
    Try your instructions with different types of requests to ensure they work broadly.
  </Step>

  <Step title="Iterate based on results">
    Refine instructions when you notice the AI isn't meeting your expectations.
  </Step>

  <Step title="Remove redundancy">
    If you find yourself repeating certain requests despite custom instructions, adjust the instructions to be clearer.
  </Step>
</Steps>

<Warning>
  **Common pitfalls:**

  * Too many instructions can dilute their effectiveness
  * Conflicting instructions may cause confusion
  * Overly specific instructions may not generalize well
  * Very long instructions consume significant tokens
</Warning>

## Token considerations

Custom instructions are included in every conversation, consuming tokens from your context window.

<Tip>
  **Optimize token usage:**

  * Keep instructions concise but clear
  * Focus on high-impact preferences
  * Remove instructions that don't significantly improve responses
  * See [tokens and limits](/prompts/tokens-and-limits) for more optimization strategies
</Tip>

## Example complete instruction sets

### Full-stack developer example

```text theme={null}
Background:
- Full-stack developer, 5 years experience
- Current stack: Next.js, TypeScript, Node.js, PostgreSQL
- Building B2B SaaS products

Code preferences:
- TypeScript with strict mode
- Functional React components with hooks
- Async/await for asynchronous operations
- Tailwind CSS for styling
- Prisma for database access

Quality standards:
- Always include error handling
- Write self-documenting code with clear naming
- Add TypeScript types for all functions
- Include JSDoc for complex logic
- Consider security and performance

Response style:
- Provide complete, runnable code examples
- Explain architectural decisions briefly
- Suggest improvements when you see issues
- Point out potential bugs or edge cases
```

### Data analyst example

```text theme={null}
Background:
- Data analyst working with Python and SQL
- Focus on business intelligence and reporting
- Non-technical stakeholders

Tech stack:
- Python with pandas, matplotlib, seaborn
- SQL (PostgreSQL and BigQuery)
- Jupyter notebooks for analysis

Preferences:
- Provide well-commented Python code
- Include data validation steps
- Suggest appropriate visualizations
- Write SQL queries that are readable and maintainable
- Explain statistical concepts clearly

Deliverable style:
- Format outputs for executive presentations
- Include insights and recommendations, not just data
- Create visualizations that tell a story
- Consider business context in analysis
```

## Sharing instruction patterns

<Tip>
  Effective instruction patterns can be shared with your team for consistency:

  1. **Team guidelines**: Establish team-wide instruction patterns
  2. **Project templates**: Create project-specific instruction templates
  3. **Onboarding**: Share instruction patterns with new team members
  4. **Best practices**: Document effective patterns that work well
</Tip>

## Next steps

<CardGroup cols={2}>
  <Card title="Create assistants" icon="robot" href="/assistants/create">
    Build specialized assistants with custom instructions
  </Card>

  <Card title="Assistant examples" icon="lightbulb" href="/assistants/examples">
    See pre-built instruction patterns
  </Card>

  <Card title="Token limits" icon="gauge" href="/prompts/tokens-and-limits">
    Optimize instruction token usage
  </Card>

  <Card title="Few-shot prompting" icon="graduation-cap" href="/prompts/few-shot-and-demos">
    Enhance instructions with examples
  </Card>
</CardGroup>
