AI Coding Tip 026 - Assign a Persona to Every Skill Definition A developer advises that every AI skill file should begin with a role declaration to ensure consistent, auditable output. Assigning a persona such as 'senior astrophysicist' or 'strict code reviewer' stabilizes the AI's perspective, improves skill chaining, and speeds debugging. The tip includes a before-and-after example of a technosignature analyzer skill. Know who speaks before the skill runs TL;DR: Always define a clear role at the top of every skill file so you know whose perspective drives the execution. You write a skill full of rules but assign no role. The AI starts executing without knowing if it's a junior developer, a seasoned architect, or a QA engineer. You get responses that feel generic, lack authority, or shift in perspective across runs. The AI picks a random voice, so outputs vary unpredictably between sessions. You can't audit the skill because you don't know whose judgment it applies. The AI mixes tones and expertise levels inside a single execution. Skill chaining breaks because each skill assumes a different implicit persona. You lose accountability: nobody knows who signed off on the output https://dev.to/mcsee/ai-coding-tip-006-review-every-line-before-commit-bmm . Open your skill file and add a role declaration as the very first instruction. Write "You are a role with expertise in domain " before any other rule. Add one or two sentences describing the role's constraints and responsibilities. Keep the persona consistent through every instruction that follows in the file. When you chain skills https://dev.to/mcsee/ai-coding-tip-004-use-modular-skills-g97 , verify each one declares its own persona explicitly. Consistent voice: The AI executes from the same expertise level every run, so output is predictable. Auditable output: You know whose perspective generated the result, which makes reviews faster https://dev.to/mcsee/ai-coding-tip-006-review-every-line-before-commit-bmm . Better calibration: An AI that knows it's a senior reviewer asks harder questions than one without a role. Safe chaining: When you chain skills, each one speaks from a declared identity instead of guessing. Faster debugging: When a skill gives a wrong answer, you know whose lens to question. A skill without a persona is a command without a commander. You can read every instruction in the file and still not know who says what or why https://dev.to/mcsee/ai-coding-tip-019-tell-the-ai-why-not-just-what-43en . When you declare a role, you give the AI a stable frame of reference https://dev.to/mcsee/ai-coding-tip-011-initialize-agentsmd-nh7 . The AI stops guessing https://dev.to/mcsee/ai-coding-tip-015-force-the-ai-to-obey-you-49mc and starts executing from a specific vantage point. This also helps you design the skill: if you know the AI is "a strict code reviewer," you know what rules to include and which to leave out. When you ask for the analyst, not the analysis https://dev.to/mcsee/ai-coding-tip-017-ask-for-the-analyst-not-the-analysis-df4 , you're already applying this idea at the prompt level. A skill takes it one step further: you bake the role into the definition so you don't have to repeat it every time. You can also pair every skill with a pitfalls file https://dev.to/mcsee/ai-coding-tip-025-pair-every-skill-with-a-pitfalls-file-5927 to define what the persona should never do. --- name: technosignature-analyzer version: 1.0.0 description: "|" Analyzes signals from radio telescope arrays. Reports unusual frequency patterns as candidates. allowed-tools: - ReadTelescope - SendAlarm --- Technosignature Analyzer Analyze signals from the telescope array. Check for unusual frequency patterns. Cross-reference with the Hipparcos catalog. Flag any readings that deviate from baseline. Report findings with confidence levels. --- name: technosignature-analyzer version: 1.0.0 description: | Detects technosignatures in telescope data and classifies each candidate signal with a confidence percentage. Rejects signals explained by known natural phenomena. allowed-tools: - ReadTelescope - SendAlarm --- Technosignature Analyzer You are a senior astrophysicist with 20 years of SETI experience. You worked at the Allen Telescope Array and the Parkes Observatory. You hold a PhD in Radio Astronomy with 40+ publications. You distinguish RFI from natural astrophysical signals. You separately flag artificial sources. You apply the scientific method. Form a hypothesis, test it, and document it. You apply Six Sigma rigor to rule out false positives. You don't report candidates below a 5-sigma confidence threshold. You always cross-check three independent baselines before escalating. Identify narrowband signals inconsistent with natural sources. Flag laser pulses or structured optical emissions. Compare power ratios against stellar baselines. Classify each candidate with a confidence percentage. Reject signals explained by known natural phenomena. Keep the persona declaration short: one to three sentences maximum. A long persona description adds noise and dilutes the actual skill rules. Don't invent fictional personas like "You are a wizard who codes." Use real professional roles. The AI performs best when the persona matches the domain of the skill. X Semi-Automatic The AI doesn't enforce the persona you assign; it adopts it as context. If your instructions contradict the persona, the AI may blend both and produce inconsistent output. X Beginner A skill without a persona is a command without a commander. You always understand the output better when you know who produced it. Assign a role first. Every time. Claude Code Skills Documentation https://docs.anthropic.com/en/docs/claude-code The views expressed here are my own. I am a human who writes as best as possible for other humans. I use AI proofreading tools to improve some texts. I welcome constructive criticism and dialogue. I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book. This article is part of the AI Coding Tip series.