A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.gitlab.com/development/documentation/topic_types/prompt_example/ below:

Prompt example page type | GitLab Docs

A prompt example provides step-by-step instructions for using GitLab Duo to accomplish a specific development or business task.

A prompt example should answer the questions:

These pages should be precise and easy to scan. They do not replace other documentation types on the site, but instead complement them. They should not be full of links or related conceptual or task information.

Format

Prompt examples should be in this format:

title: Title (active verb + object, like "Refactor legacy code")
---

One-sentence description of when to use this approach.

- Time estimate: X-Y minutes
- Level: Beginner/Intermediate/Advanced
- Prerequisites: What users need before starting

(To populate these items, see the guidance that follows this example.)

## The challenge

1-2 sentence description of the specific problem this solves.

## The approach

Brief description of the overall strategy and which GitLab Duo tools to use (usually 2-4 key phrases).

### Step 1: [Action verb]

[Specify which GitLab Duo tool to use] Brief description of what this step accomplishes.

```plaintext
Prompt template with placeholders in [brackets]
```

Expected outcome: What should happen when this prompt is used.

### Step 2: [Action verb]

[Specify which GitLab Duo tool to use] Brief description of what this step accomplishes.

```plaintext
Next prompt template with placeholders in [brackets]
```

Expected outcome: What should happen when this prompt is used.

## Tips

- Specific actionable advice for better results
- Common pitfalls to avoid
- How to iterate if first attempt doesn't work

## Verify

Ensure that:

- Quality check 1 - specific and measurable
- Quality check 2 - specific and measurable
- Quality check 3 - specific and measurable
Prompt example topic titles

For the title text, use the structure active verb + noun. For example:

Titles to avoid

Avoid these topic titles:

Level guidelines

Use these guidelines to assign difficulty levels:

Prerequisites format

Be specific about which GitLab Duo tools are needed. Common prerequisites include:

Time estimates

Provide realistic time ranges based on complexity:

Expected outcomes format

Expected outcomes should be specific and measurable. For example:

Prompt template guidelines Placeholder format

Always use [descriptive_name] format for placeholders. Make placeholders specific:

Template structure

Structure prompts with:

  1. Clear instruction: What you want GitLab Duo to do
  2. Specific context: What to focus on or reference
  3. Expected format: How to structure the response
  4. Success criteria: What good output looks like
Tips guidelines

Tips should provide:

Avoid generic advice. Be specific about what works for this particular use case.

Verification checklist

Create 3-5 specific, measurable checks that users can perform to validate success. Focus on:

Example Before

The following topic tried to cover too many different scenarios in one example. It was unclear when to use each approach and the prompts were too generic.

title: Using GitLab Duo for Development Tasks
---

You can use GitLab Duo to help with coding. Here are some ways:

- Generate code
- Fix bugs
- Write tests
- Refactor code

Ask GitLab Duo to help you with your task.
After

The information is clearer when split into a focused prompt example:

title: Refactor legacy code
---

Follow these guidelines when you need to improve performance, readability,
or maintainability of existing code.

- Time estimate: 15-30 minutes
- Level: Intermediate
- Prerequisites: Code file open in IDE, GitLab Duo Chat available

## The challenge

Transform complex, hard-to-maintain code into clean, testable components
without breaking functionality.

## The approach

Analyze, plan, and implement using GitLab Duo Chat and Code Suggestions.

### Step 1: Analyze

Use GitLab Duo Chat to understand the current state. Select the code you want to refactor, then ask:

```plaintext
Analyze the [ClassName] in [file_path]. Focus on:
1. Current methods and their complexity
2. Performance bottlenecks
3. Areas where readability can be improved
4. Potential design patterns that could be applied

Provide specific examples from the code and suggest applicable refactoring patterns.
```

Expected outcome: Detailed analysis with specific improvement suggestions.

## Tips

- Start with analysis before jumping to implementation.
- Select specific code sections when asking Chat for analysis.
- Ask Chat for specific examples from your actual code.
- Reference your existing codebase patterns for consistency.
- Let Code Suggestions help with syntax as you implement Chat's recommendations.

## Verify

Ensure that:

- Generated code follows your team's style guide.
- New structure actually improves the identified issues.
- Tests cover the refactored functionality.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4