{"slug": "coding-agents-workflows", "title": "Coding Agents & Workflows", "summary": "A developer outlines a workflow for using coding agents like Claude Code and GitHub Copilot, emphasizing the need for tailored skills and context management to avoid unsafe code generation. The post demonstrates how a checkout skill enforcing distributed saga patterns prevents issues like direct inventory deduction and broken state machines.", "body_md": "If you're working with coding agents like Claude Code, GitHub Copilot, or any other AI assistant, you've probably noticed something: they can generate code faster than you can review it. This creates a new set of challenges that traditional development workflows weren't designed to handle.\n\nHere is what I believe will help you. BTW before reading this post try to:\n\nKeep that branch around, once you've read the post, you'll go back and redo the same task with the principles below applied, so you can compare the two results yourself.\n\nYour choice of tools depends on your experience level, and that choice shapes the whole workflow you're about to build:\n\nWhichever you pick, you need to learn to be patient with LLMs. They usually tend to generate a ton of text, and rushing past it defeats the point of reviewing it at all.\n\nWhen you code, you have a ton of context in your head. So if you are expecting a coding agent to deliver good results you need to give it **enough** context but beware of [context dilution](https://diffray.ai/blog/context-dilution/).\n\n⚠️\n\nWarningIf you install\n\n[superpowers]plugin get ready for it to spin up subagents and burn a ton of tokens in the process. Personally I downloaded their brainstorming, and systematic-debugging skill and removed the plugin.\n\nConsider using **MCP servers** (like [Contact7](https://context7mcp.com/claude/)) if they offer exactly what you need. Some plugins may already cover the same functionality, so try to avoid overlap. Commit them to git so everyone has access.\n\n💡\n\nPro TipInstall Context7, it is so useful since LLMs do not have always the latest documentations for a library. You can enforce it by adding a\n\n`.mcp.json`\n\n:\n\n```\n{\n  \"mcpServers\": {\n    \"context7\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@upstash/context7-mcp@latest\"\n      ]\n    }\n  }\n}\n```\n\nRather than relying on general knowledge, develop skills tailored to your project. Imagine you are building the backend checkout service for a massive e-commerce platform (think Shopify, Amazon, or a large retail enterprise). This service handles:\n\nNow an engineer on your team asks the coding agent to:\n\nWe are releasing a 'Flash Sale' feature tomorrow. We need a new endpoint that accepts a list of product IDs and quantities, bypasses the user's shopping cart, and goes straight to the checkout/payment page. Ensure it validates the flash sale time window.\"\n\n**What happens WITHOUT a skill:** the agent reads the prompt, sees **\"bypass cart\"** and **\"straight to payment\"**, and happily writes something like this (LLMs try to follow your instructions as much as possible):\n\n``` python\n@app.post(\"/flash-checkout\")\ndef flash_checkout(products, user_id):\n    total = 0\n    for p in products:\n        # 🚨 UNSAFE: Direct DB hit.\n        # Inventory is immediately deducted, even if the user's credit card fails (loss of stock).\n        db.inventory.update_one({\"_id\": p.id}, {\"$inc\": {\"stock\": -p.qty}}) \n        total += p.price * p.qty\n\n    # 🚨 WRONG: Hardcodes US tax, ignores EU and other regions\n    # This is a contrived example and most top LLMs would ask you about it\n    total *= 1.08\n\n    # 🚨 BREAKS STATE MACHINE: Direct status update\n    # State machine is broken, so the shipping service never picks it up.\n    db.orders.insert_one({\"user\": user_id, \"status\": \"COMPLETED\", \"total\": total})\n\n    # 🚨 NO IDEMPOTENCY: User double-clicking charges them twice\n    stripe.charge(amount=total)\n    return {\"success\": True}\n```\n\nNow imagine what would have happened if you had a skill like this in `.claude/skills/checkout-orchestration-skill/SKILL.md`\n\n:\n\n```\n---\nname: checkout-orchestration-skill\ndescription: 'Enforces the distributed saga pattern for the e-commerce checkout pipeline. Use this skill whenever implementing or modifying order placement, payment flows, or cart finalization. It mandates idempotency (Redis), inventory reservation (never direct deduction), strict order state machine transitions (OrderStateMachine), tax aggregation (TaxJar/Vertex routing), async fraud handling (800ms timeout), and Kafka event emission (order_placed topic) for eventual consistency.'\n---\n\n## Core Architectural Rules\n\n**NEVER** treat checkout as a single CRUD update. It is a **distributed saga**.\n\n1. **Idempotency First**: Every checkout request must include an `idempotency_key`. If the key exists in Redis, return the cached result immediately. \n2. **Reserve, Do Not Deduct**: Never write directly to `inventory` table. Always call `InventoryReservationService.reserve()` which holds stock for 15 minutes (timeout period). Only finalize deduction after `PAYMENT_CONFIRMED` event.\n3. **State Machine Only**: The `Order` entity has a strict state machine: `PENDING -> FRAUD_CHECK -> AUTHORIZED -> PAYMENT_CAPTURED -> FULFILLMENT_QUEUE` Never skip states. Never manually set `order.status = 'completed'`. Use `OrderStateMachine.transition('CAPTURE')`.\n4. **Tax Agnosticism**: We use TaxJar for US/CA, and Vertex for EU. Always call `TaxAggregator.get_tax()` which handles the routing under the hood. Do NOT hardcode tax rates.\n5. **Fraud Timeout**: The fraud check is async. If it takes > 800ms, we proceed with `FRAUD_PENDING` status and place a dead-letter retry, but we do NOT block the user.\n6. **Eventual Consistency**: After capturing payment, push exactly one event to the `order_placed` Kafka topic. Must include the `correlation_id` for tracing.\n```\n\nAnd now if you send the same prompt to the coding agent, it generates real, production-grade, domain-aware code:\n\n``` python\n@app.post(\"/flash-checkout\")\ndef flash_checkout(products, user_id, idempotency_key):\n    # 1. Enforce Idempotency\n    cached = redis.get(idempotency_key)\n    if cached: return cached\n\n    # 2. Validate Flash Sale window (domain logic)\n    if not timezone.now() in flash_sale_window:\n        raise HTTPException(400, \"Flash sale not active\")\n\n    # 3. Build line items\n    line_items = [LineItem(p.id, p.qty) for p in products]\n\n    # 4. Reserve inventory using the domain service (DOES NOT deduct yet)\n    reservation_ids = InventoryReservationService.reserve_bulk(line_items)\n\n    # 5. Get tax through the aggregator (handles US/EU routing)\n    tax = TaxAggregator.get_tax(line_items, user_id)\n\n    # 6. Initiate state machine\n    order = OrderStateMachine.create(\n        user_id=user_id, \n        line_items=line_items, \n        tax=tax,\n        status=\"PENDING\"\n    )\n\n    # 7. Fraud check (async, non-blocking)\n    fraud_score = FraudScorer.submit_async(order.id)\n\n    # 8. Authorization (not capture, just auth to check funds)\n    auth_token = PaymentGateway.authorize(order.total, user.payment_method)\n\n    # 9. Transition to authorized state\n    OrderStateMachine.transition(order.id, \"AUTHORIZE\", context={\"auth_token\": auth_token})\n\n    # 10. Emit Kafka event for downstream processing\n    event_bus.publish(\"order_placed\", {\n        \"order_id\": order.id, \n        \"correlation_id\": request.headers[\"X-Correlation-ID\"]\n    })\n\n    response = {\"order_id\": order.id, \"status\": \"AUTHORIZED\"}\n    redis.setex(idempotency_key, 3600, json.dumps(response))\n    return response\n```\n\nYou can e.g. create a command for labeling GitHub issues:\n\n```\nmkdir -p .claude/commands\ncat > .claude/commands/label-github-issue.md << 'EOF'\n---\ndescription: Fetch a GitHub issue and apply appropriate labels using gh\nargument-hint: <github-issue-url>\nallowed-tools: Bash(gh issue view:*), Bash(gh label list:*), Bash(gh issue edit:*), Bash(gh repo view:*)\n---\n\nYou are labeling a GitHub issue. The issue URL is: $ARGUMENTS\n\nSteps:\n1. Parse the URL to extract the owner, repo, and issue number.\n2. Run `gh issue view <number> --repo <owner>/<repo> --json title,body,labels` to read the issue's current title, body, and existing labels.\n3. Run `gh label list --repo <owner>/<repo>` to see which labels actually exist in this repo. Only use labels from this list, if you strongly believe we lack certain label just let the user know as a side note, do NOT stop here even if you believe certain labels are missing.\n4. Based on the issue's title and body, decide which existing labels best apply (e.g. bug, enhancement, documentation, question, good first issue, priority levels, area/* labels, etc).\n5. Apply the chosen labels with `gh issue edit <number> --repo <owner>/<repo> --add-label \"label1,label2\"`.\n6. Report back to the user: which labels you applied and a one-line reason for each. Also report back the labels which you believe are good to add with a single line as to why.\n\nIf the issue already has labels that are still appropriate, leave them and only add what's missing. If no labels in the repo genuinely fit, say so instead of forcing one on.\nEOF\n```\n\nAnd ensure you are committing them so others will be using the same commands when needed!\n\n`AGENTS.md`\n\n: Your Agent's Navigation System\nThe most important investment you can make is in documenting a navigation system for your AI agents. You wanna commit and push this documentation to your VCS. And I believe you already know it but I usually just link to `AGENTS.md`\n\nin `CLAUDE.md`\n\n. This way I do not have to copypaste or maintain both.\n\nAlso you can have a `AGENTS.local.md`\n\n/`CLAUDE.local.md`\n\nfor your local setup which is not committed to git. So in `AGENTS.md`\n\nwe usually put stuff such as:\n\nBasically anything you usually need to work on that codebase. But make sure to keep it short and concise since if it is too long then it just take up space in your context window with no real benefits.\n\n❗\n\nNoteYou can have a\n\n`AGENTS.md`\n\n/`CLAUDE.md`\n\nin subdirectories of a project, and coding agents load them when reading and working with that directory's files. So there you can be more meticulous with your instructions.I would also like to make it crystal clear that LLMs love to optimize for coverage percentages. They'll often write brittle tests that:\n\n- Overly mock dependencies.\n- Test every code path without regard to actual functionality.\n- Break when you refactor.\nBut what we want from our test suite cases are:\n\nGood tests: Test the functionality you're building.Refactoring-safe: Shouldn't break when you reimplement. NOTE, we are assuming the APIs remain the same.Logic-catching: Should break when logic breaks.\n\n`/context`\n\nfrequently.`/clear`\n\nand start fresh when needed.`PLAN.md`\n\nor similar progress log earns its keep: treat it as your project memory and communication log, not just a one-off note.\n\n```\n  Hey agent, refactor this 50-person project's entire codebase.\n```\n\nTry to ask LLM:\n\n```\n  Break this large task into 10 small, specific steps. Where each step should be independently:\n  - Specifiable.\n  - Testable.\n  - Reviewable by a human.\n```\n\nIt is a good practice to start with writing a `PLAN.md`\n\nto brainstorm what you wanna do. In fact, that's why I downloaded [the brainstorming skill from the superpowers plugin](https://github.com/obra/superpowers/tree/b36e0829c6d0140e93cfef2ca599b1b07d4a7797/skills/brainstorming). So next time you wanna develop a feature which is big enough for the LLM to derail or misunderstand how it should work, first ask it to brainstorm and write a plan for you. Review and work on that plan, then start with implementing it. So if I wanted to visualize this:\n\n``` js\n[Explore] => [Plan] => [Confirm] => [Code] => [Commit]\n```\n\nThe prompt would be:\n\nFigure out the root cause for issue #983, then propose a few fixes. Let me choose an approach before you code. ultrathink\n\n💡\n\nPro Tip\"ultrathink\" is a special \"magic keyword\" you can add anywhere in your prompt to trigger a maximum reasoning depth mode for that specific request.\n\nIf you give your coding agent a way to measure how good it did, the results would be closer to what you wanted since it will iterate over it. For this usually we can:\n\nRemember I have already talked about it [here](https://dev.to/kasir-barati/pragmatic-agentic-programmer-994). This is code you stand behind.\n\nKey TakeawayCreate a culture of rejecting mediocre AI-generated code.\n\nIt is always a good idea to have another engineer to onboard you. But nowadays you can simply try to utilize LLMs and coding agents to help you with that as well. Ask questions such as:\n\n`recoverFromException`\n\ntake so many arguments? Look through git history to answer.Or you can ask other questions outside of onboarding process:\n\n`if/else`\n\nin So your coding agent, if it is smart enough, will be able to look at git history whenever needed, and let's imagine you have an MCP server to return your microservice architecture. Then it will use it to gain a deeper understanding of how service A interacts with service B. Sometimes you have to be specific so it knows it must use the MCP server. And there are times it can figure that out itself.\n\nIt's becoming increasingly easy to generate tons of code, and the burden is shifting to humans to review it all. Everything above is really one answer to this same problem, combat it with:\n\nNow go back to that first branch you made. Apply what you've read:\n\n`AGENTS.md`\n\n.Save the results in a separate branch, and compare it against your first attempt. That difference is the whole point of this post.", "url": "https://wpnews.pro/news/coding-agents-workflows", "canonical_source": "https://dev.to/kasir-barati/coding-agents-workflows-22kc", "published_at": "2026-08-25 15:58:03+00:00", "updated_at": "2026-08-25 16:13:54.451678+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "large-language-models"], "entities": ["Claude Code", "GitHub Copilot", "Context7", "superpowers", "Shopify", "Amazon"], "alternates": {"html": "https://wpnews.pro/news/coding-agents-workflows", "markdown": "https://wpnews.pro/news/coding-agents-workflows.md", "text": "https://wpnews.pro/news/coding-agents-workflows.txt", "jsonld": "https://wpnews.pro/news/coding-agents-workflows.jsonld"}}