Documentation Templates

Customize your documentation with templates

CodeContext uses intelligent templates to generate documentation that matches your project's style and requirements. Free users get access to default templates, while Pro users can create custom templates for complete control.

Template System Overview

Built-in Templates

Professional templates for common use cases

Smart Variables

Dynamic content based on your code

AI Enhancement

Templates enhanced by AI understanding

Built-in Templates

Default Template

Clean, professional documentation for any project

Free
# {{projectName}}

{{description}}

## Installation

```bash
{{installCommand}}
```

## Usage

{{usageExamples}}

## API Reference

{{apiDocs}}

## Contributing

{{contributingGuidelines}}

## License

{{license}}

Minimal Template

Concise documentation focusing on essentials

Free
# {{projectName}}

> {{briefDescription}}

## Quick Start

{{quickStartGuide}}

## Documentation

For detailed documentation, see [docs](./docs).

---
{{footer}}

Comprehensive Template

Detailed documentation with all sections

PRO
# {{projectName}}

{{badges}}

{{description}}

## 🚀 Features

{{featuresList}}

## 📋 Table of Contents

{{tableOfContents}}

## 🛠️ Installation

### Prerequisites
{{prerequisites}}

### Install
{{installSteps}}

## 💻 Usage

### Basic Example
{{basicExample}}

### Advanced Usage
{{advancedExamples}}

## 📖 API Reference

{{detailedApiDocs}}

## 🏗️ Architecture

{{architectureOverview}}

## 🧪 Testing

{{testingGuide}}

## 🚀 Deployment

{{deploymentInstructions}}

## 🤝 Contributing

{{contributingGuide}}

## 📝 Changelog

See [CHANGELOG.md](./CHANGELOG.md)

## 📄 License

{{licenseInfo}}

Template Variables

Templates use double curly braces {{variable}} for dynamic content. CodeContext automatically fills these with appropriate values.

Basic Variables

  • {{projectName}} - Project name
  • {{description}} - Project description
  • {{version}} - Current version
  • {{author}} - Author name
  • {{license}} - License type
  • {{repository}} - Git repository URL

Generated Content

  • {{installCommand}} - Installation steps
  • {{usageExamples}} - Code examples
  • {{apiDocs}} - API documentation
  • {{featuresList}} - Feature list
  • {{badges}} - Status badges
  • {{tableOfContents}} - TOC

Custom TemplatesPRO

Pro users can create custom templates tailored to their specific needs:

1. Create Template File

Add your template to .codecontext/templates/:

.codecontext/
└── templates/
    ├── README.md
    ├── API.md
    ├── CONTRIBUTING.md
    └── custom-readme.md

2. Configure Template

Set your custom template in config:

{
  "generation": {
    "readme": {
      "template": "custom-readme.md"
    }
  }
}

3. Advanced Features

Conditional Sections

{{#if hasTests}}...{{/if}}

Loops

{{#each features}}...{{/each}}

Custom Helpers

{{formatDate date}}

Partials

{{> header}}

Template Examples

API Documentation Template

# {{projectName}} API Reference

Base URL: `{{baseUrl}}`

## Authentication

{{authenticationDetails}}

## Endpoints

{{#each endpoints}}
### {{method}} {{path}}

{{description}}

**Parameters:**
{{#each parameters}}
- `{{name}}` ({{type}}) - {{description}}
{{/each}}

**Response:**
```json
{{responseExample}}
```
{{/each}}

Monorepo Template

# {{projectName}} Monorepo

## Packages

{{#each packages}}
### [@{{scope}}/{{name}}](./packages/{{name}})

{{description}}

```bash
npm install @{{scope}}/{{name}}
```
{{/each}}

## Development

### Setup
{{setupInstructions}}

### Commands
{{availableCommands}}

Template Best Practices

  • Keep it DRY: Use partials for repeated sections
  • Progressive enhancement: Start with basics, add complexity as needed
  • Meaningful variables: Use descriptive variable names
  • Test thoroughly: Preview with different project types
  • Version control: Track template changes in git

Related Topics

);