cocosearch-add-grammar

cocosearch-add-grammar is a skill for Claude Code from VioletCranberry/coco-search. It costs 57 tokens per session (3,666 once invoked), scanned A, original, MIT.

A guide for adding support for a domain-specific file format that uses an existing programming-language extension, such as GitHub Actions files written in YAML. It covers recognizing the format, extracting metadata, splitting content, testing, and registering the handler.

In plain words
What is it for?
Use it when extending CocoSearch with grammar support for formats such as GitHub Actions, Docker Compose, or other structured YAML-based files.
Why use it?
It provides a defined way to distinguish specialized file formats from ordinary files that share the same extension.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md.

Part of the cocosearch plugin — 12 skills shipped together

Good fit Use it when extending CocoSearch with grammar support for formats such as GitHub Actions, Docker Compose, or other structured YAML-based files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/violetcranberry/coco-search/cocosearch-add-grammar
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add VioletCranberry/coco-search --skill cocosearch-add-grammar
Clone the repo
git clone --depth 1 https://github.com/VioletCranberry/coco-search

Made for: Claude Code.

Or install cocosearch, the plugin that ships this one along with the rest of its 12 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cocosearch-add-grammar

README.md
[![agentmods](https://agentmods.dev/badge/skills/violetcranberry/coco-search/cocosearch-add-grammar/github.svg)](https://agentmods.dev/skills/violetcranberry/coco-search/cocosearch-add-grammar)
Your own site
<a href="https://agentmods.dev/skills/violetcranberry/coco-search/cocosearch-add-grammar"><img src="https://agentmods.dev/badge/skills/violetcranberry/coco-search/cocosearch-add-grammar/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cocosearch-add-grammar

Your own site · 80×15
<a href="https://agentmods.dev/skills/violetcranberry/coco-search/cocosearch-add-grammar"><img src="https://agentmods.dev/badge/skills/violetcranberry/coco-search/cocosearch-add-grammar.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,666 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.03666
Opus 5 $0.00028 $0.01833
Sonnet 5 $0.00011 $0.00733
Haiku 4.5 $0.00006 $0.00367

Measured 11d ago against content hash 3d243574251b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

cocosearch-add-grammar scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cocosearch-add-grammar/SKILL.md · 361 lines

How it starts

The opening of the file, as written. The whole thing — 361 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add Grammar Handler with CocoSearch

A structured workflow for adding a grammar handler to CocoSearch. Grammar handlers provide domain-specific chunking and metadata for files that share a base language extension but have distinct structure (e.g., GitHub Actions workflows are YAML files with a specific schema).

Philosophy: YamlGrammarBase handles the heavy lifting — matches(), extract_metadata(), comment stripping, and the fallback metadata chain are all inherited. Subclasses only implement _has_content_markers(content) for content validation and _extract_grammar_metadata(stripped, text) for grammar-specific metadata. Override matches() only for broad-pattern grammars that need mandatory content checks (like Kubernetes). This skill guides you through designing content validation and metadata extraction.

Reference: docs/adding-languages.md covers grammar handlers alongside language handlers. This skill is the dedicated deep-dive for grammars.

Step 1: Identify the Grammar

Parse the user's request to determine what's being added.

Extract from the request:

  • Grammar name: Lowercase hyphenated identifier (e.g., github-actions, docker-compose, ansible-playbook)
  • Base language: The language this grammar extends (e.g., yaml, json, toml)
  • File path patterns: Glob patterns matching file paths (e.g., .github/workflows/*.yml, docker-compose*.yml)
  • Content markers: Strings that distinguish this grammar from other files with the same extension (e.g., on: + jobs: for GitHub Actions, apiVersion: + kind: for Kubernetes)

Confirm with user: "I'll add a grammar handler for [grammar] (base: [language]) matching [patterns]. Let me find the best analog."

Step 2: Find the Best Analog

Choose the closest existing grammar handler based on the grammar type:

Grammar Type Analog Why
CI/CD pipeline (YAML) github_actions.py or gitlab_ci.py Jobs/stages/steps structure
Container orchestration (YAML) docker_compose.py or kubernetes.py Services/resources structure
Template (YAML/gotmpl) helm_template.py or helm_values.py Template directives + values
Kubernetes manifest (YAML) kubernetes.py Content-heavy matching with exclusions
Config values (YAML) helm_values.py Comment-based section markers

Read the full file on GitHub · 361 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 361 lines · 57 tokens per session scan A 3d243574251b

Subscribe to this mod's changes

cocosearch-add-grammar is a skill published in the GitHub repository VioletCranberry/coco-search (37 stars, last pushed today), licensed MIT. It adds 57 tokens to every session and 3,666 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.