docs-redirects
Skill72 starsChanged 5 months agoApache-2.0View on GitHub
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.
In this repository26 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- create-skillSkill
- docs-applies-to-taggingSkill
- docs-content-type-checkerSkill
- docs-draft-feature-docsSkill
- docs-frontmatter-descriptionSkill
- docs-page-opening-optimizerSkill
- docs-syntax-helpSkill
- docs-fix-changelogSkill
- docs-kibana-release-notesSkill
- docs-review-changelogSkill
- docs-serverless-changelogSkill
- docs-draft-workflow-docsSkill
- docs-kibana-settingsSkill
- docs-lens-chart-pageSkill
- docs-lens-chart-settingsSkill
- docs-check-contradictionsSkill
- docs-check-kibana-oasSkill
- docs-check-styleSkill
- docs-flag-jargon-skillSkill
- docs-frontmatter-auditSkill
- docs-review-prSkill
- docs-skill-reviewSkill
- docs-validate-code-samplesSkill
- docs-file-issueSkill
- docs-stack-releaseSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 88
When a page moved and specific anchors were removed, keep the page redirect and drop only those anchors:
- Distinctive: line 98
If the page itself did not move and only a same-page anchor changed, do not add a redirect entry.
- Very specific: line 102
Use the repo-name://path syntax:
- Very specific: line 111
When different anchors on the old page need to redirect to different targets, use the many: key.
- Distinctive: line 172
Update internal links: Search the repository for any links pointing to the old path and update them to the new path.
- Very specific: line 181
Run docs-builder diff validate locally to verify all necessary redirect rules are in place after your changes.
- Distinctive: line 185
Always use single quotes around paths in YAML to avoid escaping issues.
- Distinctive: line 186
Keep entries sorted alphabetically by old path for readability.
- Distinctive: line 187
When deleting a page, the redirect is mandatory — never leave a published URL without a redirect.
- Distinctive: line 188
When moving multiple pages (e.g., restructuring a folder), add a redirect for each moved page.
- Distinctive: line 189
If unsure whether a redirect is needed, it's safer to add one.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
or more contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright
ownership. Elasticsearch B.V. licenses this file to you under
the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License. -->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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

