> For the complete documentation index, see [llms.txt](https://ai-native-development.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-native-development.gitbook.io/docs/refactoring/asking-with-open-ended-questions.md).

# Asking with open-ended questions

[![](https://img.shields.io/badge/Lv1-Early_Stage_Pattern-blue)](https://github.com/orgs/AI-Native-Development/projects/1/)

## Description

Refactoring is often a complex process. It is not necessarily about what is right and what is wrong, but about understanding the basic concepts and potential improvements. using open questions in GitHub Copilot, developers can work on improving code in a more thoughtful way with the help of GitHub Copilot GitHub Copilot can help developers work on code improvements in a more thoughtful way.

### Example

Introducing open-ended questions in your queries with GitHub Copilot can lead to insightful suggestions. For example:

```javascript
// Q: How can I improve the restorability of this function?
// A: <GITHUB COPILOT SUGGESTION>
function backupData(data) {
  // Implementation here
}

// Q: What's the best way to handle errors in this context?
// A: <GITHUB COPILOT SUGGESTION>
try {
  // Some operation
} catch (error) {
  // Error handling
}
```

## Exercise

* **Exercise 1**: Write a function related to file handling and ask Copilot how to make it more reliable and efficient.
* **Exercise 2**: Create a code snippet that includes exception handling and ask Copilot for suggestions to improve error reporting.
* **Exercise 3**: Design a simple UI component and ask Copilot how to access or manipulate it in a more elegant way.

## Checklist for Further Learning

* What other areas of your code can benefit from refactoring?
* How can open-ended questions assist in your development process?


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-native-development.gitbook.io/docs/refactoring/asking-with-open-ended-questions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
