@skillkit/resources 1.8.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.
@@ -0,0 +1,265 @@
1
+ // src/commands/manifest.ts
2
+ var COMMAND_TEMPLATES = [
3
+ {
4
+ id: "tdd",
5
+ name: "TDD Workflow",
6
+ description: "Test-Driven Development workflow: RED \u2192 GREEN \u2192 REFACTOR",
7
+ category: "testing",
8
+ trigger: "/tdd",
9
+ agent: "tdd-guide",
10
+ prompt: `Start TDD workflow for the requested feature or fix.
11
+
12
+ Follow the RED \u2192 GREEN \u2192 REFACTOR cycle:
13
+
14
+ 1. **RED**: Write a failing test that describes the expected behavior
15
+ 2. **GREEN**: Write the minimum code needed to pass the test
16
+ 3. **REFACTOR**: Improve the code while keeping tests green
17
+
18
+ Guidelines:
19
+ - One test at a time
20
+ - Tests should be small and focused
21
+ - Commit after each GREEN phase
22
+ - Keep refactoring incremental
23
+
24
+ Start by asking: What behavior should we test first?`,
25
+ examples: [
26
+ "/tdd add validation to user form",
27
+ "/tdd implement search functionality"
28
+ ]
29
+ },
30
+ {
31
+ id: "plan",
32
+ name: "Implementation Planning",
33
+ description: "Create a detailed implementation plan before coding",
34
+ category: "planning",
35
+ trigger: "/plan",
36
+ agent: "planner",
37
+ prompt: `Create an implementation plan for the requested feature or change.
38
+
39
+ Include:
40
+ 1. Requirements analysis
41
+ 2. Current state assessment
42
+ 3. Proposed approach with alternatives
43
+ 4. Step-by-step implementation tasks
44
+ 5. Risk assessment and mitigations
45
+ 6. Verification criteria
46
+
47
+ Wait for plan approval before any implementation.`,
48
+ examples: [
49
+ "/plan add user authentication",
50
+ "/plan refactor payment module"
51
+ ]
52
+ },
53
+ {
54
+ id: "e2e",
55
+ name: "E2E Test Generation",
56
+ description: "Generate and run end-to-end tests with Playwright",
57
+ category: "testing",
58
+ trigger: "/e2e",
59
+ agent: "e2e-runner",
60
+ prompt: `Generate E2E tests for the specified user journey.
61
+
62
+ Process:
63
+ 1. Analyze the user flow to test
64
+ 2. Generate Playwright test code
65
+ 3. Run the test
66
+ 4. Capture screenshots/videos if needed
67
+ 5. Report results
68
+
69
+ Focus on testing critical user paths with reliable selectors.`,
70
+ examples: [
71
+ "/e2e test user login flow",
72
+ "/e2e test checkout process"
73
+ ]
74
+ },
75
+ {
76
+ id: "learn",
77
+ name: "Extract Learnings",
78
+ description: "Extract reusable patterns from the current session",
79
+ category: "learning",
80
+ trigger: "/learn",
81
+ prompt: `Analyze the current session and extract reusable patterns.
82
+
83
+ Look for:
84
+ 1. Error fixes that could apply to similar situations
85
+ 2. Workarounds for library/framework quirks
86
+ 3. Effective debugging approaches
87
+ 4. Project-specific conventions discovered
88
+
89
+ Format each learning as:
90
+ - Problem: What issue was encountered
91
+ - Solution: How it was resolved
92
+ - Context: When this applies
93
+ - Example: Code snippet if relevant
94
+
95
+ Ask for approval before saving patterns.`,
96
+ examples: [
97
+ "/learn from this debugging session",
98
+ "/learn extract patterns from recent fixes"
99
+ ]
100
+ },
101
+ {
102
+ id: "build-fix",
103
+ name: "Build Error Resolution",
104
+ description: "Fix build errors with minimal changes",
105
+ category: "development",
106
+ trigger: "/build-fix",
107
+ agent: "build-error-resolver",
108
+ prompt: `Fix the current build/type errors.
109
+
110
+ Process:
111
+ 1. Run the build to capture all errors
112
+ 2. Analyze each error's root cause
113
+ 3. Apply minimal fixes (no refactoring)
114
+ 4. Verify the build passes
115
+ 5. Run tests to ensure no regressions
116
+
117
+ Focus on getting the build green quickly with the smallest possible changes.`,
118
+ examples: [
119
+ "/build-fix",
120
+ "/build-fix typescript errors"
121
+ ]
122
+ },
123
+ {
124
+ id: "code-review",
125
+ name: "Code Review",
126
+ description: "Review code changes for quality and security",
127
+ category: "review",
128
+ trigger: "/code-review",
129
+ agent: "code-reviewer",
130
+ prompt: `Review the specified code changes.
131
+
132
+ Check for:
133
+ 1. Correctness and edge cases
134
+ 2. Security vulnerabilities
135
+ 3. Performance issues
136
+ 4. Code quality and maintainability
137
+ 5. Test coverage
138
+
139
+ Provide actionable feedback prioritized by severity.`,
140
+ examples: [
141
+ "/code-review recent changes",
142
+ "/code-review src/auth/"
143
+ ]
144
+ },
145
+ {
146
+ id: "security-review",
147
+ name: "Security Review",
148
+ description: "Audit code for security vulnerabilities",
149
+ category: "review",
150
+ trigger: "/security-review",
151
+ agent: "security-reviewer",
152
+ prompt: `Perform a security audit of the specified code.
153
+
154
+ Check for:
155
+ 1. OWASP Top 10 vulnerabilities
156
+ 2. Hardcoded secrets or credentials
157
+ 3. Input validation issues
158
+ 4. Authentication/authorization flaws
159
+ 5. Data exposure risks
160
+
161
+ Report findings with severity and remediation steps.`,
162
+ examples: [
163
+ "/security-review",
164
+ "/security-review src/api/"
165
+ ]
166
+ },
167
+ {
168
+ id: "checkpoint",
169
+ name: "Create Checkpoint",
170
+ description: "Create a verification checkpoint for current state",
171
+ category: "workflow",
172
+ trigger: "/checkpoint",
173
+ prompt: `Create a checkpoint to verify the current implementation state.
174
+
175
+ 1. Summarize changes made so far
176
+ 2. Run all relevant tests
177
+ 3. Check build status
178
+ 4. Note any pending issues
179
+ 5. Save context for potential recovery
180
+
181
+ This helps ensure work can be resumed or rolled back if needed.`,
182
+ examples: [
183
+ "/checkpoint before major refactor",
184
+ "/checkpoint feature complete"
185
+ ]
186
+ },
187
+ {
188
+ id: "verify",
189
+ name: "Verification Loop",
190
+ description: "Run comprehensive verification of recent changes",
191
+ category: "workflow",
192
+ trigger: "/verify",
193
+ prompt: `Run verification loop for recent changes.
194
+
195
+ Steps:
196
+ 1. Type check (tsc --noEmit)
197
+ 2. Lint check (eslint)
198
+ 3. Unit tests
199
+ 4. Build verification
200
+ 5. Integration tests (if applicable)
201
+
202
+ Report status and any failures that need attention.`,
203
+ examples: [
204
+ "/verify",
205
+ "/verify all"
206
+ ]
207
+ },
208
+ {
209
+ id: "cleanup",
210
+ name: "Code Cleanup",
211
+ description: "Remove dead code and consolidate duplicates",
212
+ category: "development",
213
+ trigger: "/cleanup",
214
+ agent: "refactor-cleaner",
215
+ prompt: `Analyze and clean up the codebase.
216
+
217
+ 1. Run dead code analysis (knip, ts-prune)
218
+ 2. Identify unused exports and dependencies
219
+ 3. Find duplicate code patterns
220
+ 4. Remove with verification
221
+ 5. Update imports as needed
222
+
223
+ Make incremental changes with tests passing at each step.`,
224
+ examples: [
225
+ "/cleanup",
226
+ "/cleanup src/utils/"
227
+ ]
228
+ }
229
+ ];
230
+ var COMMAND_MANIFEST = {
231
+ version: 1,
232
+ commands: COMMAND_TEMPLATES
233
+ };
234
+
235
+ // src/commands/index.ts
236
+ function getCommandTemplates() {
237
+ return COMMAND_TEMPLATES;
238
+ }
239
+ function getCommandTemplate(id) {
240
+ return COMMAND_TEMPLATES.find((c) => c.id === id) || null;
241
+ }
242
+ function getCommandByTrigger(trigger) {
243
+ const normalizedTrigger = trigger.startsWith("/") ? trigger : `/${trigger}`;
244
+ return COMMAND_TEMPLATES.find((c) => c.trigger === normalizedTrigger) || null;
245
+ }
246
+ function getCommandTemplatesByCategory(category) {
247
+ return COMMAND_TEMPLATES.filter((c) => c.category === category);
248
+ }
249
+ function getCommandTemplateIds() {
250
+ return COMMAND_TEMPLATES.map((c) => c.id);
251
+ }
252
+ function getCommandTriggers() {
253
+ return COMMAND_TEMPLATES.map((c) => c.trigger);
254
+ }
255
+ export {
256
+ COMMAND_MANIFEST,
257
+ COMMAND_TEMPLATES,
258
+ getCommandByTrigger,
259
+ getCommandTemplate,
260
+ getCommandTemplateIds,
261
+ getCommandTemplates,
262
+ getCommandTemplatesByCategory,
263
+ getCommandTriggers
264
+ };
265
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/manifest.ts","../../src/commands/index.ts"],"sourcesContent":["import type { CommandTemplate, CommandManifest } from './types.js';\n\nexport const COMMAND_TEMPLATES: CommandTemplate[] = [\n {\n id: 'tdd',\n name: 'TDD Workflow',\n description: 'Test-Driven Development workflow: RED → GREEN → REFACTOR',\n category: 'testing',\n trigger: '/tdd',\n agent: 'tdd-guide',\n prompt: `Start TDD workflow for the requested feature or fix.\n\nFollow the RED → GREEN → REFACTOR cycle:\n\n1. **RED**: Write a failing test that describes the expected behavior\n2. **GREEN**: Write the minimum code needed to pass the test\n3. **REFACTOR**: Improve the code while keeping tests green\n\nGuidelines:\n- One test at a time\n- Tests should be small and focused\n- Commit after each GREEN phase\n- Keep refactoring incremental\n\nStart by asking: What behavior should we test first?`,\n examples: [\n '/tdd add validation to user form',\n '/tdd implement search functionality',\n ],\n },\n {\n id: 'plan',\n name: 'Implementation Planning',\n description: 'Create a detailed implementation plan before coding',\n category: 'planning',\n trigger: '/plan',\n agent: 'planner',\n prompt: `Create an implementation plan for the requested feature or change.\n\nInclude:\n1. Requirements analysis\n2. Current state assessment\n3. Proposed approach with alternatives\n4. Step-by-step implementation tasks\n5. Risk assessment and mitigations\n6. Verification criteria\n\nWait for plan approval before any implementation.`,\n examples: [\n '/plan add user authentication',\n '/plan refactor payment module',\n ],\n },\n {\n id: 'e2e',\n name: 'E2E Test Generation',\n description: 'Generate and run end-to-end tests with Playwright',\n category: 'testing',\n trigger: '/e2e',\n agent: 'e2e-runner',\n prompt: `Generate E2E tests for the specified user journey.\n\nProcess:\n1. Analyze the user flow to test\n2. Generate Playwright test code\n3. Run the test\n4. Capture screenshots/videos if needed\n5. Report results\n\nFocus on testing critical user paths with reliable selectors.`,\n examples: [\n '/e2e test user login flow',\n '/e2e test checkout process',\n ],\n },\n {\n id: 'learn',\n name: 'Extract Learnings',\n description: 'Extract reusable patterns from the current session',\n category: 'learning',\n trigger: '/learn',\n prompt: `Analyze the current session and extract reusable patterns.\n\nLook for:\n1. Error fixes that could apply to similar situations\n2. Workarounds for library/framework quirks\n3. Effective debugging approaches\n4. Project-specific conventions discovered\n\nFormat each learning as:\n- Problem: What issue was encountered\n- Solution: How it was resolved\n- Context: When this applies\n- Example: Code snippet if relevant\n\nAsk for approval before saving patterns.`,\n examples: [\n '/learn from this debugging session',\n '/learn extract patterns from recent fixes',\n ],\n },\n {\n id: 'build-fix',\n name: 'Build Error Resolution',\n description: 'Fix build errors with minimal changes',\n category: 'development',\n trigger: '/build-fix',\n agent: 'build-error-resolver',\n prompt: `Fix the current build/type errors.\n\nProcess:\n1. Run the build to capture all errors\n2. Analyze each error's root cause\n3. Apply minimal fixes (no refactoring)\n4. Verify the build passes\n5. Run tests to ensure no regressions\n\nFocus on getting the build green quickly with the smallest possible changes.`,\n examples: [\n '/build-fix',\n '/build-fix typescript errors',\n ],\n },\n {\n id: 'code-review',\n name: 'Code Review',\n description: 'Review code changes for quality and security',\n category: 'review',\n trigger: '/code-review',\n agent: 'code-reviewer',\n prompt: `Review the specified code changes.\n\nCheck for:\n1. Correctness and edge cases\n2. Security vulnerabilities\n3. Performance issues\n4. Code quality and maintainability\n5. Test coverage\n\nProvide actionable feedback prioritized by severity.`,\n examples: [\n '/code-review recent changes',\n '/code-review src/auth/',\n ],\n },\n {\n id: 'security-review',\n name: 'Security Review',\n description: 'Audit code for security vulnerabilities',\n category: 'review',\n trigger: '/security-review',\n agent: 'security-reviewer',\n prompt: `Perform a security audit of the specified code.\n\nCheck for:\n1. OWASP Top 10 vulnerabilities\n2. Hardcoded secrets or credentials\n3. Input validation issues\n4. Authentication/authorization flaws\n5. Data exposure risks\n\nReport findings with severity and remediation steps.`,\n examples: [\n '/security-review',\n '/security-review src/api/',\n ],\n },\n {\n id: 'checkpoint',\n name: 'Create Checkpoint',\n description: 'Create a verification checkpoint for current state',\n category: 'workflow',\n trigger: '/checkpoint',\n prompt: `Create a checkpoint to verify the current implementation state.\n\n1. Summarize changes made so far\n2. Run all relevant tests\n3. Check build status\n4. Note any pending issues\n5. Save context for potential recovery\n\nThis helps ensure work can be resumed or rolled back if needed.`,\n examples: [\n '/checkpoint before major refactor',\n '/checkpoint feature complete',\n ],\n },\n {\n id: 'verify',\n name: 'Verification Loop',\n description: 'Run comprehensive verification of recent changes',\n category: 'workflow',\n trigger: '/verify',\n prompt: `Run verification loop for recent changes.\n\nSteps:\n1. Type check (tsc --noEmit)\n2. Lint check (eslint)\n3. Unit tests\n4. Build verification\n5. Integration tests (if applicable)\n\nReport status and any failures that need attention.`,\n examples: [\n '/verify',\n '/verify all',\n ],\n },\n {\n id: 'cleanup',\n name: 'Code Cleanup',\n description: 'Remove dead code and consolidate duplicates',\n category: 'development',\n trigger: '/cleanup',\n agent: 'refactor-cleaner',\n prompt: `Analyze and clean up the codebase.\n\n1. Run dead code analysis (knip, ts-prune)\n2. Identify unused exports and dependencies\n3. Find duplicate code patterns\n4. Remove with verification\n5. Update imports as needed\n\nMake incremental changes with tests passing at each step.`,\n examples: [\n '/cleanup',\n '/cleanup src/utils/',\n ],\n },\n];\n\nexport const COMMAND_MANIFEST: CommandManifest = {\n version: 1,\n commands: COMMAND_TEMPLATES,\n};\n","import { COMMAND_TEMPLATES, COMMAND_MANIFEST } from './manifest.js';\nimport type { CommandTemplate, CommandCategory, CommandManifest } from './types.js';\n\nexport type { CommandTemplate, CommandCategory, CommandManifest };\nexport { COMMAND_TEMPLATES, COMMAND_MANIFEST };\n\nexport function getCommandTemplates(): CommandTemplate[] {\n return COMMAND_TEMPLATES;\n}\n\nexport function getCommandTemplate(id: string): CommandTemplate | null {\n return COMMAND_TEMPLATES.find(c => c.id === id) || null;\n}\n\nexport function getCommandByTrigger(trigger: string): CommandTemplate | null {\n const normalizedTrigger = trigger.startsWith('/') ? trigger : `/${trigger}`;\n return COMMAND_TEMPLATES.find(c => c.trigger === normalizedTrigger) || null;\n}\n\nexport function getCommandTemplatesByCategory(category: CommandCategory): CommandTemplate[] {\n return COMMAND_TEMPLATES.filter(c => c.category === category);\n}\n\nexport function getCommandTemplateIds(): string[] {\n return COMMAND_TEMPLATES.map(c => c.id);\n}\n\nexport function getCommandTriggers(): string[] {\n return COMMAND_TEMPLATES.map(c => c.trigger);\n}\n"],"mappings":";AAEO,IAAM,oBAAuC;AAAA,EAClD;AAAA,IACE,IAAI;AAAA,IACJ,M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,SAAS;AAAA,EACT,UAAU;AACZ;;;ACpOO,SAAS,sBAAyC;AACvD,SAAO;AACT;AAEO,SAAS,mBAAmB,IAAoC;AACrE,SAAO,kBAAkB,KAAK,OAAK,EAAE,OAAO,EAAE,KAAK;AACrD;AAEO,SAAS,oBAAoB,SAAyC;AAC3E,QAAM,oBAAoB,QAAQ,WAAW,GAAG,IAAI,UAAU,IAAI,OAAO;AACzE,SAAO,kBAAkB,KAAK,OAAK,EAAE,YAAY,iBAAiB,KAAK;AACzE;AAEO,SAAS,8BAA8B,UAA8C;AAC1F,SAAO,kBAAkB,OAAO,OAAK,EAAE,aAAa,QAAQ;AAC9D;AAEO,SAAS,wBAAkC;AAChD,SAAO,kBAAkB,IAAI,OAAK,EAAE,EAAE;AACxC;AAEO,SAAS,qBAA+B;AAC7C,SAAO,kBAAkB,IAAI,OAAK,EAAE,OAAO;AAC7C;","names":[]}
@@ -0,0 +1,28 @@
1
+ type GuidelineCategory = 'security' | 'code-style' | 'testing' | 'git' | 'performance' | 'custom';
2
+ interface Guideline {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ category: GuidelineCategory;
7
+ content: string;
8
+ priority: number;
9
+ enabled: boolean;
10
+ scope: 'global' | 'project';
11
+ }
12
+ interface GuidelineManifest {
13
+ version: number;
14
+ guidelines: Guideline[];
15
+ }
16
+
17
+ declare const BUILTIN_GUIDELINES: Guideline[];
18
+ declare const GUIDELINE_MANIFEST: GuidelineManifest;
19
+
20
+ declare function getBuiltinGuidelines(): Guideline[];
21
+ declare function getBuiltinGuideline(id: string): Guideline | null;
22
+ declare function getGuidelinesByCategory(category: GuidelineCategory): Guideline[];
23
+ declare function getGuidelineIds(): string[];
24
+ declare function getGuidelineContent(id: string): string | null;
25
+ declare function getEnabledGuidelines(): Guideline[];
26
+ declare function getGuidelinesSortedByPriority(): Guideline[];
27
+
28
+ export { BUILTIN_GUIDELINES, GUIDELINE_MANIFEST, type Guideline, type GuidelineCategory, type GuidelineManifest, getBuiltinGuideline, getBuiltinGuidelines, getEnabledGuidelines, getGuidelineContent, getGuidelineIds, getGuidelinesByCategory, getGuidelinesSortedByPriority };
@@ -0,0 +1,215 @@
1
+ // src/guidelines/manifest.ts
2
+ var BUILTIN_GUIDELINES = [
3
+ {
4
+ id: "security",
5
+ name: "Security Guidelines",
6
+ description: "Security best practices and vulnerability prevention",
7
+ category: "security",
8
+ priority: 10,
9
+ enabled: true,
10
+ scope: "global",
11
+ content: `## Security Guidelines
12
+
13
+ ### Input Validation
14
+ - Validate all user input on the server side
15
+ - Use allowlists over denylists when possible
16
+ - Sanitize data before use in queries, commands, or output
17
+
18
+ ### Authentication & Authorization
19
+ - Never store passwords in plain text
20
+ - Use secure session management
21
+ - Implement proper authorization checks on every endpoint
22
+ - Use HTTPS for all communications
23
+
24
+ ### Data Protection
25
+ - Encrypt sensitive data at rest and in transit
26
+ - Never log sensitive information
27
+ - Use environment variables for secrets
28
+ - Implement proper access controls
29
+
30
+ ### Common Vulnerabilities to Prevent
31
+ - SQL Injection: Use parameterized queries
32
+ - XSS: Encode output, use CSP headers
33
+ - CSRF: Use anti-CSRF tokens
34
+ - Command Injection: Avoid shell commands with user input`
35
+ },
36
+ {
37
+ id: "code-style",
38
+ name: "Code Style Guidelines",
39
+ description: "Code formatting and style conventions",
40
+ category: "code-style",
41
+ priority: 7,
42
+ enabled: true,
43
+ scope: "global",
44
+ content: `## Code Style Guidelines
45
+
46
+ ### Naming Conventions
47
+ - Use descriptive, meaningful names
48
+ - camelCase for variables and functions
49
+ - PascalCase for classes and types
50
+ - SCREAMING_SNAKE_CASE for constants
51
+
52
+ ### Code Organization
53
+ - One concept per file
54
+ - Group related code together
55
+ - Keep files under 300 lines when practical
56
+ - Use barrel exports (index.ts) for public APIs
57
+
58
+ ### Functions
59
+ - Single responsibility principle
60
+ - Keep functions under 30 lines when practical
61
+ - Use early returns to reduce nesting
62
+ - Avoid side effects in pure functions
63
+
64
+ ### Comments
65
+ - Don't comment obvious code
66
+ - Explain "why" not "what"
67
+ - Keep comments up to date
68
+ - Use JSDoc for public APIs`
69
+ },
70
+ {
71
+ id: "testing",
72
+ name: "Testing Guidelines",
73
+ description: "Testing best practices and coverage requirements",
74
+ category: "testing",
75
+ priority: 8,
76
+ enabled: true,
77
+ scope: "global",
78
+ content: `## Testing Guidelines
79
+
80
+ ### Test Coverage
81
+ - Aim for 80%+ code coverage
82
+ - 100% coverage for critical paths
83
+ - Don't sacrifice quality for coverage metrics
84
+
85
+ ### Test Structure
86
+ - Arrange, Act, Assert (AAA) pattern
87
+ - One concept per test
88
+ - Descriptive test names that explain behavior
89
+ - Independent tests (no shared state)
90
+
91
+ ### Test Types
92
+ - Unit tests for business logic
93
+ - Integration tests for component interactions
94
+ - E2E tests for critical user flows
95
+
96
+ ### Test Quality
97
+ - Tests should be deterministic
98
+ - Fast execution (< 100ms for unit tests)
99
+ - Easy to understand and maintain
100
+ - Test behavior, not implementation`
101
+ },
102
+ {
103
+ id: "git",
104
+ name: "Git Workflow Guidelines",
105
+ description: "Version control best practices",
106
+ category: "git",
107
+ priority: 6,
108
+ enabled: true,
109
+ scope: "global",
110
+ content: `## Git Workflow Guidelines
111
+
112
+ ### Commits
113
+ - Write clear, concise commit messages
114
+ - Use conventional commits format
115
+ - One logical change per commit
116
+ - Don't commit generated files or secrets
117
+
118
+ ### Branches
119
+ - Use feature branches
120
+ - Keep branches short-lived
121
+ - Delete branches after merge
122
+ - Protect main/master branch
123
+
124
+ ### Pull Requests
125
+ - Keep PRs focused and small
126
+ - Write meaningful descriptions
127
+ - Request reviews from appropriate people
128
+ - Address all review comments
129
+
130
+ ### Commit Message Format
131
+ \`\`\`
132
+ <type>(<scope>): <description>
133
+
134
+ [optional body]
135
+
136
+ [optional footer]
137
+ \`\`\`
138
+
139
+ Types: feat, fix, docs, style, refactor, test, chore`
140
+ },
141
+ {
142
+ id: "performance",
143
+ name: "Performance Guidelines",
144
+ description: "Performance optimization best practices",
145
+ category: "performance",
146
+ priority: 5,
147
+ enabled: true,
148
+ scope: "global",
149
+ content: `## Performance Guidelines
150
+
151
+ ### General Principles
152
+ - Measure before optimizing
153
+ - Optimize critical paths first
154
+ - Consider time/space tradeoffs
155
+ - Profile in production-like environments
156
+
157
+ ### Database
158
+ - Use indexes appropriately
159
+ - Avoid N+1 queries
160
+ - Paginate large result sets
161
+ - Cache frequently accessed data
162
+
163
+ ### Frontend
164
+ - Minimize bundle size
165
+ - Lazy load when appropriate
166
+ - Optimize images and assets
167
+ - Use efficient rendering patterns
168
+
169
+ ### Backend
170
+ - Use connection pooling
171
+ - Implement appropriate caching
172
+ - Async operations where beneficial
173
+ - Monitor and alert on performance`
174
+ }
175
+ ];
176
+ var GUIDELINE_MANIFEST = {
177
+ version: 1,
178
+ guidelines: BUILTIN_GUIDELINES
179
+ };
180
+
181
+ // src/guidelines/index.ts
182
+ function getBuiltinGuidelines() {
183
+ return BUILTIN_GUIDELINES;
184
+ }
185
+ function getBuiltinGuideline(id) {
186
+ return BUILTIN_GUIDELINES.find((g) => g.id === id) || null;
187
+ }
188
+ function getGuidelinesByCategory(category) {
189
+ return BUILTIN_GUIDELINES.filter((g) => g.category === category);
190
+ }
191
+ function getGuidelineIds() {
192
+ return BUILTIN_GUIDELINES.map((g) => g.id);
193
+ }
194
+ function getGuidelineContent(id) {
195
+ const guideline = getBuiltinGuideline(id);
196
+ return guideline?.content || null;
197
+ }
198
+ function getEnabledGuidelines() {
199
+ return BUILTIN_GUIDELINES.filter((g) => g.enabled);
200
+ }
201
+ function getGuidelinesSortedByPriority() {
202
+ return [...BUILTIN_GUIDELINES].sort((a, b) => b.priority - a.priority);
203
+ }
204
+ export {
205
+ BUILTIN_GUIDELINES,
206
+ GUIDELINE_MANIFEST,
207
+ getBuiltinGuideline,
208
+ getBuiltinGuidelines,
209
+ getEnabledGuidelines,
210
+ getGuidelineContent,
211
+ getGuidelineIds,
212
+ getGuidelinesByCategory,
213
+ getGuidelinesSortedByPriority
214
+ };
215
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/guidelines/manifest.ts","../../src/guidelines/index.ts"],"sourcesContent":["import type { Guideline, GuidelineManifest } from './types.js';\n\nexport const BUILTIN_GUIDELINES: Guideline[] = [\n {\n id: 'security',\n name: 'Security Guidelines',\n description: 'Security best practices and vulnerability prevention',\n category: 'security',\n priority: 10,\n enabled: true,\n scope: 'global',\n content: `## Security Guidelines\n\n### Input Validation\n- Validate all user input on the server side\n- Use allowlists over denylists when possible\n- Sanitize data before use in queries, commands, or output\n\n### Authentication & Authorization\n- Never store passwords in plain text\n- Use secure session management\n- Implement proper authorization checks on every endpoint\n- Use HTTPS for all communications\n\n### Data Protection\n- Encrypt sensitive data at rest and in transit\n- Never log sensitive information\n- Use environment variables for secrets\n- Implement proper access controls\n\n### Common Vulnerabilities to Prevent\n- SQL Injection: Use parameterized queries\n- XSS: Encode output, use CSP headers\n- CSRF: Use anti-CSRF tokens\n- Command Injection: Avoid shell commands with user input`,\n },\n {\n id: 'code-style',\n name: 'Code Style Guidelines',\n description: 'Code formatting and style conventions',\n category: 'code-style',\n priority: 7,\n enabled: true,\n scope: 'global',\n content: `## Code Style Guidelines\n\n### Naming Conventions\n- Use descriptive, meaningful names\n- camelCase for variables and functions\n- PascalCase for classes and types\n- SCREAMING_SNAKE_CASE for constants\n\n### Code Organization\n- One concept per file\n- Group related code together\n- Keep files under 300 lines when practical\n- Use barrel exports (index.ts) for public APIs\n\n### Functions\n- Single responsibility principle\n- Keep functions under 30 lines when practical\n- Use early returns to reduce nesting\n- Avoid side effects in pure functions\n\n### Comments\n- Don't comment obvious code\n- Explain \"why\" not \"what\"\n- Keep comments up to date\n- Use JSDoc for public APIs`,\n },\n {\n id: 'testing',\n name: 'Testing Guidelines',\n description: 'Testing best practices and coverage requirements',\n category: 'testing',\n priority: 8,\n enabled: true,\n scope: 'global',\n content: `## Testing Guidelines\n\n### Test Coverage\n- Aim for 80%+ code coverage\n- 100% coverage for critical paths\n- Don't sacrifice quality for coverage metrics\n\n### Test Structure\n- Arrange, Act, Assert (AAA) pattern\n- One concept per test\n- Descriptive test names that explain behavior\n- Independent tests (no shared state)\n\n### Test Types\n- Unit tests for business logic\n- Integration tests for component interactions\n- E2E tests for critical user flows\n\n### Test Quality\n- Tests should be deterministic\n- Fast execution (< 100ms for unit tests)\n- Easy to understand and maintain\n- Test behavior, not implementation`,\n },\n {\n id: 'git',\n name: 'Git Workflow Guidelines',\n description: 'Version control best practices',\n category: 'git',\n priority: 6,\n enabled: true,\n scope: 'global',\n content: `## Git Workflow Guidelines\n\n### Commits\n- Write clear, concise commit messages\n- Use conventional commits format\n- One logical change per commit\n- Don't commit generated files or secrets\n\n### Branches\n- Use feature branches\n- Keep branches short-lived\n- Delete branches after merge\n- Protect main/master branch\n\n### Pull Requests\n- Keep PRs focused and small\n- Write meaningful descriptions\n- Request reviews from appropriate people\n- Address all review comments\n\n### Commit Message Format\n\\`\\`\\`\n<type>(<scope>): <description>\n\n[optional body]\n\n[optional footer]\n\\`\\`\\`\n\nTypes: feat, fix, docs, style, refactor, test, chore`,\n },\n {\n id: 'performance',\n name: 'Performance Guidelines',\n description: 'Performance optimization best practices',\n category: 'performance',\n priority: 5,\n enabled: true,\n scope: 'global',\n content: `## Performance Guidelines\n\n### General Principles\n- Measure before optimizing\n- Optimize critical paths first\n- Consider time/space tradeoffs\n- Profile in production-like environments\n\n### Database\n- Use indexes appropriately\n- Avoid N+1 queries\n- Paginate large result sets\n- Cache frequently accessed data\n\n### Frontend\n- Minimize bundle size\n- Lazy load when appropriate\n- Optimize images and assets\n- Use efficient rendering patterns\n\n### Backend\n- Use connection pooling\n- Implement appropriate caching\n- Async operations where beneficial\n- Monitor and alert on performance`,\n },\n];\n\nexport const GUIDELINE_MANIFEST: GuidelineManifest = {\n version: 1,\n guidelines: BUILTIN_GUIDELINES,\n};\n","import { BUILTIN_GUIDELINES, GUIDELINE_MANIFEST } from './manifest.js';\nimport type { Guideline, GuidelineCategory, GuidelineManifest } from './types.js';\n\nexport type { Guideline, GuidelineCategory, GuidelineManifest };\nexport { BUILTIN_GUIDELINES, GUIDELINE_MANIFEST };\n\nexport function getBuiltinGuidelines(): Guideline[] {\n return BUILTIN_GUIDELINES;\n}\n\nexport function getBuiltinGuideline(id: string): Guideline | null {\n return BUILTIN_GUIDELINES.find(g => g.id === id) || null;\n}\n\nexport function getGuidelinesByCategory(category: GuidelineCategory): Guideline[] {\n return BUILTIN_GUIDELINES.filter(g => g.category === category);\n}\n\nexport function getGuidelineIds(): string[] {\n return BUILTIN_GUIDELINES.map(g => g.id);\n}\n\nexport function getGuidelineContent(id: string): string | null {\n const guideline = getBuiltinGuideline(id);\n return guideline?.content || null;\n}\n\nexport function getEnabledGuidelines(): Guideline[] {\n return BUILTIN_GUIDELINES.filter(g => g.enabled);\n}\n\nexport function getGuidelinesSortedByPriority(): Guideline[] {\n return [...BUILTIN_GUIDELINES].sort((a, b) => b.priority - a.priority);\n}\n"],"mappings":";AAEO,IAAM,qBAAkC;AAAA,EAC7C;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBX;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBX;AAAA,E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C,SAAO,mBAAmB,IAAI,OAAK,EAAE,EAAE;AACzC;AAEO,SAAS,oBAAoB,IAA2B;AAC7D,QAAM,YAAY,oBAAoB,EAAE;AACxC,SAAO,WAAW,WAAW;AAC/B;AAEO,SAAS,uBAAoC;AAClD,SAAO,mBAAmB,OAAO,OAAK,EAAE,OAAO;AACjD;AAEO,SAAS,gCAA6C;AAC3D,SAAO,CAAC,GAAG,kBAAkB,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,QAAQ;AACvE;","names":[]}
@@ -0,0 +1,30 @@
1
+ type HookTemplateCategory = 'security' | 'quality' | 'workflow' | 'productivity';
2
+ type HookEvent = 'session:start' | 'session:resume' | 'session:end' | 'file:open' | 'file:save' | 'file:create' | 'file:delete' | 'task:start' | 'task:complete' | 'commit:pre' | 'commit:post' | 'error:occur' | 'test:fail' | 'test:pass' | 'build:start' | 'build:fail' | 'build:success';
3
+ interface HookTemplate {
4
+ id: string;
5
+ name: string;
6
+ description: string;
7
+ category: HookTemplateCategory;
8
+ event: HookEvent;
9
+ matcher?: string;
10
+ command: string;
11
+ timeout?: number;
12
+ blocking?: boolean;
13
+ variables?: Record<string, string>;
14
+ }
15
+ interface HookTemplateManifest {
16
+ version: number;
17
+ templates: HookTemplate[];
18
+ }
19
+
20
+ declare const HOOK_TEMPLATES: HookTemplate[];
21
+ declare const HOOK_TEMPLATE_MANIFEST: HookTemplateManifest;
22
+
23
+ declare function getHookTemplates(): HookTemplate[];
24
+ declare function getHookTemplate(id: string): HookTemplate | null;
25
+ declare function getHookTemplatesByCategory(category: HookTemplateCategory): HookTemplate[];
26
+ declare function getHookTemplatesByEvent(event: HookEvent): HookTemplate[];
27
+ declare function getHookTemplateIds(): string[];
28
+ declare function formatHookCommand(template: HookTemplate, variables?: Record<string, string>): string;
29
+
30
+ export { HOOK_TEMPLATES, HOOK_TEMPLATE_MANIFEST, type HookEvent, type HookTemplate, type HookTemplateCategory, type HookTemplateManifest, formatHookCommand, getHookTemplate, getHookTemplateIds, getHookTemplates, getHookTemplatesByCategory, getHookTemplatesByEvent };