Teaching AI: How to Actually Code
Photo by Aerps.com on Unsplash
Stop relying on generic prompts and teach your agent to handle production from scratch. Ok?

Free to read for non members

I was coding last month or so or should I say watching my Claude Code hallucinate a FastAPI authentication route for my new project where the logic was syntactically clean, but it completely ignored our internal security standards..

So, It was pulling generic examples from the internet instead of writing code that fit our specific stack.

And, that is when I realized I needed to stop treating my local AI like a search engine and start treating it like a junior engineer.

I needed to write a SKILL file.

Anthropic has introduced Agent Skills.

So, instead of writing massive prompt templates, you create a dedicated directory with a md file.

This file acts as a localized expert manual.

When Claude encounters a task related to that domain, it reads the manual and adopts your exact architectural habits.

I decided to start as a complete beginner with this feature.

I took the hardest, most nuanced part of our backend authentication and slowly built a custom skill to teach Claude exactly how I want it done.

Here is the progression of how that simple markdown file evolved into a production-grade asset:

The “Hello World” of Tokens

When I first created the auth-expert directory, my SKILL.md was incredibly basic.

I just wanted to see if the agent would actually listen.

I wrote a few paragraphs explaining our fundamental token structure. I explicitly told Claude that my project uses PyJWT, that our secret keys are strictly injected via specific environment variables, and that we use a very specific naming convention for our user claims.

I booted up the CLI and asked it to generate a new login endpoint.

The result was immediate.

Instead of guessing the library or the token expiry times, Claude read the skill file and output the exact boilerplate I usually write by hand.

It was a massive dopamine hit.
I did not have to correct its assumptions.
And the machine followed it perfectly.

Adding the Friction of Sessions

Basic stateless tokens are fine for tutorials, but a real startup requires actual session management.

I needed to scale the skill up.

I opened the SKILL.md file again and introduced our Redis architecture.

I documented how we store active session IDs, how we handle token revocation on logout, and how our FastAPI dependency injection verifies the session against the Redis cache before allowing access to a protected route.

Now, this phase was genuinely challenging.

You quickly realize that if you cannot explain your own architecture clearly in Markdown, the AI is going to fail.

And I’ll be honest:

Writing the skill forced me to be a better, more structural engineer.

I could not rely on lazy shortcuts.

I had to build a sustainable, readable habit of documenting exactly how data flows through our system.

When I asked Claude to build a new revoke all devices endpoint, it perfectly orchestrated the PyJWT validation and the Redis deletion logic in one shot.

It understood the relationship between the two technologies because I had explicitly mapped it out.

Pushing for Production Readiness

A working script is not the same as a production-ready feature.

To make this skill truly bulletproof, I had to introduce our enterprise constraints.

I expanded the SKILL.md one final time to include our strict error handling and data logging protocols.

I added rules specifying that every failed authentication attempt must be piped into our Snowflake data warehouse for security auditing.

I defined the exact JSON schemas our custom FastAPI exception handlers expect when a user passes an expired token.

The skill file grew from a quick cheat sheet into a comprehensive engineering brief.

Now, when I ask my local agent to scaffold a new microservice, it doesn’t just write functional code.

It writes code wrapped in our custom logging modules, backed by our Redis session standards, and strictly aligned with our Snowflake schemas :)

Building a SKILL.md file from scratch reminded me why I love software engineering.

We are moving past the era of writing clever one-line prompts to get a quick script! (Wait, are we? xD)

We are entering an era of structural design.

By taking the time to manually document your habits, your constraints, and your architectural preferences, you build a sustainable development loop.

You get the speed of AI code generation without sacrificing the structural beauty of a well-designed system.

In case we are meeting for the first time, come over here, it’ll be worth the roller coaster of articles that are gonna come up in the next few weeks.

If you’re someone who loves the UFC or MMA and bet on it, we analyze and predict who wins every week here for a small charge.