Skip to content

Add write-docs skill for Claude Code documentation workflows#455

Open
samgutentag wants to merge 16 commits intomainfrom
sam-gutentag/write-docs-skill
Open

Add write-docs skill for Claude Code documentation workflows#455
samgutentag wants to merge 16 commits intomainfrom
sam-gutentag/write-docs-skill

Conversation

@samgutentag
Copy link
Member

@samgutentag samgutentag commented Mar 12, 2026

Summary

Replaces the previous agent-based approach (6 separate agent files) with a single consolidated write-docs skill that handles the full notes-to-PR documentation workflow.

Skill: .claude/skills/write-docs/ — processes raw notes, Slack threads, and engineer context into polished docs changes with full project tracking
Pipeline: Parse notes → duplicate check → research (Linear + Slite + Slack + docs + code) → sources audit trail → draft docs → branch/PR/Linear → Slack post → HTML review report
Drafts template: .claude/drafts/TEMPLATE.md for standardized input format

MCP integrations

The skill uses four MCP servers during Phase 2 research:

  • Slack — searches #team-merge-queue, #team-flaky-tests, and other channels for product discussion, changelogs, and context threads
  • Slite — retrieves PRDs, specs, roadmap items, and knowledge base articles for product intent and requirements
  • Linear — fetches tickets, customer asks, and related engineering issues
  • Trunk Docs (GitBook) — searches existing published docs for gap analysis

Code-is-law principle

Planning docs (Slite specs, PRDs, Slack discussions) provide valuable context but frequently diverge from what actually ships. The skill now enforces:

  • Code is the authoritative source — PR diffs and source on main override planning docs when they conflict
  • Sources audit requires a "Differences: Code vs. Planning Docs" table — surfacing discrepancies before they become inaccurate docs
  • Unimplemented spec features are flagged as open questions, not documented as existing functionality

This was validated by running the prometheus-metrics-endpoint draft through research, which found 6 discrepancies between the Slite spec and actual code (missing metric, different queue depth definition, unimplemented features).

Key conventions

  • Branch format: <git-username>/<kebab-case-topic>
  • PR titles: [TRUNK-XXXXX] Short descriptive title
  • One draft = one branch = one PR = one Linear ticket
  • All staged outputs under .claude/tmp/ (gitignored)

Validated with 8 documentation PRs

Draft PR Linear
google-cloud.md #438 TRUNK-17580
atlassian-bamboo.md #436 TRUNK-17578
flaky-tests-rules-engine.md #434 TRUNK-17576
new-merge-graph-ui.md #433 TRUNK-17575
merge-queue-api-endpoints.md #439 TRUNK-17581
falky-test-cyprus.md #435 TRUNK-17577
concurrency-settings.md #437 TRUNK-17579
run-tests-private-fork.md #445 TRUNK-17582

Test plan

  • Verify skill invocation via /write-docs <draft-file>
  • Confirm duplicate/overlap detection works (Phase 0)
  • Confirm Slack/Slite MCP research surfaces relevant context during Phase 2
  • Verify sources audit file includes code-vs-planning-docs comparison
  • Review GitBook preview for any docs changes

🤖 Generated with Claude Code

samgutentag and others added 14 commits February 17, 2026 10:59
Set up three subagents for accelerating Trunk docs workflows:
- doc-writer (Opus): full documentation drafting with structured outputs
- doc-researcher (Sonnet): context gathering from Linear and existing docs
- changelog-writer (Sonnet): focused changelog/release note entries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add branch-manager agent for git branch, PR, and Linear ticket lifecycle
- Update agents README with branch-manager in the available agents table
- Add Local Development section to repo README with GitBook preview workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add notes-processor agent for end-to-end pipeline: notes file in,
  branch/PR/Linear ticket out
- Add .claude/drafts/ directory with template for Slack pastes and
  engineer notes
