1mangesh1/dev-skills-collection/ai-prompting
Claude Code and agent skill by 1mangesh1/dev-skills-collection
- community
Checking that the SKILL.md file is still in the repository.
Practical prompt engineering patterns for developers working with LLMs. Use when user asks about writing prompts, system prompts, few-shot examples, chain-of-thought, structured output from LLMs, context window management, tool calling prompts, prompt templates, code generation prompts, debugging with AI, prompt testing, token optimization, JSON mode, XML tags in prompts, model-specific prompting for Claude/GPT/Gemini, instruction hierarchies, prompt compression, jailbreaking mitigation, output validation, semantic search in prompts, or any prompt design, optimization, testing, or engineering task.
Install
npx vskill@latest install 1mangesh1/dev-skills-collection/ai-promptingSKILL.md
Practical Prompt Engineering for Developers
Patterns and techniques that work in production. Focused on Claude, GPT, and Gemini.
1. System Prompts
System prompts set the foundation. Structure them in this order:
Effective Role Definition
Why this works: specific expertise, bounded scope, version-pinned context.
Constraints That Actually Constrain
Bad: "Be careful with your responses." Good: "Never suggest DROP TABLE without a WHERE clause example. Always include EXPLAIN ANALYZE output when recommending index changes. If you are unsure about version compatibility, say so explicitly."
Constraints should be concrete, testable, and tied to specific failure modes you have observed.
Structuring Long System Prompts
For complex agents, use sections with clear headers:
2. Few-Shot Examples
Few-shot prompting gives the model concrete input-output pairs to learn from.
When to Use Few-Shot
- Output format is unusual or specific to your domain
- Classification tasks with custom categories
- Transformation tasks where the rules are easier to show than describe
- The model keeps getting the format wrong with instructions alone
Formatting Pattern
Rules for Good Examples
- Use 2-5 examples. More than 5 rarely helps and wastes tokens.
- Cover edge cases in your examples, not just the happy path.
- Order examples from simple to complex.
- Keep example formatting identical -- the model replicates inconsistencies too.
- If the task has categories, include at least one example per category.
Negative Examples
When the model produces a common wrong output, show it:
3. Chain-of-Thought Prompting
Asking the model to reason step by step improves accuracy on logic, math, multi-step problems, and debugging.
Basic Pattern
When Chain-of-Thought Helps
- Debugging (trace through execution flow)
- Code review (systematic checklist)
- Architecture decisions (evaluate tradeoffs)
- Data analysis (verify each calculation)
When to Skip It
- Simple lookup or recall tasks
- Formatting or translation where reasoning adds nothing
- When you need low latency and the answer is straightforward
Hiding Reasoning from End Users
If you are building a user-facing app, put the reasoning in a structured block and extract only the final answer:
4. Structured Output
JSON Mode
Most APIs support JSON mode. Use it with a schema definition:
Tips for reliable JSON output:
- Provide the exact field names and types
- Use enum values with pipes for constrained fields
- Include a brief comment for ambiguous fields
- For arrays, show the schema of one element
XML Tags for Structure
XML tags work well for mixing structured and unstructured content:
Claude in particular handles XML tags reliably for parsing sections of a response.
Markdown for Human-Readable Output
When output will be shown to users or rendered in a UI:
5. Context Window Management
What to Include (Priority Order)
- System prompt and instructions (always)
- Directly relevant code or data (the thing being analyzed)
- Type definitions, interfaces, schemas referenced by the code
- Related files that provide necessary context
- Conversation history (recent turns most important)
- Background documentation (lowest priority)
Ordering Within the Context
- Place instructions at the beginning and reiterate critical ones at the end
- Put the most important context closest to the instructions
- For long documents, summarize early sections and include full text
of the sections the model needs to act on
- Recent conversation turns matter more than older ones
Truncation Strategies
When hitting context limits:
- Summarize older conversation turns instead of dropping them
- Include function signatures without implementations for reference files
- Strip comments and docstrings from code context if space is tight
- Use file paths and line numbers as references instead of pasting full files
- Chunk large files and process them in multiple passes
Token Budgeting
Rough allocation for a typical coding task:
- System prompt: 5-10% of context
- Code under review: 20-40%
- Supporting context (types, related files): 15-25%
- Conversation history: 10-20%
- Reserve for model output: 15-25%
6. Tool and Function Calling Prompts
Describing Tools Clearly
Keys to Good Tool Descriptions
- State what the tool does and what it returns
- Explain when to use it and when NOT to use it
- Provide example parameter values
- Document edge cases ("returns empty array if no matches")
- Keep descriptions under 200 words -- models skim long descriptions
Guiding Tool Selection
In the system prompt, add routing hints:
7. Prompt Templates
Variable Substitution
{{code}}
Conditional Sections
Template Best Practices
- Keep variables descriptive:
{{user_query}}not{{q}} - Set defaults for optional variables
- Validate that required variables are non-empty before sending
- Version your prompt templates -- small wording changes affect output
8. Common Patterns
Code Generation
Code Review
Debugging
Documentation
Data Extraction
9. Anti-Patterns
Vague Instructions
Bad: "Make this code better." Good: "Reduce the time complexity of this function from O(n^2) to O(n log n) while maintaining the same output format."
Conflicting Constraints
Bad: "Be thorough and detailed. Keep your response under 50 words." The model will oscillate or ignore one constraint. Pick one or specify which takes priority.
Over-Constraining
Bad: "Use exactly 3 paragraphs, each with exactly 4 sentences, starting with a verb, using only present tense." This burns model capacity on format compliance instead of content quality.
Prompt Injection Vulnerability
If your prompt includes user input, separate it clearly:
Assuming Context Persistence
Each API call is stateless. Do not assume the model remembers previous conversations unless you include them in the context. Chat UIs handle this automatically, but API integrations must manage history explicitly.
10. Testing Prompts
A/B Comparison
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ai-prompting/SKILL.md
Popularity
- Repository stars
- 3
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 7 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/1mangesh1/dev-skills-collection/ai-prompting)