惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
H
Hackread – Cybersecurity News, Data Breaches, AI and More
WordPress大学
WordPress大学
博客园_首页
美团技术团队
H
Help Net Security
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
J
Java Code Geeks
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog
雷峰网
雷峰网
爱范儿
爱范儿

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
AI code you can't reuse isn't worth the token bill or the...
Dave Kurian · 2026-06-05 · via DEV Community

Most code generated by AI tools is as disposable as a rental. You pay for the output, but you rarely trust—or reuse—it. That's a problem nobody talks about until the bill, or the bug, lands.

The real bottleneck isn't the model. It's whether you own your code, or just rent it for a while.

AI-generated code is usually throwaway

In "Slow Down, Master, Monitor: Coding with Claude Code", the author admits: "most of it is just like a ship that floats—I don't know how far it can go because I just bought it." This is the default outcome for most AI-coded projects. You get working code, but it's not something you'd stake your production on—or even trust to run twice.

Here's a common pattern:

// Claude gives you this:
function fetchData(url) {
 return fetch(url).then(res => res.json());
}
// It works, until you need error handling, retries, or to run it in Node.

Enter fullscreen mode Exit fullscreen mode

You copy, paste, and move on. But next time, you start from scratch—or pay the model again.

The code is not modular, not typed, and not documented. It exists outside your normal review process. No one on the team “owns” it, so no one improves it. You get a one-off solution that’s hard to trust and harder to maintain.

Takeaway: If you can't reuse it, you're not building; you're renting.

Unowned code means unfixable code

AI agents rarely deliver code with tests, context, or clear ownership. When something breaks, you don't debug—you regenerate. This is expensive, and it erases any local improvements you've made.

Example: You get an AI-generated React component. It works in isolation, but not in your design system. You patch it, but the next prompt blows away your edits.

// AI output:
<Button label="Click me" /> // Not your design system's API

// Your system:
<MyButton variant="primary" onClick={handleClick}>Click me</MyButton>

Enter fullscreen mode Exit fullscreen mode

If you regenerate, you lose your customizations. If you try to merge, you’re hand-editing code you don’t trust. This cycle repeats until the “AI helper” becomes a liability.

Ownership matters for debugging, refactoring, and onboarding. If no one claims the code, technical debt grows.

Takeaway: Code you don't own is code you can't fix—at least, not for long.

The token-cost spiral is real

Every time you regenerate, you pay. If your context window is full of throwaway code, your costs spiral and your output gets worse—hallucinations, missed context, duplicated bugs.

A real bill: 50 generations at 17¢ each is $8.50 for a single file. Multiply by 10 files, then again when you debug or refactor.

It gets worse with larger models and longer prompts. If you ask for “a full CRUD API with tests,” you’re paying for every token—even the boilerplate you’ll throw away.

Worse, each regeneration means starting over. You lose context from previous iterations and any fixes you applied. Bugs often reappear, and subtle regressions slip through.

# Prompt 1: $0.17 - Initial code
# Prompt 2: $0.17 - Add error handling
# Prompt 3: $0.17 - Convert to TypeScript
# Prompt 4: $0.17 - Add tests
# Prompt 5: $0.17 - Integrate with API
# Total: $0.85 (for one function, not counting retries)

Enter fullscreen mode Exit fullscreen mode

This is not a sustainable workflow at scale.

Takeaway: The less you reuse, the more you pay—for less reliable code.

Reuse starts with code you control

Reusable code is testable, typed, and lives in your repo—not just in prompt history. That means:

  • Real exports, not pastes
  • Typed interfaces
  • Clear dependencies
  • Tests you actually run

For example:

// In your shared/utils.ts
export async function fetchJson<T>(url: string): Promise<T> {
 const res = await fetch(url);
 if (!res.ok) throw new Error(res.statusText);
 return res.json();
}
// Now every feature reuses the same function, and you can improve it once.

Enter fullscreen mode Exit fullscreen mode

Compare that to the AI-generated copy-paste, which you can’t update globally.

Reusable code is also code you can lint, document, and version. You can review it in PRs and run it through CI/CD. If it breaks, you can write a regression test.

Takeaway: Reusable code is code you own, test, and improve—not code you rent from an LLM.

Contextless code is hard to integrate

AI-generated code often lacks project context: your environment variables, your APIs, your conventions. It’s generic by design, so it fits nowhere perfectly.

Example: You prompt for a Python script to upload files to S3. The AI gives you:

import boto3

def upload_file(file_name, bucket):
 s3 = boto3.client('s3')
 s3.upload_file(file_name, bucket, file_name)

Enter fullscreen mode Exit fullscreen mode

But your org uses environment-based credentials, a custom logging wrapper, and a different bucket naming convention. You now spend more time adapting the code than writing it yourself.

Integration costs compound:

  • Missing config: No .env support
  • Logging: No hooks for your logger
  • Error handling: No retry logic
  • Permissions: No IAM role awareness

You end up with a patchwork of “AI snippets” that don’t talk to each other—or to the rest of your stack.

Takeaway: Code that ignores your context is code that costs more to integrate than to write.

Honest options for code you can keep

Some tools try to bridge the gap between throwaway and real code:

  • Claude Code and Cursor can work in your repo, but only if you enforce context and review every change.
  • v0 and Lovable let you export, but the output is often generic and context-blind.
  • OTF (Open Template Forest) offers MIT-licensed SDKs and paid kits: real, cross-platform components you own, not just rent—and you get the whole repo, not a zip file.

The real test: Can you pull the code into your repo, run your linter, and ship it with confidence? If not, it’s still “rented” code.

Takeaway: The best tool is the one that gives you code you can actually keep, edit, and ship.

Shipping to production means owning the risk

Renting code works for demos, but production is different. You need to:

  • Write tests
  • Enforce style guides
  • Maintain upgrade paths
  • Handle edge cases

None of this comes for free with AI code. You have to integrate, own, and maintain it—or you risk silent failures, security issues, and expensive rewrites.

For example, shipping code without tests is an invitation for regressions. Relying on “AI-generated” logic for auth, payments, or security-critical paths is a risk no senior engineer should accept without a full review.

If you don’t own the code, you can’t patch a zero-day, refactor for a major version upgrade, or onboard a new teammate with confidence.

Takeaway: If you can't ship it and support it, you're still stuck in the prototype phase.

Try-before-buy beats throwaway generations

The only way to know if code is reusable: treat it as yours from the start. Clone the repo. Run the tests. Change the API. If you can't, it's not yours—no matter how good the demo looks.

If a tool only gives you code in a chat window or a zip file, ask: Can I run my linter? Can I add tests? Can I diff changes over time?

Reusable code isn’t just about the code itself—it’s about the workflow. If you can’t run git blame, if you can’t see a changelog, if you can’t patch and merge, you’re still in “throwaway” territory.

Takeaway: You should never pay (in tokens or time) for code you can't test, edit, and keep.

The bottleneck isn't the AI—it's code you can't own

The model isn’t your bottleneck. Your ability to own, reuse, and trust the code is. Stop renting code from a tool that won’t follow you to production. Build with code you control.

Reusable, owned code is the only code worth paying for—anything less is just a demo with a ticking bill.