> For the complete documentation index, see [llms.txt](https://docs.walnutai.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.walnutai.ai/core-features/intelligence-hub/generate-user-stories/code-repository-to-requirement.md).

# Code (Repository to Requirement)

The **Code** option within the Intelligence Hub allows you to generate structured **Epics, Features, and User Stories** directly from your application's source code. This feature analyzes your connected repository to derive functional requirements, eliminating the need to manually document existing application functionality.

#### When to Use Code-Based Requirement Extraction

Use this option when your application's functionality is already available in a connected source code repository. WalnutAI analyzes the repository and automatically generates structured **Epics, Features, and User Stories**, making it easy to document existing applications, legacy systems, or projects with limited functional documentation.

* **Existing Connection:** If a repository was configured during project setup ([GitHub](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-github-with-walnutai.md), [GitLab](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-gitlab-with-walnutai.md), [Bitbucket](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-bitbucket-with-walnutai.md), [Azure Repos](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-azure-repos-with-walnutai.md), or [AWS CodeCommit](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-aws-codecommit-with-walnutai.md)), it will automatically appear under the **Code** option in the Intelligence Hub.
* **Open the Code Repository:** Click the **Code** icon in the Intelligence Hub to view the list of available repositories.

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FWMr2xgJac0oK4l4hN2eh%2FScreenshot%202026-08-06%20at%2012.06.39%E2%80%AFPM.png?alt=media&amp;token=44057011-c0a9-4361-a37a-b03ff5d90c29" alt=""><figcaption></figcaption></figure>

* **Select a Repository:** Choose the repository you want to use. The selected repository is automatically attached to the WalnutAI Chat for analysis.

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FI4WC4o8PJd1T81n7IaXy%2FScreenshot%202026-08-06%20at%2012.08.08%E2%80%AFPM.png?alt=media&amp;token=b047f6e7-1286-4ac1-8067-76477e6a9545" alt=""><figcaption></figcaption></figure>

* **Generate Requirements:** Enter your prompt in the chat and click **Generate**. WalnutAI analyzes the repository and generates structured **Epics, Features, and User Stories** based on the application's source code.

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FH4CqTm1hGWHbp9vISjao%2FScreenshot%202026-08-06%20at%2012.17.09%E2%80%AFPM.png?alt=media&amp;token=788e583f-ad46-44fd-8040-e3e6e61bd16c" alt=""><figcaption></figcaption></figure>

* Review the generated requirements and refine them as needed using the Chat panel. You can modify descriptions, acceptance criteria, or story details before saving the generated Epics, Features, and User Stories.

{% hint style="info" %}
Select a generated User Story and click Use in Chat to generate the related test cases.
{% endhint %}

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FUoEa4J2HN3sxHBenW9ih%2FScreenshot%202026-08-06%20at%2012.18.24%E2%80%AFPM.png?alt=media&amp;token=19827c70-1bc0-499a-8060-6f5bcf236ee4" alt=""><figcaption></figcaption></figure>

* Click **Save** to store the generated Epics, Features, User Stories, and Test Cases.

<figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2F4rYdYvL5Az2UKSBzlcKC%2FScreenshot%202026-08-06%20at%2012.19.54%E2%80%AFPM.png?alt=media&amp;token=a15a4330-a562-4ef2-b272-22d60c8f65ae" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Result: Upon saving, items are stored in Action Items, and Test Cases populate the Test Cases page.
{% endhint %}
