feat(templates): add agent instruction templates

This commit is contained in:
chahinebrini 2026-06-24 23:37:54 +02:00
parent 421420040a
commit 830e7af0c7
2 changed files with 71 additions and 0 deletions

58
src/core/templates.ts Normal file
View File

@ -0,0 +1,58 @@
export function agentsMd(projectName: string): string {
return `# AgentHub Instructions — ${projectName}
This project uses AgentHub for shared team memory.
Before you start working:
1. Read \`.agenthub/status/latest.md\`.
2. Check \`.agenthub/tasks/\` for open tasks assigned to your role.
3. Read any handoff files relevant to your current task.
While working:
- Create decision records for architectural or technical choices (\`agenthub decision create\`).
- Update task status (\`agenthub task done TSK-0001\`).
When handing off:
- Create a handoff file (\`agenthub handoff create\`).
- Include context, open questions, and next steps.
Do not delete or overwrite files in \`.agenthub/\` unless explicitly asked.
`;
}
export function claudeMd(): string {
return `# Claude Code — Team Role
You are part of the AgentHub team in this project.
Your default roles: architect, reviewer.
Read \`AGENTS.md\` and \`.agenthub/status/latest.md\` before making decisions.
Use \`agenthub decision create\` for architecture choices.
Use \`agenthub handoff create\` when passing work to the implementer.
`;
}
export function codexMd(): string {
return `# Codex CLI — Team Role
You are part of the AgentHub team in this project.
Your default roles: implementer, tester.
Read \`AGENTS.md\` and \`.agenthub/status/latest.md\` before implementing.
Use \`agenthub task claim TSK-0001\` to reserve a task.
Use \`agenthub task done TSK-0001\` when implementation is complete.
Use \`agenthub handoff create\` when passing work to the reviewer.
`;
}
export function kimiMd(): string {
return `# Kimi Code CLI — Team Role
You are part of the AgentHub team in this project.
Your default roles: architect, implementer, reviewer.
Read \`AGENTS.md\` and \`.agenthub/status/latest.md\` before making decisions.
Use \`agenthub decision create\` for architecture choices.
Use \`agenthub handoff create\` when passing work to another agent.
`;
}

13
tests/templates.test.ts Normal file
View File

@ -0,0 +1,13 @@
import { describe, it, expect } from 'vitest';
import { agentsMd, claudeMd, codexMd, kimiMd } from '../src/core/templates.js';
describe('templates', () => {
it('includes project name in AGENTS.md', () => {
expect(agentsMd('my-app')).toContain('my-app');
});
it('references agenthub commands', () => {
expect(claudeMd()).toContain('agenthub decision create');
expect(codexMd()).toContain('agenthub task claim');
});
});