Update GitHub PR or GitLab MR descriptions with AI session export summaries. Use when user asks to add session summary to PR/MR, document AI assistance in PR/MR, or export conversation summary to PR/MR description.
Session Export
Update PR/MR descriptions with a structured summary of the AI-assisted conversation.
Output Format
> [!NOTE]
> This PR was written with AI assistance.
<details><summary>AI Session Export</summary>
<p>
```json
{
"info": {
"title": "<brief task description>",
"agent": "opencode",
"models": ["<model(s) used>"]
},
"summary": [
"<action 1>",
"<action 2>",
...
]
}
```
Workflow
1. Export Session Data
Get session data using OpenCode CLI:
opencode export [sessionID]
Returns JSON with session info including models used. Use current session if no sessionID provided.
2. Generate Summary JSON
From exported data and conversation context, create summary:
- title: 2-5 word task description (lowercase)
- agent: always "opencode"
- models: array from export data
- summary: array of terse action statements
- Use past tense ("added", "fixed", "created")
- Start with "user requested..." or "user asked..."
- Chronological order
- Attempt to keep the summary to a max of 25 turns ("user requested", "agent did")
- NEVER include sensitive data: API keys, credentials, secrets, tokens, passwords, env vars
3. Update PR/MR Description
GitHub:
gh pr edit <PR_NUMBER> --body "$(cat <<'EOF'
<existing description>
> [!NOTE]
> This PR was written with AI assistance.
<details><summary>AI Session Export</summary>
...
</details>
EOF
)"
GitLab:
glab mr update <MR_NUMBER> --description "$(cat <<'EOF'
<existing description>
> [!NOTE]
> This MR was written with AI assistance.
<details><summary>AI Session Export</summary>
...
</details>
EOF
)"
4. Preserve Existing Content
Always fetch and preserve existing PR/MR description:
# GitHub
gh pr view <PR_NUMBER> --json body -q '.body'
# GitLab
glab mr view <MR_NUMBER> --output json | jq -r '.description'
Append session export after existing content with blank line separator.
Example Summary
For a session where user asked to add dark mode:
{
"info": {
"title": "dark mode implementation",
"agent": "opencode",
"models": ["claude sonnet 4"]
},
"summary": [
"user requested dark mode toggle in settings",
"agent explored existing theme system",
"agent created ThemeContext for state management",
"agent added DarkModeToggle component",
"agent updated CSS variables for dark theme",
"agent ran tests and fixed 2 failures",
"agent committed changes"
]
}
Security
NEVER include in summary:
- API keys, tokens, secrets
- Passwords, credentials
- Environment variable values
- Private URLs with auth tokens
- Personal identifiable information
- Internal hostnames/IPs
You Might Also Like
Related Skills

update-docs
This skill should be used when the user asks to "update documentation for my changes", "check docs for this PR", "what docs need updating", "sync docs with code", "scaffold docs for this feature", "document this feature", "review docs completeness", "add docs for this change", "what documentation is affected", "docs impact", or mentions "docs/", "docs/01-app", "docs/02-pages", "MDX", "documentation update", "API reference", ".mdx files". Provides guided workflow for updating Next.js documentation based on code changes.
vercel
docstring
Write docstrings for PyTorch functions and methods following PyTorch conventions. Use when writing or updating docstrings in PyTorch code.
pytorch
docs-writer
Always use this skill when the task involves writing, reviewing, or editing files in the `/docs` directory or any `.md` files in the repository.
google-gemini
write-concept
Write or review JavaScript concept documentation pages for the 33 JavaScript Concepts project, following strict structure and quality guidelines
leonardomso
resource-curator
Find, evaluate, and maintain high-quality external resources for JavaScript concept documentation, including auditing for broken and outdated links
leonardomso
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
anthropics