This skill should be used when writing markdown that contains code blocks inside other code blocks (nested fences), when showing markdown source that includes triple-backtick examples, when creating tutorials or documentation with embedded code snippets, when fixing broken code block rendering, or when the user asks about backtick escaping, fenced code block nesting, the k+1 rule, or how to show markdown code blocks inside markdown. Also applies proactively when writing READMEs, documentation, or blog posts that will contain code examples inside markdown fences.
From utility-skillsnpx claudepluginhub therealbill/mynet --plugin utility-skillsThis skill uses the workspace's default tool permissions.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
When markdown contains code blocks inside other code blocks (nested fences), same-length fences break rendering. The k+1 rule solves this: wrap content containing k backticks in a fence of k+1 backticks, or switch the outer fence to tildes.
Critical: This rule applies ALWAYS - even under time pressure, even for "quick" documentation, even when you think "it'll probably work." Broken rendering is worse than taking 10 extra seconds to count backticks.
Broken nested fences cause documentation that doesn't render on GitHub/GitLab and code examples visible as plain text.
If your content contains a run of k backticks, wrap it in a fence of k+1 backticks (or use tildes).
Inner uses: ``` (3 backticks)
Outer needs: ```` (4 backticks = 3+1) OR ~~~ (tildes)
Rules:
Mnemonic: Count inner backticks, add one for outer. Always.
This markdown breaks because both fences use 3 backticks:
```markdown
# Example
```go
func main() {
fmt.Println("Hello")
}
```
```
Problem: First ``` after opening closes the outer block prematurely. The Go code isn't escaped.
Use 4 backticks for outer fence when inner has 3:
````markdown
# Example
```go
func main() {
fmt.Println("Hello")
}
```
````
Switch outer fence to tildes:
~~~markdown
# Example
```go
func main() {
fmt.Println("Hello")
}
```
~~~
| Inner Content | Outer Fence Options |
|---|---|
``` (3 backticks) | ```` (4 backticks) or ~~~ (3 tildes) |
```` (4 backticks) | ````` (5 backticks) or ~~~~ (4 tildes) |
~~~ (3 tildes) | ```` (4 backticks) or ~~~~ (4 tildes) |
Nested code blocks are needed when you're:
# ❌ WRONG
```markdown
Content with ```code``` blocks
```
# ✅ CORRECT
````markdown
Content with ```code``` blocks
````
# ❌ WRONG - Opening is 4 backticks, closing is 3
````markdown
Content
```
# ✅ CORRECT - Both are 4 backticks
````markdown
Content
````
# ❌ WRONG - Don't escape, use longer fence
```markdown
Content with \`\`\`code\`\`\` blocks
```
# ✅ CORRECT - Longer outer fence makes inner backticks literal
````markdown
Content with ```code``` blocks
````
Use tildes when:
Use k+1 backticks when:
Apply the k+1 rule on every code fence that contains other code fences. Never use same-length fences for nested blocks regardless of urgency, simplicity, or assumed parser tolerance. There are no cases where skipping this rule is acceptable.