@rasensio/aidlc-content 0.6.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/capabilities/claude-code.yaml +9 -0
  3. package/capabilities/codex.yaml +8 -0
  4. package/capabilities/cursor.yaml +8 -0
  5. package/capabilities/kiro.yaml +9 -0
  6. package/capabilities/windsurf.yaml +8 -0
  7. package/dist/capabilities.d.ts +4 -0
  8. package/dist/capabilities.d.ts.map +1 -0
  9. package/dist/capabilities.js +23 -0
  10. package/dist/capabilities.js.map +1 -0
  11. package/dist/guidance.d.ts +3 -0
  12. package/dist/guidance.d.ts.map +1 -0
  13. package/dist/guidance.js +21 -0
  14. package/dist/guidance.js.map +1 -0
  15. package/dist/index.d.ts +7 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +6 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/phases.d.ts +4 -0
  20. package/dist/phases.d.ts.map +1 -0
  21. package/dist/phases.js +34 -0
  22. package/dist/phases.js.map +1 -0
  23. package/dist/skills.d.ts +4 -0
  24. package/dist/skills.d.ts.map +1 -0
  25. package/dist/skills.js +40 -0
  26. package/dist/skills.js.map +1 -0
  27. package/dist/templates.d.ts +4 -0
  28. package/dist/templates.d.ts.map +1 -0
  29. package/dist/templates.js +29 -0
  30. package/dist/templates.js.map +1 -0
  31. package/dist/types.d.ts +31 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/types.js +2 -0
  34. package/dist/types.js.map +1 -0
  35. package/guidance/accessibility.md +67 -0
  36. package/guidance/api-conventions.md +124 -0
  37. package/guidance/index.yaml +7 -0
  38. package/guidance/secure-defaults.md +71 -0
  39. package/package.json +39 -0
  40. package/phases/.gitkeep +0 -0
  41. package/skills/00-overview.md +74 -0
  42. package/skills/01-getting-started.md +131 -0
  43. package/skills/02-first-activation.md +158 -0
  44. package/skills/10-ideation.md +45 -0
  45. package/skills/20-requirements.md +54 -0
  46. package/skills/30-design.md +57 -0
  47. package/skills/40-implementation.md +64 -0
  48. package/skills/50-testing.md +60 -0
  49. package/skills/60-deployment.md +63 -0
  50. package/skills/70-maintenance.md +56 -0
  51. package/skills/80-review.md +85 -0
  52. package/skills/81-continue.md +57 -0
  53. package/skills/82-add-action.md +71 -0
  54. package/templates/.gitkeep +0 -0
  55. package/templates/bugfix.yaml +14 -0
  56. package/templates/full-feature.yaml +44 -0
  57. package/templates/micro-task.yaml +11 -0
  58. package/templates/quick-feature.yaml +20 -0
  59. package/templates/spike.yaml +15 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Rodrigo Asensio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ platform: claude-code