- Update agents README with new workflow documentation
- Add .gitignore rules to keep personal drafts out of git

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Explainers enhance existing docs with examples and scenarios based on
customer questions, with guidelines to keep workflow guides clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Agents now produce a .sources.md file alongside each notes file,
listing every Linear ticket, GitHub PR, existing doc, code snippet,
and external reference used as input. Provides a human-readable
audit trail for accuracy checks and cross-referencing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add review report generation (Phase 6) to notes-processor agent
- Add Slack link extraction and attachment to Linear tickets
- Add automatic search and linking of related engineering tickets
- Enrich PR bodies with Slack context and related ticket references
- Add Slack Links field to notes template
- Create session report at .claude/reports/2026-02-17-docs-backlog.md
- Replace Claude Squad references with sequential workflow docs
- Add "What the Agent Does" section to README explaining all 6 phases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Agents now extract and attach all URLs from notes files — Slack, Slite,
Loom, Google Docs, Notion, and any other context links. All are attached
to Linear tickets and referenced in PR bodies. Template field renamed
from "Slack Links" to "Context Links".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Changelog entries now staged to .claude/staging/changelog/ for DatoCMS upload
- Review reports output as HTML (open in browser with clickable links and checkboxes)
- Remove old markdown report format
- Add .claude/staging/ and .claude/reports/*.html to .gitignore
- Update notes-processor with Phase 5.5 (changelog) and updated Phase 6 (HTML report)
- Broaden template "Slack Links" to "Context Links" (Slack, Slite, Loom, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move all agent outputs to .claude/tmp/ (report.html, changelogs/, slack/, sources/)
- Add Phase 5.6: Slack post generation for internal team notification
- Remove console text summary output format
- Require clickable Linear links in all sources files
- Simplify .gitignore to single .claude/tmp/ entry
- Clean up old staging/, reports/, and drafts/*.sources.md locations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ensure GitHub PRs and Linear tickets cross-reference each other by
requiring a Linear ticket ID prefix in PR titles and clickable Linear
URLs in PR bodies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Visual diagrams showing the 8-phase notes-processor pipeline flow
and how the 5 agents collaborate with external services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the 6 separate agent files (.claude/agents/) and replace with a
consolidated write-docs skill (.claude/skills/write-docs/) that handles
the full notes-to-PR workflow including duplicate detection, research,
drafting, branching, Linear updates, and staged outputs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@trunk-staging-io
Copy link

trunk-staging-io bot commented Mar 12, 2026

✨ Submitted to Merge by github-actions[bot]. It will be added to the merge queue once all branch protection rules pass and there are no merge conflicts with the target branch. See more details here.

@claude
Copy link

claude bot commented Mar 12, 2026

Claude finished @samgutentag's task in 1m 30s —— View job


Review Complete

  • Gather context
  • Read changed files
  • Review for typos, grammar, and formatting
  • Check documentation best practices
  • Post review feedback

Overall the PR is well-structured and clearly written. Found 3 minor issues (all non-blocking), with inline suggestions attached:

  1. .claude/drafts/TEMPLATE.md line 21 — Comment says "the agents will figure it out" but this PR replaces agents with a skill. Should say "the skill will figure it out" for consistency.

  2. .claude/skills/write-docs/README.md line 38 — Mermaid style STOP references a node that doesn't exist (actual nodes are STOP1 and STOP2). The red color styling on those stop nodes won't render. Needs two separate style directives.

  3. .claude/skills/write-docs/SKILL.md line 182 — Step numbering skips 18 (Phase 6 ends at step 17, Phase 7 opens at step 19). Minor but jarring when following the steps.

No blocking issues. The .gitignore changes correctly use the negation pattern (!.claude/drafts/TEMPLATE.md) to commit the template while ignoring personal drafts. The readme.md additions are clear and accurate.


<!-- Brief description of the product change, if you know it.
If you only have context below, leave this blank
and the agents will figure it out. -->
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment still refers to "agents" but this PR replaces the agent-based approach with a single skill. Should be updated for consistency:

Suggested change
and the agents will figure it out. -->
and the skill will figure it out. -->


style A fill:#4a9eff,color:#fff
style STOP fill:#ff6b6b,color:#fff
style K fill:#51cf66,color:#fff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style STOP directive references a node named STOP that doesn't exist in the diagram — the actual nodes are STOP1 and STOP2. This means the red styling won't render. Should be two separate style lines:

Suggested change
style K fill:#51cf66,color:#fff
style STOP1 fill:#ff6b6b,color:#fff
style STOP2 fill:#ff6b6b,color:#fff


### Phase 7: Clean Up

19. Return to the original branch and restore any stashed changes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step numbering skips 18 — Phase 6 ends at step 17, and Phase 7 starts at step 19. Should be renumbered:

Suggested change
19. Return to the original branch and restore any stashed changes.
18. Return to the original branch and restore any stashed changes.

@github-actions
Copy link

/trunk merge

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: Claude code review passed.

…k/Slite MCP

Apply best practices from Claude skill authoring guide:
- Split SKILL.md into main file + OVERLAP-CHECK.md and OUTPUTS.md reference files
  for progressive disclosure (Claude loads them only when reaching the relevant phase)
- Trim SKILL.md from 210 to ~130 lines by removing what Claude already knows
- Add progress checklist for tracking workflow phases
- Add table of contents for navigability
- Expand Phase 2 research to include Slite (PRDs, specs) and Slack
  (#team-flaky-tests, #team-merge-queue) as additional context sources
- Merge DEMO.md into skill README.md as the single human-facing reference
- Rename "agents" to "skills" in drafts template

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link

claude bot commented Mar 12, 2026

Claude finished @samgutentag's task in 2m 9s —— View job


Review Complete

  • Gather context
  • Read changed files
  • Review for typos, grammar, and formatting
  • Check documentation best practices
  • Post review feedback

The previous 3 issues from the prior review are all resolved in the latest commit — the TEMPLATE.md "agents" wording, the Mermaid style STOP node (diagram was replaced with a plain-text pipeline block), and the missing step 18 are all fixed. Found 4 new minor issues (all non-blocking):

  1. .claude/skills/write-docs/SKILL.md line 85 — Phase 3 restarts at step 8. which duplicates Phase 2's last step. This causes all subsequent phases (4–7) to also be numbered 2 behind. Phase 3 should start at 10., then Phase 4 → 11–13, Phase 5 → 14–16, Phase 6 → 17–18, Phase 7 → 19–20.

  2. .gitignore line 5 — Comment reads # Agent drafts but this PR replaces agents with a skill. Should be # Skill drafts.

  3. .gitignore line 9 — Same: # Agent outputs# Skill outputs.

  4. .claude/skills/write-docs/README.md line 275 — Dry run checklist mentions "GitBook" as an MCP server, but GitBook is the publishing platform — not an MCP server. The Prerequisites section lists claude.ai trunk docs instead. The checklist should match.

Inline suggestions attached for all four.


### Phase 3: Draft Documentation

8. Write or edit documentation:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step numbering is off here — Phase 2 ends at step 8. **Gap analysis** (line 77) and Phase 2.5 uses step 9. (line 81), so Phase 3 should start at step 10. not 8.. This causes all subsequent phases to also be numbered 2 behind.

Suggested change
8. Write or edit documentation:
10. Write or edit documentation:

Fix this →

.DS_Store
/.idea/workspace.xml

# Agent drafts (notes files are personal, template is committed)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment still says "Agent drafts" but this PR replaces agents with a skill. Minor inconsistency:

Suggested change
# Agent drafts (notes files are personal, template is committed)
# Skill drafts (notes files are personal, template is committed)

.claude/drafts/*.md
!.claude/drafts/TEMPLATE.md

# Agent outputs (local working files, all under tmp/)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same — "Agent outputs" → "Skill outputs" for consistency:

Suggested change
# Agent outputs (local working files, all under tmp/)
# Skill outputs (local working files, all under tmp/)

- [ ] No existing `.claude/tmp/indefinite-monitor-muting/` directory
- [ ] Claude Code starts cleanly and recognizes the skill
- [ ] MCP servers are responding (Linear, GitBook, Slack, Slite)
- [ ] Terminal font size is readable from the back of the room
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dry run checklist lists "GitBook" as an MCP server to verify, but GitBook is the publishing platform — not an MCP server. The actual MCP servers listed in Prerequisites are claude.ai Slack, claude.ai Trunk Slite, claude.ai trunk docs, and claude.ai Linear. Suggest aligning the checklist with that list:

Suggested change
- [ ] Terminal font size is readable from the back of the room
- [ ] MCP servers are responding (Linear, trunk docs, Slack, Slite)

@github-actions
Copy link

/trunk merge

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: Claude code review passed.

…cs skill

Phase 2 research now mandates that actual source code and PR diffs are the
authoritative source — planning docs (Slite specs, PRDs, Slack threads) provide
context but code wins on conflicts. Sources audit file must include
code-confirmed details, a code-vs-planning-docs diff table, and open questions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant