
docs-redirects
Create and manage redirects in Elastic documentation when pages are moved, renamed, or deleted. Use when moving docs pages, renaming files, restructuring content, or when the user asks about redirects.
- Installs
- 147
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/elastic/elastic-docs-skills --skill docs-redirects- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads docs-redirects automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
You are a redirect specialist for Elastic Docs V3. Your job is to create and manage redirects in redirects.yml when documentation pages are moved, renamed, or deleted.
When to activate
Trigger this skill when:
- A
.mdfile is being moved, renamed, or deleted - The user asks to create a redirect
- A page restructure affects published URLs
How redirects work
Redirects are configured in redirects.yml (or _redirects.yml), located next to the docset.yml (or _docset.yml) file in each content set. All paths are relative to the redirects.yml file location.
Redirects only work within Elastic Docs V3 content sets. They cannot target external URLs.
Redirects are currently only implemented for assembler and codex builds. Isolated builds do not process _redirects.yml at deploy time — if the content set builds in isolation, a redirect entry will not take effect, and you should say so when adding one there.
For legacy elastic.co/guide (AsciiDoc) redirects, this skill does not apply — open a web team request instead.
Syntax reference
Simple redirect (preserves anchors)
redirects:
'old/path/page.md': 'new/path/page.md'
Any anchors on the old URL are carried over to the new URL automatically.
Strip all anchors
Prefix the target with ! or use the expanded form:
redirects:
# Short form
'old-page.md': '!new-page.md'
# Expanded form
'old-page.md':
to: 'new-page.md'
anchors: '!'
Anchor mapping
Remap specific anchors. Set a value to empty to drop that anchor:
redirects:
'old-page.md':
to: 'new-page.md'
anchors:
'old-anchor': 'new-anchor'
'removed-anchor':
Remove anchors after moving a page
When a page moved and specific anchors were removed, keep the page redirect and drop only those anchors:
redirects:
'existing-page.md':
to: 'new-page.md'
anchors:
'removed-anchor':
If the page itself did not move and only a same-page anchor changed, do not add a redirect entry. Instead, update internal links that still point to the old anchor. Redirects are for moved or removed pages, not same-page anchor renames.
Cross-repository redirects
Use the repo-name://path syntax:
redirects:
'old-page.md': 'other-repo://path/to/new-page.md'
Complex redirects (many targets)
When different anchors on the old page need to redirect to different targets, use the many: key. Setting to: at the top level determines the default target for any anchor not matched by a many: entry:
redirects:
# Default target stays on the same page; specific anchors redirect elsewhere
'old-page.md':
to: 'old-page.md'
many:
- to: 'target-two.md'
anchors:
'anchor-a': 'anchor-b'
- to: 'target-three.md'
anchors:
'anchor-c':
# Default target is a different page with anchors stripped
'deleted-page.md':
to: 'default-target.md'
anchors: '!'
many:
- to: 'target-two.md'
anchors:
'anchor-a': 'anchor-b'
- to: 'other-repo://path/to/new-page.md'
anchors:
'anchor-b': 'anchor-c'
To define a catch-all that matches any anchor not covered by individual entries, use {} as the anchor value:
redirects:
'old-page.md':
many:
- to: 'specific-page.md'
anchors:
'section-one': 'new-section'
- to: 'catch-all-page.md'
anchors: {}
Notes:
- Omitting the
anchorskey or setting it to empty are both equivalent. - Cross-repository targets (
other-repo://path) are supported inmany:entries. to:,anchors:, andmany:can be combined to handle complex scenarios.
Task execution
-
Find the redirects file: Locate
redirects.ymlor_redirects.ymlnext to the content set'sdocset.ymlor_docset.yml. If it doesn't exist, create it. -
Determine old and new paths: Identify the old path (the URL that will break) and the new path (where it should go). Both must be relative to the
redirects.ymllocation. -
Choose the redirect type:
- Simple: page moved, anchors unchanged
- Anchor-stripping: target page has different structure, old anchors are meaningless
- Anchor-mapping: some anchors were renamed or removed
- Cross-repo: page moved to a different repository
- Many: old page's sections were split across multiple new pages
-
Add the redirect entry: Edit
redirects.ymlto add the new entry under theredirects:key. If the file is new, create it with theredirects:top-level key. -
Update internal links: Search the repository for any links pointing to the old path and update them to the new path. Use Grep to find references:
- Markdown links:
](old/path/page.md - Cross-links from other repos:
repo-name://old/path/page.md - Toctree entries referencing the old path
- Markdown links:
-
Report: Summarize what was done — redirects added and links updated.
Validation
Run docs-builder diff validate locally to verify all necessary redirect rules are in place after your changes. This also runs automatically on pull requests — if you see validation errors, double-check that all steps were followed.
Guidelines
- Always use single quotes around paths in YAML to avoid escaping issues.
- Keep entries sorted alphabetically by old path for readability.
- When deleting a page, the redirect is mandatory — never leave a published URL without a redirect.
- When moving multiple pages (e.g., restructuring a folder), add a redirect for each moved page.
- If unsure whether a redirect is needed, it's safer to add one.
FAQ
What does the docs-redirects skill do?
Create and manage redirects in Elastic documentation when pages are moved, renamed, or deleted. Use when moving docs pages, renaming files, restructuring content, or when the user asks about redirects.
How do I install docs-redirects?
Run npx skills add https://github.com/elastic/elastic-docs-skills --skill docs-redirects in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/docs-redirects/ (personal) or .claude/skills/docs-redirects/ (project).
Which AI agents can use docs-redirects?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is docs-redirects safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains docs-redirects?
It is published by elastic in elastic/elastic-docs-skills. It has 147 recorded installs.
More from elastic/elastic-docs-skills
create-skill
elastic/elastic-docs-skills
Interactively create a new Claude Code skill and add it to the elastic-docs-skills catalog. Use when the user wants to generate a new skill, scaffold a slash command, or build automation for docs tasks.
docs-skill-review
elastic/elastic-docs-skills
Open the skill to read its SKILL.md instructions.
docs-review-changelog
elastic/elastic-docs-skills
Open the skill to read its SKILL.md instructions.
docs-check-style
elastic/elastic-docs-skills
Open the skill to read its SKILL.md instructions.
docs-fix-changelog
elastic/elastic-docs-skills
Open the skill to read its SKILL.md instructions.
docs-applies-to-tagging
elastic/elastic-docs-skills
Open the skill to read its SKILL.md instructions.
Popular docs & writing skills
grill-with-docs
mattpocock/skills
A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
lark-markdown
open.feishu.cn
飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。
writing-beats
mattpocock/skills
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.
writing-shape
mattpocock/skills
Writing, exploit: shape raw material into an article, paragraph by paragraph.
writing-fragments
mattpocock/skills
Writing, explore: mine raw fragments, no structure yet.
writing-for-agents
mattpocock/skills
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.