<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: UK</title>
    <description>The latest articles on DEV Community by UK (@yuuuukiiii1104).</description>
    <link>https://dev.to/yuuuukiiii1104</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3841051%2F7632e745-41ed-4e5c-9022-175d37fbdf93.jpeg</url>
      <title>DEV Community: UK</title>
      <link>https://dev.to/yuuuukiiii1104</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yuuuukiiii1104"/>
    <language>en</language>
    <item>
      <title>Modular Prompts: Managing Complex Claude Code Skills with @include and @delegate</title>
      <dc:creator>UK</dc:creator>
      <pubDate>Tue, 24 Mar 2026 04:26:57 +0000</pubDate>
      <link>https://dev.to/yuuuukiiii1104/modular-prompts-managing-complex-claude-code-skills-with-include-and-delegate-1m0o</link>
      <guid>https://dev.to/yuuuukiiii1104/modular-prompts-managing-complex-claude-code-skills-with-include-and-delegate-1m0o</guid>
      <description>&lt;p&gt;If you've been building AI agents with Claude Code, you've probably hit this wall: your &lt;code&gt;SKILL.md&lt;/code&gt; starts as a clean 50-line file, and three months later it's a 400-line monolith that nobody wants to touch.&lt;/p&gt;

&lt;p&gt;There's a better way.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem with Monolithic Prompts
&lt;/h2&gt;

&lt;p&gt;As your Claude Code projects grow, a single &lt;code&gt;SKILL.md&lt;/code&gt; tends to accumulate everything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Role definitions&lt;/li&gt;
&lt;li&gt;Domain knowledge (account codes, product catalogs, compliance rules)&lt;/li&gt;
&lt;li&gt;Output format specs&lt;/li&gt;
&lt;li&gt;Conditional logic for edge cases&lt;/li&gt;
&lt;li&gt;Changelog notes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is a file that's hard to read, hard to test, and impossible to share across skills. When your "accounting assistant" and your "invoice generator" both need the same tax code definitions, you end up copy-pasting — and then maintaining two diverging copies.&lt;/p&gt;

&lt;p&gt;Sound familiar?&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: &lt;a class="mentioned-user" href="https://dev.to/include"&gt;@include&lt;/a&gt; and @delegate
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;dotmd-parser&lt;/code&gt; introduces two directives that bring modular design to prompt engineering.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a class="mentioned-user" href="https://dev.to/include"&gt;@include&lt;/a&gt; — inline composition
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@include path/to/file.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At runtime, the contents of the referenced file are inserted inline — exactly like &lt;code&gt;#include&lt;/code&gt; in C or &lt;code&gt;import&lt;/code&gt; in Python. The final prompt seen by the model is the fully expanded text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Invoice Generator&lt;/span&gt;

@include shared/role-accountant.md
@include shared/tax-codes.md
@include shared/output-format.md

