{"slug": "three-commands-to-make-claude-code-stop-guessing-your-infra", "title": "Three Commands to Make Claude Code Stop Guessing Your Infra", "summary": "Claude Code, an AI coding assistant, generates infrastructure-touching code without awareness of actual cloud resources, leading to costly errors like full table scans on 50M-row DynamoDB tables. A new tool called infrawise solves this by giving Claude Code deterministic knowledge of infrastructure through the Model Context Protocol, using three commands: `infrawise init` to configure project settings, `infrawise doctor` to verify live connectivity, and `infrawise dev` to run a local MCP server that surfaces real-time findings such as detected full scans, missing indexes, and hot partition risks.", "body_md": "You asked Claude Code to add a query for orders by customer status. It generated a `.scan()`\n\nwith a `FilterExpression`\n\n. Your Orders table has 50M rows and three functions already hammering the same partition key. Claude Code had no idea — it read your TypeScript files, not your AWS account.\n\nThat's the problem. AI coding assistants are literate in your source code. They are blind to your infrastructure.\n\nWhen Claude Code reads your codebase, it builds a model of your application: function names, variable patterns, the string `\"Orders\"`\n\npassed to `DynamoDB.DocumentClient`\n\n. It can follow call chains, infer intent, and generate syntactically correct code.\n\nWhat it cannot do is describe your actual infrastructure:\n\n`listAllOrders()`\n\nalready does a full scan and costs $40/day`Sessions`\n\nSo when you ask it to add a new query, it generates something that looks correct. It might use `.query()`\n\ninstead of `.scan()`\n\n. But it'll query on an attribute with no index — because it has no way to know which attributes are indexed. It'll write a `FilterExpression`\n\nthat reads every item before filtering — which is exactly a scan, just spelled differently.\n\nThe code compiles. Tests pass. The problem ships.\n\n**infrawise** gives Claude Code deterministic knowledge of your infrastructure through the Model Context Protocol. Three commands get you there.\n\n**1. infrawise init**\n\n```\ncd your-project\ninfrawise init\n```\n\nRuns once per project. Detects your AWS profile and region, asks which databases you use, and writes a single file: `infrawise.yaml`\n\n. That's the only file it creates in your repository — one config, no framework, no SDK changes.\n\n**2. infrawise doctor**\n\n```\ninfrawise doctor\n```\n\nBefore you trust any analysis, verify that infrawise can actually reach your infrastructure. Doctor checks every configured adapter — DynamoDB, PostgreSQL, Lambda, S3 — and reports what's reachable.\n\nThis step matters more than it sounds. If your AWS credentials are stale or your DB password rotated, `infrawise analyze`\n\nwill run against cached metadata from last week and give you confident-but-wrong context. Doctor catches this before you feed stale data to Claude Code.\n\n```\n✓ DynamoDB  Connected (profile: default)\n✓ PostgreSQL  Connected\n✗ Lambda  credentials expired\n```\n\nFix what's broken, then move on.\n\n**3. infrawise dev**\n\n```\ninfrawise dev\n```\n\nThe command you run while you work. It runs a fresh analysis of your repository and infrastructure, then starts an MCP server that Claude Code queries during code generation.\n\nIf no analysis cache exists, it runs one automatically. If your infrastructure changes — you add a GSI, a new Lambda, a new table — run `infrawise dev`\n\nagain and the context updates.\n\nRegister it with Claude Code once:\n\n```\nclaude mcp add --transport http infrawise http://localhost:3000/mcp\n```\n\nFrom that point, every time Claude Code generates infrastructure-touching code, it queries this server first.\n\nHere's what `infrawise analyze`\n\nsurfaces on a real project:\n\n```\nFindings  3 total\n\n1.  HIGH  Full table scan detected on DynamoDB table \"Orders\"\n         listAllOrders() scans without any filter — reads every item in the table.\n       → Replace Scan with Query using a partition key or add a GSI.\n\n2.  MED   PostgreSQL table \"users\" has no index on column \"email\"\n         Filtering on \"email\" causes sequential scans.\n       → CREATE INDEX CONCURRENTLY idx_users_email ON users(email);\n\n3.  MED   DynamoDB table \"Sessions\" accessed by 6 distinct code paths\n         High access concentration may create hot partition issues at scale.\n       → Consider write sharding or DynamoDB DAX for read-heavy workloads.\n```\n\nThese aren't generic warnings. They name the function (`listAllOrders`\n\n), the table (`Orders`\n\n), and the exact fix (`CREATE INDEX CONCURRENTLY idx_users_email ON users(email)`\n\n). The GSI recommendation for DynamoDB includes the exact config — attribute name, key type, projection — not a suggestion to \"consider adding an index.\"\n\nWhen Claude Code queries the MCP server and gets this context:\n\n`.scan()`\n\non `Orders`\n\n— it knows the table has 50M rows and an existing high-severity finding`.query()`\n\n— because it knows both`status`\n\n— because it knows that GSI already exists`Sessions`\n\nalready has 6 access paths before adding a seventhYou're not getting a smarter model. You're giving the existing model the facts it was missing.\n\nThe gap between AI-generated code and production-safe code is mostly an information gap. Claude Code is capable of writing correct infrastructure queries — it just doesn't have your infrastructure. `infrawise init`\n\nconnects it. `infrawise doctor`\n\nvalidates the connection. `infrawise dev`\n\nkeeps it current.\n\nThree commands. One config file. No changes to your application code.\n\n**Key Takeaways**\n\n`infrawise init`\n\nruns once and writes a single `infrawise.yaml`\n\nto your project`infrawise doctor`\n\nprevents you from trusting analysis built on stale or broken connections`infrawise dev`\n\nkeeps infra context fresh automatically and serves it over MCP", "url": "https://wpnews.pro/news/three-commands-to-make-claude-code-stop-guessing-your-infra", "canonical_source": "https://dev.to/siddharth_pandey_27/three-commands-to-make-claude-code-stop-guessing-your-infra-2onj", "published_at": "2026-06-05 18:30:45+00:00", "updated_at": "2026-06-05 18:42:02.022560+00:00", "lang": "en", "topics": ["ai-tools", "ai-infrastructure", "ai-agents"], "entities": ["Claude Code", "infrawise", "AWS", "DynamoDB", "Model Context Protocol"], "alternates": {"html": "https://wpnews.pro/news/three-commands-to-make-claude-code-stop-guessing-your-infra", "markdown": "https://wpnews.pro/news/three-commands-to-make-claude-code-stop-guessing-your-infra.md", "text": "https://wpnews.pro/news/three-commands-to-make-claude-code-stop-guessing-your-infra.txt", "jsonld": "https://wpnews.pro/news/three-commands-to-make-claude-code-stop-guessing-your-infra.jsonld"}}