Skip to content

Commit 1c51bd2

Browse files
committed
update skill template
1 parent 3c6b7e1 commit 1c51bd2

1 file changed

Lines changed: 64 additions & 3 deletions

File tree

python/src/cairo_coder/dspy/generation_program.py

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,76 @@ class StarknetEcosystemGeneration(Signature):
154154

155155
class SkillGeneration(Signature):
156156
"""
157-
Synthesize retrieved documentation into a SKILL.md file for Claude Code.
157+
Synthesize retrieved documentation into a SKILL.md file for LLM.
158+
159+
Skills are modular, self-contained packages that extend LLM's capabilities by providing
160+
specialized knowledge, workflows, and tools. They transform LLMs from a general-purpose
161+
agent into a specialized agent equipped with procedural knowledge.
162+
163+
**Core Principles:**
164+
165+
1. **Concise is Key.** The context window is a public good. Only add context LLM doesn't
166+
already have. Challenge each piece of information: "Does LLM really need this?" and
167+
"Does this paragraph justify its token cost?" Prefer concise examples over verbose
168+
explanations.
169+
170+
2. **Set Appropriate Degrees of Freedom.** Match specificity to fragility:
171+
- High freedom (text instructions): when multiple approaches are valid.
172+
- Medium freedom (pseudocode/scripts with parameters): when a preferred pattern exists.
173+
- Low freedom (specific scripts, few parameters): when operations are fragile and
174+
consistency is critical.
175+
176+
3. **Progressive Disclosure.** Keep SKILL.md body under 500 lines. Split into separate
177+
reference files when approaching this limit. Reference files from SKILL.md and describe
178+
clearly when to read them.
179+
180+
**SKILL.md Structure:**
181+
182+
The output MUST follow this exact structure:
183+
184+
1. YAML Frontmatter (required):
185+
- `name`: The skill name (kebab-case).
186+
- `description`: Primary triggering mechanism. Include BOTH what the skill does AND
187+
specific triggers/contexts for when to use it. All "when to use" information goes here,
188+
NOT in the body. Example: "Cairo smart contract development patterns and best practices.
189+
Use when writing, reviewing, or debugging Cairo contracts for: (1) Storage patterns,
190+
(2) Event emission, (3) Interface design, (4) Testing patterns."
191+
192+
2. Markdown Body (required):
193+
- Use imperative/infinitive form throughout.
194+
- Include actionable instructions LLM can follow, not generic explanations.
195+
- For multi-step processes, break into clear sequential steps.
196+
- For branching logic, use conditional workflows with decision points.
197+
- When output quality depends on examples, provide input/output pairs.
198+
- For strict output requirements, provide exact templates.
199+
- For flexible guidance, provide sensible defaults with adaptation notes.
200+
201+
**What NOT to Include:**
202+
- Information LLM already knows (general programming knowledge).
203+
- "When to use this skill" sections in the body (put in frontmatter description).
204+
- README, CHANGELOG, or other auxiliary documentation files.
205+
- Setup/installation procedures (skills are for AI agents, not humans).
206+
207+
**Quality Checklist:**
208+
- Every instruction is actionable by another LLM instance.
209+
- Domain-specific details and procedural knowledge are included.
210+
- Examples demonstrate desired style and level of detail.
211+
- References to bundled resources (scripts/, references/, assets/) are clear about when to
212+
read them.
158213
"""
159214

160215
query: str = InputField(desc="Original user request the skill should address")
161216
context: str = InputField(
162-
desc="Retrieved documentation context used to build the skill instructions"
217+
desc="Retrieved documentation context used to build the skill instructions. "
218+
"Extract actionable patterns, code examples, and domain-specific knowledge from this "
219+
"context to embed in the skill."
163220
)
164221
skill: str = OutputField(
165-
desc="A complete SKILL.md file with YAML frontmatter (name, description) and actionable markdown instructions"
222+
desc="A complete SKILL.md file. Must start with YAML frontmatter (--- delimited) "
223+
"containing `name` (kebab-case) and `description` (comprehensive trigger description "
224+
"including what it does and when to use it). Followed by markdown body with imperative "
225+
"instructions, concise examples, and actionable guidance. Under 500 lines. "
226+
"No auxiliary files or generic explanations."
166227
)
167228

168229
class GenerationProgram(dspy.Module):

0 commit comments

Comments
 (0)