Fix agent-skill directive: copy install command + learn more link#3392
Fix agent-skill directive: copy install command + learn more link#3392leemthompo wants to merge 8 commits into
Conversation
The link was resolving to the current page on some docs pages instead of the agent skills overview. Anchor to the correct section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The "Get the skill" button linked to a URL that 404'd because the @skill-name syntax isn't a valid GitHub path. Replace it with a button that copies the actual install command (npx skills add @skill-name) to clipboard. Falls back to the old link when no skill name is present. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover SkillName extraction, InstallCommand generation, copy button rendering, and the fallback to a link when the URL has no @skill-name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR adds a "Copy install command" button to the agent-skill directive. When a skill URL contains an Sequence DiagramsequenceDiagram
participant Directive as Directive Parser
participant ViewModel as View Model
participant View as Razor View
participant DOM as DOM/Button
participant User as User
participant Clipboard as navigator.clipboard
Directive->>Directive: Extract skill name from `@segment`
Directive->>ViewModel: InstallCommand = npx skills add `@name`
ViewModel->>View: Render with InstallCommand
alt Has Install Command
View->>DOM: Render copy button + data-copy-text
else No Install Command
View->>DOM: Render fallback link
end
User->>DOM: Click copy button
DOM->>Clipboard: writeText(InstallCommand)
Clipboard-->>DOM: Success
DOM->>DOM: Show "Copied!" + green background
Note over DOM: 1.5 second timeout
DOM->>DOM: Restore original button state
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/syntax/agent-skill.md`:
- Line 67: Update the sentence that reads "The skill name is extracted from the
URL as the segment after `@`" to explicitly state that the parser uses the final
`@` in the URL (e.g., change to "after the final `@`") so URLs with multiple `@`
characters are parsed correctly; locate the phrase "The skill name is extracted
from the URL as the segment after `@`" (and the accompanying example
`https://github.com/elastic/agent-skills@elasticsearch-esql`) and replace it
with wording that clarifies extraction uses the final `@`.
In `@src/Elastic.Markdown/Myst/Directives/AgentSkill/AgentSkillBlock.cs`:
- Around line 27-38: ExtractSkillName currently returns the substring after the
final '@' including any URL fragment, query or trailing slash; update
ExtractSkillName so after computing name = url[(atIndex + 1)..] you first remove
any fragment or query by truncating at the first '#' or '?' if present, then
TrimEnd('/') to drop trailing slashes, and finally return null if the resulting
name is empty; this ensures SkillName (used where SkillName is assigned)
contains only the clean skill identifier.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0317685e-4d29-4d66-a43d-57542addaf27
📒 Files selected for processing (9)
docs/syntax/agent-skill.mdsrc/Elastic.Documentation.Site/Assets/agent-skill.tssrc/Elastic.Documentation.Site/Assets/main.tssrc/Elastic.Documentation.Site/Assets/markdown/agent-skill.csssrc/Elastic.Markdown/Myst/Directives/AgentSkill/AgentSkillBlock.cssrc/Elastic.Markdown/Myst/Directives/AgentSkill/AgentSkillView.cshtmlsrc/Elastic.Markdown/Myst/Directives/AgentSkill/AgentSkillViewModel.cssrc/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cstests/Elastic.Markdown.Tests/Directives/AgentSkillTests.cs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parse from Uri.AbsolutePath instead of the raw URL string so fragments (#readme) and query params don't leak into the skill name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Both CodeRabbit findings addressed in 01436e9:
|
|
@theletterf I think this might be a GitHub Actions permissions error? |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fork PRs cannot use deployment APIs or AWS OIDC credentials. Skip assembler-preview and integration when the head branch is on a fork, matching the pattern used in docs-preview-local. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
wildemat
left a comment
There was a problem hiding this comment.
Looks great thanks Liam. Addresses complaints raised as part of reference search onboarding skill in docs starter guides
Summary
Fixes elastic/docs-content-internal#1206.
The
{agent-skill}banner had three UX problems: the "Get the skill" button linked to a URL that 404'd (the@skill-namesyntax isn't a valid GitHub path), there was no direct way to install a skill, and the "Learn more" link pointed back to the current page on some docs pages.This PR:
npx skills add @skill-nameto clipboard, extracted from the existing:url:property#available-skillsanchor on the agent skills overview page@skill-nameis present in the URLTest plan
dotnet run --project src/tooling/docs-builder -- serve --path docs) and navigate to the agent skill syntax pagenpx skills add @elasticsearch-esqlis copied to clipboard/explore-analyze/ai-features/agent-skills#available-skills🤖 Generated with Claude Code
Demo
Screen.Recording.2026-05-25.at.14.41.51.mov