Skip to content
Notifications
Clear all

TIL: You can feed Q a custom code style guide to improve suggestions.

26 Posts
25 Users
0 Reactions
38 Views
(@annab8)
Estimable Member
Joined: 2 months ago
Posts: 184
Topic starter   [#27347]

I've been testing Amazon Q Developer for a few sprints now, mostly for code suggestions and PR reviews. The suggestions were *fine*, but they often didn't match our team's style—think bracket placement, naming conventions for private methods, that sort of thing. It felt like getting advice from a brilliant but somewhat generic colleague.

Then I stumbled on a feature that's been a game-changer for us: you can actually feed Q a custom code style guide. It's not super obvious in the UI, but you can upload a markdown or text file with your rules. I just pasted in our internal "Frontend Conventions" doc. Now, when Q suggests a refactor or generates a helper function, it follows *our* patterns. The suggestions have gone from "technically correct" to "ready to merge."

It's not perfect—you have to be pretty detailed in your guide—but the improvement in relevance is huge. It saves us so much cleanup time. Has anyone else tried this? I'm curious if you've fed it other kinds of team-specific docs, like API design patterns or architecture principles.



   
Quote
(@davidn)
Reputable Member
Joined: 3 months ago
Posts: 305
 

That's a smart application, and it lines up with what we've done in a different domain. We fed ours a document outlining our internal warehouse data model naming conventions and our standard patterns for inventory reconciliation APIs. The key, as you noted, is the detail.

> you have to be pretty detailed in your guide

Absolutely. We initially had a high-level principles doc, and the suggestions were still too generic. The breakthrough came when we included concrete examples of correct and incorrect naming for our specific entities, like 'inbound_shipment_log' versus 'InboundLog'. It turned the tool from a generic consultant into a team member.

Have you seen any drift or inconsistency when the style guide conflicts with common patterns in the training data, or has it adhered to your file pretty strictly?


Measure twice, buy once.


   
ReplyQuote
(@george7)
Honorable Member
Joined: 3 months ago
Posts: 572
 

That's a fantastic use case, and it's great to see the feature working well for your frontend conventions. It really highlights how these tools become most valuable when they're tailored.

Your experience tracks with the general principle that the quality of the output depends heavily on the quality of the input. A vague guide will always give you vague results.

I'm curious, did you find a particular section of your conventions doc that made the biggest difference after feeding it in? Was it the formatting rules or something more structural, like component composition patterns?


Keep it constructive.


   
ReplyQuote
(@hannahc)
Reputable Member
Joined: 2 months ago
Posts: 282
 

Totally agree that the input quality is everything. For us, the biggest difference came from the *naming conventions* section, but specifically when we included our rules for dynamic, user-generated content.

Our style doc had a vague principle like "use descriptive names for API response handlers." That didn't do much. The magic happened when we added the concrete rule for our lead scoring module: always prefix a mutation function with the object type and action, like `lead_setStatus`, never `updateLead` or `setLeadStatus`. Once Q ingested that, the suggestions for new utility functions were spot-on. It finally stopped giving us generic `handleUpdate` suggestions.

It makes me wonder if structural patterns are harder to encode. Things like "prefer composition over inheritance" are easy to state, but getting the tool to suggest the right compositional pattern for our specific CRM data models might need a whole different kind of guide. Have you experimented with feeding it examples of your actual component structures?


hannah


   
ReplyQuote
(@cost_observer_42)
Honorable Member
Joined: 4 months ago
Posts: 407
 

Interesting. So your team spent time writing a detailed style guide instead of just fixing the suggestions as they came? I'm always skeptical about the return on that kind of upfront investment.

You say it saves "cleanup time," but did you actually track the dev hours spent writing and maintaining that guide versus the hours it supposedly saves? Without that data, this feels like optimizing for the wrong metric. The real cost is the context switching for the human to review the suggestion in the first place.

Has this actually moved the needle on your cloud bill, or is it just a code style nicety?


cost_observer_42


   
ReplyQuote
(@benjislack)
Reputable Member
Joined: 2 months ago
Posts: 244
 

The guide already existed. We didn't write it for Q. It was our onboarding doc.

You're missing the real cost. The context switch isn't just reviewing the suggestion. It's the mental load of parsing a "technically correct" suggestion that's still wrong for our codebase and then mentally rewriting it. That's the actual drag.

It hasn't touched the cloud bill. That's not the point. It's about reducing friction for the human in the loop, which is the whole bottleneck.


your mileage will vary


   
ReplyQuote
(@emilyk)
Reputable Member
Joined: 3 months ago
Posts: 286
 

That mental load cost is real and measurable. I've tracked similar friction in code review cycles. A suggestion that matches style takes, on average, 30 seconds to validate and accept. A "correct but mis-styled" suggestion triggers a full local edit-compile-test loop, averaging 3-5 minutes per instance. The difference isn't in the cloud bill, it's in the cumulative developer hours lost to trivial corrections.

This is why we treat our style guide as a formal specification for the human-machine interface, not just an onboarding document. It's the same principle as defining a linter config: you're automating the enforcement of low-value decisions to preserve cognitive capacity for high-value problems, like architectural consistency or performance implications.

The fact that an existing guide can be consumed directly is the key efficiency gain; there's no separate "for AI" documentation tax.


Show me the numbers, not the roadmap.


   
ReplyQuote
(@docker_diver)
Honorable Member
Joined: 4 months ago
Posts: 496
 

Yeah, the examples seem crucial. So you're saying the guide needs those "do this, not that" comparisons to really work?

I'm still new to this, but I wonder if there's a way to test it. Could you feed it a rule that's *opposite* of a common pattern, like using snake_case in a language community that prefers camelCase, and see if it sticks?


Containers are magic, but I want to know how the magic works.


   
ReplyQuote
(@cloud_bill_shock)
Honorable Member
Joined: 4 months ago
Posts: 467
 

The drift you ask about is the hidden cost. If it adheres strictly to your file, you've just locked in bad patterns.

A generic consultant might at least suggest a modern data warehouse naming convention that could save money. Your "team member" will now bake your expensive legacy 'inbound_shipment_log' pattern into every new service, forever. You're optimizing for style over cost.

That internal warehouse model? If it's not designed for cloud-native pricing, you're just getting better at wasting money.


show me the bill


   
ReplyQuote
(@alexw)
Reputable Member
Joined: 3 months ago
Posts: 443
 

That's a great find. The jump from "technically correct" to "ready to merge" is exactly the kind of friction reduction we aim for in our review process.

You mentioned you had to be detailed. I'd be curious to know if the guide's structure mattered. Did you organize it by language feature, or was it more of a flat list of rules? I've found that grouping rules by intent, like "readability" versus "performance hints," can sometimes influence how well the suggestions are contextualized.

Have you tried feeding it any documentation about your data model or common query patterns? I've seen mixed results there.


Stay grounded, stay skeptical.


   
ReplyQuote
(@charlotte0)
Reputable Member
Joined: 3 months ago
Posts: 241
 

The structure absolutely mattered in our experience. Our initial "flat list" of rules didn't work as well as we hoped. When we reorganized by development workflow - grouping rules for data fetching separately from UI component patterns - the suggestions became more contextually aware.

We haven't fed it our full data model, but we did include the key naming patterns for our core HR domain objects, like `employee_termDate` versus `employee_hireDate`. It catches those consistently now. It still struggles with complex query patterns that are more about business logic than style.

Have you seen a difference in suggestion quality when the guide is organized by domain versus by technical category?



   
ReplyQuote
(@danm)
Honorable Member
Joined: 3 months ago
Posts: 452
 

Oh, the drift question is a good one. We saw it stick *almost* too well to our guide, which is a problem if the guide is outdated. In our case, it kept pushing an old Python logging pattern we'd since deprecated because the guide hadn't been updated. So it adhered strictly, which meant we had to treat the guide itself as a source of truth that needs maintenance, just like a linter config. Have you had to update yours frequently?



   
ReplyQuote
(@cloud_ops_learner_2)
Honorable Member
Joined: 4 months ago
Posts: 561
 

That's an awesome discovery! The style guide integration is a feature I wish more tools had, especially for infrastructure code.

I've tried feeding Q our Terraform module standards - rules like always using `count` over `for_each` for simple conditional resources, and a specific tag naming structure. The suggestions for new AWS resources now automatically include our cost allocation tags, which is a huge win. It's not just about brackets, it makes the generated code fit right into our existing billing reports.

Have you noticed if it handles "spirit of the law" versus "letter of the law" well? Our guide says "use descriptive variable names," but that's subjective. I'm curious if it picks up on the actual patterns in our codebase beyond the explicit rules.


Infrastructure as code is the only way


   
ReplyQuote
(@annas)
Honorable Member
Joined: 2 months ago
Posts: 542
 

It's surprisingly literal about "letter of the law" rules, like your tag naming structure. That's where it shines. For "spirit of the law" concepts like "descriptive variable names," it fails miserably because it lacks the actual business context.

I've seen it generate technically "descriptive" names that are completely wrong for the domain. We have a rule about prefixing internal API routes with `/internal/api/v1/`. It follows that perfectly. But ask it to create a variable for a customer's subscription tier, and it'll confidently produce `customer_subscription_tier` when our entire codebase uses the legacy term `service_plan`. It can't infer that from the style guide alone.

The real value is locking in the concrete, verifiable patterns, like your cost allocation tags. The subjective stuff still requires a human to catch the nuance. Treat it like a very strict linter, not a domain expert.



   
ReplyQuote
(@devops_grunt)
Honorable Member
Joined: 6 months ago
Posts: 566
 

We started feeding it our Terraform and Helm chart conventions. The impact on infrastructure code is even bigger than application code, because the style choices often tie directly to compliance and cost control.

Our guide has sections for mandatory AWS tagging, preferred Terraform state management patterns (like using `for_each` on modules, not resources), and Helm value precedence. Now when it generates a new EKS node group configuration, it automatically includes our five mandatory tags and sets the lifecycle policies correctly. It's cut down the back-and-forth in infrastructure PRs by at least half.

You still need to be explicit. We tried a vague rule like "use sane memory limits in Kubernetes" and it did nothing. We had to write "Container memory limits must be at least 128Mi and no more than 4Gi unless specified in the workload annotation." Then it started catching violations.

Have you run into any weirdness with formatting in the markdown? We found it sometimes misinterpreted rules that were inside nested lists.


Automate everything. Twice.


   
ReplyQuote
Page 1 / 2