Coding Guidelines
by @benzooku
Apply AI-assisted coding best practices when helping with programming tasks. Use when (1) the user asks for help writing, refactoring, debugging, or architec...
clawhub install coding-guidelinesπ About This Skill
name: ai-coding-guide description: "Apply AI-assisted coding best practices when helping with programming tasks. Use when (1) the user asks for help writing, refactoring, debugging, or architecting code, (2) the user request is too vague or too detailed and needs shaping into an effective AI coding prompt, (3) planning multi-file or complex coding work that benefits from subagent orchestration, (4) the user asks about how to use AI coding tools effectively. Triggers on coding tasks, code reviews, architecture discussions, and requests involving AI coding workflows."
AI Coding Guide
Apply context engineering principles to every coding interaction. Guide the user toward effective collaboration β not just code output.
Core Principles
1. Context is finite β minimize tokens, maximize signal 2. Plan before execute β outline approach before writing code 3. Specific constraints over vague goals β "don't break tests" beats "make it good" 4. Review output like a junior dev's PR β AI code *looks* right more than it *is* right
Handling User Prompts
When the prompt is too vague
Recognize vague signals: "make it better", "fix this", "add auth", "refactor the code", one-liners without context.
Do not guess. Ask focused clarifying questions (max 3-4):
1. What β "What specifically should change? What's the end state?" 2. Why β "What problem are you solving? What's broken or missing?" 3. Constraints β "Any tech stack limits, existing patterns to follow, things I must not break?" 4. Scope β "Is this a quick fix or a rework? How many files/modules are involved?"
Example response to a vague prompt: > "I can help with auth β before I dive in, a few quick ones: are we talking email/password, OAuth, or both? And is this a greenfield add or fitting into an existing user system?"
If the task is small and the vague direction is clear enough, just do it. Don't over-clarify simple things like "add a loading spinner" or "fix the typo in line 42."
When the prompt is too detailed
Recognize over-specification: micromanaging the implementation, specifying every variable name, dictating control flow, listing steps that the model can figure out.
Acknowledge the detail, then extract intent:
> "Got it β sounds like the goal is [restate the actual intent in one sentence]. I'll follow your constraints on [X, Y, Z] but I might adjust the implementation details if I find a cleaner approach. Cool?"
Don't be a contrarian about it. If they specified every step, they probably have a reason (past bad experiences, specific architecture). Follow their structure but flag if something seems off.
Red flag: If the prompt is 500+ words of step-by-step instructions, ask "Is this a spec you've already validated, or should I suggest alternatives too?" β some people paste specs, others are micromanaging from anxiety.
The "Goldilocks prompt" target
Aim for prompts that include:
Context Management for Coding Tasks
Before starting non-trivial work
1. Read relevant files first β understand the codebase before proposing changes 2. Identify the minimum context β only load files that matter for THIS task 3. Check for existing patterns β how does this codebase handle similar things?
During execution
git commit between logical steps so changes are recoverableContext to always include
Context to exclude
Subagent Use for Coding
When to spawn subagents
When NOT to spawn subagents
Subagent guidelines
Planning Workflow
For any task touching 2+ files or involving architectural decisions:
1. Understand β Read relevant code, clarify requirements 2. Plan β Write a brief plan (3-7 steps max). State what files change and why. 3. Review β Get user approval before executing 4. Execute β Implement step by step, committing between steps 5. Verify β Run tests, check edge cases, review the diff
For simple tasks (single file, clear intent): skip planning, just do it.
Anti-Patterns to Avoid
Quick Reference: Prompt Quality Checklist
Before executing a coding task, mentally check: