gptme-contrib Contribution Pattern

lesson workflow active workflow/gptme-contrib-contribution-pattern.md View on GitHub

gptme-contrib Contribution Pattern

Rule

Follow a structured five-phase workflow when contributing lessons or code to gptme-contrib to ensure high-quality submissions that pass automated review and reach the maintainer in merge-ready state.

Context

When contributing lessons, documentation, or code to the gptme-contrib shared repository.

Detection

Observable signals that you need this workflow:

Pattern

Phase 1: Content Preparation

Before writing:

# Check peer files for frontmatter schema — MANDATORY first step
ls gptme-contrib/lessons/<category>/
head -15 gptme-contrib/lessons/<category>/existing-lesson.md

# All lesson files use: match.keywords + status
# Keywords can be inline-array ["a","b"] or block-sequence style — both are valid
# Do NOT add category/tags fields unless they appear in peer files

While writing:

# Wrong: non-deterministic set ordering (Python hash randomization)
raise ValueError(f"Expected one of {VALID_OPTIONS}")

# Correct: stable output
raise ValueError(f"Expected one of {sorted(VALID_OPTIONS)}")

Before committing, validate locally:

cd gptme-contrib
pre-commit run --all-files

Phase 2: Branch and PR Creation

# Create branch from origin/master — not from a local branch
git checkout -b feat/descriptive-branch-name origin/master

# Add and commit
git add lessons/<category>/<lesson-name>.md
git commit -m "docs(lessons): add <topic> lesson"

# Push and open PR
git push -u origin feat/descriptive-branch-name
gh pr create --title "docs(lessons): add <topic> lesson" --body "..."

PR description should include:

Phase 3: Automated Review Response

Greptile reviews every PR. Address all feedback within the same session (or within hours). Common issues it flags:

Issue Fix
Frontmatter fields not in peer files Remove non-standard fields
"Five patterns" but six defined Recount and fix the text
{VALID_OPTIONS} in f-string Change to {sorted(VALID_OPTIONS)}
ls file 2>/dev/null in bash Change to [[ -f file ]]
Missing Detection section Add it before the Pattern section

Reply template:

Thanks for the review!

Addressed in <commit-hash>:
- **<issue 1>** — <what you changed>
- **<issue 2>** — <what you changed>

Phase 4: Maintainer Approval

After Greptile approves (or raises no blockers), wait for human maintainer review. No action needed until feedback arrives. Don't ping or rebase while waiting.

Phase 5: Post-Merge

Anti-Patterns

❌ Not checking peer frontmatter first: Adding category: workflow and tags: [git] fields to a file where every peer uses only match.keywords + status. Greptile will flag this as a schema inconsistency.

❌ Inaccurate count claims: Writing "All five patterns share..." when the lesson defines six sections (1–6). Count the sections, then write the number.

❌ Non-deterministic set ordering:

raise ValueError(f"Expected one of {VALID_UNITS}")  # output varies run to run

❌ Creating branch from local instead of origin/master: Contaminating the PR with unrelated commits from other local work. See also: branch-from-master.md, clean-pr-creation.md

❌ Slow review response: Greptile leaves feedback. Leaving it unaddressed for days signals low engagement and slows the merge cycle. Address feedback in the same or next session.

Outcome

Following this workflow results in:

Related

Origin

2026-03-06: Extracted from the contribution workflow across multiple gptme-contrib lesson PRs. The Greptile review patterns (frontmatter drift, count mismatch, set ordering, bash anti-pattern) appeared consistently across PRs #369–#371 and are the main failure modes to avoid.

Match Keywords

contribute lesson contrib PR external contribution submit lesson upstream lesson upstream to gptme-contrib