Back to .md Directory

AI Usage Best Practices Plan

Outlines a plan to use AI productively in development, with guardrails against duplication and over-reliance.

May 2, 2026
0 downloads
1 views
ai prompt claude guardrails
View source

What this file does

Outlines a plan to use AI productively in development, with guardrails against duplication and over-reliance.

When to use it

  • Adopting AI coding assistants and want to avoid common pitfalls
  • Setting up CI checks for code duplication
  • Creating team guidelines for when to use AI
  • Building a prompt library for repetitive tasks

Assumes this stack

jscpdESLintHuskylint-staged

AI Usage Best Practices Plan

Goal

Position as a developer who uses AI thoughtfully—maximizing productivity while avoiding common pitfalls like code duplication and over-reliance.

Current State

  • CLAUDE.md with project constraints
  • Explicit anti-patterns defined
  • CI guardrails for duplication (in progress)

Implementation Roadmap

1. CI Duplication Detection

Problem: AI tends to generate similar code rather than reuse existing abstractions.

Solutions:

  • Add jscpd to CI pipeline for copy-paste detection
  • Configure thresholds: fail on >5% duplication
  • Add custom ESLint rules for project-specific patterns
npm install -D jscpd

3. Pre-commit AI Review Hook

Checks to implement:

  • Bundle size delta
  • New dependencies added
  • Duplicate utility detection
  • Naming convention violations

Tool options:

  • Husky + custom scripts
  • lint-staged with custom functions

4. Scoped Usage Guidelines

Document when AI helps vs hurts:

TaskAI RecommendedWhy
Boilerplate (types, tests)YesRepetitive, low risk
State managementNoRequires domain context
Styling/layoutYesFollows patterns
Business logicNoNeeds human judgment
RefactoringPartialGood for suggestions, review manually
Code reviewYesCatches patterns linters miss

5. Prompt Library

Create reusable prompts for common tasks:

/prompts
  component-scaffold.md
  test-generation.md
  pr-review.md
  refactor-check.md

Each prompt should include:

  • Context requirements
  • Expected output format
  • Quality checks to apply after

6. AI-Assisted PR Review Checklist

Use AI to check:

  • Does this duplicate existing utilities?
  • Are naming conventions consistent?
  • Could this be simplified?
  • Are there abstraction opportunities?

Do NOT use AI to check:

  • Business logic correctness
  • Security implications
  • Performance in production context

Metrics to Track

  • Duplication percentage over time
  • PR review turnaround
  • Bugs introduced in AI-assisted vs manual code
  • Bundle size trends

Talking Points for Marketing

  1. "I use AI as a force multiplier, not a replacement for judgment"
  2. "I've built guardrails that catch AI's common failure modes"
  3. "I document when AI helps and when it hurts—that's the skill"
  4. "AI is great at patterns, humans are great at context"

Next Actions

  1. Set up jscpd in CI
  2. Create prompt library folder
  3. Document team's scoped usage guidelines
  4. Add pre-commit hook for bundle size check

What's inside

6 roadmap sections, 1 table, 1 folder structure, 1 checklist, 1 metrics list, 4 talking points

Change this for your project

  • Replace jscpd duplication threshold 5% with your team's acceptable limit
  • Replace /prompts folder structure with your own prompt storage path

Where it goes

Keep alongside your test suite. Used to define and score model evaluations.

Worth borrowing

  • Scoped usage guidelines table distinguishing AI-suitable from human-only tasks
  • Prompt library with context, output format, and quality checks

Related Documents