Skip to main content

Issue Templates

Issue templates let repository maintainers define structured forms for creating issues. When contributors create an issue using a template, the title, body, labels, and assignees are pre-filled based on the template definition. This ensures consistency and reduces the burden on contributors to remember what information to include.

How Issue Templates Work

Issue templates are Markdown files stored in the .jjhub/ISSUE_TEMPLATE/ directory at the root of your repository. Each file defines a single template with YAML frontmatter for metadata and Markdown content for the issue body. When a user creates an issue with --template, the CLI fetches the template from the repository, pre-fills the issue fields, and lets the user edit before submitting.

Template File Format

Each template file is a Markdown file (.md) with YAML frontmatter. The frontmatter defines metadata like the title, labels, and assignees. The Markdown body becomes the issue body, typically containing a structured form with sections to fill in.

Frontmatter Fields

Example Template

Create a file at .jjhub/ISSUE_TEMPLATE/bug-report.md:

More Template Examples

Feature request (.jjhub/ISSUE_TEMPLATE/feature-request.md):
Documentation issue (.jjhub/ISSUE_TEMPLATE/docs.md):

CLI Usage

Creating an Issue from a Template

Use the --template flag (short: -T) with jjhub issue create to use a template:
The --template flag accepts the template filename without the .md extension. For example, a template at .jjhub/ISSUE_TEMPLATE/bug-report.md is referenced as bug-report. When you use --template, the template’s default title, labels, and assignees are applied. Any flags you pass explicitly (like --title or --assignee) override the template defaults.

Listing Available Templates

To see what templates are available for a repository:
This returns the list of templates with their names, descriptions, and configured defaults.

API

List Issue Templates

Retrieve all issue templates defined in a repository.
Response (200 OK):
The endpoint reads template files from the .jjhub/ISSUE_TEMPLATE/ directory on the repository’s default bookmark, parses the YAML frontmatter, and returns the structured template data.

Directory Structure

Templates must be placed in the .jjhub/ISSUE_TEMPLATE/ directory at the repository root:
The directory name ISSUE_TEMPLATE is case-sensitive and must be uppercase. Template files must have the .md extension.

Best Practices

  • Keep templates focused. Each template should serve a single purpose (bug report, feature request, documentation issue, etc.).
  • Use descriptive filenames. The filename (without extension) is what users pass to --template, so make it memorable and clear.
  • Include placeholder text. Use descriptive placeholder text in each section so contributors know what information to provide.
  • Apply labels automatically. Use the labels frontmatter field to categorize issues at creation time, reducing manual triage work.
  • Set a default title prefix. Use the title field with a prefix like [Bug]: to make issues scannable in lists.
  • Keep the template list short. Three to five templates covers most projects. Too many templates creates decision fatigue.