---
title: "Contribution templates"
description: "Find the effective issue and pull request templates of a repository, with their scope and source, and read one in full by its key."
canonical_url: "https://forges.agntn.dev/guide/templates"
---
# Contribution templates

> Find the effective issue and pull request templates of a repository, with their scope and source, and read one in full by its key.

## Calls

```ts
const repo = { owner: "owner", repo: "repo" };

const page = await forge.contributionTemplates.list(repo, { kind: "issue", perPage: 20 });

for (const summary of page.items) {
  console.log(summary.name, summary.scope, summary.inherited, summary.sourcePath);
}

const template = await forge.contributionTemplates.get(repo, {
  kind: "issue",
  key: page.items[0]!.key,
});
console.log(template.content);
```

`kind` is `issue` or `pull_request`. Lists carry metadata only. A template body can be big, so `get` reads one by the opaque `key` the list gave you. Pass kind and key back unchanged.

## The shape

```ts
interface ContributionTemplateSummary {
  kind: "issue" | "pull_request";
  key: string;
  name: string;
  scope: "repository" | "owner" | "group" | "instance" | "unknown";
  inherited: boolean;
  sourceRepository: string | null;
  sourcePath: string | null;
  sourceRef: string | null;
}
```

## Where templates come from

**GitHub** follows the recognized locations: `.github/ISSUE_TEMPLATE/`, `ISSUE_TEMPLATE.md`, `pull_request_template.md` and friends, in the repository first. When the repository has none, the owner's `.github` repository supplies defaults, with `scope: "owner"`, `inherited: true` and the source repository and path filled in. Issue and pull request overrides are resolved on their own: a local issue template does not hide an inherited pull request template. A host that speaks the GitHub API but lacks the GitHub Enterprise headers is treated as repository scope only, because guessing at owner inheritance there would be exactly that, a guess.

**GitLab** uses its effective project template API, which already knows about group and instance inheritance. When that API hides where the winning file came from, `scope` is `unknown` and the three source fields are `null`. No guessing here either.

**Gitea and Forgejo** expose repository scope only.

**GitBucket** and other hosts speaking the GitHub API: repository scope only.

Discovery does not lint template frontmatter or form schemas. It tells you what applies and where it lives, and stops there.

## In an agent

`forges_contribution_templates_list` and `forges_contribution_templates_get` are the same two calls. A list drops bodies outright and names the tool that reads one, because a busy repository's templates would otherwise push the actual conversation out of the context.


## Sitemap

See the full [sitemap](https://forges.agntn.dev/sitemap.md) for all pages.
