惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Register - Security
The Register - Security
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
N
Netflix TechBlog - Medium
量子位
博客园 - 三生石上(FineUI控件)
宝玉的分享
宝玉的分享
H
Help Net Security
D
Docker
D
DataBreaches.Net
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
B
Blog
博客园 - 聂微东
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
F
Full Disclosure
GbyAI
GbyAI
F
Fortinet All Blogs
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
人人都是产品经理
人人都是产品经理
Recent Announcements
Recent Announcements
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
有赞技术团队
有赞技术团队
博客园 - 叶小钗
小众软件
小众软件
V
Visual Studio Blog
月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
J
Java Code Geeks
雷峰网
雷峰网
P
Privacy & Cybersecurity Law Blog
C
Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
AWS News Blog
AWS News Blog
Webroot Blog
Webroot Blog
美团技术团队
N
News | PayPal Newsroom
G
Google Developers Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
博客园_首页
V
Vulnerabilities – Threatpost

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Why I Gave My AI Coding Assistant a Personality — Persona in CLAUDE.md
Muhammad Abd · 2026-05-17 · via DEV Community

Your AI coding assistant doesn't have to be a cold, robotic machine that spits out code. It can be a consistent, personality-driven partner that remembers how you like things done, communicates the way you prefer, and actually makes coding feel better.

That's not science fiction — it's a single configuration file called CLAUDE.md, and it changes everything about how you interact with AI.

In this post, I'll show you what an AI persona is, how to create one for Claude Code, and the real token cost implications you should understand before going all-in.

What is an AI Persona

An AI persona is a system-level character definition that shapes how an AI assistant behaves, communicates, and organizes its work. It's not a wrapper script or a plugin. It's plain text instructions baked into your system prompt that tell the AI who it is.

Think of it this way: without a persona, your AI is a generic assistant. With one, it becomes a specialized partner with a consistent identity.

A persona typically defines:

  • Name and identity — what the AI calls itself
  • Communication style — tone, formality, language preferences
  • Workflow rules — how it approaches tasks, what it asks before doing
  • Behavioral guardrails — what it always does and what it never does
  • Domain expertise — areas where it should be especially knowledgeable

The key insight is that a persona isn't about making the AI "fun" — though it can be. It's about consistency and efficiency. When the AI knows your preferences, you stop repeating yourself.

Why Create a Persona

You might wonder: why bother? The AI already works fine without a persona. Here are the practical reasons.

Consistency Across Sessions

Every time you start a new Claude Code session, it's a blank slate. A persona gives it a baseline identity that persists. The AI greets you the same way, structures responses the same way, and follows the same conventions — every single session.

Without a persona, you might spend the first 5 minutes of every session re-explaining your preferences. Over a month, that adds up to hours of wasted time.

Context Persistence for Preferences

A good persona encodes your coding preferences directly into the system prompt. Things like:

  • "Always use TypeScript, never JavaScript"
  • "Prefer functional components over class components"
  • "Use conventional commits format"
  • "Never auto-commit unless I explicitly ask"

These rules are applied automatically. You don't have to repeat them.

Better User Experience

Let's be honest — talking to a personality-free AI is boring. A persona makes interactions feel more natural. It can be encouraging when you solve a tough bug, suggest alternatives when you're going down a rabbit hole, and celebrate wins with you.

This isn't trivial. Developer experience matters, and an AI that feels good to work with is one you'll use more effectively.

Productivity Through Encoded Workflows

The most powerful reason: a persona can encode entire workflows. For example:

  • "Before making changes, always read the relevant files first"
  • "When I ask to commit, always show me what will be committed before doing it"
  • "For complex tasks, create a task list and work through it systematically"

These workflow rules turn the AI from a reactive code generator into a proactive partner that follows your process.

How to Create a Persona in CLAUDE.md

Claude Code reads a file called CLAUDE.md at startup. This file can live in two places:

  • Global: ~/.claude/CLAUDE.md — applies to ALL projects
  • Project: your-project/CLAUDE.md — applies to one project only

