Skip to content
Back to skills

Rag Code Gen

ASecurity

RAG-grounded code generation with source citations. Triggers on: grounded code, ground this, cite sources, show me with sources, how do I with attune, reference attune docs, grounded against attune docs.

  • 11 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 2, 2026
ai-agentsgogitapisecurity

Works with

  • cli
  • api
  • mcp

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 2, 2026

npx -y skills add Smart-AI-Memory/attune-ai --skill rag-code-gen --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rag Code Gen?

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

Security grade badge for Rag Code Gen
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/smart-ai-memory-rag-code-gen-attune-ai/badge)](https://www.skillsdirectory.com/skills/smart-ai-memory-rag-code-gen-attune-ai)

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
---
name: rag-code-gen
description: "RAG-grounded code generation with source citations. Triggers on: grounded code, ground this, cite sources, show me with sources, how do I with attune, reference attune docs, grounded against attune docs."
argument-hint: "<what you want generated + any specifics>"
---

# 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:

1. **What are you trying to produce?** Code, config,
   explanation, or a mix?
2. **Any specific attune surface?** e.g. "the
   security-audit workflow", "MCP tool pattern", "BaseWorkflow
   subclass". Helps retrieval hit the right concept file.
3. **Depth?** Default is `standard`. `quick` saves time
   and budget for simple asks; `deep` is 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` / `deep`
- `feedback` — pass `good` or `bad` AFTER inspecting the
  output to record a verdict against every cited template
- `model` — override the generator model if you need to

## Output shape

`WorkflowResult.final_output` is a string with two parts:

1. The generated code / explanation
2. A `## Sources` section listing each cited
   `attune-help` template 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.

## If the extra isn't installed

The workflow returns a structured error pointing at
`pip install attune-rag` (a core dep — missing means a broken
install). No exception propagates.

## See also

- [docs/rag/index.md](../../docs/rag/index.md) — full
  walkthrough including the standalone attune-rag usage
- [attune-rag on PyPI](https://pypi.org/project/attune-rag/)
- [Embeddings decision record](../../docs/rag/embeddings-decision-2026-04-17.md)

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

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