Skip to content

Tutorial: document an undocumented repository

Turn a repository that has no documentation into a structured documentation set: an overview, a getting started guide, and an API reference. You start from an empty session and finish with a single pull request that adds all three pages, written to a consistent style.

By the end, you can:

  • Have the agent survey a codebase and propose a documentation structure.
  • Generate several linked pages in one session.
  • Teach the agent your style and terminology so the pages read as one set.
  • Review every new page and ship them all in one pull request.

The whole path takes about 30 minutes. For a single README, see Getting started. To update docs that already exist, see Tutorial: document a code change.

You need:

  • An EkLine account in your organization.
  • A repository that contains working code but little or no documentation. A small library or service works best for a first run.
  • Permission to open pull requests on that repository.

You don’t write any documentation by hand in this tutorial. You direct the agent, review what it drafts, and refine it with follow-up prompts.

The agent documents only code it can read, so connect a repository first.

  1. Log in to your EkLine dashboard.
  2. Click New session in the sidebar. If the composer shows Docs and Marketing, select Docs.
  3. If you haven’t connected a repository yet, follow Connect GitHub to EkLine to install the GitHub App and select which repositories the agent can access.

Verify: The new session page reads I can help improve your documentation, with a box for your request. The editor panel opens on the left once the agent drafts a file.

A new Docs Agent session with the sessions sidebar and the chat panel ready for a prompt

If you use GitLab instead, follow Connect GitLab to EkLine. The rest of this tutorial is the same.

Before you generate a single page, let the agent read the repository and tell you what a documentation set should contain. This grounds every later page in what the code actually does.

In the chat panel, type:

This repository has no documentation. Survey the codebase and
propose a documentation structure. List the pages to create, what
each page should cover, and who it is for.

The agent reads your repository structure, source files, and configuration, then responds with a proposed outline.

Verify: The agent responds with a list of proposed pages and a short description of each. Read it and decide which pages to create first. The next steps create three: an overview, a getting started guide, and an API reference.

Start with the page that frames everything else. Give the agent the page, the audience, and where it belongs.

Create an overview page at docs/index.md. Explain what this
project does, who it is for, and its key capabilities. Keep it
to a short introduction that links out to the other pages.

Verify: A draft of the overview appears in the editor panel on the left. Read it and confirm the description of the project matches what the code does.

With the overview in place, add the remaining pages in the same session. The agent keeps each new page consistent with the ones already drafted.

  1. Generate the getting started guide:
    Create a getting started guide at docs/getting-started.md.
    Cover installation, the minimum configuration, and a first
    working example pulled from the code.
  2. Generate the API reference:
    Create an API reference at docs/api-reference.md for the
    public functions in this repository. Include parameters,
    return values, and an example for each.
  3. Switch between the drafts in the editor panel to read each page.

For more ways to generate each page type, see Create documentation and Generate an API reference. To pull in a spec or a design doc from a connected tool, see Combine multiple sources.

Verify: The editor panel shows a tab for each of the three new files: docs/index.md, docs/getting-started.md, and docs/api-reference.md.

Separate prompts can drift in tone and terminology. Bring the set into line with a single follow-up.

Review these three pages together. Use the same term for each
concept across all of them, match the heading style, and make
sure every link between the pages resolves.

Because the agent is now changing pages it already drafted, the editor shows its edits under a Reviewing changes banner. Open each page’s tab, read the changes, and click Accept All to keep them or Reject All to discard them.

Verify: The agent updates the drafts so the pages share terminology and heading style, and the cross-links between them point to real pages.

Never ship a first draft unread. You know your product, so check the set before it becomes a pull request.

  1. Open each file in the editor panel and read it in full.
  2. Check the file tabs in the editor panel for any file you didn’t ask for.
  3. Check three things on every page:
    • Accuracy: Does each page describe what the code actually does?
    • Completeness: Does the getting started guide take a reader from nothing to a working example?
    • Consistency: Do the three pages use the same terms and structure?

If something is off, ask the agent to fix it rather than editing by hand. For example: "The installation command in the getting started guide is wrong. Read the package configuration and correct it."

Verify: The three pages are accurate, complete, and consistent, and the editor panel holds no file you didn’t ask for.

When the set reads well, publish all three pages through your normal review process.

  1. Click Raise PR in the toolbar.
  2. The agent prefills a prompt such as Open a pull request. Edit it to add a title or description if you want, then press Enter.
  3. The agent creates the pull request and responds in the chat with a link to it on GitHub.

Verify: The chat shows a link to a new pull request. Open it. The PR adds your three documentation pages and nothing else.

You took a repository from no documentation to a review-ready pull request. Along the way you:

  • Had the agent survey the codebase and propose a structure.
  • Generated an overview, a getting started guide, and an API reference in one session.
  • Brought the pages into a single, consistent style.
  • Reviewed every page and shipped the whole set in one pull request.

You now have a documentation set to build on. Each time your product changes, you update it with the same review-and-refine loop rather than starting over.

Built on Potluck Docs, our open source template.