Skip to content

Commit 95e7bef

Browse files
justinegeffenclaudeCopilot
authored
chore: Bug fixes and improvements to review agents and workflow [NOTASK] (#1092)
* fix: Correct bash syntax error in post-inline-suggestions.sh Fix missing = operator on line 71 causing 'command not found' error. Changes: - Line 71: comment_body+'' Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: Add missing 'changes' dependency to summary job The summary job references needs.changes.outputs.docs but was missing 'changes' in its needs array, causing the condition to fail. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * test: Add manual test workflow for inline suggestions script This workflow can be triggered manually to validate the bash script works correctly before merging to master. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat: Add conditional agent execution based on PR type - Classify PRs as 'rename' or 'content' based on git diff analysis - Rename PRs (>70% renames, <5 significant content changes): Skip voice-tone and terminology - Content PRs: Run all agents (voice-tone, terminology) - Limit suggestions to 100 per PR to prevent overwhelming output - Show PR type in review summary This reduces noise on rename/refactor PRs while maintaining full editorial review for content changes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore: Reduce suggestion limit from 100 to 50 Even 100 inline suggestions is overwhelming. Cap at 50 for better UX. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat: Preserve full suggestions list as downloadable artifact When >50 suggestions are found: - First 50 appear as inline comments (actionable) - Full list uploaded as 'all-editorial-suggestions' artifact - Comment links to workflow run to download complete list - Suggestions retained for 30 days This allows reviewing all suggestions without overwhelming the PR UI. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore: Raise suggestion limit from 50 to 60 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * docs: Restructure Claude documentation for clarity CLAUDE.md (user-facing): - Added Quick Start section - Comprehensive PR review workflow explanation - Manual re-run instructions - Artifact download guide - Troubleshooting section - Directory structure with file counts .claude/README.md (technical): - Balanced coverage of skills AND agents - Agent definitions and configurations - GitHub Actions integration details - Development guidelines - Architecture overview Both files now follow industry-standard documentation structure with clear separation between user guide and technical implementation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * style: Convert headings to sentence case Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * docs: simplify terminology section in CLAUDE.md Remove specific terminology examples (Tower, RNA-Seq, UI elements) from user guide. Users can reference .claude/agents/terminology.md for detailed rules. * docs: add workflows and architecture section to CLAUDE.md Add clear explanation of editorial and API workflows with step-by-step flow descriptions and component listings. * docs: clarify .claude directory contents in README Specify 'agents, skills, and configuration' instead of just 'configuration' for clarity. * docs: fix heading level for Related documentation section Change from level 3 (###) to level 2 (##) to match other main sections. * docs: complete API workflow components list Add missing workflow file, scripts, and trigger details to match actual implementation. * Update CLAUDE.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Justine Geffen <justinegeffen@users.noreply.github.com> * fixes from copilot * Update .claude/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Justine Geffen <justinegeffen@users.noreply.github.com> * added syntax checker * removed test file * Update .claude/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Justine Geffen <justinegeffen@users.noreply.github.com> * Update CLAUDE.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Justine Geffen <justinegeffen@users.noreply.github.com> * final fixes * final bug fix --------- Signed-off-by: Justine Geffen <justinegeffen@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 72722e3 commit 95e7bef

File tree

5 files changed

+523
-77
lines changed

5 files changed

+523
-77
lines changed

.claude/README.md

Lines changed: 217 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,240 @@
11
# Claude Code Configuration
22

3-
This directory contains Claude Code configuration for the Seqera Platform documentation repository.
3+
This directory contains Claude Code agents, skills, and configuration for the Seqera Platform documentation repository.
44

5-
## Skills
5+
## Overview
6+
7+
**What's in `.claude/`:**
8+
- **Agents** - Editorial review assistants that check documentation quality
9+
- **Skills** - Task-specific workflows for documentation automation
10+
- **Configuration** - Settings for CLI and GitHub Actions integration
611

7-
Skills are AI-powered workflows that help automate documentation tasks. Skills in this directory are available to:
12+
**Available to:**
813
- Claude Code CLI users working on this project
9-
- Claude Desktop app (when this directory is in a synced project)
10-
- GitHub Actions workflows using the Claude API
14+
- Claude Desktop app (synced projects)
15+
- GitHub Actions workflows via Claude API
16+
17+
## Skills
18+
19+
Skills are AI-powered workflows that automate specific documentation tasks.
1120

1221
### openapi-overlay-generator
1322

1423
Generates OpenAPI overlay files for Seqera Platform API documentation updates.
1524

16-
**Use when**:
17-
25+
**Use when:**
1826
- Analyzing Speakeasy comparison overlays
1927
- Generating operations, parameters, or schemas overlay files
2028
- Documenting new API endpoints or Platform version updates
2129
- Validating overlay files against documentation standards
2230

23-
See `skills/openapi-overlay-generator/SKILL.md` for complete documentation.
31+
**Documentation:** See `skills/openapi-overlay-generator/SKILL.md`
32+
33+
**Invocation:** `/openapi-overlay-generator`
34+
35+
### review
36+
37+
Runs comprehensive editorial reviews on documentation files or directories.
38+
39+
**Use when:**
40+
- Pre-commit review of changed files
41+
- Directory-wide quality checks
42+
- Targeted review (voice-tone only, terminology only)
43+
44+
**Invocation:**
45+
```bash
46+
/review <file-or-directory> [--profile=<profile>]
47+
```
48+
49+
**Profiles:**
50+
- `quick` - Voice-tone and terminology only
51+
- `comprehensive` - All agents
52+
- `new-content` - Includes structure checks
53+
54+
## Agents
55+
56+
Agents are specialized editorial reviewers that check documentation for specific quality criteria. They run automatically in GitHub Actions on PRs or manually via `/review`.
57+
58+
### voice-tone
59+
60+
Ensures documentation uses second person, active voice, and present tense.
61+
62+
**Configuration:** `.claude/agents/voice-tone.md`
63+
64+
**Checks:**
65+
- Second person ("you") vs third person ("the user")
66+
- Active vs passive voice
67+
- Present vs future tense
68+
- Hedging language ("may", "might", "could")
69+
70+
### terminology
71+
72+
Enforces consistent product names, feature names, and formatting.
73+
74+
**Configuration:** `.claude/agents/terminology.md`
75+
76+
**Checks:**
77+
- Product names (Seqera Platform, Studios, Nextflow)
78+
- Feature terminology (drop-down, compute environment)
79+
- UI formatting (bold for buttons, backticks for code)
80+
- RNA-Seq capitalization
81+
82+
**Special rules:**
83+
- Tower: Acceptable in legacy contexts
84+
- TowerForge: Always acceptable
85+
- drop-down: Always hyphenated
86+
87+
### clarity
88+
89+
Improves readability by flagging complex sentences and jargon.
90+
91+
**Configuration:** `.claude/agents/clarity.md`
92+
93+
**Status:** Currently disabled in workflows
94+
95+
**Checks:**
96+
- Sentence length (>30 words)
97+
- Undefined jargon
98+
- Complex constructions
99+
- Missing prerequisites
100+
101+
### punctuation
102+
103+
Ensures consistent punctuation across documentation.
104+
105+
**Status:** Not yet implemented as separate agent
106+
107+
**Checks:**
108+
- Oxford commas
109+
- List punctuation
110+
- Quotation marks
111+
- Dash usage
112+
113+
## GitHub Actions integration
114+
115+
### Documentation review workflow
116+
117+
**File:** `.github/workflows/docs-review.yml`
118+
119+
**Triggers:**
120+
- Pull requests modifying `platform-*` directories
121+
- Manual workflow dispatch
122+
123+
**How it works:**
124+
0. Validates bash script syntax (fails fast if scripts have errors)
125+
1. Classifies PR as "rename" or "content" type
126+
2. Runs agents based on PR type (rename PRs skip voice-tone & terminology)
127+
3. Posts up to 60 inline suggestions per PR
128+
4. Saves full report as downloadable artifact (30-day retention)
129+
130+
**Outputs:**
131+
- Inline suggestions on specific lines (click to apply)
132+
- Comment with download link if >60 suggestions found
133+
- Summary report with PR type and agent status
134+
135+
### Scripts
136+
137+
**`.github/scripts/post-inline-suggestions.sh`**
138+
- Converts agent findings to GitHub inline suggestions
139+
- Posts via GitHub Review API
140+
141+
**`.github/scripts/classify-pr-type.sh`**
142+
- Analyzes git diff to determine PR type
143+
- Outputs "rename" or "content" for workflow decisions
144+
145+
## Agent output format
146+
147+
Agents output structured suggestions:
148+
149+
```
150+
FILE: path/to/file.md
151+
LINE: 42
152+
ISSUE: Brief description
153+
ORIGINAL: |
154+
exact original text
155+
SUGGESTION: |
156+
corrected text
157+
---
158+
```
159+
160+
This format is parsed by `post-inline-suggestions.sh` and converted to GitHub's inline suggestion syntax.
24161

25162
## For contributors
26163

164+
### Working with API documentation
165+
27166
When working on API documentation:
28-
1. Claude Code will automatically detect and offer to use relevant skills
29-
2. Skills provide specialized knowledge about documentation standards and automation
30-
3. Skills include scripts and references that ensure consistency across API docs
167+
1. Claude Code automatically detects and offers relevant skills
168+
2. Skills provide specialized knowledge about documentation standards
169+
3. Skills include scripts ensuring consistency across API docs
170+
171+
### Working with editorial content
172+
173+
When working on documentation content:
174+
1. Open PR → Agents automatically review changes
175+
2. Review inline suggestions on affected lines
176+
3. Apply fixes individually or batch-apply multiple
177+
4. Re-run workflow manually from Actions tab if needed
178+
179+
### Testing changes locally
180+
181+
```bash
182+
# Test specific agent
183+
/review --profile=quick platform-enterprise_docs/quickstart.md
184+
185+
# Review entire directory
186+
/review platform-cloud/docs/
187+
188+
# Test skill
189+
/openapi-overlay-generator
190+
```
191+
192+
## Development
193+
194+
### Modifying agents
195+
196+
1. Edit agent definition in `.claude/agents/<agent-name>.md`
197+
2. Test locally with `/review`
198+
3. Create PR (agents will review their own changes)
199+
4. Merge after approval
200+
201+
### Adjusting suggestion limits
202+
203+
Current limit: 60 inline suggestions per PR
204+
205+
To change: Edit `.github/workflows/docs-review.yml` lines 268-284
206+
207+
### Adding new agents
208+
209+
1. Create `.claude/agents/<new-agent>.md`
210+
2. Add to `.github/workflows/docs-review.yml`
211+
3. Update documentation in `.claude/README.md` and `CLAUDE.md`
212+
4. Test on sample content
31213

32214
## Maintenance
33215

34-
- Skills are version-controlled with the repository
216+
- Skills and agents are version-controlled with the repository
35217
- Updates to skills should be reviewed like any other code change
36-
- Test skill changes locally before committing
218+
- Test changes locally before committing
219+
- Monitor the **Actions** tab in GitHub for workflow issues
220+
- Artifacts auto-delete after 30 days
221+
222+
## Architecture
223+
224+
```
225+
.claude/
226+
├── README.md # This file
227+
├── agents/
228+
│ ├── voice-tone.md # Agent definitions
229+
│ ├── terminology.md
230+
│ └── clarity.md
231+
└── skills/
232+
└── openapi-overlay-generator/
233+
└── SKILL.md
234+
```
235+
236+
## Resources
237+
238+
- **User Guide:** See `CLAUDE.md` in repository root
239+
- **Workflows:** See `.github/workflows/docs-review.yml`
240+
- **Scripts:** See `.github/scripts/`
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# Classifies PR as "rename" or "content" based on git diff analysis
3+
4+
set -e
5+
6+
BASE_REF=${1:-master}
7+
HEAD_REF=${2:-HEAD}
8+
9+
# Get diff stats
10+
SUMMARY=$(git diff --summary "$BASE_REF...$HEAD_REF")
11+
DIFF=$(git diff --numstat "$BASE_REF...$HEAD_REF")
12+
13+
# Count rename operations
14+
RENAME_COUNT=$(echo "$SUMMARY" | grep -c "rename" || true)
15+
16+
# Count total changed files
17+
TOTAL_FILES=$(echo "$DIFF" | wc -l | tr -d ' ')
18+
19+
# Count files with significant content changes (>10 lines added+deleted)
20+
CONTENT_CHANGES=$(echo "$DIFF" | awk '{if ($1+$2 > 10) print}' | wc -l | tr -d ' ')
21+
22+
# Calculate rename ratio
23+
if [[ $TOTAL_FILES -gt 0 ]]; then
24+
RENAME_RATIO=$((RENAME_COUNT * 100 / TOTAL_FILES))
25+
else
26+
RENAME_RATIO=0
27+
fi
28+
29+
# Classification logic:
30+
# - If >70% of files are renames AND <5 files have significant content changes: "rename"
31+
# - Otherwise: "content"
32+
33+
if [[ $RENAME_RATIO -gt 70 ]] && [[ $CONTENT_CHANGES -lt 5 ]]; then
34+
echo "rename"
35+
else
36+
echo "content"
37+
fi
38+
39+
# Debug output (appears in GitHub Actions logs)
40+
echo " Rename count: $RENAME_COUNT" >&2
41+
echo " Total files: $TOTAL_FILES" >&2
42+
echo " Content changes: $CONTENT_CHANGES" >&2
43+
echo " Rename ratio: ${RENAME_RATIO}%" >&2

.github/scripts/post-inline-suggestions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ create_review() {
6868
local comment_body="**${current_issue}**"$'\n\n'
6969
comment_body+='```suggestion'$'\n'
7070
comment_body+="${current_suggestion}"$'\n'
71-
comment_body+'```'
71+
comment_body+='```'
7272

7373
# Add to comments JSON array
7474
comments=$(jq -n \

0 commit comments

Comments
 (0)