Borrowing it
Nothing to install: this file belongs to Smart-AI-Memory/attune-ai. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Smart-AI-Memory/attune-ai/main/.agents/skills/rag-code-gen/SKILL.mdgit clone --depth 1 https://github.com/Smart-AI-Memory/attune-aiWrote 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.
[](https://agentmods.dev/skills/smart-ai-memory/attune-ai/rag-code-gen)<a href="https://agentmods.dev/skills/smart-ai-memory/attune-ai/rag-code-gen"><img src="https://agentmods.dev/badge/skills/smart-ai-memory/attune-ai/rag-code-gen/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.
<a href="https://agentmods.dev/skills/smart-ai-memory/attune-ai/rag-code-gen"><img src="https://agentmods.dev/badge/skills/smart-ai-memory/attune-ai/rag-code-gen.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.00715 |
| Opus 5.5 | $0.00020 | $0.00286 |
| Sonnet 5.5 | $0.00010 | $0.00143 |
| Haiku 4.5 | $0.00005 | $0.00072 |
Grade A, and why
rag-code-gen 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.
RAG-grounded code generation
attune-rag ships with attune-ai core (pip install attune-ai).
Grounds code generation in the attune-help template corpus
so outputs cite real APIs, workflow names, and patterns
instead of hallucinating them. Every output ends with a
## Sources block of clickable citations.
Scoping
Before running, ask:
- What are you trying to produce? Code, config, explanation, or a mix?
- Any specific attune surface? e.g. "the security-audit workflow", "MCP tool pattern", "BaseWorkflow subclass". Helps retrieval hit the right concept file.
- Depth? Default is
standard.quicksaves time and budget for simple asks;deepis for complex multi-file or architectural questions.
Running
attune workflow run rag-code-gen \
--input '{"query": "<the request>"}'
Optional inputs:
k— max grounding docs to retrieve (default 3)depth—quick/standard/deepfeedback— passgoodorbadAFTER inspecting the output to record a verdict against every cited templatemodel— override the generator model if you need to
Output shape
WorkflowResult.final_output is a string with two parts:
- The generated code / explanation
- A
## Sourcessection listing each citedattune-helptemplate with its category, retrieval score, and a clickable link to the source on GitHub
WorkflowResult.metadata carries the full citation dict
(query, retriever_name, retrieved_at, hits[]) plus
fallback_used and confidence so callers can make
routing decisions.
When RAG doesn't help
If the retriever can't find relevant templates, the
workflow still runs — it falls back to an unaugmented
prompt that explicitly tells the model there is NO
grounding context so it should say "I don't know about
attune X" rather than invent. metadata.fallback_used is
True in that case.
Alternative: MCP tool only (no LLM call)
If you want just retrieval without generation, use the
rag_knowledge_query MCP tool directly. It returns hits +
an augmented prompt string without calling an LLM itself —
handy for routing decisions, agent planning, or feeding
another model.
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.
- 1mo ago First seen · 84 lines · 50 tokens per session scan A 4f24c3292354
rag-code-gen is a skill published in the GitHub repository Smart-AI-Memory/attune-ai (10 stars, last pushed today), licensed Apache-2.0. It adds 50 tokens to every session and 715 once invoked, about $0.0002 per session on Opus 5.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-31.
Other skills, from other repositories
oracle
Designing and evaluating AI/ML systems: prompt engineering, RAG design, LLM application patterns, AI safety, evaluation frameworks, MLOps, cost optimization. Use for AI pipelines or eval harnesses.
seek
Designing search engines and vector DBs for full-text, vector, and hybrid retrieval, including permission-aware retrieval for multi-tenant or per-role corpora. Use for search design, index optimization, the RAG retrieval layer, or deciding where ACL filtering belongs in the query path.
svg-chart
Render data into a standalone SVG chart file — bar, line, or pie. Use when the user provides numbers (inline, JSON, or CSV) and asks for a chart, graph, plot, trend, comparison, breakdown, or any visual summary of the data. Produces a self-contained .svg viewable in any browser; no external libraries required.
mlx-serve
Hook an app, game or script up to the local mlx-serve server for LLM chat, embeddings, image, speech, music, sound effect, video and 3D generation, and Laya/Kev/Clef typed decisions, or make a whole film or music video on this Mac. Use when code should call mlx-serve or the user wants a video, song, pictures or game…
rag-vs-finetune-decision
The model-capability decision tree — prompt-engineering first, then RAG for missing knowledge, then fine-tuning for missing behavior/format or cost/latency, climbing only as far as needed. Covers the cost/latency/maintenance tradeoffs of each rung and when each is the wrong choice (especially the premature-fine-tune…
openrouter
OpenRouter unified AI API - Access 200+ LLMs through single interface with intelligent routing, streaming, cost optimization, and model fallbacks.