sniffable-python
БесплатноБез исполняемых скриптовНе проверенStructure Python so LLMs can understand it in 50 lines.
от majiayu000★ 31 звезда на GitHubОб этом скилле
Sniffable Python
"Structure code for the first 50 lines. That's all the LLM needs."
Don't invent new syntax — structure existing syntax for optimal LLM comprehension.
If your code smells good, the LLM can sniff it from the first whiff.
Steve Jobs wanted pixels you could lick. We want code you can sniff.
The Problem
LLMs can read Python. But:
- Large files overwhelm context
- Implementation details bury the API
- Comments scattered or missing
- No clear entry point for understanding
Solution: Structure Python so the first ~50 lines contain everything needed to understand and use the tool. Make your code's bouquet apparent from the opening notes.
The Pattern
Canonical Structure
#!/usr/bin/env python3
"""skill-name: Brief description of what the script does.
This docstring becomes --help output AND is immediately visible to the LLM.
It should contain:
- Purpose (one sentence)
- Usage examples
- Key behaviors
Usage:
python script.py command [options]
Examples:
python script.py move north --quiet
python script.py examine sword --verbose
"""
import argparse
from pathlib import Path
import yaml
# Configuration
DEFAULT_ROOM = "start"
VALID_DIRECTIONS = ["north", "south", "east", "west"]
MAX_INVENTORY = 10
def main():
"""Main entry point — CLI structure only, no implementation."""
parser = argparse.ArgumentParser(
description=__doc__.split('\n')[0], # First line of module docstring
formatter_class=argparse.RawDescriptionHelpFormatter
)
subparsers = parser.add_subparsers(dest="command", required=True)
# move command
move_parser = subparsers.add_parser("move", help="Move in a direction")
move_parser.add_argument("direction", choices=VALID_DIRECTIONS,
help="Direction to move")
move_parser.add_argument("--quiet", "-q", action="store_true",
help="Suppress output")
# examine command
examine_parser = subparsers.add_parser("examine", help="Look at something")
examine_parser.add_argument("target", help="What to examine")
examine_parser.add_argument("--verbose", "-v", action="store_true",
help="Show details")
# status command
status_parser = subparsers.add_parser("status", help="Show game state")
status_parser.add_argument("--verbose", "-v", action="store_true",
help="Show details")
args = parser.parse_args()
_dispatch(args)
# Implementation (LLM only reads past here if modifying behavior)
def _dispatch(args):
"""Route to appropriate handler."""
if args.command == "move":
_do_move(args.direction, args.quiet)
elif args.command == "examine":
_do_examine(args.target, args.verbose)
elif args.command == "status":
_show_status(args.verbose)
def _do_move(direction: str, quiet: bool) -> None:
"""Internal: Execute movement."""
...
def _do_examine(target: str, verbose: bool) -> None:
"""Internal: Examine an object."""
...
def _show_status(verbose: bool) -> None:
"""Internal: Display status."""
...
if __name__ == "__main__":
main()
The Zones
| Zone | Lines | Purpose |
|---|---|---|
| Shebang + Docstring | 1-15 | Purpose, usage, becomes --help |
| Imports | 16-22 | Dependencies visible at a glance |
| Constants | 23-30 | Configuration, valid values, limits |
| CLI Structure | 31-50 | Command tree with types and docs |
| Implementation | 51+ | Only read if modifying |
Why This Works
Dual-Audience Design
# One file, two audiences, same source of truth
dual_audience:
source: "Python file (sniffable)"
audiences:
human:
entry_point: "--help"
sees: "CLI usage, arguments, examples"
llm:
entry_point: "first 50 lines"
sees: "docstring, imports, constants, CLI tree"
convergence: "Same source of truth — no duplication, no drift"
DRY Principle
The CLI decorators ARE the documentation:
@click.option('--verbose', '-v', is_flag=True, help='Show details')
This single line defines:
- The flag name (
--verbose) - The short form (
-v) - The type (boolean flag)
- The help text
- The Python parameter name and type
No duplication. No drift. One source.
Why Syntax Compression Fails
Some argue for compressing syntax to save tokens — dense symbols, sigils, minimal keywords. This is the wrong optimization.
Perl is the cautionary tale. Its obsessive fetish for compact syntax, sigils, punctuation, and performative TMTOWTDI one-liners — to the point of looking like line noise — is exactly why it's no longer relevant for LLM comprehension and generation.
| Approach | Tokens | Comprehension | Training Data |
|---|---|---|---|
| Dense novel syntax | Fewer | Low (unfamiliar) | Minimal |
| Sniffable Python | More |
Установить sniffable-python в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
read_filewrite_fileВложенные файлы
FAQ
Что делает скилл sniffable-python?
Structure Python so LLMs can understand it in 50 lines.
Как установить скилл sniffable-python?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sniffable-python запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic