Add resource path convention

From brabos-ai/code-addiction · View interactive version

Add resource path convention is an AI agent skill from the GitHub repository brabos-ai/code-addiction. Use when writing commands or skills that reference other commands, skills, or scripts — ensures paths resolve correctly across all providers after installation

How to use this skill

Skill file

Resource Path Convention

<!-- uses:

-->

Commands and skills in framwork/.codeadd/ are the source of truth. After build, they are placed in provider-specific directories (.claude/commands/, .agents/skills/, .gemini/commands/, etc.). Hardcoded .codeadd/ paths to commands or skills break because these directories do not exist in the installed project. Use build-time variables to reference resources.

When to Use

When NOT to Use

Variables

Build-time variables are available. build.js replaces them with the correct provider path during build.

A fragment's variables are resolved at a different moment, by the same rule. A fragment under

fragments/ or plugins/*/fragments/ is never built: it ships as authored, and the CLI injects it into

the installed commands when a feature or plugin is enabled. The CLI resolves each variable for the

provider of the file it is injecting into, with the rule build.js uses —

cli/tests/fragment-placeholders.test.js holds the two equal. **Write a fragment exactly as you write a

command.** Until that resolution existed, every variable in a fragment landed raw in the installed file.

`{{cmd:NAME}}`

Resolves to the full path of a command file for the target provider.

{{cmd:add-plan}}

# Claude → .claude/commands/add-plan.md
# Gemini → .gemini/commands/add-plan.toml

`{{skill:NAME/FILE}}`

Resolves to the full path of a skill file. Use SKILL.md for the main file, or any sub-file name.

{{skill:add--backend-development/SKILL.md}}

# Claude → .claude/skills/add--backend-development/SKILL.md
# Gemini → .gemini/skills/add--backend-development/SKILL.md

.codeadd/scripts/ — literal, no variable

Everything the directory ships is reached by the literal path: .codeadd/scripts/.

Scripts (no variable needed)

Node entries are reached by the literal path — the entries stay the same for every provider and for every install:

node .codeadd/scripts/status.cjs
node .codeadd/scripts/done.cjs

The shipped feature-id.cjs is a Node CommonJS module (global id allocation). Invoke entries with node .codeadd/scripts/<entry>.cjs.

`{{addpath:X}}`

Resolves to the literal .codeadd/X path — same across all providers. Use for runtime paths that exist in the user's installed project (the installer preserves .codeadd/), but are NOT distributed by the build pipeline.

Typical cases: artefacts generated at runtime by commands like /add-wiki (which writes wiki/), the manifest file, or any artefact materialized in the user's project after install.

{{addpath:wiki/domains/backend.md}}  # → .codeadd/wiki/domains/backend.md
{{addpath:manifest.json}}            # → .codeadd/manifest.json

When to use {{addpath:}} vs {{skill:}}:

| | {{skill:NAME/FILE}} | {{addpath:skills/NAME/FILE}} |

|---|---|---|

| Skill exists in the framework's skill source directory | ✅ | ❌ |

| Skill is generated at runtime in user project | ❌ | ✅ |

| Resolves per-provider | ✅ | ❌ (always .codeadd/) |

The docs root is a literal

Outputs live under .codeadd/docs/ on every provider, always — it never changes and it is data in the user's project, not a framework artefact. Write it literally; there is no variable for it. Searches that name it must pass it explicitly (see add--doc-schemas, Docs Branch).

`{{doc-schema}}`

Resolves to the current doc format version — the one integer declared as DOC_SCHEMA_VERSION in .codeadd/scripts/docs-root.cjs. Same across all providers, like {{addpath:}}. Use it wherever a generated document or a template carries its schema: frontmatter line:

schema: {{doc-schema}}               # → the integer DOC_SCHEMA_VERSION declares

Never write the number. A literal schema: <n> in markdown source is a build lint warning: the version changes with the doc format, not with the package, and a copy in a file is how the files come to disagree. The variable is refused inside a chosen injection anchor line and inside a ## Materializes block, as the other variables are.

Examples

Correct

## STEP 1: Load Context
1. Read {{cmd:add-plan}} — PRIMARY reference
2. Run: node .codeadd/scripts/status.cjs
3. Read {{skill:add--backend-development/SKILL.md}}
4. For layout notation, Read {{skill:add--ux-design/design-contract.md}}

Incorrect

## STEP 1: Load Context
Read .codeadd/commands/add-plan.md          ← BROKEN: doesn't exist after install
cat .codeadd/skills/backend-development/SKILL.md  ← BROKEN: wrong path
node .codeadd/scripts/status.cjs             ← CORRECT: scripts are at .codeadd/

Validation Checklist

[ ] No raw references to .codeadd/commands/ (use {{cmd:NAME}})
[ ] No raw references to .codeadd/skills/ (use {{skill:NAME/FILE}} for source skills, {{addpath:skills/NAME/FILE}} for runtime-generated skills)
[ ] Script references use .codeadd/scripts/ (literal, no variable)
[ ] Runtime artefacts in installed project use {{addpath:X}}
[ ] Command names match provider-map.json commands keys
[ ] Skill names match provider-map.json skills keys (with add- prefix)
[ ] Skill sub-files exist in the source skill directory
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.