Why Docs Come First and Code Becomes a Byproduct

AI tools evolve rapidly. This post may become outdated as new developments emerge.

“Agentic coding” is becoming a hot topic in dev circles lately. But what is it really about?
It’s not just AI writing code for you. It’s a different way of building software — one where documents lead, agents do the work, and your codebase becomes more than just code. It turns into an evolving, reusable asset.

Here’s a breakdown of what agentic coding really means, why it’s not just hype, and how it might reshape the way we think about development.


So What is Agentic Coding?

Agentic coding is a development style where AI agents (usually LLM-based) help you turn goals into working code. But it’s not just autocompletion or boilerplate generation.

Instead, it’s a full loop:

  1. Understand the goal
  2. Plan the tasks
  3. Update the documentation
  4. Write the code
  5. Test and validate
  6. Iterate based on feedback

Think of it like pairing with an extremely diligent assistant that never forgets what you told it and always keeps things in sync.


“80% Productivity Boost” — Hype or Real?

You might’ve seen claims like “agentic coding boosts dev productivity by 80%.” Is that real?

Well, it depends.

If you’re doing:

  • Basic CRUD work
  • REST API scaffolding
  • Repetitive tasks
  • Writing tests and docs for existing logic

Then yes, you’ll feel a serious speed boost — possibly even more than 80% for certain workflows.

But if you’re doing:

  • Complex business logic
  • System design
  • Trade-off decisions
  • Architecture

Then you’re still very much in charge.

Realistically, most teams will see 30–60% time savings in practical workflows, especially post-design.


Like TDD, But for Everything

One of the biggest advantages of agentic coding is the way it naturally accumulates reusable assets over time.
It’s kind of like how TDD gives you a suite of regression tests “for free” as you build — agentic coding gives you design docs, decision history, test coverage, and more.

Let’s compare:

AspectTDDAgentic Coding
Starts withWriting testsWriting or updating documentation
ProducesTest coverageDocs, decisions, code, tests, context
BenefitsSafer refactoringFaster onboarding, traceability, reusability

Instead of just writing code, you’re building a body of knowledge that your team (or agent) can refer to later.


What Kind of Assets Get Created?

Over time, agentic workflows can generate and accumulate:

  • User intent and history: what was requested, why, and how it evolved
  • Documentation: API specs, feature descriptions, constraints
  • Decision logs: explanations of why certain choices were made
  • Autogenerated tests, comments, and usage examples
  • Error and fix history: what failed, why, and how it was resolved
  • Design conventions and coding style patterns
  • Semantic search-ready artifacts (via vector databases or embeddings)

This is way beyond just shipping features — you’re building a living, queryable system memory.


Docs First, Code Follows

Here’s the core philosophy:
Code should not be written unless the docs are up to date.

Why?

Because the agent relies on context. If your documentation is outdated, the agent will misinterpret requirements or produce the wrong implementation.
This creates a natural constraint: the doc must be current before any code is generated.

This leads to a few positive effects:

  • Documentation stays accurate by design
  • Changes leave a traceable reasoning path
  • Features are easier to test and maintain
  • New team members can quickly understand intent and flow

It’s not just good practice anymore — it’s the actual fuel the agent runs on.


Prompts Include Docs, Not Just Commands

When using agentic workflows, you’re not just saying:

“Add a loyalty points to the payment API.”

You’re giving the agent real context, like:

We are currently using the following API for processing payments:

POST /payment
{
  userId: string,
  productId: string,
  couponCode?: string
}

Payments are processed using credit cards. If a `couponCode` is provided, a discount is applied.

New requirement:
We want to allow users to apply their loyalty points to reduce the payment amount, with the following conditions:
- A user can apply loyalty points for up to 20% of the payment amount.
- The used loyalty points should be deducted from the user's current balance.
- If the user has fewer points than needed, apply as many points as possible without blocking the transaction.

What needs to be updated:
1. Extend the API spec to include a new field for enabling point usage.
2. Modify the backend implementation to support this logic.
3. Update the payment calculation logic to apply coupon first, then loyalty points.
4. Add unit tests to verify different edge cases for loyalty point usage.
5. Include the amount of loyalty points used in the API response.

Notes:
- Coupons and loyalty points should be usable together.
- The system must apply the coupon discount before applying loyalty points.

This is a simple example to illustrate the prompting structure. It doesn’t reflect a real production API.


How to Try Agentic Coding — A Proof of Work (PoW) Approach

If you want to adopt agentic coding in your project, here’s a simple step-by-step way to get started and build good habits:

  1. Start Small with One Feature
    Pick a small, well-defined feature. Before coding, update or create its documentation first in your docs/ folder. Write down its purpose, inputs, outputs, and expected behavior clearly.

  2. Use Documentation as Your Source of Truth
    Ensure your team agrees that docs must come first before any code changes. Refer back to docs every time you write or update code.

  3. Feed Docs Into Your AI Agents
    When asking AI to help write code, include the relevant docs in your prompt. This keeps generated code aligned with your expectations.

  4. Create a Feedback Loop
    Review generated code, run tests, and update docs if you find mismatches or missing info. This keeps docs and code synced.

  5. Make It Part of Your Workflow
    Use a lightweight checklist or PR template to enforce the habit:

    • Docs updated first
    • Code generated with doc context
    • Tests created or updated
    • Docs finalized after tests
  6. Iterate and Expand
    As you get comfortable, expand this practice to more features and team members. Add tools later, like OpenAPI specs, CI checks, or semantic doc search.

In short: “Docs first, code follows, sync often.” Start small, build habits, and grow from there.


Final Thoughts

Agentic coding isn’t just about faster code writing. It’s a mindset shift. You treat documentation and intent as the core foundation, with code as a reliable byproduct. This builds a living knowledge base that helps your team work smarter, onboard faster, and maintain code more confidently.


What’s Next?

I’m currently adopting this documentation-first, agentic coding workflow. I plan to share detailed posts about my hands-on experience, challenges, and results soon.