2
+ capabilities:
3
+ plan-mode:
4
+ phases: [ideation, requirements, design]
5
+ activation: >-
6
+ Before producing this phase's artifact, enter plan mode to reason through
7
+ the problem space, identify constraints, and outline the approach before
8
+ committing to a structure. Exit plan mode only when you begin writing the
9
+ artifact.
@@ -0,0 +1,8 @@
1
+ platform: codex
2
+ capabilities:
3
+ code-generation:
4
+ phases: [implementation, testing]
5
+ activation: >-
6
+ Leverage Codex sandboxed execution for this phase. Write implementation
7
+ code and tests together, using the sandbox to validate that tests pass
8
+ before proposing the final changeset.
@@ -0,0 +1,8 @@
1
+ platform: cursor
2
+ capabilities:
3
+ composer:
4
+ phases: [design, implementation]
5
+ activation: >-
6
+ Use Cursor Composer for this phase to coordinate multi-file edits in a
7
+ single operation. Frame the design or implementation as a Composer prompt
8
+ describing the desired end state across all affected files.
@@ -0,0 +1,9 @@
1
+ platform: kiro
2
+ capabilities:
3
+ spec-driven-development:
4
+ phases: [requirements, design, implementation]
5
+ activation: >-
6
+ Use Kiro spec sessions for this phase. Keep spec documents under
7
+ .kiro/specs/ and let the spec workflow drive requirements, design
8
+ decisions, and task breakdown. Reference the active spec when producing
9
+ artifacts so that traceability is maintained.
@@ -0,0 +1,8 @@
1
+ platform: windsurf
2
+ capabilities:
3
+ cascade:
4
+ phases: [implementation]
5
+ activation: >-
6
+ Use Windsurf Cascade flows for implementation steps that span multiple
7
+ files. Keep individual instructions concise due to context-size
8
+ constraints; reference .aidlc/skills/ for full phase guidance when needed.
@@ -0,0 +1,4 @@
1
+ import type { CapabilityMap } from './types.js';
2
+ export declare function loadCapabilities(): CapabilityMap[];
3
+ export declare function getCapabilityMap(platform: string): CapabilityMap | undefined;
4
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKhD,wBAAgB,gBAAgB,IAAI,aAAa,EAAE,CAclD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE5E"}
@@ -0,0 +1,23 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { resolve, dirname } from 'node:path';
3
+ import { readdirSync, readFileSync } from 'node:fs';
4
+ import { parse as parseYaml } from 'yaml';
5
+ const CONTENT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
6
+ const CAPABILITIES_DIR = resolve(CONTENT_ROOT, 'capabilities');
7
+ export function loadCapabilities() {
8
+ const files = readdirSync(CAPABILITIES_DIR)
9
+ .filter(f => f.endsWith('.yaml') || f.endsWith('.yml'))
10
+ .sort();
11
+ return files.map(filename => {
12
+ const raw = readFileSync(resolve(CAPABILITIES_DIR, filename), 'utf8');
13
+ const parsed = parseYaml(raw);
14
+ return {
15
+ platform: parsed['platform'] ?? '',
16
+ capabilities: parsed['capabilities'] ?? {},
17
+ };
18
+ });
19
+ }
20
+ export function getCapabilityMap(platform) {
21
+ return loadCapabilities().find(c => c.platform === platform);
22
+ }
23
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAG1C,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAC5E,MAAM,gBAAgB,GAAG,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAE/D,MAAM,UAAU,gBAAgB;IAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,gBAAgB,CAAC;SACxC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACtD,IAAI,EAAE,CAAC;IAEV,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC1B,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QACtE,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAA4B,CAAC;QAEzD,OAAO;YACL,QAAQ,EAAG,MAAM,CAAC,UAAU,CAAY,IAAI,EAAE;YAC9C,YAAY,EAAG,MAAM,CAAC,cAAc,CAA6B,IAAI,EAAE;SACxE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,gBAAgB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { GuidanceLayer } from './types.js';
2
+ export declare function loadGuidance(): GuidanceLayer[];
3
+ //# sourceMappingURL=guidance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../src/guidance.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAShD,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAc9C"}
@@ -0,0 +1,21 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { resolve, dirname } from 'node:path';
3
+ import { readFileSync } from 'node:fs';
4
+ import { parse as parseYaml } from 'yaml';
5
+ const CONTENT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
6
+ const GUIDANCE_DIR = resolve(CONTENT_ROOT, 'guidance');
7
+ export function loadGuidance() {
8
+ const indexPath = resolve(GUIDANCE_DIR, 'index.yaml');
9
+ const indexRaw = readFileSync(indexPath, 'utf8');
10
+ const index = parseYaml(indexRaw);
11
+ return index.layers.map(layer => {
12
+ const filePath = resolve(GUIDANCE_DIR, layer.file);
13
+ const body = readFileSync(filePath, 'utf8');
14
+ return {
15
+ name: layer.name,
16
+ filename: layer.file,
17
+ body,
18
+ };
19
+ });
20
+ }
21
+ //# sourceMappingURL=guidance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guidance.js","sourceRoot":"","sources":["../src/guidance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAG1C,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAC5E,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AAMvD,MAAM,UAAU,YAAY;IAC1B,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAkB,CAAC;IAEnD,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC5C,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,QAAQ,EAAE,KAAK,CAAC,IAAI;YACpB,IAAI;SACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { loadSkills, getSkill } from './skills.js';
2
+ export { loadTemplates, getTemplate } from './templates.js';
3
+ export { loadGuidance } from './guidance.js';
4
+ export { loadCapabilities, getCapabilityMap } from './capabilities.js';
5
+ export { loadPhases, getPhase } from './phases.js';
6
+ export type { Skill, WorkflowTemplate, GuidanceLayer, CapabilityMap, PhaseDefinition } from './types.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { loadSkills, getSkill } from './skills.js';
2
+ export { loadTemplates, getTemplate } from './templates.js';
3
+ export { loadGuidance } from './guidance.js';
4
+ export { loadCapabilities, getCapabilityMap } from './capabilities.js';
5
+ export { loadPhases, getPhase } from './phases.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { PhaseDefinition } from './types.js';
2
+ export declare function loadPhases(): PhaseDefinition[];
3
+ export declare function getPhase(name: string): PhaseDefinition | undefined;
4
+ //# sourceMappingURL=phases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../src/phases.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,wBAAgB,UAAU,IAAI,eAAe,EAAE,CA2B9C;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAElE"}
package/dist/phases.js ADDED
@@ -0,0 +1,34 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { resolve, dirname } from 'node:path';
3
+ import { readdirSync, readFileSync, existsSync } from 'node:fs';
4
+ import { parse as parseYaml } from 'yaml';
5
+ const CONTENT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
6
+ const PHASES_DIR = resolve(CONTENT_ROOT, 'phases');
7
+ export function loadPhases() {
8
+ if (!existsSync(PHASES_DIR)) {
9
+ return [];
10
+ }
11
+ const files = readdirSync(PHASES_DIR)
12
+ .filter(f => f.endsWith('.yaml') || f.endsWith('.yml') || f.endsWith('.json'))
13
+ .sort();
14
+ if (files.length === 0) {
15
+ return [];
16
+ }
17
+ return files.map(filename => {
18
+ const raw = readFileSync(resolve(PHASES_DIR, filename), 'utf8');
19
+ const parsed = filename.endsWith('.json')
20
+ ? JSON.parse(raw)
21
+ : parseYaml(raw);
22
+ return {
23
+ name: parsed['name'] ?? '',
24
+ purpose: parsed['purpose'] ?? '',
25
+ exitCriteria: Array.isArray(parsed['exitCriteria'])
26
+ ? parsed['exitCriteria']
27
+ : [],
28
+ };
29
+ });
30
+ }
31
+ export function getPhase(name) {
32
+ return loadPhases().find(p => p.name === name);
33
+ }
34
+ //# sourceMappingURL=phases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phases.js","sourceRoot":"","sources":["../src/phases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAG1C,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAC5E,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AAEnD,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC7E,IAAI,EAAE,CAAC;IAEV,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC1B,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YACvC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAA6B;YAC9C,CAAC,CAAE,SAAS,CAAC,GAAG,CAA6B,CAAC;QAEhD,OAAO;YACL,IAAI,EAAG,MAAM,CAAC,MAAM,CAAY,IAAI,EAAE;YACtC,OAAO,EAAG,MAAM,CAAC,SAAS,CAAY,IAAI,EAAE;YAC5C,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;gBACjD,CAAC,CAAE,MAAM,CAAC,cAAc,CAAc;gBACtC,CAAC,CAAC,EAAE;SACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Skill } from './types.js';
2
+ export declare function loadSkills(): Skill[];
3
+ export declare function getSkill(name: string): Skill | undefined;
4
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA6BxC,wBAAgB,UAAU,IAAI,KAAK,EAAE,CASpC;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAExD"}
package/dist/skills.js ADDED
@@ -0,0 +1,40 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { resolve, dirname } from 'node:path';
3
+ import { readdirSync, readFileSync } from 'node:fs';
4
+ const CONTENT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
5
+ const SKILLS_DIR = resolve(CONTENT_ROOT, 'skills');
6
+ function parseSkillFrontmatter(raw) {
7
+ const match = raw.match(/^---\n([\s\S]*?)\n---/);
8
+ if (!match) {
9
+ return { name: '', phase: '', description: '' };
10
+ }
11
+ const frontmatter = match[1];
12
+ const meta = {};
13
+ for (const line of frontmatter.split('\n')) {
14
+ const colonIdx = line.indexOf(':');
15
+ if (colonIdx === -1)
16
+ continue;
17
+ const key = line.slice(0, colonIdx).trim();
18
+ const value = line.slice(colonIdx + 1).trim();
19
+ meta[key] = value;
20
+ }
21
+ return {
22
+ name: meta['name'] ?? '',
23
+ phase: meta['phase'] ?? '',
24
+ description: meta['description'] ?? '',
25
+ };
26
+ }
27
+ export function loadSkills() {
28
+ const files = readdirSync(SKILLS_DIR).filter(f => f.endsWith('.md')).sort();
29
+ return files.map(filename => {
30
+ const raw = readFileSync(resolve(SKILLS_DIR, filename), 'utf8');
31
+ const meta = parseSkillFrontmatter(raw);
32
+ // Strip frontmatter from body
33
+ const body = raw.replace(/^---\n[\s\S]*?\n---\n?/, '');
34
+ return { filename, meta, body };
35
+ });
36
+ }
37
+ export function getSkill(name) {
38
+ return loadSkills().find(s => s.meta.name === name);
39
+ }
40
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGpD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAC5E,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AAEnD,SAAS,qBAAqB,CAAC,GAAW;IACxC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,IAAI,GAA2B,EAAE,CAAC;IAExC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,QAAQ,KAAK,CAAC,CAAC;YAAE,SAAS;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;QACxB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAC1B,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE;KACvC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5E,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC1B,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;QACxC,8BAA8B;QAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;QACvD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WorkflowTemplate } from './types.js';
2
+ export declare function loadTemplates(): WorkflowTemplate[];
3
+ export declare function getTemplate(name: string): WorkflowTemplate | undefined;
4
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKnD,wBAAgB,aAAa,IAAI,gBAAgB,EAAE,CAqBlD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEtE"}
@@ -0,0 +1,29 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { resolve, dirname } from 'node:path';
3
+ import { readdirSync, readFileSync } from 'node:fs';
4
+ import { parse as parseYaml } from 'yaml';
5
+ const CONTENT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
6
+ const TEMPLATES_DIR = resolve(CONTENT_ROOT, 'templates');
7
+ export function loadTemplates() {
8
+ const files = readdirSync(TEMPLATES_DIR)
9
+ .filter(f => f.endsWith('.yaml') || f.endsWith('.yml'))
10
+ .sort();
11
+ return files.map(filename => {
12
+ const raw = readFileSync(resolve(TEMPLATES_DIR, filename), 'utf8');
13
+ const parsed = parseYaml(raw);
14
+ const phases = Array.isArray(parsed['phases'])
15
+ ? parsed['phases'].map(p => p.name)
16
+ : [];
17
+ return {
18
+ name: parsed['name'] ?? '',
19
+ scope: parsed['scope'] ?? '',
20
+ phases,
21
+ description: parsed['description'] ?? '',
22
+ raw: parsed,
23
+ };
24
+ });
25
+ }
26
+ export function getTemplate(name) {
27
+ return loadTemplates().find(t => t.name === name);
28
+ }
29
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAG1C,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAC5E,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AAEzD,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,CAAC;SACrC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACtD,IAAI,EAAE,CAAC;IAEV,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC1B,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QACnE,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAA4B,CAAC;QAEzD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5C,CAAC,CAAE,MAAM,CAAC,QAAQ,CAA6B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAChE,CAAC,CAAC,EAAE,CAAC;QAEP,OAAO;YACL,IAAI,EAAG,MAAM,CAAC,MAAM,CAAY,IAAI,EAAE;YACtC,KAAK,EAAG,MAAM,CAAC,OAAO,CAAY,IAAI,EAAE;YACxC,MAAM;YACN,WAAW,EAAG,MAAM,CAAC,aAAa,CAAY,IAAI,EAAE;YACpD,GAAG,EAAE,MAAM;SACZ,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,31 @@
1
+ export interface Skill {
2
+ filename: string;
3
+ meta: {
4
+ name: string;
5
+ phase: string;
6
+ description: string;
7
+ };
8
+ body: string;
9
+ }
10
+ export interface WorkflowTemplate {
11
+ name: string;
12
+ scope: string;
13
+ phases: string[];
14
+ description: string;
15
+ raw: Record<string, unknown>;
16
+ }
17
+ export interface GuidanceLayer {
18
+ name: string;
19
+ filename: string;
20
+ body: string;
21
+ }
22
+ export interface CapabilityMap {
23
+ platform: string;
24
+ capabilities: Record<string, unknown>;
25
+ }
26
+ export interface PhaseDefinition {
27
+ name: string;
28
+ purpose: string;
29
+ exitCriteria: string[];
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: accessibility
3
+ description: Web accessibility guidelines and inclusive design
4
+ ---
5
+ # Accessibility
6
+
7
+ Follow these accessibility rules when building user interfaces. All interactive content must be usable by people with diverse abilities, including those using assistive technologies.
8
+
9
+ ## Semantic HTML
10
+
11
+ - Use semantic elements (`<nav>`, `<main>`, `<article>`, `<section>`, `<header>`, `<footer>`) for page structure.
12
+ - Use heading elements (`<h1>`–`<h6>`) in logical hierarchy; never skip levels for styling.
13
+ - Use `<button>` for actions and `<a>` for navigation; never use `<div>` or `<span>` as interactive elements without proper roles.
14
+ - Use `<label>` elements explicitly associated with form inputs via `for`/`id` pairing.
15
+ - Use lists (`<ul>`, `<ol>`, `<dl>`) for grouped items rather than styled `<div>` sequences.
16
+
17
+ ## ARIA Usage
18
+
19
+ - Prefer native HTML semantics over ARIA; add ARIA only when no native element provides the required semantics.
20
+ - Use `aria-label` or `aria-labelledby` for interactive elements that lack visible text labels.
21
+ - Set `aria-expanded`, `aria-selected`, `aria-checked` states dynamically to reflect current UI state.
22
+ - Apply `role="alert"` or `aria-live="polite"` for dynamic content that must be announced to screen readers.
23
+ - Never use `aria-hidden="true"` on focusable elements.
24
+
25
+ ## Keyboard Navigation
26
+
27
+ - All interactive elements must be reachable and operable via keyboard alone (Tab, Shift+Tab, Enter, Space, Arrow keys).
28
+ - Maintain a logical tab order that follows the visual reading flow; avoid positive `tabindex` values.
29
+ - Provide visible focus indicators on all focusable elements; never remove outline without a visible replacement.
30
+ - Implement keyboard shortcuts for complex widgets (modals, dropdowns, tabs) per WAI-ARIA Authoring Practices.
31
+ - Trap focus inside modal dialogs until dismissed; restore focus to the triggering element on close.
32
+
33
+ ## Color and Contrast
34
+
35
+ - Maintain a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text (WCAG AA).
36
+ - Never use color as the sole means of conveying information; pair color with text, icons, or patterns.
37
+ - Verify contrast in both light and dark modes if the application supports theme switching.
38
+ - Ensure focus indicators have at least 3:1 contrast against adjacent colors.
39
+
40
+ ## Images and Media
41
+
42
+ - Provide meaningful `alt` text for informative images; use `alt=""` for decorative images.
43
+ - Provide captions or transcripts for video and audio content.
44
+ - Avoid auto-playing media; if unavoidable, provide an immediate mechanism to pause or stop.
45
+ - Ensure animated content can be paused and does not flash more than 3 times per second.
46
+
47
+ ## Forms and Errors
48
+
49
+ - Associate error messages with their input fields using `aria-describedby` or `aria-errormessage`.
50
+ - Display error summaries at the top of forms with links to the offending fields.
51
+ - Do not rely solely on placeholder text as a label; placeholders disappear on input.
52
+ - Group related form controls with `<fieldset>` and `<legend>`.
53
+ - Provide clear instructions before the form and inline help where input format is constrained.
54
+
55
+ ## Responsive and Adaptive Design
56
+
57
+ - Support zoom up to 200% without loss of content or functionality.
58
+ - Use relative units (rem, em, %) for text and spacing rather than fixed pixels.
59
+ - Ensure touch targets are at least 44x44 CSS pixels for mobile interfaces.
60
+ - Test layouts with different text sizes, languages, and reading directions (LTR/RTL).
61
+
62
+ ## Testing and Verification
63
+
64
+ - Run automated accessibility scans (axe-core, Lighthouse) in CI and fix all critical/serious issues.
65
+ - Test with at least one screen reader (VoiceOver, NVDA, or JAWS) for major user flows.
66
+ - Validate keyboard-only navigation for all primary workflows.
67
+ - Note: full WCAG conformance requires manual testing with assistive technologies and expert review.
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: api-conventions
3
+ description: REST API naming, error format, and versioning conventions
4
+ ---
5
+ # API Conventions
6
+
7
+ Follow these conventions when designing, implementing, or reviewing REST APIs. Consistency across endpoints reduces integration friction and simplifies documentation.
8
+
9
+ ## URL Structure and Naming
10
+
11
+ - Use lowercase, hyphen-separated path segments: `/user-profiles`, not `/userProfiles` or `/user_profiles`.
12
+ - Use plural nouns for resource collections: `/orders`, `/products`, `/users`.
13
+ - Use resource identifiers as path segments: `/users/{userId}/orders/{orderId}`.
14
+ - Limit nesting to two levels; deeper relationships should use query parameters or links.
15
+ - Use query parameters for filtering, sorting, and pagination: `?status=active&sort=-created_at&page=2`.
16
+ - Avoid verbs in URLs; let HTTP methods convey the action.
17
+
18
+ ## HTTP Methods
19
+
20
+ - `GET` — Retrieve a resource or collection. Must be safe and idempotent. Never mutate state.
21
+ - `POST` — Create a new resource or trigger a non-idempotent action. Return 201 with Location header for creates.
22
+ - `PUT` — Replace an entire resource. Must be idempotent. Return 200 or 204.
23
+ - `PATCH` — Partially update a resource. Use JSON Merge Patch or JSON Patch content types. Return 200.
24
+ - `DELETE` — Remove a resource. Must be idempotent. Return 204 on success, 404 if already absent.
25
+ - `OPTIONS` — Return allowed methods and CORS headers. Used for preflight requests.
26
+
27
+ ## Status Codes
28
+
29
+ Use the most specific applicable status code:
30
+
31
+ | Range | Use for |
32
+ |-------|---------|
33
+ | 200 | Successful retrieval or update |
34
+ | 201 | Resource created (include Location header) |
35
+ | 204 | Success with no response body |
36
+ | 400 | Malformed request (syntax or validation errors) |
37
+ | 401 | Missing or invalid authentication credentials |
38
+ | 403 | Authenticated but insufficient permissions |
39
+ | 404 | Resource not found |
40
+ | 409 | Conflict (e.g., duplicate key, version mismatch) |
41
+ | 422 | Semantically invalid request (valid syntax but business rule violation) |
42
+ | 429 | Rate limit exceeded (include Retry-After header) |
43
+ | 500 | Unexpected server error (never expose internals) |
44
+
45
+ ## Error Response Format
46
+
47
+ Return a consistent JSON error body for all 4xx and 5xx responses:
48
+
49
+ ```json
50
+ {
51
+ "error": {
52
+ "code": "VALIDATION_FAILED",
53
+ "message": "Human-readable summary of the problem",
54
+ "details": [
55
+ {
56
+ "field": "email",
57
+ "issue": "Must be a valid email address"
58
+ }
59
+ ],
60
+ "request_id": "req_abc123"
61
+ }
62
+ }
63
+ ```
64
+
65
+ - `code` — Machine-readable error identifier (UPPER_SNAKE_CASE).
66
+ - `message` — Brief, user-safe description. Never include stack traces or internal paths.
67
+ - `details` — Optional array of field-level errors for validation failures.
68
+ - `request_id` — Correlation identifier for debugging (matches server-side logs).
69
+
70
+ ## Pagination
71
+
72
+ - Use cursor-based pagination for large or frequently-changing collections.
73
+ - Support limit/offset as a simpler alternative for smaller, stable datasets.
74
+ - Return pagination metadata in the response body:
75
+
76
+ ```json
77
+ {
78
+ "data": [...],
79
+ "pagination": {
80
+ "next_cursor": "eyJpZCI6MTAwfQ",
81
+ "has_more": true,
82
+ "total_count": 2340
83
+ }
84
+ }
85
+ ```
86
+
87
+ - Include `total_count` only when it can be computed efficiently.
88
+
89
+ ## Versioning
90
+
91
+ - Use URL prefix versioning for major breaking changes: `/v1/users`, `/v2/users`.
92
+ - Increment the version number only on backward-incompatible changes.
93
+ - Support the previous major version for at least 6 months after a new version ships.
94
+ - Treat additive changes (new optional fields, new endpoints) as backward-compatible.
95
+ - Document deprecation timelines in the Sunset response header and changelog.
96
+
97
+ ## Request and Response Conventions
98
+
99
+ - Use `snake_case` for JSON field names throughout request and response bodies.
100
+ - Represent timestamps in ISO 8601 format with UTC timezone: `2025-06-15T10:30:00Z`.
101
+ - Use envelope format for collections: `{ "data": [...], "pagination": {...} }`.
102
+ - Return the full created or updated resource in response to POST, PUT, and PATCH.
103
+ - Accept and return `Content-Type: application/json` by default.
104
+ - Support `Accept` header negotiation where multiple formats are available.
105
+
106
+ ## Rate Limiting and Throttling
107
+
108
+ - Enforce rate limits per client or API key.
109
+ - Return `429 Too Many Requests` with a `Retry-After` header (seconds until next allowed request).
110
+ - Include rate limit headers on every response: `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`.
111
+
112
+ ## CORS and Security Headers
113
+
114
+ - Configure CORS to allow only trusted origins; avoid wildcard `*` in production.
115
+ - Return appropriate CORS headers: `Access-Control-Allow-Origin`, `Access-Control-Allow-Methods`, `Access-Control-Allow-Headers`.
116
+ - Set `Cache-Control: no-store` on responses containing sensitive data.
117
+ - Include `X-Content-Type-Options: nosniff` and `X-Request-Id` on all responses.
118
+
119
+ ## Documentation and Discoverability
120
+
121
+ - Provide an OpenAPI 3.x specification for every public API.
122
+ - Include request/response examples for each endpoint.
123
+ - Document authentication requirements, rate limits, and error codes.
124
+ - Use consistent terminology across endpoint descriptions.
@@ -0,0 +1,7 @@
1
+ layers:
2
+ - name: secure-defaults
3
+ file: secure-defaults.md
4
+ - name: accessibility
5
+ file: accessibility.md
6
+ - name: api-conventions
7
+ file: api-conventions.md
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: secure-defaults
3
+ description: Security best practices and secure coding defaults
4
+ ---
5
+ # Secure Defaults
6
+
7
+ Follow these security rules by default when writing or reviewing code. Deviations require explicit justification in the design artifact.
8
+
9
+ ## Input Validation
10
+
11
+ - Validate and sanitize all external inputs at the system boundary before processing.
12
+ - Use an allowlist approach for accepted values when possible; reject unknown inputs.
13
+ - Enforce maximum length, type, and format constraints on every input field.
14
+ - Never trust client-side validation alone; always validate server-side.
15
+
16
+ ## Database and Query Safety
17
+
18
+ - Use parameterized queries or prepared statements for all database access.
19
+ - Never construct SQL, NoSQL, or ORM queries by string concatenation with user input.
20
+ - Apply principle of least privilege to database credentials (read-only where writes are not needed).
21
+ - Escape identifiers if dynamic table or column names are unavoidable.
22
+
23
+ ## Authentication and Authorization
24
+
25
+ - Hash passwords with a modern adaptive algorithm (bcrypt, scrypt, or argon2) with per-user salts.
26
+ - Enforce minimum password complexity or passphrase length per current NIST guidance.
27
+ - Implement rate limiting and account lockout on authentication endpoints.
28
+ - Check authorization on every request; never rely solely on client-side role checks.
29
+ - Use short-lived tokens (JWT, session) with explicit expiration and refresh rotation.
30
+
31
+ ## Secrets Management
32
+
33
+ - Never store secrets (API keys, tokens, passwords, private keys) in source code or config files committed to version control.
34
+ - Use environment variables or a dedicated secrets manager for runtime secrets.
35
+ - Rotate secrets on a defined schedule and immediately on suspected compromise.
36
+ - Log secret access but never log secret values.
37
+
38
+ ## Transport and Data Protection
39
+
40
+ - Use TLS 1.2+ for all network communication; reject plain HTTP in production.
41
+ - Encrypt sensitive data at rest using AES-256 or equivalent.
42
+ - Set Secure, HttpOnly, and SameSite attributes on all authentication cookies.
43
+ - Apply Content-Security-Policy, X-Content-Type-Options, and Strict-Transport-Security headers.
44
+
45
+ ## Error Handling and Logging
46
+
47
+ - Never expose stack traces, internal paths, or database details in user-facing error responses.
48
+ - Log errors with sufficient context for debugging but exclude sensitive data (PII, secrets).
49
+ - Use structured logging (JSON) with consistent severity levels.
50
+ - Return generic error messages to clients; map internal errors to safe public codes.
51
+
52
+ ## Dependency Security
53
+
54
+ - Pin dependency versions and use lock files to ensure reproducible builds.
55
+ - Audit dependencies for known vulnerabilities regularly (e.g., npm audit, Snyk, Dependabot).
56
+ - Prefer well-maintained packages with active security response teams.
57
+ - Remove unused dependencies to reduce attack surface.
58
+
59
+ ## Least Privilege and Defense in Depth
60
+
61
+ - Run services with the minimum permissions required for their function.
62
+ - Separate concerns: do not mix admin and user-facing logic in the same process.
63
+ - Apply defense in depth: assume any single layer can be bypassed.
64
+ - Validate at multiple boundaries (network edge, service boundary, data layer).
65
+
66
+ ## File and Resource Handling
67
+
68
+ - Validate uploaded file types, sizes, and content (not just extensions).
69
+ - Store uploaded files outside the web root with randomized names.
70
+ - Set restrictive file permissions on sensitive files (0600 for keys, 0644 for config).
71
+ - Avoid path traversal: canonicalize paths and reject `..` sequences in user input.