Skip to content
Back to skills

1254 Code Snippets 01afc87e

ASecurity

Tool for generating tested code snippets for Mintlify docs.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 1, 2026
businesspythonbashci/cd

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned June 1, 2026

npx -y skills add tools-only/X-Skills --skill 1254-code-snippets_01afc87e --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1254 Code Snippets 01afc87e?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1254 Code Snippets 01afc87e
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1254-code-snippets-01afc87e/badge)](https://www.skillsdirectory.com/skills/tools-only-1254-code-snippets-01afc87e)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# sniptest

Tool for generating tested code snippets for Mintlify docs.

## How It Works

1. Write testable Python in `/testers/*.py` with `# @sniptest` comments
2. Pre-commit hook runs `python sniptest/generate.py`
3. Generated `.mdx` files appear in `/snippets/`
4. Docs import from `/snippets/` - never write inline code blocks
5. CI/CD tests all `/testers/*.py` for validity

## Syntax

```python
# @sniptest filename=example.py
# @sniptest highlight=3-5,8
# @sniptest show=1-15

from notte_sdk import NotteClient

client = NotteClient()
# code here...

# Hidden below (via show=1-15)
if __name__ == "__main__":
    test()
```

## Decorators

| Decorator | Example | Output |
|-----------|---------|--------|
| `filename` | `filename=example.py` | Filename in header |
| `highlight` | `highlight=1-2,5` | `highlight={1-2,5}` |
| `focus` | `focus=2,4-5` | `focus={2,4-5}` |
| `lines` | `lines=true` | Show line numbers |
| `expandable` | `expandable=true` | Collapsible block |
| `wrap` | `wrap=true` | Wrap long lines |
| `icon` | `icon=rocket` | `icon="rocket"` |
| `show` | `show=5` or `show=5-20` | Pre-shave lines (single = that line only) |

### Line Number Syntax

| Type | Example | Means |
|------|---------|-------|
| Single | `5` | Line 5 |
| Range | `1-5` | Lines 1 through 5 |
| Mixed | `1-2,5,8-10` | Lines 1, 2, 5, 8, 9, 10 |

Works for `highlight` and `focus`. The `show` decorator only supports single range or single number.

### Processing Order

All line numbers refer to the **original code** (after `# @sniptest` comments are stripped).

`show` shaves lines AND remaps `highlight`/`focus` to match:

```
# @sniptest show=3-5
# @sniptest highlight=4-5

Original:        Output:
1: line1         (removed)
2: line2         (removed)
3: line3    →    1: line3
4: line4    →    2: line4  ← highlighted
5: line5    →    3: line5  ← highlighted

Result: highlight={2-3}
```

Lines outside `show` range are removed from `highlight`/`focus`.

## Commands

```bash
python sniptest/generate.py           # Generate all
python sniptest/generate.py --dry-run # Preview
python sniptest/generate.py --clean   # Remove orphans
python sniptest/generate.py --verbose # Show unchanged
```

## Generated Header

```mdx
{/* Auto-generated mdx file. Do not edit! */}
{/* @sniptest testers/agents/example.py */}
```

## Using in Docs

```mdx
import Example from '/snippets/agents/example.mdx';

<Example />
```

## No Inline Code

Never write code blocks directly in MDX. Always import from `/snippets/`.

Files in this skill

  • README.md801 B
  • skill.md2.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.