Skip to main content

How I Use Claude Code in Production: A Practical Workflow for Senior Developers

Author
Ignacio AmatIgnacio Amat
Published
Reading Time8 min
Developer using Claude Code in terminal for Laravel Vue project

I’ve been using Claude Code daily for 8 months on real Laravel + Vue projects in production (SaaS, ecommerce, internal platforms). This isn’t a “how to install” guide — it’s the actual workflow, prompt patterns, MCP setup, measurable results, and hard boundaries on what I never delegate.


The Core Philosophy: Driver, Not Autopilot

Claude Code is a multiplier for developers who already know what they’re doing. The key is using it as a driver, not glorified autocomplete.

My rule: I own every architectural decision, security boundary, and merge. Claude handles scaffolding, repetition, and mechanical tasks.


My Daily Workflow (Real, Not Theoretical)

1. Morning Audit: “What Broke Overnight?”

# Before first coffee, I run:
claude-code "Review all changes on current branch vs main. Look for:
- Security issues (auth, payments, PII)
- N+1 queries
- Unused variables/imports
- Logic that could be simplified
- Missing tests for new code
Be specific with file and line."

Result: 70% of mechanical issues caught before human code review. ~15 min saved per PR.

2. Feature Development: Spec → Scaffold → Implement → Test

Step 1: Write the spec first (I do this)

# Spec: Monthly Stripe Subscription

## Scope
- POST /api/v1/subscriptions
- Validation + idempotency key
- Webhook: invoice.payment_succeeded
- Pest feature tests (happy path, declined card, duplicate webhook, idempotency key reuse)

## Architecture Decisions (ADR)
- Action pattern: CreateSubscriptionAction + SubscriptionData DTO
- Stripe webhook: signature verification + idempotency in stripe_events table
- Jobs: ProcessInvoicePayment (queue: billing), SendInvoiceEmail (queue: notifications)

Step 2: Scaffold with Claude Code

claude-code "Read the spec above. Generate:
1. CreateSubscriptionAction with SubscriptionData DTO
2. StoreSubscriptionRequest (Form Request) with validation
3. SubscriptionController::store()
4. StripeWebhookController::handleInvoicePaymentSucceeded
5. ProcessInvoicePaymentJob + SendInvoiceEmailJob
6. Migration for stripe_events table (idempotency)
7. Pest feature tests covering all 4 acceptance criteria

Use existing patterns from app/Actions, app/Jobs, tests/Feature.
Follow Laravel 11 + PHP 8.3 conventions (readonly, attributes, typed properties)."

Step 3: I implement business logic, edge cases, architectural decisions

  • Claude generates ~80% scaffolding
  • I write: Stripe idempotency logic, proration handling, trial logic, error mapping

Step 4: Tests (Claude generates, I review + add mutation testing edge cases)

claude-code "Generate Pest feature tests for CreateSubscriptionAction covering:
- Happy path with valid card
- Declined card (card_declined)
- Duplicate webhook (idempotency key)
- Idempotency key reuse
- Missing payment method
Use Pest datasets for parametrization. Match existing test style in tests/Feature/Billing."

3. Refactoring: Where Claude Code Shines Most

Example: Legacy ACL → Spatie Laravel Permission (real migration)

claude-code "I'm migrating from custom ACL to spatie/laravel-permission. Give me a step-by-step plan.

Context:
- routes/web.php with 200+ can() calls
- Models: User, Role, Permission (custom)
- Tests: 50+ feature tests using custom gates
- Internal README explaining current system

Requirements:
- Zero-downtime migration
- Backward compatibility during transition
- Flag edge cases I might miss
- Don't execute anything yet — just the plan."

Claude returns a 6-step plan, flags 3 edge cases I hadn’t seen (nested permissions, wildcard gates, API token scopes). Migration estimated at 2 days → took 4 hours.

4. What I NEVER Delegate to Claude Code

CategoryWhy
Architecture decisionsMicroservice boundaries, data ownership, event contracts — I think these through with the team
Business judgmentsFeature priority, scope tradeoffs, UX decisions — discussed with product/client
Security-critical codeAuth, authorization, payments, crypto, PII handling — I review line by line
Final mergeI always review the full diff before merging to main
Production incident responseDebugging live issues requires context Claude doesn’t have

MCP Servers: Connecting Claude to My Tools

