# Contribution Templates

Templates for the AIWG contributor workflow.

## Templates

### pr-template.md

Template for PR descriptions generated by `aiwg -contribute-pr`.

**Variables:**
- `{summary}` - Brief description of the feature
- `{changes}` - Bullet list of changes grouped by type
- `{breaking_changes}` - Breaking changes section (if applicable)
- `{testing}` - Testing results (lint, manifest, docs, quality score)
- `{checklist}` - PR completion checklist

**Used by:** `tools/contrib/create-pr.mjs`

### intake-template.md

Template for contribution intake forms created by `aiwg -contribute-start`.

**Variables:**
- `{feature}` - Feature name
- `{created_at}` - ISO timestamp
- `{username}` - GitHub username

**Used by:** `tools/contrib/start-contribution.mjs`

**Sections:**
- Overview - Brief description
- Description - Problem statement and solution approach
- Deliverables - Checklist of what will be delivered
- Dependencies - Prerequisites and dependencies
- Implementation Plan - Phased approach
- Success Criteria - How to measure success
- Checklist - Pre-PR checklist
- Notes - Additional context

### feature-checklist.md

Comprehensive checklist for contributors to ensure completeness.

**Sections:**
- Setup - Fork, workspace, branch
- Intake - Problem, solution, success criteria
- Implementation - Code, integration, patterns
- Documentation - README, quickstart, integration guide
- Quality Gates - Lint, manifest, quality score
- Testing - Platform testing, edge cases
- Git Hygiene - Commits, secrets, cleanup
- PR Preparation - Quality validation, description
- Post-PR - Monitoring, feedback, syncing

**Usage:**
Contributors can reference this checklist throughout the contribution process:
```bash
cat templates/contrib/feature-checklist.md
```

## Integration with Commands

**start-contribution.mjs**
- Uses `intake-template.md` to create `.aiwg/contrib/{feature}/intake.md`
- Replaces `{feature}`, `{created_at}`, `{username}` with actual values

**create-pr.mjs**
- Uses `pr-template.md` to generate PR description
- Populates template variables based on workspace data and quality report
- Adds contribution-specific metadata

## Customization

Contributors can customize their intake and PR descriptions:

1. **Edit intake:** `.aiwg/contrib/{feature}/intake.md`
2. **PR description:** Generated automatically, but can be edited in PR creation prompt

## Example Workflow

```bash
# 1. Start contribution (creates intake from template)
aiwg -contribute-start cursor-integration

# 2. Complete intake
# Edit: .aiwg/contrib/cursor-integration/intake.md

# 3. Implement feature (reference feature-checklist.md)
# ...

# 4. Create PR (uses pr-template.md)
aiwg -contribute-pr cursor-integration
```

## Template Variables Reference

### Common Variables

- `{feature}` - Feature name (e.g., "cursor-integration")
- `{username}` - GitHub username
- `{created_at}` - ISO 8601 timestamp
- `{quality_score}` - Quality score (0-100)

### PR Template Variables

- `{summary}` - Generated from feature name and type
- `{changes}` - List of files changed, grouped by type
- `{breaking_changes}` - Breaking changes section with migration guide
- `{testing}` - Quality gate results
- `{checklist}` - Completion checklist items

## Template Conventions

1. **Markdown headers:** Use `##` for main sections
2. **Checklists:** Use `- [ ]` for unchecked items
3. **Placeholders:** Use `{variable_name}` for template variables
4. **Sections:** Keep sections focused and scannable
5. **Examples:** Include examples where helpful

## Future Enhancements

Potential template additions:

- `breaking-change-template.md` - Template for breaking change documentation
- `migration-guide-template.md` - Template for migration guides
- `test-plan-template.md` - Template for contribution test plans
