Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsnpx agentmods add commands/matt-dionis/claude-code-configs/add-resourceWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/matt-dionis/claude-code-configs/add-resource)<a href="https://agentmods.dev/commands/matt-dionis/claude-code-configs/add-resource"><img src="https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/add-resource.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01680 |
| Opus 5 | $0.00000 | $0.00840 |
| Sonnet 5 | $0.00000 | $0.00336 |
| Haiku 4.5 | $0.00000 | $0.00168 |
Grade A, and why
add-resource scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 243 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Add Resource to MCP Server
Adds a new resource endpoint to your MCP server with proper URI handling.
Usage
/add-resource <name> <description> [uri-pattern] [mime-type]
Examples
/add-resource config "Server configuration" config://settings application/json
/add-resource users "User database" data://users/{id} application/json
/add-resource files "File system access" file:///{path} text/plain
Implementation
import * as fs from 'fs/promises';
import * as path from 'path';
async function addResource(
name: string,
description: string,
uriPattern?: string,
mimeType: string = 'application/json'
) {
// Generate URI pattern if not provided
const uri = uriPattern || `${name}://default`;
// Generate resource file
const resourceContent = generateResourceFile(name, description, uri, mimeType);
// Write resource file
const resourcePath = path.join('src/resources', `${name}.ts`);
await fs.writeFile(resourcePath, resourceContent);
// Update resource index
await updateResourceIndex(name);
// Generate test file
const testContent = generateResourceTest(name, uri);
const testPath = path.join('tests/unit/resources', `${name}.test.ts`);
await fs.writeFile(testPath, testContent);
console.log(`✅ Resource "${name}" added successfully!`);
console.log(` - Implementation: ${resourcePath}`);
console.log(` - Test file: ${testPath}`);
console.log(` - URI pattern: ${uri}`);
console.log(` - MIME type: ${mimeType}`);
console.log(`\nNext steps:`);
console.log(` 1. Implement the resource provider in ${resourcePath}`);
console.log(` 2. Test with MCP Inspector`);
}
function generateResourceFile(
name: string,
description: string,
uri: string,
mimeType: string
): string {
const hasDynamicParams = uri.includes('{');
return `
import type { Resource, ResourceContent } from '../types/resources.js';
export const ${name}Resource: Resource = {
uri: '${uri}',
name: '${name}',
description: '${description}',
mimeType: '${mimeType}',
};
export async function read${capitalize(name)}Resource(
uri: string
): Promise<ResourceContent[]> {
${hasDynamicParams ? generateDynamicResourceHandler(uri) : generateStaticResourceHandler()}
return [
{
uri,
mimeType: '${mimeType}',
text: ${mimeType === 'application/json' ? 'JSON.stringify(data, null, 2)' : 'data'},
},
];
}
${generateResourceDataFunction(name, mimeType)}
`;
}
function generateDynamicResourceHandler(uriPattern: string): string {
return `
// Parse dynamic parameters from URI
const params = parseUriParams('${uriPattern}', uri);
// Fetch data based on parameters
const data = await fetch${capitalize(name)}Data(params);
if (!data) {
throw new Error(\`Resource not found: \${uri}\`);
}
`;
}
function generateStaticResourceHandler(): string {
return `
// Fetch static resource data
const data = await fetch${capitalize(name)}Data();
`;
}
function generateResourceDataFunction(name: string, mimeType: string): string {
if (mimeType === 'application/json') {
return `
async function fetch${capitalize(name)}Data(params?: Record<string, string>) {
// TODO: Implement data fetching logic
// This is a placeholder implementation
if (params?.id) {
// Return specific item
return {
id: params.id,
name: 'Example Item',
timestamp: new Date().toISOString(),
};
}
// Return collection
return {
items: [
{ id: '1', name: 'Item 1' },
{ id: '2', name: 'Item 2' },
],
total: 2,
};
}
function parseUriParams(pattern: string, uri: string): Record<string, string> {
// Convert pattern to regex
const regexPattern = pattern
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/\{(\w+)\}/g, '(?<$1>[^/]+)');
const regex = new RegExp(\`^\${regexPattern}$\`);
const match = uri.match(regex);
return match?.groups || {};
}
`;
} else {
return `
async function fetch${capitalize(name)}Data(params?: Record<string, string>) {
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 243 lines · 0 tokens per session scan A 226e1eae561f
add-resource is a command published in the GitHub repository Matt-Dionis/claude-code-configs (624 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,680 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.
analyze
Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
constitution
Create or update the project constitution from interactive or provided principle inputs.
converge
Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it.