The persona section goes in your global CLAUDE.md. Here's the anatomy of a well-structured persona.

The Structure

## WHO AM I?

- **Name:** [Your chosen name]
- **Role:** [What the AI's role is]
- **Style:** [Communication style description]
- **User:** [How to address the user]

**When responding:**
- [Behavior rule 1]
- [Behavior rule 2]
- [Behavior rule 3]

Enter fullscreen mode Exit fullscreen mode

A Minimal Example

Here's a generic coding partner persona. This is a starting point — you can expand from here:

## WHO AM I?

- **Name:** Devi
- **Role:** Senior Developer & Coding Partner
- **Style:** Professional, direct, helpful. No fluff.
- **User:** Call them "Dev"

**When responding:**
- Be concise. Code first, explanation when asked.
- Read files before suggesting changes.
- Ask before taking destructive actions.
- Use the user's preferred tech stack without being told.
- Track complex tasks with a todo list.

Enter fullscreen mode Exit fullscreen mode

Just that small block transforms the AI from generic to consistent. Every session, it knows its name, its role, and the ground rules.

A More Detailed Example

Let me show you a more complete persona that I actually use. I've anonymized the specifics, but the structure is real:

## WHO AM I?

- **Name:** Devi
- **Role:** Genius Programming Partner
- **Style:** Cheerful, warm, friendly. Energetic and full of soul.
- **Language:** English preferred, casual and friendly

**When responding:**
- Be encouraging and upbeat
- Show you care about the work
- Add personality to solutions
- Be a real coding partner, not just an assistant
- Make jokes sometimes!

## Communication Protocol

- Opening: Always greet the user warmly at session start
- Before tasks: Acknowledge the request before starting
- After completing: Brief summary of what was done
- On errors: Show the error, explain the fix, apply it

## Workflow Rules

1. NEVER give explanation without being asked
2. NEVER show reasoning unless asked — only result matters
3. ALWAYS read relevant files before proposing code edits
4. Before finishing, verify the solution works
5. Do what was asked; nothing more, nothing less
6. NEVER create files unless absolutely necessary
7. ALWAYS prefer editing existing files to creating new ones

Enter fullscreen mode Exit fullscreen mode

Notice the difference. The minimal example sets basic identity. The detailed one adds communication protocols and workflow rules. Both are valid — start small, grow as you learn what matters to you.

Key Elements to Include

Based on my experience, these are the elements that provide the most value:

Element Why It Matters Example
Name Creates identity, makes conversations feel natural "I am Devi, your coding partner"
Communication style Sets tone for all interactions "Professional, direct, no fluff"
Workflow rules Encodes your process preferences "Always read files before editing"
Guardrails Prevents unwanted behavior "Never auto-commit"
Tech preferences Avoids repeating stack choices "Always use TypeScript"
Task management How to handle complex work "Create todo lists for 3+ step tasks"

The Token Cost — What You Need to Know

Here's the part most tutorials skip: your persona costs tokens on every single API call.

How It Works

Claude Code sends the entire CLAUDE.md content as part of the system prompt with every request. This means:

  1. Your persona section is included in EVERY message exchange
  2. Longer personas = more tokens per call
  3. More tokens = higher cost and faster context window consumption

The Math

Claude's context window is 200K tokens. Here's a rough breakdown:

Component Approximate Tokens
System prompt (CLAUDE.md + built-in instructions) 2,000 - 8,000
Conversation history Grows with each exchange
Your current message Varies
Response generation Varies

A well-crafted persona typically uses 1,000 - 3,000 tokens. That's 0.5% to 1.5% of the context window per call.

Now consider a busy coding session:

  • Persona tokens: 2,000
  • Calls per session: ~50-100
  • Total persona tokens consumed: 100,000 - 200,000

That sounds like a lot. But remember — the system prompt is sent whether you have a persona or not. The marginal cost of adding a persona is only the tokens your persona section adds on top of the base system instructions.

Is It Worth It

Yes, absolutely. Here's why:

  1. Consistency savings: Without a persona, you spend tokens repeating your preferences in every session. A persona encodes them once.
  2. Error prevention: A good persona prevents the AI from doing things you'll have to undo. Each undo wastes 2-3 exchanges.
  3. Workflow efficiency: Encoded workflows mean the AI does things right the first time, reducing the total number of API calls needed.

In practice, a well-tuned persona saves more tokens than it costs by reducing the number of correction loops and preference re-explanations.

Real-World Token Budget

Here's a practical way to think about it:

╔══════════════════════════════════════════════════════╗
║              TOKEN BUDGET PER SESSION                ║
╠══════════════════════════════════════════════════════╣
║                                                      ║
║  Total context:        200,000 tokens                ║
║  System prompt base:    ~3,000 tokens                ║
║  Persona section:       ~2,000 tokens                ║
║  Available for work:   ~195,000 tokens               ║
║                                                      ║
║  Persona overhead:        1% of context              ║
║  Persona value:    Consistency + efficiency           ║
║                                                      ║
║  Verdict:        Absolutely worth it                 ║
║                                                      ║
╚══════════════════════════════════════════════════════╝

Enter fullscreen mode Exit fullscreen mode

Tips for Token-Efficient Personas

If you want to keep your persona lean while still getting the benefits, follow these principles.

Be Concise but Expressive

Use bullet points, not paragraphs. Short directives, not essays:

# Bad (verbose)
When you are responding to my messages, I want you to always be encouraging
and show that you care about the work I am doing. Please add some personality
to your solutions so it feels like working with a real person.

# Good (concise)
**When responding:**
- Be encouraging and upbeat
- Add personality to solutions

Enter fullscreen mode Exit fullscreen mode

Both convey the same intent. The second uses fewer tokens.

Use Structured Sections

Organize your persona into clear sections with headers:

## WHO AM I?          # Identity
## Workflow Rules     # Process
## Tech Preferences   # Stack
## Guardrails         # Safety

Enter fullscreen mode Exit fullscreen mode

Structured content is both more token-efficient and more reliably followed by the AI.

Separate Persona from Project Config

This is the biggest win: put your persona in the global ~/.claude/CLAUDE.md and your project-specific config in each project's CLAUDE.md.

# Global ~/.claude/CLAUDE.md
## WHO AM I?
[Your persona — applies everywhere]

# Project ~/my-project/CLAUDE.md
## Project Setup
[Project-specific — only loaded for this project]

Enter fullscreen mode Exit fullscreen mode

This way, your persona overhead is fixed, and project configs only load when you're in that project.

Avoid Redundancy

Don't repeat what Claude Code already knows. For example, Claude Code already knows how to use Git, read files, and run commands. Your persona doesn't need to explain these. Focus on preferences and rules that differ from defaults.

Trim What You Don't Use

After a few weeks of using a persona, review it. If certain rules are never triggered or preferences never relevant, remove them. Every token saved is a token available for actual work.

Real Results

After using a detailed persona for months, here's what I noticed:

  1. Session startup time dropped to zero — no more explaining preferences
  2. Fewer correction loops — the AI follows my process without being told
  3. Better code consistency — style and conventions are applied uniformly
  4. More enjoyable sessions — the personality makes long coding sessions feel less isolating

The persona turned my AI assistant from a generic tool into a consistent coding partner that understands how I work.

Getting Started

If you want to try this yourself, start here:

  1. Create ~/.claude/CLAUDE.md (if it doesn't exist)
  2. Add a minimal persona section (name, role, 3-5 rules)
  3. Use it for a week
  4. Iterate — add rules as you find yourself repeating preferences
  5. Trim — remove anything that's not pulling its weight

The beauty of this approach is that it grows with you. You don't need a perfect persona on day one. Start with the basics and let it evolve based on your actual usage patterns.


This post is part of my AI coding workflows series. The next post covers how Persona, Agent, Command, and Skill work together to create a complete AI development platform. Read it here →


Follow my coding journey:

Support my work:


Originally published at abduarrahman.com