Get better results from AI coding assistants when building with OnchainKit. Whether you’re using Cursor, GitHub Copilot, or other AI tools, these techniques will improve your workflow.Documentation Index
Fetch the complete documentation index at: https://base-a060aa97-pat-schemav2-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Understanding Context Windows
Why Context Matters
AI coding assistants have a “context window” - the amount of text they can process at once. Think of it as working memory:- Most assistants process thousands of tokens (roughly 4-5 words per token)
- Everything you share consumes this limited space
- Once full, older conversation parts may be lost
Optimizing for Context Windows
Optimize for context windows:- Share relevant info first - Most important details upfront
- Skip unnecessary content - Avoid irrelevant code or docs
- Structure requests clearly - Use sections and formatting
- Reference smartly - Share only relevant files for large codebases
Setting Up AI Tools
Cursor Rules
Cursor Rules provide consistent context to help AI understand your codebase better.- Open Command Palette:
Cmd + Shift + P(Mac) orCtrl + Shift + P(Windows/Linux) - Search “Cursor Rules” and create/edit rules
- Add project-specific rules:
- Save to apply rules to AI suggestions
OnchainKit Projects
Create a new OnchainKit project:Creating Project Documentation
A project instructions file helps AI understand your codebase. Create this early and update regularly. Instructions.md prompt:For architecture planning and complex design decisions, use reasoning-focused AI models. They excel at analyzing tradeoffs, edge cases, and long-term planning.
Effective Prompting Strategies
Be Specific
AI tools respond best to clear, direct instructions. ❌ “Help me with my code” ✅ “Refactor this authentication function to use async/await instead of nested then() calls”Provide Context
Template:Iterate
Start simple and refine rather than trying to get everything perfect at once. Template:Working with OnchainKit
Using Documentation
Reference OnchainKit documentation directly in your prompts:- Browse OnchainKit docs
- Find your component
- Reference the docs URL in your prompt
Component Integration
Token balance example:Debugging with AI
Debugging Prompts
Bug analysis template:When Stuck
Clarification template:Advanced Techniques
-
Step-by-step reasoning
-
Format specification
-
Length guidance
-
Clarify ambiguities
Best Practices
- Understand context limitations - AI has finite memory, prioritize important info
- Provide relevant context - Share code, errors, and project details that matter
- Be specific - Clear instructions beat vague questions
- Break down complex tasks - Iterative approaches work better
- Request explanations - Ask AI to explain generated code you don’t understand
- Use clear formatting - Structure prompts with sections
- Reference docs - Include OnchainKit documentation links
- Test and validate - Always review AI-generated code before implementing
- Build on context - Reference earlier conversation parts when iterating
- Provide feedback - Tell AI what worked and what didn’t