skill-body-long-code-block
Long code blocks in SKILL.md should be moved to reference files
Rule Details
This rule scans the body of SKILL.md files for fenced code blocks (triple backticks) and reports any that exceed the maximum line count. Long code blocks inflate the skill file size, slow down AI model processing, and make the skill harder to maintain. Large code examples and templates should be moved to separate files in the references/ directory and linked from the main SKILL.md for progressive disclosure.
Incorrect
Code block exceeding the default 20-line limit
---
name: setup
description: Sets up the development environment
---
## Usage
```bash
# Line 1
# Line 2
# ...
# Line 25
```Correct
Short code block within the limit
---
name: setup
description: Sets up the development environment
---
## Usage
```bash
npm install
npm run build
```Long code moved to a reference file
---
name: setup
description: Sets up the development environment
---
## Usage
See [full setup script](references/setup.sh) for the complete configuration.How To Fix
Move the long code block into a file under the references/ directory and link to it from the SKILL.md body. Keep only short, illustrative snippets inline.
Options
Default options:
{
"maxLines": 20
}Allow up to 40 lines per code block:
{
"maxLines": 40
}Enforce a strict 10-line limit:
{
"maxLines": 10
}When Not To Use It
Disable this rule if your skill requires inline code blocks that cannot be meaningfully extracted into separate reference files.
Related Rules
Resources
Version
Available since: v0.2.0