&lt;span class="gu"&gt;## Task&lt;/span&gt;
Generate an invoice for the following items: {{items}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each shared file stays focused on one thing. &lt;code&gt;role-accountant.md&lt;/code&gt; defines who the model is. &lt;code&gt;tax-codes.md&lt;/code&gt; is your master reference for tax rates. &lt;code&gt;output-format.md&lt;/code&gt; specifies the JSON schema you expect back.&lt;/p&gt;

&lt;p&gt;When tax rates change, you update one file — and every skill that &lt;code&gt;@include&lt;/code&gt;s it picks up the change automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  @delegate — agent composition
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@delegate path/to/agent.md
@delegate path/to/agent.md --parallel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;code&gt;@include&lt;/code&gt; expands content, &lt;code&gt;@delegate&lt;/code&gt; hands off execution to a sub-agent. The referenced file is not expanded inline — it's a separate agent that runs independently (or in parallel with &lt;code&gt;--parallel&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Document Processing Pipeline&lt;/span&gt;

@include shared/role-orchestrator.md

&lt;span class="gu"&gt;## Steps&lt;/span&gt;
&lt;span class="p"&gt;1.&lt;/span&gt; Extract text from uploaded document
@delegate agents/ocr-extractor.md
&lt;span class="p"&gt;
2.&lt;/span&gt; Classify document type
@delegate agents/doc-classifier.md --parallel
&lt;span class="p"&gt;
3.&lt;/span&gt; Route to appropriate handler
@delegate agents/routing-agent.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how you build multi-agent workflows without everything living in one file.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Real-World Example: Customer Support Skill
&lt;/h2&gt;

&lt;p&gt;Here's how a customer support skill looks when broken into modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;support/
├── SKILL.md                    # Root — orchestrates everything
├── shared/
│   ├── role.md                 # "You are a support specialist..."
│   ├── product-catalog.md      # Product names, SKUs, pricing
│   ├── escalation-rules.md     # When to escalate to human
│   └── response-format.md      # JSON output schema
└── agents/
    ├── intent-classifier.md    # Classifies ticket intent
    └── kb-search.md            # Searches knowledge base
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;SKILL.md&lt;/code&gt; ties it together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Customer Support Skill&lt;/span&gt;

@include shared/role.md
@include shared/product-catalog.md
@include shared/escalation-rules.md
@include shared/response-format.md

&lt;span class="gu"&gt;## Workflow&lt;/span&gt;

Classify the customer intent first:
@delegate agents/intent-classifier.md

Then search for relevant articles:
@delegate agents/kb-search.md --parallel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dependency graph looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SKILL.md
├── shared/role.md
├── shared/product-catalog.md
├── shared/escalation-rules.md
├── shared/response-format.md
├── agents/intent-classifier.md
└── agents/kb-search.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clean. Readable. Each file has a single responsibility.&lt;/p&gt;




&lt;h2&gt;
  
  
  When It Gets Complex: dotmd-parser
&lt;/h2&gt;

&lt;p&gt;Once you have 10+ files referencing each other, questions start coming up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;"I want to update &lt;code&gt;shared/escalation-rules.md&lt;/code&gt; — what else will break?"&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;"Is there a circular reference somewhere in this skill tree?"&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;"What &lt;code&gt;{{variables}}&lt;/code&gt; are left unresolved after expansion?"&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where &lt;a href="https://github.com/dotmd-projects/dotmd-parser" rel="noopener noreferrer"&gt;dotmd-parser&lt;/a&gt; comes in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;dotmd-parser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Build the dependency graph
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dotmd_parser&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;build_graph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;summary&lt;/span&gt;

&lt;span class="n"&gt;graph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;build_graph&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./support/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;graph&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;# Nodes: 7  (skill:1, shared:4, agent:2)
# Edges: 6  (include:4, delegate:2)
# Warnings: 0
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Find what breaks before you edit
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dotmd_parser&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;build_graph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dependents_of&lt;/span&gt;

&lt;span class="n"&gt;graph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;build_graph&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./support/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;affected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dependents_of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;graph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/abs/path/to/shared/product-catalog.md&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# → ["/abs/path/to/support/SKILL.md"]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One call tells you the full blast radius of your change.&lt;/p&gt;

&lt;h3&gt;
  
  
  Detect circular references
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;graph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;build_graph&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./bad-skill/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Warnings: 1
# [CIRCULAR] 循環参照: bad-skill/SKILL.md -&amp;gt; b.md -&amp;gt; bad-skill/SKILL.md
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Circular references are caught at parse time — not when your agent starts looping at runtime.&lt;/p&gt;

&lt;h3&gt;
  
  
  Expand &lt;a class="mentioned-user" href="https://dev.to/include"&gt;@include&lt;/a&gt; to final text
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dotmd_parser&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;resolve&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./support/SKILL.md&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;items&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;laptop, mouse&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;        &lt;span class="c1"&gt;# Fully expanded prompt
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;placeholders&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;   &lt;span class="c1"&gt;# Any unresolved {{variables}}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The &lt;a class="mentioned-user" href="https://dev.to/include"&gt;@include&lt;/a&gt; Convention
&lt;/h2&gt;

&lt;p&gt;There's no official spec for &lt;code&gt;@include&lt;/code&gt; in Claude Code — this is a convention we've been building on top of SKILL.md. The format is intentionally simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@include relative/path/to/file.md
@delegate relative/path/to/agent.md
@delegate relative/path/to/agent.md --parallel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;dotmd-parser&lt;/code&gt; also tracks &lt;code&gt;Read \&lt;/code&gt;path/to/file.md`&lt;code&gt;references (runtime reads that don't expand inline) and&lt;/code&gt;{{variable}}` placeholders.&lt;/p&gt;

&lt;p&gt;If you're building anything non-trivial with Claude Code, we'd encourage you to try this pattern. The overhead is low — it's just Markdown files — and the payoff in maintainability is significant.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next: dotmd-io
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;dotmd-parser&lt;/code&gt; is the open-source core. We're building &lt;strong&gt;dotmd-io&lt;/strong&gt; on top of it — a web platform that gives your whole team a visual interface for managing SKILL.md dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dependency graph visualization (ReactFlow + D3)&lt;/li&gt;
&lt;li&gt;Monaco Editor with &lt;code&gt;@include&lt;/code&gt;/&lt;code&gt;@delegate&lt;/code&gt; syntax highlighting&lt;/li&gt;
&lt;li&gt;A/B testing and prompt scoring via Claude API&lt;/li&gt;
&lt;li&gt;Git-based version control with one-click rollback&lt;/li&gt;
&lt;li&gt;RBAC for non-engineers to safely edit prompts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If that sounds useful, watch the repo: &lt;a href="https://github.com/dotmd-projects/dotmd-parser" rel="noopener noreferrer"&gt;github.com/dotmd-projects/dotmd-parser&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`bash&lt;br&gt;
pip install dotmd-parser&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Start with a small skill and try extracting one shared file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`plaintext&lt;br&gt;
my-skill/&lt;br&gt;
├── SKILL.md          # @include shared/role.md&lt;br&gt;
└── shared/&lt;br&gt;
    └── role.md       # Just the role definition&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Run the parser to verify:&lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;bash&lt;br&gt;
dotmd-parser ./my-skill/&lt;/p&gt;

&lt;h1&gt;
  
  
  Nodes: 2  (skill:1, shared:1)
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Edges: 1  (include:1)
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Warnings: 0
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;Once it clicks, you'll find yourself refactoring every prompt you write.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built something with &lt;code&gt;@include&lt;/code&gt;? We'd love to see it — open an issue or drop a comment below.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;code&gt;claudecode&lt;/code&gt; &lt;code&gt;promptengineering&lt;/code&gt; &lt;code&gt;python&lt;/code&gt; &lt;code&gt;ai&lt;/code&gt; &lt;code&gt;opensource&lt;/code&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>promptengineering</category>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
