llm-feature-design
Skill1 starsChanged 6 months agoMITView on GitHub
Design LLM-powered features that survive production - model choice, prompt structure, structured output, fallbacks, cost control, evals, and guardrails. Use when the user wants to add AI/LLM functionality to a product, asks about prompt design, RAG, agent features, handling model failures, or evaluating LLM output quality.
In this repository50 other files it gives its agents.
- accessibility-reviewSkill
- adr-authorSkill
- api-designSkill
- architecture-reviewSkill
- caching-strategySkill
- changelogSkill
- ci-cd-pipelineSkill
- codebase-explorationSkill
- code-reviewSkill
- code-style-guideSkill
- context-engineeringSkill
- conventional-commitsSkill
- cost-optimizationSkill
- database-migrationSkill
- data-privacy-reviewSkill
- debuggingSkill
- dependency-updateSkill
- deprecation-migrationSkill
- error-handlingSkill
- feature-flag-rolloutSkill
- filament-resource-designSkill
- flux-ui-patternsSkill
- git-workflowSkill
- i18n-reviewSkill
- idea-refineSkill
- incident-responseSkill
- incremental-implementationSkill
- inertia-patternsSkill
- laravel-ai-featuresSkill
- laravel-eloquent-performanceSkill
- laravel-queue-designSkill
- laravel-testingSkill
- livewire-component-designSkill
- observabilitySkill
- onboarding-docSkill
- performance-budgetSkill
- pr-descriptionSkill
- primevue-patternsSkill
- refactoringSkill
- release-checklistSkill
- resilience-patternsSkill
- runbook-authorSkill
- security-auditSkill
- spec-writingSkill
- task-breakdownSkill
- tech-debt-triageSkill
- test-writingSkill
- threat-modelingSkill
- using-elyra-skillsSkill
- vue-component-patternsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
LLM last: If regex, SQL, or a rules engine solves it, use that.
- Distinctive: line 37
Could this be done without an LLM?: Write down why not.
- Distinctive: line 53
Put variable user content in clearly delimited sections.
- Distinctive: line 67
Run evals on every prompt/model change — this is your regression suite
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LLM Feature Design
An LLM feature is a probabilistic component inside a deterministic system. Design for the 5% of calls that go wrong, not the demo that went right.
When to use
- "Add an AI feature that…" (summarize, classify, extract, generate, chat)
- Choosing between models, or between LLM and non-LLM solutions
- "The prompt works sometimes" / output quality is inconsistent
- Reviewing an LLM integration before launch
Principles
- LLM last. If regex, SQL, or a rules engine solves it, use that. LLMs buy flexibility at the cost of latency, money, and nondeterminism.
- Structured in, structured out. Free-text responses parsed with string-splitting is a production incident on a timer. Use schemas/tool calls.
- The prompt is code. Versioned, reviewed, tested — never edited live in a dashboard.
- No evals, no iteration. Without a measured baseline, every prompt "improvement" is a coin flip.
Process
1. Frame the task
- What's the exact job? (classify into N labels ≠ summarize ≠ extract fields ≠ open generation)
- What does failure cost? Wrong label in an internal tool vs wrong refund amount to a customer → very different designs
- Could this be done without an LLM? Write down why not.
2. Choose the shape
| Task | Shape |
| Classification / extraction | Single call, structured output (JSON schema / tool call), low temperature |
| Summarization / rewriting | Single call, length + style constraints in prompt |
| Q&A over own data | RAG: retrieve → ground → answer with citations |
| Multi-step with side effects | Agent with tools — only if a fixed pipeline truly can't work |
Pick the smallest model that passes your evals; upgrade on evidence, not vibes.
3. Design the prompt
- Structure: role → task → constraints → examples (few-shot) → input
- Put variable user content in clearly delimited sections; treat it as untrusted (prompt injection)
- Specify the output schema and the failure behavior: "If the answer is not in the context, return
null" — give the model an out, or it will invent one
4. Engineer the failure paths
- Validation: parse + schema-check every response; on failure → one retry with the error fed back, then fallback
- Fallback: deterministic default, cached previous result, degraded UX, or human handoff — never a raw stack trace
- Timeouts + budgets: max tokens, max retries, max $/request; rate-limit per user
- Idempotency for anything with side effects
5. Build evals before shipping
- Collect 20–100 representative inputs (include the ugly ones) with expected outputs
- Score automatically where possible (exact match, schema validity, contains-citation); LLM-as-judge for fuzzy quality, spot-checked by humans
- Run evals on every prompt/model change — this is your regression suite
6. Guardrails & ops
- Input: size limits, injection screening for high-stakes actions
- Output: PII/unsafe-content filtering where relevant; citations required for factual claims from RAG
- Log prompt version, model, latency, token cost per call; alert on error-rate and cost anomalies
- Plan for model deprecation: pinned model versions + eval suite = safe upgrades
Output format
## LLM feature: <name>
**Task:** … **Why LLM:** …
**Shape:** single call / RAG / agent. **Model:** … (smallest that passes evals)
### Prompt contract
Input: … → Output schema: … → On unanswerable: …
### Failure handling
| Failure | Behavior |
|---------|----------|
| Invalid output | retry ×1 w/ error → fallback: … |
| Timeout | … |
### Evals
Dataset: N cases. Metrics: … Baseline: …%
### Cost & limits
~$/request, max tokens, rate limit.Anti-patterns
- ❌ Shipping on "it worked in the playground" with zero evals
- ❌ Parsing free-text output with regex instead of demanding structured output
- ❌ No "I don't know" path — forcing the model to always answer manufactures hallucinations
- ❌ User input concatenated raw into the prompt for a feature with side effects
- ❌ Defaulting to the biggest model without testing a smaller one
- ❌ Prompt edited in production with no version history
- ❌ Unbounded loops in agents — no max iterations, no budget
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