// .cursor/mcp.json (or claude_code_config.json)
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-github"],
      "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}" }
    },
    "sentry": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-sentry"],
      "env": { "SENTRY_AUTH_TOKEN": "${SENTRY_TOKEN}", "SENTRY_ORG": "my-org" }
    },
    "postgres": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-postgres"],
      "env": { "POSTGRES_CONNECTION_STRING": "${DEV_DB_URL}" }
    },
    "laravel": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-laravel"]
    },
    "stripe": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-stripe"],
      "env": { "STRIPE_SECRET_KEY": "${STRIPE_SECRET}" }
    }
  }
}

Real use cases:

MCP ServerWhat I Ask
GitHub”Summarize all open PRs on this repo. Which have failing checks? Which are stale >7 days?”
Sentry”What new errors appeared in production in the last 24h? Group by frequency. Suggest likely causes for the top 3.”
Postgres (dev)“Show me the 10 slowest queries in the last hour. Any missing indexes?”
Laravel”Generate a migration for adding soft deletes to the subscriptions table with proper indexes.”
Stripe”List all webhook endpoints configured. Which ones are failing >5%? Show me the last 5 failures for invoice.payment_succeeded.”

Measurable Results (8 Months, Real Projects)

MetricBeforeAfterMethod
Code review time45 min/PR18 min/PRMorning audit catches 70% mechanical issues
Refactoring time2 days (legacy ACL)4 hoursFull codebase context + step-by-step plan
Production bugsBaseline-30%Morning audit + augmented review + mutation testing
Onboarding new codebase2 weeks3 daysSpecs + ADRs + Claude exploration + MCP access
Test scaffolding60 min/feature10 min/featurePest dataset generation from spec
Documentation syncManual, staleAutoMCP docs-sync post-merge

These are my numbers on my projects. Your mileage varies, but the order of magnitude holds for any developer using it with discipline.


Prompt Patterns Library (Copy-Paste Ready)

For Code Review (Pre-PR)

claude-code "Review all changes on this branch vs main. Be specific with file:line. Flag:
1. Security: auth bypass, SQL injection, XSS, PII exposure
2. Performance: N+1, missing indexes, unbounded queries
3. Correctness: off-by-one, null dereference, race conditions
4. Maintainability: god classes, duplicated logic, unclear naming
5. Tests: missing coverage for new logic, brittle assertions
Output format: [SEVERITY] file:line — description — suggested fix"

For Refactoring with Full Context

claude-code "I need to refactor [X] to [Y]. 
Context files: [list 5-10 relevant files]
Constraints: [zero-downtime / backward compat / no API change]
Give me a step-by-step plan with:
- Files to create/modify/delete
- Edge cases to handle
- Rollback procedure
- Test strategy
Don't execute — just the plan."

For Test Generation (Pest + Datasets)

claude-code "Generate Pest feature tests for [Action/Controller].
Use datasets for parametrization.
Cover: happy path, validation failures, authorization, edge cases [list].
Match existing style in tests/Feature/[Module].
Output only the test file content."

For Documentation Sync (Post-Merge Hook)

claude-code "This PR was merged. Changed files: [list].
Update:
1. ADR if architecture changed (docs/adr/NNN-title.md)
2. OpenAPI spec (Scribe) if routes/controllers changed
3. CHANGELOG.md (conventional commits)
4. Onboarding docs if new patterns introduced
Commit with message: '[docs] sync: ADR-NNN, OpenAPI, CHANGELOG'"

The Discipline Checklist (Every PR)

  • Spec written first (I write, not Claude)
  • Claude scaffolds (actions, requests, jobs, migrations, tests)
  • I implement business logic (edge cases, decisions, tradeoffs)
  • Claude generates tests (I review + add mutation testing cases)
  • Morning audit runs (Claude catches mechanical issues)
  • I do final code review (full diff, architectural coherence)
  • Docs auto-synced (MCP post-merge)
  • No AI-generated code merged without human review — ever

Conclusion: It’s a Skill, Not a Tool

Claude Code doesn’t make you a better developer. Using it with discipline makes you faster at the things that already make you good.

The developers who benefit most are those who:

  1. Already know the patterns (so they recognize good vs bad output)
  2. Write specs first (so Claude has clear intent)
  3. Set hard boundaries (security, architecture, merge authority)
  4. Measure outcomes (review time, bug rate, onboarding speed)

If you work with Laravel + Vue and want to discuss this workflow in depth, get in touch.


Related articles

Review my developer profile

If this article matches the kind of product work your team is facing, review my stack or professional availability.

Tell me what you need

You can reach out about a role, contract, technical collaboration, question, or general inquiry. A few lines of context are usually enough for me to reply within 24 business hours.

0/500
Availability