cokit-cli 1.0.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/FAQ.md +102 -0
- package/LICENSE +32 -0
- package/QUICK-START.md +37 -0
- package/README.md +110 -0
- package/bin/cokit.js +4 -0
- package/docs/cokit-comprehensive-mapping-guide.md +937 -0
- package/docs/cokit-slides.md +205 -0
- package/docs/cokit-team-presentation.md +319 -0
- package/docs/migration-guide.md +120 -0
- package/docs/project-roadmap.md +257 -0
- package/package.json +35 -0
- package/plans/260106-1102-cokit-implementation/phases/phase-01-cli-tool.md +151 -0
- package/plans/260106-1102-cokit-implementation/phases/phase-02-repo-level-templates.md +198 -0
- package/plans/260106-1102-cokit-implementation/phases/phase-03-user-level-skills.md +219 -0
- package/plans/260106-1102-cokit-implementation/phases/phase-04-prompt-files.md +328 -0
- package/plans/260106-1102-cokit-implementation/phases/phase-05-documentation.md +166 -0
- package/plans/260106-1102-cokit-implementation/plan.md +130 -0
- package/plans/260106-1102-cokit-implementation/research/researcher-01-copilot-skills-spec.md +182 -0
- package/plans/260106-1102-cokit-implementation/research/researcher-02-copilot-instructions-prompts.md +201 -0
- package/plans/reports/code-reviewer-260106-1718-phase2-repo-templates.md +184 -0
- package/plans/reports/code-reviewer-260106-1728-phase3-review.md +486 -0
- package/plans/reports/code-reviewer-260106-1742-phase4-prompts.md +235 -0
- package/plans/reports/code-reviewer-260106-1753-phase5-docs.md +275 -0
- package/plans/reports/docs-manager-260106-1217-phase1-completion.md +45 -0
- package/plans/reports/docs-manager-260106-1734-phase3-skills.md +108 -0
- package/plans/reports/docs-manager-260106-1746-phase4-prompt-files.md +75 -0
- package/plans/reports/project-manager-260106-1734-SUMMARY.md +354 -0
- package/plans/reports/project-manager-260106-1734-phase3-completion.md +257 -0
- package/plans/reports/project-manager-260106-1734-phase3-to-phase4-transition.md +274 -0
- package/plans/reports/project-manager-260106-1734-phase4-kickoff.md +343 -0
- package/plans/reports/project-manager-260106-1734-project-status.md +355 -0
- package/plans/reports/project-manager-260106-1746-phase4-completion.md +249 -0
- package/plans/reports/project-manager-260106-1746-phase4-deliverables.md +350 -0
- package/plans/reports/project-manager-260106-1804-project-complete.md +297 -0
- package/plans/reports/tester-260106-1717-phase2-templates.md +216 -0
- package/plans/reports/tester-260106-1726-phase3-user-skills.md +256 -0
- package/plans/reports/tester-260106-1741-phase4-prompts.md +202 -0
- package/plans/reports/tester-260106-1751-phase5-docs.md +301 -0
- package/skills/code-review/SKILL.md +86 -0
- package/skills/code-review/references/code-review-reception.md +76 -0
- package/skills/code-review/references/verification-before-completion.md +86 -0
- package/skills/debugging/SKILL.md +70 -0
- package/skills/debugging/references/root-cause-tracing.md +65 -0
- package/skills/debugging/references/systematic-debugging.md +74 -0
- package/skills/debugging/references/verification.md +74 -0
- package/skills/docs-seeker/SKILL.md +91 -0
- package/skills/docs-seeker/references/search-patterns.md +93 -0
- package/skills/docs-seeker/references/source-evaluation.md +77 -0
- package/skills/planning/SKILL.md +82 -0
- package/skills/planning/references/plan-organization.md +88 -0
- package/skills/planning/references/research-phase.md +56 -0
- package/skills/planning/references/solution-design.md +65 -0
- package/skills/sequential-thinking/SKILL.md +80 -0
- package/skills/sequential-thinking/references/advanced-techniques.md +88 -0
- package/skills/sequential-thinking/references/core-patterns.md +87 -0
- package/src/commands/add.js +93 -0
- package/src/commands/doctor.js +117 -0
- package/src/commands/init.js +152 -0
- package/src/commands/list.js +91 -0
- package/src/commands/update.js +22 -0
- package/src/index.js +23 -0
- package/src/utils/colors.js +14 -0
- package/src/utils/copy.js +122 -0
- package/src/utils/paths.js +35 -0
- package/templates/repo/.github/.cokit-version +4 -0
- package/templates/repo/.github/AGENTS.md +55 -0
- package/templates/repo/.github/copilot-instructions.md +45 -0
- package/templates/repo/.github/instructions/backend.instructions.md +35 -0
- package/templates/repo/.github/instructions/development.instructions.md +25 -0
- package/templates/repo/.github/instructions/frontend.instructions.md +31 -0
- package/templates/repo/.github/instructions/testing.instructions.md +31 -0
- package/templates/repo/.github/prompts/code.prompt.md +28 -0
- package/templates/repo/.github/prompts/docs.prompt.md +23 -0
- package/templates/repo/.github/prompts/fix.prompt.md +24 -0
- package/templates/repo/.github/prompts/plan.prompt.md +24 -0
- package/templates/repo/.github/prompts/review.prompt.md +24 -0
- package/templates/repo/.github/prompts/test.prompt.md +23 -0
- package/templates/repo/.github/skills/code-review/SKILL.md +46 -0
- package/templates/repo/.github/skills/debugging/SKILL.md +34 -0
- package/templates/repo/.vscode/settings.json +6 -0
- package/templates/repo/prompts/code.prompt.md +40 -0
- package/templates/repo/prompts/docs.prompt.md +29 -0
- package/templates/repo/prompts/fix.prompt.md +35 -0
- package/templates/repo/prompts/plan.prompt.md +41 -0
- package/templates/repo/prompts/review.prompt.md +38 -0
- package/templates/repo/prompts/test.prompt.md +29 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// list command - Show installed components
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { pathExists, listDirs, countFiles } from '../utils/copy.js';
|
|
4
|
+
import { getUserSkillsDir, getRepoGithubDir } from '../utils/paths.js';
|
|
5
|
+
import { success, error, info, bold, cyan, dim } from '../utils/colors.js';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { readdirSync, existsSync } from 'fs';
|
|
8
|
+
|
|
9
|
+
export const listCommand = new Command('list')
|
|
10
|
+
.description('Show installed CoKit components')
|
|
11
|
+
.option('-a, --all', 'Show both project and global')
|
|
12
|
+
.action(async (options) => {
|
|
13
|
+
console.log();
|
|
14
|
+
console.log(bold(cyan('CoKit Installation Status')));
|
|
15
|
+
console.log();
|
|
16
|
+
|
|
17
|
+
// Check project-level installation
|
|
18
|
+
console.log(bold('Project (.github/):'));
|
|
19
|
+
const githubDir = getRepoGithubDir();
|
|
20
|
+
|
|
21
|
+
if (pathExists(githubDir)) {
|
|
22
|
+
// Check for copilot-instructions.md
|
|
23
|
+
const instructionsFile = join(githubDir, 'copilot-instructions.md');
|
|
24
|
+
if (pathExists(instructionsFile)) {
|
|
25
|
+
success('copilot-instructions.md');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Check for AGENTS.md
|
|
29
|
+
const agentsFile = join(githubDir, 'AGENTS.md');
|
|
30
|
+
if (pathExists(agentsFile)) {
|
|
31
|
+
success('AGENTS.md');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check prompts
|
|
35
|
+
const promptsDir = join(githubDir, 'prompts');
|
|
36
|
+
if (pathExists(promptsDir)) {
|
|
37
|
+
const promptFiles = readdirSync(promptsDir).filter(f => f.endsWith('.prompt.md'));
|
|
38
|
+
if (promptFiles.length > 0) {
|
|
39
|
+
success(`prompts/ (${promptFiles.length} prompts)`);
|
|
40
|
+
promptFiles.forEach(f => {
|
|
41
|
+
console.log(dim(` ${f}`));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Check instructions
|
|
47
|
+
const instructionsDir = join(githubDir, 'instructions');
|
|
48
|
+
if (pathExists(instructionsDir)) {
|
|
49
|
+
const instructionFiles = readdirSync(instructionsDir).filter(f => f.endsWith('.instructions.md'));
|
|
50
|
+
if (instructionFiles.length > 0) {
|
|
51
|
+
success(`instructions/ (${instructionFiles.length} files)`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Check skills
|
|
56
|
+
const skillsDir = join(githubDir, 'skills');
|
|
57
|
+
if (pathExists(skillsDir)) {
|
|
58
|
+
const skills = listDirs(skillsDir);
|
|
59
|
+
if (skills.length > 0) {
|
|
60
|
+
success(`skills/ (${skills.length} skills)`);
|
|
61
|
+
skills.forEach(s => {
|
|
62
|
+
console.log(dim(` ${s}`));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
info('Not installed');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log();
|
|
71
|
+
|
|
72
|
+
// Check global skills
|
|
73
|
+
console.log(bold('Personal (~/.copilot/skills/):'));
|
|
74
|
+
const globalSkillsDir = getUserSkillsDir();
|
|
75
|
+
|
|
76
|
+
if (pathExists(globalSkillsDir)) {
|
|
77
|
+
const skills = listDirs(globalSkillsDir);
|
|
78
|
+
if (skills.length > 0) {
|
|
79
|
+
success(`${skills.length} skills installed`);
|
|
80
|
+
skills.forEach(s => {
|
|
81
|
+
console.log(dim(` ${s}`));
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
info('No skills installed');
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
info('Not installed');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
console.log();
|
|
91
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// update command - Update CoKit to latest version
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { info, done, hint, bold, cyan } from '../utils/colors.js';
|
|
4
|
+
|
|
5
|
+
export const updateCommand = new Command('update')
|
|
6
|
+
.description('Update CoKit to the latest version')
|
|
7
|
+
.action(async () => {
|
|
8
|
+
console.log();
|
|
9
|
+
console.log(bold(cyan('Updating CoKit...')));
|
|
10
|
+
console.log();
|
|
11
|
+
|
|
12
|
+
info('CoKit is distributed via npx - it always uses the latest version.');
|
|
13
|
+
console.log();
|
|
14
|
+
hint('To update templates in your project, run:');
|
|
15
|
+
console.log(' npx cokit init --overwrite');
|
|
16
|
+
console.log();
|
|
17
|
+
hint('To update personal skills, run:');
|
|
18
|
+
console.log(' npx cokit init --global --overwrite');
|
|
19
|
+
console.log();
|
|
20
|
+
done('No action needed - npx always fetches latest!');
|
|
21
|
+
console.log();
|
|
22
|
+
});
|
package/src/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// CoKit CLI - Make GitHub Copilot smarter in 30 seconds
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { initCommand } from './commands/init.js';
|
|
4
|
+
import { addCommand } from './commands/add.js';
|
|
5
|
+
import { listCommand } from './commands/list.js';
|
|
6
|
+
import { doctorCommand } from './commands/doctor.js';
|
|
7
|
+
import { updateCommand } from './commands/update.js';
|
|
8
|
+
|
|
9
|
+
const program = new Command();
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.name('cokit')
|
|
13
|
+
.description('Make GitHub Copilot smarter in 30 seconds')
|
|
14
|
+
.version('1.0.0');
|
|
15
|
+
|
|
16
|
+
// Register commands
|
|
17
|
+
program.addCommand(initCommand);
|
|
18
|
+
program.addCommand(addCommand);
|
|
19
|
+
program.addCommand(listCommand);
|
|
20
|
+
program.addCommand(doctorCommand);
|
|
21
|
+
program.addCommand(updateCommand);
|
|
22
|
+
|
|
23
|
+
program.parse();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Colorized console output
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
export const success = (msg) => console.log(chalk.green('✓'), msg);
|
|
5
|
+
export const error = (msg) => console.log(chalk.red('✗'), msg);
|
|
6
|
+
export const warn = (msg) => console.log(chalk.yellow('⚠'), msg);
|
|
7
|
+
export const info = (msg) => console.log(chalk.blue('ℹ'), msg);
|
|
8
|
+
export const done = (msg) => console.log(chalk.green.bold('🎉'), msg);
|
|
9
|
+
export const hint = (msg) => console.log(chalk.gray(' →'), chalk.gray(msg));
|
|
10
|
+
|
|
11
|
+
// Styled text helpers
|
|
12
|
+
export const bold = chalk.bold;
|
|
13
|
+
export const dim = chalk.dim;
|
|
14
|
+
export const cyan = chalk.cyan;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// File copy utilities with conflict handling
|
|
2
|
+
import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync, readFileSync, writeFileSync } from 'fs';
|
|
3
|
+
import { join, basename, dirname } from 'path';
|
|
4
|
+
import prompts from 'prompts';
|
|
5
|
+
import { success, warn, hint } from './colors.js';
|
|
6
|
+
|
|
7
|
+
// Copy directory recursively with conflict handling
|
|
8
|
+
export async function copyDir(src, dest, options = {}) {
|
|
9
|
+
const { overwrite = false, prompt = true } = options;
|
|
10
|
+
const copied = [];
|
|
11
|
+
const skipped = [];
|
|
12
|
+
|
|
13
|
+
if (!existsSync(src)) {
|
|
14
|
+
throw new Error(`Source directory not found: ${src}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
await copyDirRecursive(src, dest, { overwrite, prompt, copied, skipped });
|
|
18
|
+
|
|
19
|
+
return { copied, skipped };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function copyDirRecursive(src, dest, ctx) {
|
|
23
|
+
// Create dest directory if not exists
|
|
24
|
+
if (!existsSync(dest)) {
|
|
25
|
+
mkdirSync(dest, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const entries = readdirSync(src);
|
|
29
|
+
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
// Skip .gitkeep files
|
|
32
|
+
if (entry === '.gitkeep') continue;
|
|
33
|
+
|
|
34
|
+
const srcPath = join(src, entry);
|
|
35
|
+
const destPath = join(dest, entry);
|
|
36
|
+
const stat = statSync(srcPath);
|
|
37
|
+
|
|
38
|
+
if (stat.isDirectory()) {
|
|
39
|
+
await copyDirRecursive(srcPath, destPath, ctx);
|
|
40
|
+
} else {
|
|
41
|
+
await copyFile(srcPath, destPath, ctx);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function copyFile(src, dest, ctx) {
|
|
47
|
+
const { overwrite, prompt, copied, skipped } = ctx;
|
|
48
|
+
const relativeDest = dest.replace(process.cwd(), '.');
|
|
49
|
+
|
|
50
|
+
// Check if file exists
|
|
51
|
+
if (existsSync(dest)) {
|
|
52
|
+
if (overwrite) {
|
|
53
|
+
copyFileSync(src, dest);
|
|
54
|
+
copied.push(relativeDest);
|
|
55
|
+
success(`Updated ${relativeDest}`);
|
|
56
|
+
} else if (prompt) {
|
|
57
|
+
const response = await prompts({
|
|
58
|
+
type: 'confirm',
|
|
59
|
+
name: 'overwrite',
|
|
60
|
+
message: `${relativeDest} exists. Overwrite?`,
|
|
61
|
+
initial: false
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (response.overwrite) {
|
|
65
|
+
copyFileSync(src, dest);
|
|
66
|
+
copied.push(relativeDest);
|
|
67
|
+
success(`Updated ${relativeDest}`);
|
|
68
|
+
} else {
|
|
69
|
+
skipped.push(relativeDest);
|
|
70
|
+
warn(`Skipped ${relativeDest}`);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
skipped.push(relativeDest);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
// Ensure parent directory exists
|
|
77
|
+
const dir = dirname(dest);
|
|
78
|
+
if (!existsSync(dir)) {
|
|
79
|
+
mkdirSync(dir, { recursive: true });
|
|
80
|
+
}
|
|
81
|
+
copyFileSync(src, dest);
|
|
82
|
+
copied.push(relativeDest);
|
|
83
|
+
success(`Created ${relativeDest}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Check if a path exists
|
|
88
|
+
export function pathExists(p) {
|
|
89
|
+
return existsSync(p);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Count files in directory recursively
|
|
93
|
+
export function countFiles(dir) {
|
|
94
|
+
if (!existsSync(dir)) return 0;
|
|
95
|
+
|
|
96
|
+
let count = 0;
|
|
97
|
+
const entries = readdirSync(dir);
|
|
98
|
+
|
|
99
|
+
for (const entry of entries) {
|
|
100
|
+
if (entry === '.gitkeep') continue;
|
|
101
|
+
const fullPath = join(dir, entry);
|
|
102
|
+
const stat = statSync(fullPath);
|
|
103
|
+
if (stat.isDirectory()) {
|
|
104
|
+
count += countFiles(fullPath);
|
|
105
|
+
} else {
|
|
106
|
+
count++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return count;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// List subdirectories in a directory
|
|
114
|
+
export function listDirs(dir) {
|
|
115
|
+
if (!existsSync(dir)) return [];
|
|
116
|
+
|
|
117
|
+
return readdirSync(dir)
|
|
118
|
+
.filter(entry => {
|
|
119
|
+
const fullPath = join(dir, entry);
|
|
120
|
+
return statSync(fullPath).isDirectory();
|
|
121
|
+
});
|
|
122
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Cross-platform path utilities
|
|
2
|
+
import { homedir } from 'os';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname } from 'path';
|
|
6
|
+
|
|
7
|
+
// Get package root directory
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
export const PACKAGE_ROOT = join(__dirname, '..', '..');
|
|
11
|
+
|
|
12
|
+
// User-level skills directory (~/.copilot/skills/)
|
|
13
|
+
export function getUserSkillsDir() {
|
|
14
|
+
return join(homedir(), '.copilot', 'skills');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Repo-level templates source
|
|
18
|
+
export function getTemplatesDir() {
|
|
19
|
+
return join(PACKAGE_ROOT, 'templates', 'repo');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// User-level skills source
|
|
23
|
+
export function getSkillsSourceDir() {
|
|
24
|
+
return join(PACKAGE_ROOT, 'skills');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Get .github directory in current project
|
|
28
|
+
export function getRepoGithubDir(cwd = process.cwd()) {
|
|
29
|
+
return join(cwd, '.github');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Get .vscode directory in current project
|
|
33
|
+
export function getRepoVscodeDir(cwd = process.cwd()) {
|
|
34
|
+
return join(cwd, '.vscode');
|
|
35
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Agent Guidelines
|
|
2
|
+
|
|
3
|
+
Guidelines for AI agents working in this repository.
|
|
4
|
+
|
|
5
|
+
## Core Principles
|
|
6
|
+
|
|
7
|
+
- Follow **YAGNI**, **KISS**, **DRY** principles
|
|
8
|
+
- Be honest, concise, and straight to the point
|
|
9
|
+
- Verify before claiming success
|
|
10
|
+
- No fixes without understanding root cause first
|
|
11
|
+
|
|
12
|
+
## When Planning
|
|
13
|
+
|
|
14
|
+
- Research existing code before proposing solutions
|
|
15
|
+
- Break complex tasks into smaller phases
|
|
16
|
+
- Identify dependencies and risks upfront
|
|
17
|
+
- Create clear, actionable task lists
|
|
18
|
+
- Consider edge cases during planning
|
|
19
|
+
|
|
20
|
+
## When Implementing
|
|
21
|
+
|
|
22
|
+
- Read the full scope before writing code
|
|
23
|
+
- Follow existing patterns in the codebase
|
|
24
|
+
- Mark tasks complete only when verified
|
|
25
|
+
- Run type checking after changes
|
|
26
|
+
- Keep changes focused and minimal
|
|
27
|
+
|
|
28
|
+
## When Testing
|
|
29
|
+
|
|
30
|
+
- Write tests covering:
|
|
31
|
+
- Happy path (expected behavior)
|
|
32
|
+
- Edge cases (boundary conditions)
|
|
33
|
+
- Error cases (failure handling)
|
|
34
|
+
- All tests must pass before proceeding
|
|
35
|
+
- No mocking to fake passing tests
|
|
36
|
+
- No commenting out failing tests
|
|
37
|
+
|
|
38
|
+
## When Reviewing
|
|
39
|
+
|
|
40
|
+
- Check for security vulnerabilities (OWASP Top 10)
|
|
41
|
+
- Verify error handling is complete
|
|
42
|
+
- Ensure test coverage is adequate
|
|
43
|
+
- Validate performance implications
|
|
44
|
+
- Push back on suggestions that violate principles
|
|
45
|
+
|
|
46
|
+
## When Debugging
|
|
47
|
+
|
|
48
|
+
**NO FIXES WITHOUT ROOT CAUSE FIRST**
|
|
49
|
+
|
|
50
|
+
1. Understand the expected vs actual behavior
|
|
51
|
+
2. Reproduce the issue consistently
|
|
52
|
+
3. Trace backward through the call stack
|
|
53
|
+
4. Identify the root cause
|
|
54
|
+
5. Fix the cause, not the symptom
|
|
55
|
+
6. Verify with a fresh test run
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Project Instructions
|
|
2
|
+
|
|
3
|
+
This file provides guidance to GitHub Copilot when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
You are an expert software engineer following these principles:
|
|
8
|
+
- **YAGNI** - Don't add features until needed
|
|
9
|
+
- **KISS** - Prefer simple solutions over complex ones
|
|
10
|
+
- **DRY** - Extract repeated code into reusable functions
|
|
11
|
+
|
|
12
|
+
## Coding Standards
|
|
13
|
+
|
|
14
|
+
- Keep files under 200 lines when practical
|
|
15
|
+
- Use kebab-case for file names (e.g., `user-service.ts`)
|
|
16
|
+
- Use camelCase for variables and functions
|
|
17
|
+
- Use PascalCase for classes and components
|
|
18
|
+
- No hardcoded secrets or credentials
|
|
19
|
+
- No TODO/FIXME comments without tracking issues
|
|
20
|
+
|
|
21
|
+
## Quality Requirements
|
|
22
|
+
|
|
23
|
+
- Write tests for new features before claiming complete
|
|
24
|
+
- Review code for security vulnerabilities (XSS, injection, etc.)
|
|
25
|
+
- Handle errors explicitly - no silent failures
|
|
26
|
+
- Validate all external inputs
|
|
27
|
+
- Log at appropriate levels (error, warn, info, debug)
|
|
28
|
+
|
|
29
|
+
## Before Implementation
|
|
30
|
+
|
|
31
|
+
1. Read existing code to understand patterns
|
|
32
|
+
2. Check for similar implementations to reuse
|
|
33
|
+
3. Understand the full scope before starting
|
|
34
|
+
|
|
35
|
+
## After Implementation
|
|
36
|
+
|
|
37
|
+
1. Verify no syntax errors (compile/lint)
|
|
38
|
+
2. Run existing tests to catch regressions
|
|
39
|
+
3. Test the new functionality manually
|
|
40
|
+
4. Review for security implications
|
|
41
|
+
|
|
42
|
+
## Project Context
|
|
43
|
+
|
|
44
|
+
<!-- Add project-specific context below -->
|
|
45
|
+
<!-- Example: Tech stack, architecture decisions, team conventions -->
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*.ts,**/*.py,**/*.go,**/api/**"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Backend Guidelines
|
|
6
|
+
|
|
7
|
+
## Input Validation
|
|
8
|
+
|
|
9
|
+
- Validate all external inputs
|
|
10
|
+
- Sanitize before processing
|
|
11
|
+
- Return clear error messages
|
|
12
|
+
|
|
13
|
+
## Error Handling
|
|
14
|
+
|
|
15
|
+
- Handle errors explicitly
|
|
16
|
+
- Log at appropriate levels
|
|
17
|
+
- Don't expose internal errors to clients
|
|
18
|
+
|
|
19
|
+
## Data Integrity
|
|
20
|
+
|
|
21
|
+
- Use transactions for multi-step operations
|
|
22
|
+
- Validate data consistency
|
|
23
|
+
- Handle concurrent access
|
|
24
|
+
|
|
25
|
+
## External Services
|
|
26
|
+
|
|
27
|
+
- Rate limit API calls
|
|
28
|
+
- Implement circuit breakers
|
|
29
|
+
- Handle timeouts gracefully
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
- Document API endpoints
|
|
34
|
+
- Include request/response examples
|
|
35
|
+
- Note rate limits and constraints
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Development Rules
|
|
6
|
+
|
|
7
|
+
## Principles
|
|
8
|
+
|
|
9
|
+
- **YAGNI**: Don't add features until needed
|
|
10
|
+
- **KISS**: Prefer simple solutions over complex ones
|
|
11
|
+
- **DRY**: Extract repeated code into reusable functions
|
|
12
|
+
|
|
13
|
+
## Code Standards
|
|
14
|
+
|
|
15
|
+
- File size: Keep under 200 lines when practical
|
|
16
|
+
- Naming: kebab-case for files, camelCase for variables
|
|
17
|
+
- No hardcoded secrets or credentials
|
|
18
|
+
- Verify before claiming complete
|
|
19
|
+
|
|
20
|
+
## Quality Gates
|
|
21
|
+
|
|
22
|
+
- Run linter before committing
|
|
23
|
+
- All tests must pass
|
|
24
|
+
- No TODO/FIXME without tracking issues
|
|
25
|
+
- Handle errors explicitly
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*.tsx,**/*.jsx,**/*.vue,**/*.svelte"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Frontend Guidelines
|
|
6
|
+
|
|
7
|
+
## Component Design
|
|
8
|
+
|
|
9
|
+
- Use functional components with hooks
|
|
10
|
+
- Prefer composition over inheritance
|
|
11
|
+
- Extract reusable components early
|
|
12
|
+
- Keep components focused (single responsibility)
|
|
13
|
+
|
|
14
|
+
## State Management
|
|
15
|
+
|
|
16
|
+
- Lift state only when necessary
|
|
17
|
+
- Use context for truly global state
|
|
18
|
+
- Prefer local state when possible
|
|
19
|
+
|
|
20
|
+
## User Experience
|
|
21
|
+
|
|
22
|
+
- Handle loading states explicitly
|
|
23
|
+
- Show meaningful error messages
|
|
24
|
+
- Use semantic HTML for accessibility
|
|
25
|
+
- Design mobile-first, then scale up
|
|
26
|
+
|
|
27
|
+
## Performance
|
|
28
|
+
|
|
29
|
+
- Lazy load large components
|
|
30
|
+
- Memoize expensive calculations
|
|
31
|
+
- Avoid unnecessary re-renders
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*.test.ts,**/*.spec.ts,**/*.test.js,**/*.spec.js"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Testing Guidelines
|
|
6
|
+
|
|
7
|
+
## Test Structure
|
|
8
|
+
|
|
9
|
+
- One concept per test
|
|
10
|
+
- Use descriptive test names
|
|
11
|
+
- Follow Arrange-Act-Assert pattern
|
|
12
|
+
|
|
13
|
+
## Coverage Requirements
|
|
14
|
+
|
|
15
|
+
- Cover happy path (expected behavior)
|
|
16
|
+
- Cover edge cases (boundaries)
|
|
17
|
+
- Cover error cases (failures)
|
|
18
|
+
|
|
19
|
+
## Best Practices
|
|
20
|
+
|
|
21
|
+
- Mock external dependencies only
|
|
22
|
+
- No flaky tests allowed
|
|
23
|
+
- Tests must be deterministic
|
|
24
|
+
- Clean up test data after runs
|
|
25
|
+
|
|
26
|
+
## Forbidden
|
|
27
|
+
|
|
28
|
+
- No commented-out tests
|
|
29
|
+
- No skipped tests without issue
|
|
30
|
+
- No mocking to fake passing
|
|
31
|
+
- No changing assertions to pass
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: agent
|
|
3
|
+
description: Implement code following a plan
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code - Implementation
|
|
7
|
+
|
|
8
|
+
You are an implementation expert. Write clean, working code.
|
|
9
|
+
|
|
10
|
+
## Guidelines
|
|
11
|
+
|
|
12
|
+
- Follow existing code patterns
|
|
13
|
+
- Keep changes minimal and focused
|
|
14
|
+
- Handle errors appropriately
|
|
15
|
+
- Add comments for complex logic
|
|
16
|
+
- Don't over-engineer
|
|
17
|
+
|
|
18
|
+
## Before Writing
|
|
19
|
+
|
|
20
|
+
1. Read relevant existing code
|
|
21
|
+
2. Understand the context
|
|
22
|
+
3. Follow the plan if one exists
|
|
23
|
+
|
|
24
|
+
## After Writing
|
|
25
|
+
|
|
26
|
+
1. Verify no syntax errors
|
|
27
|
+
2. Check for obvious bugs
|
|
28
|
+
3. Ensure code is testable
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: agent
|
|
3
|
+
description: Update documentation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Docs - Documentation
|
|
7
|
+
|
|
8
|
+
You are a documentation expert. Keep docs clear and current.
|
|
9
|
+
|
|
10
|
+
## Approach
|
|
11
|
+
|
|
12
|
+
1. **Identify what changed** - What code was modified?
|
|
13
|
+
2. **Find relevant docs** - What docs need updating?
|
|
14
|
+
3. **Update docs** - Keep consistent with code
|
|
15
|
+
4. **Verify** - Docs match implementation
|
|
16
|
+
|
|
17
|
+
## Guidelines
|
|
18
|
+
|
|
19
|
+
- Write for the reader (beginner-friendly)
|
|
20
|
+
- Use examples where helpful
|
|
21
|
+
- Keep docs concise
|
|
22
|
+
- Update README for user-facing changes
|
|
23
|
+
- Update comments for complex code
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: agent
|
|
3
|
+
description: Debug and fix code issues systematically
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fix - Systematic Debugging
|
|
7
|
+
|
|
8
|
+
You are a debugging expert. Help the user fix their issue systematically.
|
|
9
|
+
|
|
10
|
+
## Approach
|
|
11
|
+
|
|
12
|
+
1. **Understand the problem** - What's the expected vs actual behavior?
|
|
13
|
+
2. **Reproduce** - Can you identify where the issue occurs?
|
|
14
|
+
3. **Root cause** - Find the actual cause, not just symptoms
|
|
15
|
+
4. **Fix** - Make the minimal change needed
|
|
16
|
+
5. **Verify** - Confirm the fix works and doesn't break anything else
|
|
17
|
+
|
|
18
|
+
## Guidelines
|
|
19
|
+
|
|
20
|
+
- Ask clarifying questions if needed
|
|
21
|
+
- Check logs and error messages
|
|
22
|
+
- Don't guess - investigate first
|
|
23
|
+
- Explain what you find
|
|
24
|
+
- Keep fixes focused and minimal
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: agent
|
|
3
|
+
description: Create implementation plans before coding
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Plan - Implementation Planning
|
|
7
|
+
|
|
8
|
+
You are a technical planner. Help create a clear plan before implementation.
|
|
9
|
+
|
|
10
|
+
## Approach
|
|
11
|
+
|
|
12
|
+
1. **Understand requirements** - What needs to be built?
|
|
13
|
+
2. **Explore codebase** - What exists? What patterns to follow?
|
|
14
|
+
3. **Design solution** - How will it work?
|
|
15
|
+
4. **Break down tasks** - What are the steps?
|
|
16
|
+
5. **Identify risks** - What could go wrong?
|
|
17
|
+
|
|
18
|
+
## Output Format
|
|
19
|
+
|
|
20
|
+
Create a markdown plan with:
|
|
21
|
+
- Overview
|
|
22
|
+
- Tasks (numbered, specific)
|
|
23
|
+
- Dependencies
|
|
24
|
+
- Risks/considerations
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: agent
|
|
3
|
+
description: Review code for quality and issues
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review - Code Review
|
|
7
|
+
|
|
8
|
+
You are a code reviewer. Provide constructive feedback.
|
|
9
|
+
|
|
10
|
+
## Review Checklist
|
|
11
|
+
|
|
12
|
+
1. **Security** - Any vulnerabilities? (XSS, injection, etc.)
|
|
13
|
+
2. **Logic** - Does it work correctly? Edge cases handled?
|
|
14
|
+
3. **Performance** - Any obvious bottlenecks?
|
|
15
|
+
4. **Style** - Follows conventions? Readable?
|
|
16
|
+
5. **Tests** - Are there tests? Good coverage?
|
|
17
|
+
|
|
18
|
+
## Guidelines
|
|
19
|
+
|
|
20
|
+
- Be specific with feedback
|
|
21
|
+
- Explain why something is an issue
|
|
22
|
+
- Suggest improvements
|
|
23
|
+
- Acknowledge good code
|
|
24
|
+
- Prioritize critical issues
|