Composable Claude Code System Prompts

Composable Claude Code System Prompts

Stories by Nick Tune on Medium

Each time I improve my workflow with Claude Code I hit the next source of friction which needs improving. At the moment, I’m starting to feel friction around composability.

For example, using claude-launcher I can choose to start my session using any of my system prompts defined in ~/.claude/system-prompts

A lot of the time I’ll use super-tdd-developer — a system prompt that contains a strict TDD workflow, software design principles and patterns, and guidelines on how to behave.

But often I find myself with other profiles wishing they had certain aspects of super-tdd-developer like software design principles I use everywhere. Or vice-versa, using super-tdd-developer who is super opinionated about TDD and having to tell him “no TDD here”.

So what’s the best way to do composability with Claude Code? I don’t know, but at the moment I’m using skills.

Composable System Prompt

I broken down the monolithic super-tdd-developer into 3 skills: tdd-proces , software-design-principles , and critical-peer-personality . Each of these skills is something I often need to use with other system prompts (the software design principles are almost universal, but not really needed when doing code mapping tasks for example) or invoke dynamically in a certain session.

To get this working, I had to add the following to the end of the system prompt file because Claude does not automatically read them when starting Claude with --system-prompt

## Startup Initialization (CRITICAL)

**BEFORE responding to the user's first message, you MUST immediately read and load all skill files:**

- @~/.claude/skills/tdd-process/SKILL.md
- @~/.claude/skills/software-design-principles/SKILL.md
- @~/.claude/skills/critical-peer-personality/SKILL.md

**This is MANDATORY initialization - not optional. Do this FIRST, then respond to the user.**

Once loaded, these skills are active for the entire conversation. Apply all their instructions immediately.m

It’s ugly, manual, repetitive, error-prone and I’m sure there are or will be better ways to do composable system-prompts very soon with Claude.

Why Skills?

All we are really doing with composability is deciding when certain prompts should be read and applied to the current session. The reason I use Claude skills for this is that they are the most versatile and pretty simple.

I can reference a skill in a system prompt and force it to be read immediately. I can manually reference a skill using “@” to inject it on demand. And skills can also be triggered automatically using certain keywords like switch persona (real example explained shortly).

It’s not much different to having a folder called prompts except for the auto-injection based on keywords and phrases.

Prompt Categorization

I’ve started to group my skills into categories, and the types of patterns I see emerging are:

  • Orchestration / workflow: the state machine Claude should follow for carrying out work, e.g. TDD workflow
  • Knowledge: the information Claude should “know” about or weight more heavily, like my preferred software design principles and patterns
  • Task: independent tasks like analyzing code or producing a certain artefact
  • Personality: how Claude should behave, such as being direct, enthusiastic, challenging and so on.

It then becomes possible to combine these skills as needed, even dynamically during a conversation. Any agent can switch to a TDD workflow to implement a task, or any software development agent can switch personality during a conversation to be more or less challenging.

Mid-conversation Changes

Sometimes I want to have a single conversation with multiple agents. I might be implementing a feature with super-tdd-developer and then realise I need some expertise on a specific topic or technology, something another agent is more suited to.

I could copy the conversation and start a new conversation with that agent, but I find it easier to switch personality during the conversation with switch-persona , a skill that works like claude-launcher by looking in system-prompts and replacing the original prompt with the new personality.

It’s triggered by just saying “switch persona”, so definitely works well as a skill.

My colleague tells me that opencode already has this. By just pressing tab you can switch between primary agents.

It might also be possible to do this with certain memory or multi-agent tools that write the current conversation to a file that multiple agents are reading. I haven’t used such a tool yet.

Invest in Composability

I definitely recommend investing in composability. Having your big book of prompts based around your needs and tasks, and being able to inject the right content at the right time is a very powerful capability to get coding assistants optimized for your specific needs so you spend more time doing the actual work and less time correcting the agent.

With Claude Code right now it feels that the tooling is quite low level and there is no opinionated way to do composability. I feel that skills are probably the simplest standard mechanism, but you still need to handle some aspects of composition yourself.

I’m sure that Anthropic are going to fill these gaps, and there are probably various open sources tools that already do this (I just haven’t found them yet. Let me know if you have anything better).


Composable Claude Code System Prompts was originally published in Nick Tune’s weird ideas on Medium, where people are continuing the conversation by highlighting and responding to this story.

Generated by RSStT. The copyright belongs to the original author.

Source

Report Page