agents-templated 1.2.12 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -21
- package/bin/cli.js +76 -59
- package/index.js +2 -10
- package/lib/instructions.js +124 -102
- package/package.json +1 -1
- package/templates/.cursorrules +9 -70
- package/templates/.github/copilot-instructions.md +7 -62
- package/templates/AGENTS.md +5 -0
- package/templates/CLAUDE.md +116 -47
- package/templates/README.md +17 -21
- package/templates/agent-docs/ARCHITECTURE.md +6 -5
- package/templates/agent-docs/README.md +6 -11
- package/templates/agents/rules/ai-integration.mdc +54 -0
- package/templates/agents/rules/guardrails.mdc +97 -0
- package/templates/agents/rules/intent-routing.mdc +9 -0
- package/templates/agents/rules/planning.mdc +69 -0
- package/templates/agents/skills/README.md +0 -7
- package/templates/agents/skills/api-design/SKILL.md +59 -0
- package/templates/agents/skills/llm-integration/SKILL.md +64 -0
- package/templates/instructions/source/core.md +209 -26
- package/templates/AGENTS.MD +0 -665
package/lib/instructions.js
CHANGED
|
@@ -1,145 +1,167 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const GENERATED_INSTRUCTION_PATHS = {
|
|
7
|
-
canonical: {
|
|
8
|
-
generic: '.github/instructions/AGENTS.md'
|
|
9
|
-
},
|
|
10
|
-
compatibility: {
|
|
11
|
-
generic: 'AGENTS.MD',
|
|
12
|
-
copilot: '.github/copilot-instructions.md',
|
|
13
|
-
claude: '.claude/CLAUDE.md'
|
|
14
|
-
}
|
|
15
|
-
};
|
|
4
|
+
// CLAUDE.md is the single source of truth. Edit it directly — no generation needed.
|
|
5
|
+
const CANONICAL_INSTRUCTION_FILE = 'CLAUDE.md';
|
|
16
6
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
// Thin compatibility pointer files — policy lives in CLAUDE.md, not here.
|
|
8
|
+
const POINTER_FILES = {
|
|
9
|
+
agents: 'AGENTS.MD',
|
|
10
|
+
copilot: '.github/copilot-instructions.md'
|
|
11
|
+
};
|
|
20
12
|
|
|
21
|
-
function
|
|
13
|
+
function buildAgentsPointer() {
|
|
22
14
|
return [
|
|
23
|
-
'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
''
|
|
15
|
+
'# AGENTS Instructions',
|
|
16
|
+
'',
|
|
17
|
+
'> Primary policy: [`CLAUDE.md`](CLAUDE.md).',
|
|
18
|
+
'> This file is a compatibility pointer. All policy lives in CLAUDE.md.',
|
|
19
|
+
'> If this file and CLAUDE.md conflict, CLAUDE.md wins.'
|
|
27
20
|
].join('\n');
|
|
28
21
|
}
|
|
29
22
|
|
|
30
|
-
function
|
|
31
|
-
const titles = {
|
|
32
|
-
generic: '# AGENTS Instructions',
|
|
33
|
-
copilot: '# GitHub Copilot Instructions',
|
|
34
|
-
claude: '# Claude Instructions'
|
|
35
|
-
};
|
|
36
|
-
|
|
23
|
+
function buildCopilotPointer() {
|
|
37
24
|
return [
|
|
38
|
-
|
|
25
|
+
'<!-- Tool profile: copilot-compat -->',
|
|
26
|
+
'# GitHub Copilot Instructions',
|
|
39
27
|
'',
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
''
|
|
28
|
+
'Primary policy source: `CLAUDE.md`.',
|
|
29
|
+
'Load policy only from the canonical source file above.',
|
|
30
|
+
'If this file and CLAUDE.md conflict, CLAUDE.md wins.'
|
|
44
31
|
].join('\n');
|
|
45
32
|
}
|
|
46
33
|
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
files[GENERATED_INSTRUCTION_PATHS.compatibility.copilot] = `${buildHeaders('copilot-compat')}${buildCompatInstruction('copilot', corePath)}`;
|
|
54
|
-
files[GENERATED_INSTRUCTION_PATHS.compatibility.claude] = `${buildHeaders('claude-compat')}${buildCompatInstruction('claude', corePath)}`;
|
|
55
|
-
|
|
56
|
-
return files;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function resolveCoreContent(targetDir, templateDir) {
|
|
60
|
-
const canonicalPath = path.join(targetDir, CORE_SOURCE_REL_PATH);
|
|
61
|
-
if (await fs.pathExists(canonicalPath)) {
|
|
62
|
-
return fs.readFile(canonicalPath, 'utf8');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
for (const legacyFile of getLegacyCoreCandidates()) {
|
|
66
|
-
const legacyPath = path.join(targetDir, legacyFile);
|
|
67
|
-
if (await fs.pathExists(legacyPath)) {
|
|
68
|
-
return fs.readFile(legacyPath, 'utf8');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const templateCorePath = path.join(templateDir, CORE_SOURCE_REL_PATH);
|
|
73
|
-
return fs.readFile(templateCorePath, 'utf8');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async function ensureCoreSource(targetDir, templateDir, force = false) {
|
|
77
|
-
const targetCorePath = path.join(targetDir, CORE_SOURCE_REL_PATH);
|
|
78
|
-
|
|
79
|
-
if (await fs.pathExists(targetCorePath) && !force) {
|
|
80
|
-
return;
|
|
34
|
+
async function writeGeneratedInstructions(targetDir, templateDir, force = false) {
|
|
35
|
+
// Copy CLAUDE.md from template if not present (or forced)
|
|
36
|
+
const targetClaude = path.join(targetDir, CANONICAL_INSTRUCTION_FILE);
|
|
37
|
+
if (!(await fs.pathExists(targetClaude)) || force) {
|
|
38
|
+
const templateClaude = path.join(templateDir, CANONICAL_INSTRUCTION_FILE);
|
|
39
|
+
await fs.copy(templateClaude, targetClaude);
|
|
81
40
|
}
|
|
82
41
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
async function writeGeneratedInstructions(targetDir, templateDir, force = false) {
|
|
89
|
-
await ensureCoreSource(targetDir, templateDir, force);
|
|
90
|
-
const corePath = path.join(targetDir, CORE_SOURCE_REL_PATH);
|
|
91
|
-
const coreContent = await fs.readFile(corePath, 'utf8');
|
|
92
|
-
const artifacts = buildGeneratedArtifacts(coreContent);
|
|
42
|
+
// Write thin pointer files
|
|
43
|
+
const pointers = {
|
|
44
|
+
[POINTER_FILES.agents]: buildAgentsPointer(),
|
|
45
|
+
[POINTER_FILES.copilot]: buildCopilotPointer()
|
|
46
|
+
};
|
|
93
47
|
|
|
94
|
-
for (const [relPath, content] of Object.entries(
|
|
48
|
+
for (const [relPath, content] of Object.entries(pointers)) {
|
|
95
49
|
const targetPath = path.join(targetDir, relPath);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
50
|
+
if (!(await fs.pathExists(targetPath)) || force) {
|
|
51
|
+
await fs.ensureDir(path.dirname(targetPath));
|
|
52
|
+
await fs.writeFile(targetPath, content, 'utf8');
|
|
99
53
|
}
|
|
100
|
-
|
|
101
|
-
await fs.ensureDir(path.dirname(targetPath));
|
|
102
|
-
await fs.writeFile(targetPath, content, 'utf8');
|
|
103
54
|
}
|
|
104
55
|
}
|
|
105
56
|
|
|
106
57
|
async function validateInstructionDrift(targetDir) {
|
|
107
|
-
const
|
|
108
|
-
if (!(await fs.pathExists(
|
|
109
|
-
return {
|
|
110
|
-
ok: false,
|
|
111
|
-
missingCore: true,
|
|
112
|
-
driftFiles: []
|
|
113
|
-
};
|
|
58
|
+
const claudePath = path.join(targetDir, CANONICAL_INSTRUCTION_FILE);
|
|
59
|
+
if (!(await fs.pathExists(claudePath))) {
|
|
60
|
+
return { ok: false, missingCanonical: true, driftFiles: [] };
|
|
114
61
|
}
|
|
115
62
|
|
|
116
|
-
const coreContent = await fs.readFile(corePath, 'utf8');
|
|
117
|
-
const expected = buildGeneratedArtifacts(coreContent);
|
|
118
63
|
const driftFiles = [];
|
|
64
|
+
const expectedPointers = {
|
|
65
|
+
[POINTER_FILES.agents]: buildAgentsPointer(),
|
|
66
|
+
[POINTER_FILES.copilot]: buildCopilotPointer()
|
|
67
|
+
};
|
|
119
68
|
|
|
120
|
-
for (const [relPath, expectedContent] of Object.entries(
|
|
69
|
+
for (const [relPath, expectedContent] of Object.entries(expectedPointers)) {
|
|
121
70
|
const filePath = path.join(targetDir, relPath);
|
|
122
71
|
if (!(await fs.pathExists(filePath))) {
|
|
123
72
|
driftFiles.push(relPath);
|
|
124
73
|
continue;
|
|
125
74
|
}
|
|
126
|
-
|
|
127
75
|
const actual = await fs.readFile(filePath, 'utf8');
|
|
128
76
|
if (actual !== expectedContent) {
|
|
129
77
|
driftFiles.push(relPath);
|
|
130
78
|
}
|
|
131
79
|
}
|
|
132
80
|
|
|
133
|
-
return {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
81
|
+
return { ok: driftFiles.length === 0, missingCanonical: false, driftFiles };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function scaffoldSkill(targetDir, skillName) {
|
|
85
|
+
const skillDir = path.join(targetDir, 'agents', 'skills', skillName);
|
|
86
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
87
|
+
|
|
88
|
+
if (await fs.pathExists(skillFile)) {
|
|
89
|
+
throw new Error(`Skill already exists: agents/skills/${skillName}/SKILL.md`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const title = skillName.split('-').map(w => w[0].toUpperCase() + w.slice(1)).join(' ');
|
|
93
|
+
const content = [
|
|
94
|
+
`---`,
|
|
95
|
+
`name: ${skillName}`,
|
|
96
|
+
`description: TODO — describe what this skill does.`,
|
|
97
|
+
`---`,
|
|
98
|
+
``,
|
|
99
|
+
`# ${title}`,
|
|
100
|
+
``,
|
|
101
|
+
`## Trigger Conditions`,
|
|
102
|
+
``,
|
|
103
|
+
`- TODO — when should this skill activate?`,
|
|
104
|
+
``,
|
|
105
|
+
`## Workflow`,
|
|
106
|
+
``,
|
|
107
|
+
`1. TODO`,
|
|
108
|
+
``,
|
|
109
|
+
`## Output Contract`,
|
|
110
|
+
``,
|
|
111
|
+
`- TODO`,
|
|
112
|
+
``,
|
|
113
|
+
`## Guardrails`,
|
|
114
|
+
``,
|
|
115
|
+
`- Do not override security or testing constraints.`,
|
|
116
|
+
``
|
|
117
|
+
].join('\n');
|
|
118
|
+
|
|
119
|
+
await fs.ensureDir(skillDir);
|
|
120
|
+
await fs.writeFile(skillFile, content, 'utf8');
|
|
121
|
+
return `agents/skills/${skillName}/SKILL.md`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function scaffoldRule(targetDir, ruleName) {
|
|
125
|
+
const rulesDir = path.join(targetDir, 'agents', 'rules');
|
|
126
|
+
const ruleFile = path.join(rulesDir, `${ruleName}.mdc`);
|
|
127
|
+
|
|
128
|
+
if (await fs.pathExists(ruleFile)) {
|
|
129
|
+
throw new Error(`Rule already exists: agents/rules/${ruleName}.mdc`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const content = [
|
|
133
|
+
`---`,
|
|
134
|
+
`title: "TODO — Rule Title"`,
|
|
135
|
+
`description: "TODO — describe what this rule enforces."`,
|
|
136
|
+
`version: "1.0.0"`,
|
|
137
|
+
`tags: ["${ruleName}"]`,
|
|
138
|
+
`alwaysApply: false`,
|
|
139
|
+
`---`,
|
|
140
|
+
``,
|
|
141
|
+
`## Purpose`,
|
|
142
|
+
``,
|
|
143
|
+
`TODO — explain the purpose of this rule.`,
|
|
144
|
+
``,
|
|
145
|
+
`## Requirements`,
|
|
146
|
+
``,
|
|
147
|
+
`1. TODO`,
|
|
148
|
+
``,
|
|
149
|
+
`## Guardrails`,
|
|
150
|
+
``,
|
|
151
|
+
`- This rule does not override security or testing constraints.`,
|
|
152
|
+
``
|
|
153
|
+
].join('\n');
|
|
154
|
+
|
|
155
|
+
await fs.ensureDir(rulesDir);
|
|
156
|
+
await fs.writeFile(ruleFile, content, 'utf8');
|
|
157
|
+
return `agents/rules/${ruleName}.mdc`;
|
|
138
158
|
}
|
|
139
159
|
|
|
140
160
|
module.exports = {
|
|
141
|
-
|
|
142
|
-
|
|
161
|
+
CANONICAL_INSTRUCTION_FILE,
|
|
162
|
+
POINTER_FILES,
|
|
143
163
|
writeGeneratedInstructions,
|
|
144
|
-
validateInstructionDrift
|
|
164
|
+
validateInstructionDrift,
|
|
165
|
+
scaffoldSkill,
|
|
166
|
+
scaffoldRule
|
|
145
167
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agents-templated",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Technology-agnostic development template with multi-AI agent support (Cursor, Copilot, VSCode, Gemini), security-first patterns, and comprehensive testing guidelines",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/templates/.cursorrules
CHANGED
|
@@ -1,70 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Core Principles
|
|
11
|
-
- **Security-first development**: Always validate inputs, authenticate users, implement appropriate rate limiting
|
|
12
|
-
- **Type safety**: Use strong typing systems available in chosen language/framework
|
|
13
|
-
- **Performance optimization**: Monitor resource usage, implement caching, optimize assets
|
|
14
|
-
- **Testing strategy**: Comprehensive testing at unit, integration, and E2E levels
|
|
15
|
-
- **Accessibility**: WCAG 2.1 AA compliance for all user-facing interfaces
|
|
16
|
-
- **Documentation**: Keep project documentation updated and comprehensive
|
|
17
|
-
|
|
18
|
-
## Architecture Principles
|
|
19
|
-
- **Technology-agnostic**: This template adapts to your chosen stack
|
|
20
|
-
- **Security patterns**: Input validation, authentication, authorization, rate limiting
|
|
21
|
-
- **Performance patterns**: Caching, lazy loading, bundle optimization
|
|
22
|
-
- **Testing patterns**: Unit (80%), Integration (15%), E2E (5%) coverage target
|
|
23
|
-
- **Feature-oriented structure**: Group by domain/feature, not just technical layer
|
|
24
|
-
|
|
25
|
-
## Security Requirements (CRITICAL)
|
|
26
|
-
- **Input validation**: All user inputs MUST be validated with appropriate schema validation
|
|
27
|
-
- **Authentication**: Implement secure authentication flows with session management
|
|
28
|
-
- **Rate limiting**: Public endpoints MUST have rate limiting protection
|
|
29
|
-
- **Authorization**: Role-based access control with proper middleware
|
|
30
|
-
- **Error handling**: Never expose sensitive data in error responses
|
|
31
|
-
- **Database access**: Use ORM/ODM patterns, avoid raw queries unless performance-critical
|
|
32
|
-
|
|
33
|
-
## Code Quality Standards
|
|
34
|
-
- **Type Safety**: Use strict typing, avoid loose type usage
|
|
35
|
-
- **Performance**: Monitor bundle/binary size, implement lazy loading patterns
|
|
36
|
-
- **Accessibility**: WCAG 2.1 AA compliance for user-facing components
|
|
37
|
-
- **Testing**: All business logic and user flows must have appropriate tests
|
|
38
|
-
- **Documentation**: Keep README, agent-docs/ARCHITECTURE.md, and AGENTS.md updated
|
|
39
|
-
|
|
40
|
-
## Technology Stack Adaptation
|
|
41
|
-
Choose your stack and apply these patterns consistently:
|
|
42
|
-
|
|
43
|
-
### Frontend Options
|
|
44
|
-
- **React/Next.js/Vue/Svelte**: Component-based with proper state management
|
|
45
|
-
- **Angular**: Component + service architecture with TypeScript
|
|
46
|
-
- **Traditional**: Server-side rendering with progressive enhancement
|
|
47
|
-
|
|
48
|
-
### Backend Options
|
|
49
|
-
- **Node.js**: Express, Fastify, or framework API routes
|
|
50
|
-
- **Python**: Django, FastAPI, Flask with proper ORM patterns
|
|
51
|
-
- **Other**: Adapt patterns to your chosen backend technology
|
|
52
|
-
|
|
53
|
-
### Database Options
|
|
54
|
-
- **SQL**: PostgreSQL, MySQL with ORM (Prisma, TypeORM, SQLAlchemy)
|
|
55
|
-
- **NoSQL**: MongoDB, DynamoDB with ODM patterns
|
|
56
|
-
- **Cloud**: Supabase, Firebase, managed database services
|
|
57
|
-
|
|
58
|
-
## Agent Delegation (See AGENTS.md for details)
|
|
59
|
-
- **UI/Design work** → FrontendAgent
|
|
60
|
-
- **API/Business logic** → BackendAgent
|
|
61
|
-
- **Database/Schema** → DatabaseAgent
|
|
62
|
-
- **Testing implementation** → TestAgent
|
|
63
|
-
- **Security reviews** → SecurityAgent
|
|
64
|
-
- **Code quality** → ReviewerAgent
|
|
65
|
-
|
|
66
|
-
## Usage Instructions
|
|
67
|
-
1. Choose your technology stack
|
|
68
|
-
2. Adapt the patterns in agents/rules/*.mdc to your chosen technologies
|
|
69
|
-
3. Update this .cursorrules file with stack-specific details
|
|
70
|
-
4. Begin development following the established patterns
|
|
1
|
+
<!-- GENERATED FILE - DO NOT EDIT DIRECTLY -->
|
|
2
|
+
<!-- Source of truth: instructions/source/core.md -->
|
|
3
|
+
<!-- Tool profile: cursor-compat -->
|
|
4
|
+
# Cursor Rules
|
|
5
|
+
|
|
6
|
+
Primary policy source: `instructions/source/core.md`.
|
|
7
|
+
Load policy only from the canonical source file above.
|
|
8
|
+
Do not duplicate, summarize, or inline rules in this file.
|
|
9
|
+
If this file and the canonical source conflict, the canonical source wins.
|
|
@@ -1,64 +1,9 @@
|
|
|
1
|
+
<!-- GENERATED FILE - DO NOT EDIT DIRECTLY -->
|
|
2
|
+
<!-- Source of truth: instructions/source/core.md -->
|
|
3
|
+
<!-- Tool profile: copilot-compat -->
|
|
1
4
|
# GitHub Copilot Instructions
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- **AI Guide**: See `AGENTS.md` for comprehensive instructions
|
|
8
|
-
- **Architecture**: See `agent-docs/ARCHITECTURE.md` for project guidelines
|
|
9
|
-
- **Custom Skills**: See `agents/skills/` directory for domain-specific extensions
|
|
10
|
-
- **Detailed Rules**: See `agents/rules/*.mdc` files
|
|
11
|
-
|
|
12
|
-
## Always Apply
|
|
13
|
-
|
|
14
|
-
1. **Security-first**: Validate inputs, authenticate endpoints, rate limit public APIs
|
|
15
|
-
- Reference: `agents/rules/security.mdc`
|
|
16
|
-
|
|
17
|
-
2. **Testing**: Unit (80%), Integration (15%), E2E (5%) coverage
|
|
18
|
-
- Reference: `agents/rules/testing.mdc`
|
|
19
|
-
|
|
20
|
-
3. **Type Safety**: Strong typing with runtime validation at boundaries
|
|
21
|
-
- Reference: `agents/rules/core.mdc`
|
|
22
|
-
|
|
23
|
-
## Agent Delegation
|
|
24
|
-
|
|
25
|
-
When implementing features, follow agent patterns from `AGENTS.MD`:
|
|
26
|
-
- **UI/Design** → FrontendAgent patterns (`agents/rules/frontend.mdc`)
|
|
27
|
-
- **API/Logic** → BackendAgent patterns (`agents/rules/security.mdc`)
|
|
28
|
-
- **Database** → DatabaseAgent patterns (`agents/rules/database.mdc`)
|
|
29
|
-
- **Testing** → TestAgent patterns (`agents/rules/testing.mdc`)
|
|
30
|
-
- **Security** → SecurityAgent patterns (`agents/rules/security.mdc`)
|
|
31
|
-
|
|
32
|
-
## Deterministic Slash Commands
|
|
33
|
-
|
|
34
|
-
- Slash command protocol is defined in `AGENTS.MD` under `Deterministic Slash Command System Standard`.
|
|
35
|
-
- Modular command contracts are stored in `agents/commands/`.
|
|
36
|
-
- Command mode is strict: unknown or malformed slash commands must return structured error output and stop.
|
|
37
|
-
- No conversational fallback is allowed once slash-command mode is entered.
|
|
38
|
-
- Destructive actions require explicit confirmation token format: `CONFIRM-DESTRUCTIVE:<target>`.
|
|
39
|
-
|
|
40
|
-
## Critical Rules
|
|
41
|
-
|
|
42
|
-
- Validate ALL user inputs with schema validation
|
|
43
|
-
- Authenticate and authorize protected endpoints
|
|
44
|
-
- Rate limit public endpoints
|
|
45
|
-
- Write tests for all business logic
|
|
46
|
-
- Ensure WCAG 2.1 AA accessibility compliance
|
|
47
|
-
- Use ORM/ODM patterns, avoid raw queries
|
|
48
|
-
- Never expose sensitive data in errors/logs
|
|
49
|
-
|
|
50
|
-
## Reference Files
|
|
51
|
-
|
|
52
|
-
- `AGENTS.MD` - Primary AI assistant guide
|
|
53
|
-
- `agent-docs/ARCHITECTURE.md` - Architecture and technology stack guidance
|
|
54
|
-
- `agents/commands/` - Deterministic slash command contracts
|
|
55
|
-
- `agents/rules/core.mdc` - Core principles
|
|
56
|
-
- `agents/rules/security.mdc` - Security patterns (CRITICAL)
|
|
57
|
-
- `agents/rules/testing.mdc` - Testing strategy (CRITICAL)
|
|
58
|
-
- `agents/rules/frontend.mdc` - Frontend patterns
|
|
59
|
-
- `agents/rules/database.mdc` - Database patterns
|
|
60
|
-
- `agents/rules/style.mdc` - Code style guidelines
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
**Note**: This is technology-agnostic. Adapt patterns to your chosen stack while maintaining security and quality standards.
|
|
6
|
+
Primary policy source: `instructions/source/core.md`.
|
|
7
|
+
Load policy only from the canonical source file above.
|
|
8
|
+
Do not duplicate, summarize, or inline rules in this file.
|
|
9
|
+
If this file and the canonical source conflict, the canonical source wins.
|
package/templates/CLAUDE.md
CHANGED
|
@@ -1,65 +1,134 @@
|
|
|
1
|
-
# Claude
|
|
1
|
+
# Claude Instructions
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This is the single source of truth for AI development policy in this repository.
|
|
4
|
+
All policy, routing, and skill governance lives here — edit this file directly.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Reference Index
|
|
9
|
+
|
|
10
|
+
### Rule modules (`.github/instructions/rules/`)
|
|
11
|
+
|
|
12
|
+
| Module | File | Governs |
|
|
13
|
+
|--------|------|---------|
|
|
14
|
+
| Security | `.github/instructions/rules/security.mdc` | Validation, authn/authz, secrets, rate limiting |
|
|
15
|
+
| Testing | `.github/instructions/rules/testing.mdc` | Strategy, coverage mix, test discipline |
|
|
16
|
+
| Core | `.github/instructions/rules/core.mdc` | Type safety, runtime boundaries, error modeling |
|
|
17
|
+
| Database | `.github/instructions/rules/database.mdc` | ORM patterns, migrations, query safety |
|
|
18
|
+
| Frontend | `.github/instructions/rules/frontend.mdc` | Accessibility, responsiveness, client trust boundaries |
|
|
19
|
+
| Style | `.github/instructions/rules/style.mdc` | Naming, modularity, separation of concerns |
|
|
20
|
+
| System Workflow | `.github/instructions/rules/system-workflow.mdc` | Branching, PR structure, review gates |
|
|
21
|
+
| Workflows | `.github/instructions/rules/workflows.mdc` | Automation, CI/CD, deployment gates |
|
|
22
|
+
| Hardening | `.github/instructions/rules/hardening.mdc` | Threat modeling, audit mode, dependency review |
|
|
23
|
+
| Intent Routing | `.github/instructions/rules/intent-routing.mdc` | Deterministic task-to-rule mapping |
|
|
24
|
+
| Planning | `.github/instructions/rules/planning.mdc` | Feature discussion and implementation planning |
|
|
25
|
+
| AI Integration | `.github/instructions/rules/ai-integration.mdc` | LLM safety, cost controls, fallback behavior |
|
|
26
|
+
| Guardrails | `.github/instructions/rules/guardrails.mdc` | Hard stops, scope control, reversibility, minimal footprint |
|
|
27
|
+
|
|
28
|
+
### Skill modules (`.github/skills/`)
|
|
29
|
+
|
|
30
|
+
| Skill | Path | Activate when... |
|
|
31
|
+
|-------|------|------------------|
|
|
32
|
+
| app-hardening | `.github/skills/app-hardening/SKILL.md` | Hardening, anti-tamper, integrity controls |
|
|
33
|
+
| bug-triage | `.github/skills/bug-triage/SKILL.md` | Something is broken, failing, or crashing |
|
|
34
|
+
| feature-delivery | `.github/skills/feature-delivery/SKILL.md` | Build/add/implement feature work |
|
|
35
|
+
| find-skills | `.github/skills/find-skills/SKILL.md` | User asks to discover a skill |
|
|
36
|
+
| ui-ux-pro-max | `.github/skills/ui-ux-pro-max/SKILL.md` | UI, layout, design, visual work |
|
|
37
|
+
| api-design | `.github/skills/api-design/SKILL.md` | REST/GraphQL API design, OpenAPI specs, versioning |
|
|
38
|
+
| llm-integration | `.github/skills/llm-integration/SKILL.md` | LLM integrations, RAG, prompt engineering, evaluation |
|
|
39
|
+
|
|
40
|
+
Skills add capability only. They must not override security, testing, or core constraints.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Always Enforce
|
|
6
45
|
|
|
7
|
-
- **
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
46
|
+
1. **Security-first (non-overrideable)** — `.github/instructions/rules/security.mdc`
|
|
47
|
+
- Validate all external inputs at boundaries.
|
|
48
|
+
- Require authentication and role-based authorization for protected operations.
|
|
49
|
+
- Rate-limit public APIs.
|
|
50
|
+
- Never expose secrets, credentials, or PII in logs/errors/responses.
|
|
11
51
|
|
|
12
|
-
|
|
52
|
+
2. **Testing discipline (non-overrideable)** — `.github/instructions/rules/testing.mdc`
|
|
53
|
+
- Coverage mix target: Unit 80% / Integration 15% / E2E 5%.
|
|
54
|
+
- Business logic must have tests; critical flows need integration coverage.
|
|
55
|
+
- Never disable/remove tests to pass builds.
|
|
13
56
|
|
|
14
|
-
|
|
15
|
-
-
|
|
57
|
+
3. **Type safety and runtime boundaries** — `.github/instructions/rules/core.mdc`
|
|
58
|
+
- Strong internal typing, runtime validation at boundaries, explicit error models.
|
|
16
59
|
|
|
17
|
-
|
|
18
|
-
-
|
|
60
|
+
4. **Database integrity** — `.github/instructions/rules/database.mdc`
|
|
61
|
+
- Prefer ORM/ODM, justify raw queries, enforce DB constraints, prevent N+1, reversible migrations.
|
|
19
62
|
|
|
20
|
-
|
|
21
|
-
-
|
|
63
|
+
5. **Frontend standards** — `.github/instructions/rules/frontend.mdc`
|
|
64
|
+
- WCAG 2.1 AA, responsive defaults, clear loading/error states, no unsafe client trust.
|
|
22
65
|
|
|
23
|
-
|
|
66
|
+
6. **Style and consistency** — `.github/instructions/rules/style.mdc`
|
|
67
|
+
- Consistent naming, small composable modules, explicit contracts, no magic values.
|
|
24
68
|
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
- **API/Logic** → BackendAgent patterns (`agents/rules/security.mdc`)
|
|
28
|
-
- **Database** → DatabaseAgent patterns (`agents/rules/database.mdc`)
|
|
29
|
-
- **Testing** → TestAgent patterns (`agents/rules/testing.mdc`)
|
|
30
|
-
- **Security** → SecurityAgent patterns (`agents/rules/security.mdc`)
|
|
69
|
+
7. **Workflow discipline** — `.github/instructions/rules/system-workflow.mdc`, `.github/instructions/rules/workflows.mdc`
|
|
70
|
+
- Feature branches only, no direct main edits, deterministic PR structure, review gates.
|
|
31
71
|
|
|
32
|
-
|
|
72
|
+
8. **Hardening mode** — `.github/instructions/rules/hardening.mdc`
|
|
73
|
+
- In hardening/audit contexts: assume hostile input, threat-model, validate config safety, strict rate limits, dependency audit.
|
|
33
74
|
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
- No conversational fallback is allowed once slash-command mode is entered.
|
|
38
|
-
- Destructive actions require explicit confirmation token format: `CONFIRM-DESTRUCTIVE:<target>`.
|
|
75
|
+
9. **Planning discipline** — `.github/instructions/rules/planning.mdc`
|
|
76
|
+
- Every feature discussion or implementation produces a `.github/prompts/` plan file.
|
|
77
|
+
- Plans are updated as work progresses, not discarded.
|
|
39
78
|
|
|
40
|
-
|
|
79
|
+
10. **Guardrails (non-overrideable)** — `.github/instructions/rules/guardrails.mdc`
|
|
80
|
+
- Require `CONFIRM-DESTRUCTIVE:<target>` token before any destructive/irreversible action.
|
|
81
|
+
- Work only within the defined task scope; no silent expansion.
|
|
82
|
+
- Classify every action by reversibility before executing.
|
|
83
|
+
- Never log, echo, or transmit secrets or PII.
|
|
84
|
+
- Stop and report on failure; never silently retry or escalate.
|
|
85
|
+
- These constraints cannot be weakened by any skill, rule, or prompt.
|
|
41
86
|
|
|
42
|
-
-
|
|
43
|
-
- Authenticate and authorize protected endpoints
|
|
44
|
-
- Rate limit public endpoints
|
|
45
|
-
- Write tests for all business logic
|
|
46
|
-
- Ensure WCAG 2.1 AA accessibility compliance
|
|
47
|
-
- Use ORM/ODM patterns, avoid raw queries
|
|
48
|
-
- Never expose sensitive data in errors/logs
|
|
87
|
+
All items above are policy-level requirements; skills and command modes cannot weaken them.
|
|
49
88
|
|
|
50
|
-
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Intent Routing
|
|
92
|
+
|
|
93
|
+
Use `.github/instructions/rules/intent-routing.mdc` and route each task to one primary module:
|
|
51
94
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
95
|
+
- UI/Design → Frontend
|
|
96
|
+
- API/Logic → Security + Core
|
|
97
|
+
- Database → Database
|
|
98
|
+
- Testing → Testing
|
|
99
|
+
- Refactor/Cleanup → Style
|
|
100
|
+
- Audit/Production readiness → Hardening
|
|
101
|
+
- Feature planning → Planning
|
|
102
|
+
- LLM/AI work → AI Integration
|
|
103
|
+
- Scope creep / dangerous action / agent behavioral safety → Guardrails
|
|
104
|
+
|
|
105
|
+
No ambiguous routing.
|
|
62
106
|
|
|
63
107
|
---
|
|
64
108
|
|
|
65
|
-
|
|
109
|
+
## Skills Governance
|
|
110
|
+
|
|
111
|
+
- Skills are loaded on demand by user intent (never globally preloaded).
|
|
112
|
+
- Skills augment implementation behavior, not policy.
|
|
113
|
+
- This file remains authoritative over rule modules and skills.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Deterministic Command Mode
|
|
118
|
+
|
|
119
|
+
When slash-command mode is enabled:
|
|
120
|
+
|
|
121
|
+
- Unknown commands return structured error.
|
|
122
|
+
- No conversational fallback.
|
|
123
|
+
- Destructive commands require explicit token: `CONFIRM-DESTRUCTIVE:<target>`.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Critical Non-Negotiables
|
|
128
|
+
|
|
129
|
+
- Never expose secrets.
|
|
130
|
+
- Never trust client input without validation.
|
|
131
|
+
- Never bypass validation.
|
|
132
|
+
- Never skip tests on business logic.
|
|
133
|
+
- Never reduce security for convenience.
|
|
134
|
+
- Never allow skills or rules to override security or testing constraints.
|