@phuc1403/musketeer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALLATION.md +22 -0
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/bin/musketeer.js +72 -0
- package/manifest.json +238 -0
- package/package.json +46 -0
- package/src/copier.js +119 -0
- package/src/lockfile.js +61 -0
- package/src/manifest-loader.js +46 -0
- package/src/muster.js +48 -0
- package/src/provisioner/detect.js +93 -0
- package/src/provisioner/guide.js +32 -0
- package/src/provisioner/index.js +113 -0
- package/src/provisioner/mcp.js +26 -0
- package/src/provisioner/os-package-manager.js +71 -0
- package/src/provisioner/venv.js +44 -0
- package/src/reconcile.js +94 -0
- package/src/resolver.js +130 -0
- package/src/schema.js +152 -0
- package/src/settings-merger.js +0 -0
- package/template/.claude/agents/code-reviewer.md +166 -0
- package/template/.claude/agents/hallmark-auditor.md +78 -0
- package/template/.claude/agents/hallmark-explorer.md +81 -0
- package/template/.claude/agents/researcher.md +33 -0
- package/template/.claude/hooks/block-migration-edits.cjs +31 -0
- package/template/.claude/hooks/format-json-hook.js +91 -0
- package/template/.claude/hooks/inject-design-docs.cjs +86 -0
- package/template/.claude/hooks/lib/colors.cjs +122 -0
- package/template/.claude/hooks/lib/git-info-cache.cjs +191 -0
- package/template/.claude/hooks/lib/transcript-parser.cjs +277 -0
- package/template/.claude/hooks/usage-context-awareness.cjs +166 -0
- package/template/.claude/hooks/validate-cml-hook.js +145 -0
- package/template/.claude/skills/adr-writer/SKILL.md +78 -0
- package/template/.claude/skills/adr-writer/references/adr-example.md +38 -0
- package/template/.claude/skills/adr-writer/references/adr-template.md +46 -0
- package/template/.claude/skills/architecture-characteristic-writer/SKILL.md +117 -0
- package/template/.claude/skills/architecture-characteristic-writer/assets/worksheet-template.md +40 -0
- package/template/.claude/skills/architecture-characteristic-writer/references/characteristics-catalog.md +106 -0
- package/template/.claude/skills/code-review/SKILL.md +54 -0
- package/template/.claude/skills/code-review/references/adversarial-review.md +223 -0
- package/template/.claude/skills/code-review/references/checklists/api.md +52 -0
- package/template/.claude/skills/code-review/references/checklists/base.md +100 -0
- package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -0
- package/template/.claude/skills/context-map/SKILL.md +80 -0
- package/template/.claude/skills/context-map/example.cml +106 -0
- package/template/.claude/skills/context-map/reference/Aggregate/Aggregate.md +1 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/Bounded Context.md +41 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/businessModel.md +6 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/domainVisionStatement.md +3 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/evolution.md +6 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/implementationTechnology.md +1 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/implements.md +1 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/knowledgeLevel.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/realizes.md +9 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/refines.md +10 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/responsibilities.md +26 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/type.md +23 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Anticorruption Layer.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Bounded Context Relationship.md +13 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Conformist.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Customer-Supplier (C-S).md +23 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Open Host Service.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Partnership (P).md +14 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Published Language.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Shared Kernel (SK).md +13 -0
- package/template/.claude/skills/context-map/reference/Context Map.md +63 -0
- package/template/.claude/skills/context-map/reference/Domain/Domain.md +30 -0
- package/template/.claude/skills/context-map/reference/Domain/supports.md +34 -0
- package/template/.claude/skills/context-map/reference/Domain/type.md +3 -0
- package/template/.claude/skills/context-map/reference/Semantic Rules.md +33 -0
- package/template/.claude/skills/hallmark/SKILL.md +552 -0
- package/template/.claude/skills/hallmark/references/anti-patterns.md +412 -0
- package/template/.claude/skills/hallmark/references/assets.md +406 -0
- package/template/.claude/skills/hallmark/references/color.md +95 -0
- package/template/.claude/skills/hallmark/references/component-cookbook.md +256 -0
- package/template/.claude/skills/hallmark/references/components/c1-outlined-chip.md +12 -0
- package/template/.claude/skills/hallmark/references/components/c2-inline-form-as-cta.md +16 -0
- package/template/.claude/skills/hallmark/references/components/c3-typographic-link.md +8 -0
- package/template/.claude/skills/hallmark/references/components/c4-sticky-bottom-bar.md +16 -0
- package/template/.claude/skills/hallmark/references/components/f1-bento-grid.md +20 -0
- package/template/.claude/skills/hallmark/references/components/f2-sticky-scroll-stack.md +20 -0
- package/template/.claude/skills/hallmark/references/components/f3-tabular-spec-sheet.md +11 -0
- package/template/.claude/skills/hallmark/references/components/f4-step-sequence.md +11 -0
- package/template/.claude/skills/hallmark/references/components/f5-annotated-screenshot.md +11 -0
- package/template/.claude/skills/hallmark/references/components/f6-product-card-grid.md +41 -0
- package/template/.claude/skills/hallmark/references/components/ft1-mast-headed.md +13 -0
- package/template/.claude/skills/hallmark/references/components/ft2-inline-rule-single-line.md +10 -0
- package/template/.claude/skills/hallmark/references/components/ft3-index-style-category-list.md +12 -0
- package/template/.claude/skills/hallmark/references/components/ft4-dense-typographic.md +10 -0
- package/template/.claude/skills/hallmark/references/components/ft5-statement.md +21 -0
- package/template/.claude/skills/hallmark/references/components/ft6-letter-close.md +19 -0
- package/template/.claude/skills/hallmark/references/components/ft7-newsletter-first.md +27 -0
- package/template/.claude/skills/hallmark/references/components/ft8-marquee-scroll.md +25 -0
- package/template/.claude/skills/hallmark/references/components/h1-marquee.md +15 -0
- package/template/.claude/skills/hallmark/references/components/h2-split-diptych.md +15 -0
- package/template/.claude/skills/hallmark/references/components/h3-quote-led.md +11 -0
- package/template/.claude/skills/hallmark/references/components/h4-stat-led.md +14 -0
- package/template/.claude/skills/hallmark/references/components/h5-letter-hero.md +11 -0
- package/template/.claude/skills/hallmark/references/components/h6-photographic-fold.md +16 -0
- package/template/.claude/skills/hallmark/references/components/h7-demo-video-clipped-by-viewport-edge.md +27 -0
- package/template/.claude/skills/hallmark/references/components/h8-mockup-split-browser-framed.md +23 -0
- package/template/.claude/skills/hallmark/references/components/h9-custom-illustration-centerpiece.md +27 -0
- package/template/.claude/skills/hallmark/references/components/n1-wordmark-2-links.md +12 -0
- package/template/.claude/skills/hallmark/references/components/n10-floating-on-scroll-morph.md +19 -0
- package/template/.claude/skills/hallmark/references/components/n2-floating-chip.md +14 -0
- package/template/.claude/skills/hallmark/references/components/n3-side-rail.md +14 -0
- package/template/.claude/skills/hallmark/references/components/n4-hidden-behind-k.md +9 -0
- package/template/.claude/skills/hallmark/references/components/n5-floating-pill.md +28 -0
- package/template/.claude/skills/hallmark/references/components/n6-newspaper-masthead.md +24 -0
- package/template/.claude/skills/hallmark/references/components/n7-brutal-slab.md +22 -0
- package/template/.claude/skills/hallmark/references/components/n8-terminal-command.md +21 -0
- package/template/.claude/skills/hallmark/references/components/n9-edge-aligned-minimal.md +17 -0
- package/template/.claude/skills/hallmark/references/components/s1-left-margin-numbered.md +15 -0
- package/template/.claude/skills/hallmark/references/components/s2-hanging.md +13 -0
- package/template/.claude/skills/hallmark/references/components/s3-sticky-pinned.md +19 -0
- package/template/.claude/skills/hallmark/references/components/s4-inline-no-break.md +11 -0
- package/template/.claude/skills/hallmark/references/components/s5-bottom-anchored.md +13 -0
- package/template/.claude/skills/hallmark/references/components/t1-pull-quote-with-marginalia.md +12 -0
- package/template/.claude/skills/hallmark/references/components/t2-logo-wall-hairline.md +19 -0
- package/template/.claude/skills/hallmark/references/components/t3-single-huge-quote.md +11 -0
- package/template/.claude/skills/hallmark/references/components/t4-numbered-stat-strip.md +14 -0
- package/template/.claude/skills/hallmark/references/contract.md +24 -0
- package/template/.claude/skills/hallmark/references/copy.md +182 -0
- package/template/.claude/skills/hallmark/references/custom-craft.md +626 -0
- package/template/.claude/skills/hallmark/references/custom-theme.md +329 -0
- package/template/.claude/skills/hallmark/references/design-md.md +116 -0
- package/template/.claude/skills/hallmark/references/export-formats.md +328 -0
- package/template/.claude/skills/hallmark/references/floating-nav.md +89 -0
- package/template/.claude/skills/hallmark/references/genres/atmospheric.md +65 -0
- package/template/.claude/skills/hallmark/references/genres/editorial.md +70 -0
- package/template/.claude/skills/hallmark/references/genres/modern-minimal.md +67 -0
- package/template/.claude/skills/hallmark/references/genres/playful.md +65 -0
- package/template/.claude/skills/hallmark/references/hero-enrichment.md +474 -0
- package/template/.claude/skills/hallmark/references/imagery-kit.md +170 -0
- package/template/.claude/skills/hallmark/references/interaction-and-states.md +207 -0
- package/template/.claude/skills/hallmark/references/layout-and-space.md +111 -0
- package/template/.claude/skills/hallmark/references/macrostructures/01-bento-grid.md +35 -0
- package/template/.claude/skills/hallmark/references/macrostructures/02-long-document.md +34 -0
- package/template/.claude/skills/hallmark/references/macrostructures/03-marquee-hero.md +31 -0
- package/template/.claude/skills/hallmark/references/macrostructures/04-stat-led.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/05-workbench.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/06-conversational-faq.md +33 -0
- package/template/.claude/skills/hallmark/references/macrostructures/07-manifesto.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/08-photographic.md +34 -0
- package/template/.claude/skills/hallmark/references/macrostructures/09-quote-led.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/10-specimen.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/11-catalogue.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/12-letter.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/13-index-first.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/14-narrative-workflow.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/15-split-studio.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/17-type-specimen.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/18-portfolio-grid.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/19-map-diagram.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/20-ecosystem-index.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/21-component-playground.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures.md +89 -0
- package/template/.claude/skills/hallmark/references/microinteractions.md +260 -0
- package/template/.claude/skills/hallmark/references/motion.md +109 -0
- package/template/.claude/skills/hallmark/references/preview-examples.md +49 -0
- package/template/.claude/skills/hallmark/references/responsive.md +138 -0
- package/template/.claude/skills/hallmark/references/slop-test.md +205 -0
- package/template/.claude/skills/hallmark/references/structure.md +164 -0
- package/template/.claude/skills/hallmark/references/study.md +511 -0
- package/template/.claude/skills/hallmark/references/typography.md +243 -0
- package/template/.claude/skills/hallmark/references/verbs/audit.md +25 -0
- package/template/.claude/skills/hallmark/references/verbs/redesign.md +269 -0
- package/template/.claude/skills/hallmark-explore/SKILL.md +137 -0
- package/template/.claude/skills/hallmark-explore/references/direction-matrix.md +124 -0
- package/template/.claude/skills/hallmark-explore/references/explorer-call.md +68 -0
- package/template/.claude/skills/hallmark-explore/scripts/build_compare.py +174 -0
- package/template/.claude/skills/hallmark-explore/scripts/scaffold_exploration.py +122 -0
- package/template/.claude/skills/hallmark-loop/SKILL.md +105 -0
- package/template/.claude/skills/hallmark-loop/references/auditor-call.md +60 -0
- package/template/.claude/skills/hallmark-loop/references/capture.md +78 -0
- package/template/.claude/skills/hallmark-loop/references/loop-control.md +79 -0
- package/template/.claude/skills/handoff/SKILL.md +15 -0
- package/template/.claude/skills/install.ps1 +42 -0
- package/template/.claude/skills/install.sh +54 -0
- package/template/.claude/skills/knowledge-crunching/SKILL.md +130 -0
- package/template/.claude/skills/knowledge-crunching/assets/context.template.md +59 -0
- package/template/.claude/skills/knowledge-crunching/references/crunching-dialogue.md +113 -0
- package/template/.claude/skills/research/SKILL.md +69 -0
- package/template/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/template/.claude/skills/skill-creator/SKILL.md +149 -0
- package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -0
- package/template/.claude/skills/skill-creator/agents/comparator.md +202 -0
- package/template/.claude/skills/skill-creator/agents/grader.md +223 -0
- package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -0
- package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -0
- package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -0
- package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -0
- package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -0
- package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -0
- package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -0
- package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -0
- package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -0
- package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +151 -0
- package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -0
- package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -0
- package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -0
- package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -0
- package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -0
- package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -0
- package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -0
- package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -0
- package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -0
- package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -0
- package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -0
- package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -0
- package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -0
- package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -0
- package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -0
- package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -0
- package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -0
- package/template/.claude/skills/skill-creator/scripts/utils.py +47 -0
- package/template/.claude/skills/tdd/SKILL.md +142 -0
- package/template/.claude/skills/tdd/assets/Directory.Build.props +26 -0
- package/template/.claude/skills/tdd/deep-modules.md +15 -0
- package/template/.claude/skills/tdd/dotnet-build-config.md +21 -0
- package/template/.claude/skills/tdd/interface-design.md +31 -0
- package/template/.claude/skills/tdd/mocking.md +59 -0
- package/template/.claude/skills/tdd/refactoring.md +10 -0
- package/template/.claude/skills/tdd/test-per-layer.md +69 -0
- package/template/.claude/skills/tdd/tests.md +61 -0
- package/template/.claude/statusline.cjs +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Architecture Characteristics Catalog
|
|
2
|
+
|
|
3
|
+
Based on Mark Richards' Architecture Characteristics Worksheet (DeveloperToArchitect.com, March 2024) and "Software Architecture" reference material.
|
|
4
|
+
|
|
5
|
+
## Common Architecture Characteristics
|
|
6
|
+
|
|
7
|
+
| Characteristic | Definition | Related |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| **performance** | Time it takes for system to process a business request | a |
|
|
10
|
+
| **responsiveness** | Time it takes to get a response to the user | a |
|
|
11
|
+
| **availability** | Uptime of a system; usually measured in 9's (e.g., 99.9%) | b |
|
|
12
|
+
| **fault tolerance** | When fatal errors occur, other parts of system continue to function | b |
|
|
13
|
+
| **scalability** | System capacity and growth over time; as users/requests increase, responsiveness, performance, and error rates remain constant | c |
|
|
14
|
+
| **elasticity** | System can expand and respond quickly to unexpected or anticipated extreme loads (e.g., 20 to 250,000 users instantly) | c |
|
|
15
|
+
| **data integrity** | Data across the system is correct and there is no data loss | d |
|
|
16
|
+
| **data consistency** | Data across the system is in sync and consistent across databases and tables | d |
|
|
17
|
+
| **adaptability** | Ease in which system can adapt to changes in environment and functionality | e |
|
|
18
|
+
| **extensibility** | Ease in which system can be extended with additional features and functionality | e |
|
|
19
|
+
| **concurrency** | Ability to process simultaneous requests, usually in the same order received; implied when scalability and elasticity are supported | |
|
|
20
|
+
| **interoperability** | Ability to interface and interact with other systems to complete a business request | |
|
|
21
|
+
| **deployability** | Amount of ceremony involved with releasing software, frequency of releases, and overall risk of deployment | |
|
|
22
|
+
| **testability** | Ease of and completeness of testing | |
|
|
23
|
+
| **abstraction** | Level at which parts of system are isolated from other parts (internal and external interactions) | |
|
|
24
|
+
| **workflow** | Ability to manage complex workflows requiring multiple parts (services) to complete a business request | |
|
|
25
|
+
| **configurability** | Ability to support multiple configurations, custom on-demand configurations and configuration updates | |
|
|
26
|
+
| **recoverability** | Ability to start where it left off in the event of a system crash | |
|
|
27
|
+
|
|
28
|
+
**Related pairs (a/b):** Some systems only need one, others may need both.
|
|
29
|
+
|
|
30
|
+
## Implicit Characteristics (Always Considered)
|
|
31
|
+
|
|
32
|
+
| Characteristic | Definition |
|
|
33
|
+
|---|---|
|
|
34
|
+
| **feasibility (cost/time)** | Taking into account timeframes, budgets, and developer skills when making architectural choices; tight timeframes and budgets make this a driving characteristic |
|
|
35
|
+
| **security** | Ability to restrict access to sensitive information or functionality |
|
|
36
|
+
| **maintainability** | Level of effort required to locate and apply changes to the system |
|
|
37
|
+
| **observability** | Ability to make available and stream metrics such as overall health, uptime, response times, performance, etc. |
|
|
38
|
+
|
|
39
|
+
Implicit characteristics become **driving** characteristics if they are critical concerns.
|
|
40
|
+
|
|
41
|
+
## Composite Architecture Characteristics
|
|
42
|
+
|
|
43
|
+
| Composite | Components |
|
|
44
|
+
|---|---|
|
|
45
|
+
| **agility** | maintainability + testability + deployability |
|
|
46
|
+
| **reliability** | availability + testability + data integrity + data consistency + fault tolerance |
|
|
47
|
+
|
|
48
|
+
## Category Groupings (from reference material)
|
|
49
|
+
|
|
50
|
+
### Process Characteristics
|
|
51
|
+
modularity, testability, agility, deployability, decouple-ability, extensibility
|
|
52
|
+
|
|
53
|
+
### Structural Characteristics
|
|
54
|
+
security, maintainability, extensibility, portability, localization
|
|
55
|
+
|
|
56
|
+
### Operational Characteristics
|
|
57
|
+
scalability, recoverability, robustness, performance, reliability/safety, availability
|
|
58
|
+
|
|
59
|
+
### Cross-cutting Characteristics
|
|
60
|
+
security, legal, authentication/authorization, privacy, accessibility, usability
|
|
61
|
+
|
|
62
|
+
## Guiding Questions by Category
|
|
63
|
+
|
|
64
|
+
### Operational
|
|
65
|
+
- How many concurrent users are expected? Peak vs average?
|
|
66
|
+
- What uptime SLA is required? (99.9%? 99.99%?)
|
|
67
|
+
- Is traffic steady or bursty? (e.g., seasonal spikes, flash sales)
|
|
68
|
+
- How fast must the system respond? (ms? seconds?)
|
|
69
|
+
- What happens if the system goes down? Business impact?
|
|
70
|
+
|
|
71
|
+
### Structural
|
|
72
|
+
- How frequently will new features be added?
|
|
73
|
+
- How many external systems need integration?
|
|
74
|
+
- How large is the development team? Multiple teams?
|
|
75
|
+
- How often will the system be deployed?
|
|
76
|
+
- Is the codebase expected to grow significantly?
|
|
77
|
+
|
|
78
|
+
### Cross-cutting
|
|
79
|
+
- Does the system handle sensitive/personal data?
|
|
80
|
+
- Are there compliance requirements? (GDPR, HIPAA, PCI-DSS, SOC2)
|
|
81
|
+
- Does it need to work across regions/languages?
|
|
82
|
+
- Who are the end users? Technical sophistication?
|
|
83
|
+
- Are there legal/regulatory constraints?
|
|
84
|
+
|
|
85
|
+
### Environment & Feasibility
|
|
86
|
+
- Startup (agility-first) or enterprise (stability-first)?
|
|
87
|
+
- Budget and timeline constraints?
|
|
88
|
+
- Team expertise — what technologies are they comfortable with?
|
|
89
|
+
- Existing infrastructure that must be leveraged?
|
|
90
|
+
|
|
91
|
+
## Custom Characteristics
|
|
92
|
+
|
|
93
|
+
If no existing characteristic fits, create a custom one:
|
|
94
|
+
- Name MUST end in `-ility` (e.g., `auditability`, `portability`, `learnability`)
|
|
95
|
+
- Provide a clear, one-sentence definition following the pattern: "The ability/ease/level of [what the system can do]"
|
|
96
|
+
- Assign to the most appropriate category
|
|
97
|
+
- Document why existing characteristics don't cover this concern
|
|
98
|
+
|
|
99
|
+
### Examples of Custom Characteristics
|
|
100
|
+
| Characteristic | Definition | Category |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| **auditability** | The ability to trace and record all system actions for compliance review | Cross-cutting |
|
|
103
|
+
| **portability** | The ease in which the system can be moved to a different environment or platform | Structural |
|
|
104
|
+
| **learnability** | The ease in which new developers can understand and contribute to the system | Process |
|
|
105
|
+
| **debuggability** | The ease in which issues can be identified and diagnosed in production | Operational |
|
|
106
|
+
| **reproducibility** | The ability to consistently reproduce system behavior across environments | Process |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: "Review code quality with adversarial rigor. Supports input modes: pending changes, PR number, commit hash, codebase scan. Always-on red-team analysis finds security holes, false assumptions, and failure modes."
|
|
4
|
+
argument-hint: "[#PR | COMMIT | --pending | codebase [parallel]]"
|
|
5
|
+
metadata:
|
|
6
|
+
author: claudekit
|
|
7
|
+
version: "3.0.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Code Review
|
|
11
|
+
|
|
12
|
+
Adversarial, evidence-based code review. Two stages: **Quality** then **Adversarial** (red-team). Be honest, brutal, concise. **YAGNI / KISS / DRY.** Verify before claiming; evidence before assertions.
|
|
13
|
+
|
|
14
|
+
## 1. Resolve the input
|
|
15
|
+
|
|
16
|
+
Parse arguments, first match wins, then get the diff:
|
|
17
|
+
|
|
18
|
+
| Argument | Mode | Diff command |
|
|
19
|
+
|----------|------|--------------|
|
|
20
|
+
| `#123` / PR URL | PR | `gh pr diff <n>` (+ `gh pr view <n> --json title,body,baseRefName` for intent) |
|
|
21
|
+
| `[0-9a-f]{7,40}` | Commit | `git show <sha>` |
|
|
22
|
+
| `--pending` | Pending | `git diff HEAD` (staged + unstaged) — ask user for intent |
|
|
23
|
+
| *(none, changes in context)* | Default | recent changes already in context |
|
|
24
|
+
| `codebase` / `codebase parallel` | Codebase | full-codebase scan (see below) |
|
|
25
|
+
| *(none, no context)* | Prompt | `AskUserQuestion`: pending / PR / commit / codebase |
|
|
26
|
+
|
|
27
|
+
Errors: PR not found → "PR #N not found"; bad SHA → "commit not found — is it pushed?"; empty `git diff HEAD` → "no pending changes". Ambiguous PR-vs-commit → prefer PR, note the assumption.
|
|
28
|
+
|
|
29
|
+
Always review **added/modified lines** (`+` in diff). Pre-existing code is out of scope unless the change makes it newly broken.
|
|
30
|
+
|
|
31
|
+
## 2. Stage 1 — Quality review
|
|
32
|
+
|
|
33
|
+
If the work implemented a plan/spec, first confirm compliance: list each requirement, mark PASS / MISSING / EXTRA. Missing requirements fail the review before quality matters — well-written code that doesn't match the spec is still wrong.
|
|
34
|
+
|
|
35
|
+
Then review the diff for: correctness, standards, edge cases (null/empty/boundary/error paths), performance, and reuse/simplification. Dispatch a `code-reviewer` subagent for non-trivial diffs; review inline for small ones. Each finding: `file:line`, problem, fix.
|
|
36
|
+
|
|
37
|
+
**Checklists (optional, for pre-landing / security audits):** detect project type — `package.json` with react/vue/next/etc → load `references/checklists/web-app.md`; `src/routes|api|controllers` → `references/checklists/api.md`; always load `references/checklists/base.md`. Run critical categories first (blocking), informational second. Honor the suppressions list at the bottom of `base.md`.
|
|
38
|
+
|
|
39
|
+
## 3. Stage 2 — Adversarial review (always-on)
|
|
40
|
+
|
|
41
|
+
**Skip only when ALL true:** ≤2 files changed, ≤30 lines, no security-sensitive files (auth/crypto/input-parsing/SQL/env), no new dependencies. When skipped, note `Adversarial: skipped (below threshold)`.
|
|
42
|
+
|
|
43
|
+
**Never skip** when auth/middleware/security/crypto, a lockfile, env vars, DB schema, or an API route changed.
|
|
44
|
+
|
|
45
|
+
Run the red-team pass per **`references/adversarial-review.md`** — spawn an adversarial `code-reviewer` whose only job is to break the code (security holes, false assumptions, failure modes, races, data corruption, supply chain, observability gaps). Then adjudicate each finding **Accept / Reject / Defer** with a reason — no silent dismissals; benefit of the doubt goes to the adversary. Critical accepted findings block merge. On re-review, pass only the fix diff.
|
|
46
|
+
|
|
47
|
+
## Codebase modes
|
|
48
|
+
|
|
49
|
+
- **`codebase`** — explore relevant files, dispatch parallel `code-reviewer` subagents by area, then run the always-on adversarial pass over the full scope. Report combined findings.
|
|
50
|
+
- **`codebase parallel`** — first enumerate edge cases exhaustively (null, boundary, error, race, validation, security, leaks, untested paths), group into ≤6 categories, dispatch one `code-reviewer` per category to **verify** them, aggregate handled/unhandled, then run the adversarial pass.
|
|
51
|
+
|
|
52
|
+
## Bottom line
|
|
53
|
+
|
|
54
|
+
Resolve what you're reviewing → quality pass → adversarial pass (scope-gated) → adjudicate → fix Critical, then claim only with verification evidence.
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: adversarial-review
|
|
3
|
+
description: Stage 3 red-team review that actively tries to break code — finds security holes, false assumptions, failure modes, race conditions. Spawns adversarial reviewer subagent with destructive mindset. Includes scope gate for trivial changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Adversarial Review (Stage 3)
|
|
7
|
+
|
|
8
|
+
Runs after every Stage 2 (Code Quality) pass. Subject to scope gate below.
|
|
9
|
+
|
|
10
|
+
## Scope Gate
|
|
11
|
+
|
|
12
|
+
Skip adversarial review when ALL of these are true:
|
|
13
|
+
- Changed files <= 2
|
|
14
|
+
- Lines changed <= 30
|
|
15
|
+
- No security-sensitive files touched (auth, crypto, input parsing, SQL, env)
|
|
16
|
+
- No new dependencies added
|
|
17
|
+
|
|
18
|
+
When skipped, note: `Adversarial: skipped (below threshold)` in review output.
|
|
19
|
+
|
|
20
|
+
**NEVER skip when:**
|
|
21
|
+
- Any file in: `auth/`, `middleware/`, `security/`, `crypto/`
|
|
22
|
+
- `package.json`, `package-lock.json`, or lockfile changed
|
|
23
|
+
- Environment variables added/changed
|
|
24
|
+
- Database schema modified
|
|
25
|
+
- API route added/changed
|
|
26
|
+
|
|
27
|
+
## Mindset
|
|
28
|
+
|
|
29
|
+
> "You are hired to tear apart the implementer's work. Your job is to find every way this code can fail, be exploited, or produce incorrect results. Assume the implementer made mistakes. Prove it."
|
|
30
|
+
|
|
31
|
+
This is NOT a standard code review. Standard reviews check if code meets requirements. Adversarial review assumes requirements are met and asks: **"How can this still break?"**
|
|
32
|
+
|
|
33
|
+
## What to Attack
|
|
34
|
+
|
|
35
|
+
### Security Holes
|
|
36
|
+
- Injection vectors (SQL, command, XSS, template)
|
|
37
|
+
- Auth bypass paths (missing checks, privilege escalation)
|
|
38
|
+
- Secrets exposure (logs, error messages, stack traces)
|
|
39
|
+
- Input trust boundaries (user input treated as safe)
|
|
40
|
+
- SSRF, path traversal, deserialization attacks
|
|
41
|
+
|
|
42
|
+
### False Assumptions
|
|
43
|
+
- "This will never be null" -- prove it can be
|
|
44
|
+
- "This list always has elements" -- find the empty case
|
|
45
|
+
- "Users always call A before B" -- find the out-of-order path
|
|
46
|
+
- "This config value exists" -- find the missing env var
|
|
47
|
+
- "This third-party API always returns 200" -- find the failure mode
|
|
48
|
+
- "This API shape won't change" -- find the breaking caller
|
|
49
|
+
|
|
50
|
+
### Failure Modes & Resource Exhaustion
|
|
51
|
+
- What happens when disk is full?
|
|
52
|
+
- What happens when network times out mid-operation?
|
|
53
|
+
- What happens when the database connection drops during a transaction?
|
|
54
|
+
- Unbounded allocations from user-controlled input
|
|
55
|
+
- Missing timeouts on external calls
|
|
56
|
+
- Event loop blocking (sync operations in async context)
|
|
57
|
+
- Connection/handle leaks on error paths
|
|
58
|
+
- Regex catastrophic backtracking (ReDoS)
|
|
59
|
+
|
|
60
|
+
### Race Conditions
|
|
61
|
+
- Shared mutable state without locks
|
|
62
|
+
- Time-of-check-to-time-of-use (TOCTOU)
|
|
63
|
+
- Async operations with implicit ordering assumptions
|
|
64
|
+
- Cache invalidation during concurrent writes
|
|
65
|
+
|
|
66
|
+
### Data Corruption
|
|
67
|
+
- Partial writes on failure (no transaction/rollback)
|
|
68
|
+
- Type coercion surprises (string "0" as falsy)
|
|
69
|
+
- Floating point comparison for equality
|
|
70
|
+
- Timezone-naive datetime operations
|
|
71
|
+
|
|
72
|
+
### Supply Chain & Dependencies
|
|
73
|
+
- New dependencies: postinstall scripts, maintainer reputation, bundle size
|
|
74
|
+
- Lockfile changes: version drift, removed integrity hashes
|
|
75
|
+
- Transitive deps pulling in known-vulnerable packages
|
|
76
|
+
|
|
77
|
+
### Observability Blind Spots
|
|
78
|
+
- Swallowed errors (`catch {}` with no log)
|
|
79
|
+
- Missing structured context in error logs
|
|
80
|
+
- PII in log output
|
|
81
|
+
|
|
82
|
+
## Process
|
|
83
|
+
|
|
84
|
+
### 1. Spawn Adversarial Reviewer
|
|
85
|
+
|
|
86
|
+
Dispatch `code-reviewer` subagent with adversarial prompt:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
You are an adversarial code reviewer. Your ONLY job is to find ways this code
|
|
90
|
+
can fail, be exploited, or produce incorrect results.
|
|
91
|
+
|
|
92
|
+
DO NOT praise the code. DO NOT note what works well.
|
|
93
|
+
ONLY report problems. If you find nothing, say "No findings" -- but try harder first.
|
|
94
|
+
|
|
95
|
+
Focus on ADDED/MODIFIED lines (+ prefix in diff). Pre-existing code is out of scope
|
|
96
|
+
unless the change makes it newly exploitable.
|
|
97
|
+
|
|
98
|
+
Context (read for understanding, DO NOT review):
|
|
99
|
+
{CONTEXT_FILES}
|
|
100
|
+
|
|
101
|
+
Runtime: {RUNTIME} (e.g., Node.js single-threaded, browser, serverless)
|
|
102
|
+
Framework: {FRAMEWORK} (e.g., Express with global error handler at app.ts:45)
|
|
103
|
+
|
|
104
|
+
Review this diff:
|
|
105
|
+
{DIFF}
|
|
106
|
+
|
|
107
|
+
Changed files: {FILES}
|
|
108
|
+
|
|
109
|
+
Attack vectors to check:
|
|
110
|
+
1. Security holes (injection, auth bypass, secrets exposure)
|
|
111
|
+
2. False assumptions (null, empty, ordering, config, API contracts)
|
|
112
|
+
3. Failure modes + resource exhaustion (timeouts, leaks, unbounded input)
|
|
113
|
+
4. Race conditions (shared state, TOCTOU, async ordering)
|
|
114
|
+
5. Data corruption (partial writes, type coercion, encoding)
|
|
115
|
+
6. Supply chain (new deps, lockfile changes, transitive vulns)
|
|
116
|
+
7. Observability (swallowed errors, missing logs, PII in output)
|
|
117
|
+
|
|
118
|
+
For each finding, report:
|
|
119
|
+
- SEVERITY: Critical / Medium / Low
|
|
120
|
+
- CATEGORY: Security / Assumption / Failure / Race / Data / Supply / Observability
|
|
121
|
+
- LOCATION: file:line
|
|
122
|
+
- ATTACK: How to trigger the problem
|
|
123
|
+
- IMPACT: What happens when triggered
|
|
124
|
+
- FIX: Describe the fix approach (e.g., "add null check before line 42").
|
|
125
|
+
Do NOT write implementation code -- the implementer has full context.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**If adversarial produces >10 findings on <100 lines changed:** likely too aggressive. Batch-reject noise, deep-review only Critical/Medium.
|
|
129
|
+
|
|
130
|
+
### 2. Adjudicate Findings
|
|
131
|
+
|
|
132
|
+
Main agent reviews each adversarial finding and assigns verdict:
|
|
133
|
+
|
|
134
|
+
| Verdict | Meaning | Action |
|
|
135
|
+
|---------|---------|--------|
|
|
136
|
+
| **Accept** | Valid flaw, reproducible or clearly reasoned | Must fix before merge |
|
|
137
|
+
| **Reject** | False positive, already handled, or impossible path | Document why, no action |
|
|
138
|
+
| **Defer** | Valid but low-risk, tracked for later | Create GitHub issue for tracking |
|
|
139
|
+
|
|
140
|
+
**Rules:**
|
|
141
|
+
- Every finding gets a verdict -- no silent dismissals
|
|
142
|
+
- Critical findings: Accept unless you can PROVE false positive
|
|
143
|
+
- Benefit of doubt goes to the adversary (safer to fix than to dismiss)
|
|
144
|
+
- If >50% of findings are Rejected, the adversary was too aggressive -- but still report all
|
|
145
|
+
|
|
146
|
+
**Calibration examples:**
|
|
147
|
+
|
|
148
|
+
| Verdict | Example | Reasoning |
|
|
149
|
+
|---------|---------|-----------|
|
|
150
|
+
| Accept | "SQL injection via string interpolation in query builder" | Clearly exploitable, concrete path shown |
|
|
151
|
+
| Reject | "Missing null check on config.apiUrl" | Config loaded at startup with schema validation (see config.ts:12), cannot be null at runtime |
|
|
152
|
+
| Defer | "No rate limiting on POST /api/upload" | Valid concern but internal-only tool currently; track for public exposure |
|
|
153
|
+
|
|
154
|
+
### 3. Report Format
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
## Adversarial Review -- Stage 3
|
|
158
|
+
|
|
159
|
+
### Summary
|
|
160
|
+
- Findings: N total (X Critical, Y Medium, Z Low)
|
|
161
|
+
- Accepted: A (must fix)
|
|
162
|
+
- Rejected: B (false positive)
|
|
163
|
+
- Deferred: C (tracked via GitHub issues)
|
|
164
|
+
|
|
165
|
+
### Accepted Findings (Must Fix)
|
|
166
|
+
|
|
167
|
+
#### [1] SEVERITY -- CATEGORY -- file:line
|
|
168
|
+
**Attack:** How to trigger
|
|
169
|
+
**Impact:** What happens
|
|
170
|
+
**Fix:** Approach description
|
|
171
|
+
**Verdict:** Accept -- [reason]
|
|
172
|
+
|
|
173
|
+
### Rejected Findings
|
|
174
|
+
|
|
175
|
+
#### [N] SEVERITY -- CATEGORY -- file:line
|
|
176
|
+
**Attack:** Claimed vector
|
|
177
|
+
**Verdict:** Reject -- [reason this is a false positive]
|
|
178
|
+
|
|
179
|
+
### Deferred Findings
|
|
180
|
+
|
|
181
|
+
#### [N] SEVERITY -- CATEGORY -- file:line
|
|
182
|
+
**Attack:** How to trigger
|
|
183
|
+
**Verdict:** Defer -- [reason] → GitHub issue #X
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 4. Fix Accepted Findings
|
|
187
|
+
|
|
188
|
+
- Critical: Block merge. Fix immediately via `/fix` or manual edit.
|
|
189
|
+
- Medium: Fix before merge if feasible. Defer only with explicit user approval.
|
|
190
|
+
- Low: Track. Fix in follow-up if pattern repeats.
|
|
191
|
+
|
|
192
|
+
### Re-review Optimization
|
|
193
|
+
|
|
194
|
+
On fix cycles (re-running after accepted findings were fixed):
|
|
195
|
+
- Only pass the FIX diff to adversarial, not the full original diff
|
|
196
|
+
- Verify accepted findings are resolved
|
|
197
|
+
- Check for regression: did the fix introduce new issues?
|
|
198
|
+
|
|
199
|
+
## Integration with Pipeline
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Stage 1 (Spec) → PASS
|
|
203
|
+
↓
|
|
204
|
+
Stage 2 (Quality) → PASS
|
|
205
|
+
↓
|
|
206
|
+
Scope gate → below threshold? → skip (note in report)
|
|
207
|
+
↓ (above threshold)
|
|
208
|
+
Stage 3 (Adversarial) → findings
|
|
209
|
+
├─ 0 Accepted → PASS → proceed
|
|
210
|
+
├─ Accepted Critical → BLOCK → fix → re-run Stage 3 (fix diff only)
|
|
211
|
+
└─ Accepted Medium/Low only → fix or defer → proceed
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Task pipeline update:** When using task-managed reviews, adversarial review gets its own task between "Review implementation" and "Fix critical issues".
|
|
215
|
+
|
|
216
|
+
## What This Is NOT
|
|
217
|
+
|
|
218
|
+
- NOT a style review (Stage 2 handles that)
|
|
219
|
+
- NOT a spec compliance check (Stage 1 handles that)
|
|
220
|
+
- NOT dependency graph analysis or import tracing (scout handles that)
|
|
221
|
+
- NOT a general "suggestions for improvement" pass
|
|
222
|
+
|
|
223
|
+
This is a focused, hostile attempt to break the code. If the code survives, it's ready to ship.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# API Review Checklist (Overlay)
|
|
2
|
+
|
|
3
|
+
Additive to `base.md`. Apply when project exposes REST/GraphQL/gRPC APIs.
|
|
4
|
+
|
|
5
|
+
## Detection
|
|
6
|
+
|
|
7
|
+
Apply this overlay when any of these are true:
|
|
8
|
+
- Project has route definitions (Express, FastAPI, NestJS, Django, Rails, Go chi/gin)
|
|
9
|
+
- OpenAPI/Swagger spec file exists
|
|
10
|
+
- `src/routes/`, `src/api/`, `src/controllers/` directories
|
|
11
|
+
- GraphQL schema files in the diff
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Pass 1 — CRITICAL (additions to base)
|
|
16
|
+
|
|
17
|
+
### Auth & Rate Limiting
|
|
18
|
+
- Public endpoints missing rate limiting (login, registration, password reset)
|
|
19
|
+
- API keys or tokens exposed in URL query parameters (use headers)
|
|
20
|
+
- Missing auth middleware on new routes
|
|
21
|
+
- Batch/bulk endpoints without per-item authorization checks
|
|
22
|
+
|
|
23
|
+
### Input Validation
|
|
24
|
+
- Request body accepted without schema validation (missing Zod, Joi, Pydantic, etc.)
|
|
25
|
+
- Mass assignment: entire request body spread into database model
|
|
26
|
+
- File upload without size/type restrictions
|
|
27
|
+
- Array inputs without length limits (DoS via large payloads)
|
|
28
|
+
|
|
29
|
+
### Data Exposure
|
|
30
|
+
- Sensitive fields in API responses (password hashes, internal IDs, tokens)
|
|
31
|
+
- Stack traces or internal error details in production error responses
|
|
32
|
+
- Verbose error messages that leak schema/implementation details
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Pass 2 — INFORMATIONAL (additions to base)
|
|
37
|
+
|
|
38
|
+
### API Design
|
|
39
|
+
- List endpoints without pagination (LIMIT/OFFSET or cursor-based)
|
|
40
|
+
- Missing consistent error response format across endpoints
|
|
41
|
+
- Inconsistent naming conventions (camelCase vs snake_case in same API)
|
|
42
|
+
- Missing request/response content-type headers
|
|
43
|
+
|
|
44
|
+
### Observability
|
|
45
|
+
- New endpoints without logging/metrics
|
|
46
|
+
- Error paths that swallow exceptions silently
|
|
47
|
+
- Missing correlation/request IDs for tracing
|
|
48
|
+
|
|
49
|
+
### Versioning & Compatibility
|
|
50
|
+
- Breaking changes to existing response shapes without version bump
|
|
51
|
+
- Removed fields without deprecation notice
|
|
52
|
+
- Changed field types (string → number) in existing responses
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Base Review Checklist
|
|
2
|
+
|
|
3
|
+
Universal checklist for all project types. Two-pass model: critical (blocking) + informational (non-blocking).
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Review `git diff origin/main` for the issues below. Be specific — cite `file:line` and suggest fixes. Skip anything that's fine. Only flag real problems.
|
|
8
|
+
|
|
9
|
+
**Output format:**
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Pre-Landing Review: N issues (X critical, Y informational)
|
|
13
|
+
|
|
14
|
+
**CRITICAL** (blocking):
|
|
15
|
+
- [file:line] Problem description
|
|
16
|
+
Fix: suggested fix
|
|
17
|
+
|
|
18
|
+
**Issues** (non-blocking):
|
|
19
|
+
- [file:line] Problem description
|
|
20
|
+
Fix: suggested fix
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If no issues: `Pre-Landing Review: No issues found.`
|
|
24
|
+
|
|
25
|
+
Be terse. One line problem, one line fix. No preamble.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Pass 1 — CRITICAL (blocking)
|
|
30
|
+
|
|
31
|
+
### Injection & Data Safety
|
|
32
|
+
- String interpolation in SQL/database queries (even with type casting — use parameterized queries)
|
|
33
|
+
- Unsanitized user input written to database or rendered in HTML
|
|
34
|
+
- Raw HTML output from user-controlled data (`innerHTML`, `dangerouslySetInnerHTML`, `html_safe`, `raw()`, `| safe`)
|
|
35
|
+
- Command injection via string concatenation in shell commands (use argument arrays)
|
|
36
|
+
- Path traversal via user input in file operations
|
|
37
|
+
|
|
38
|
+
### Race Conditions & Concurrency
|
|
39
|
+
- Read-check-write without atomic operations (check-then-set should be atomic WHERE + UPDATE)
|
|
40
|
+
- Find-or-create without unique database constraint (concurrent calls create duplicates)
|
|
41
|
+
- Status transitions without atomic WHERE old_status + UPDATE new_status
|
|
42
|
+
- Shared mutable state accessed without synchronization
|
|
43
|
+
|
|
44
|
+
### Security Boundaries
|
|
45
|
+
- Missing authentication checks on new endpoints/routes
|
|
46
|
+
- Privilege escalation paths (user can access/modify another user's data — IDOR)
|
|
47
|
+
- Secrets in logs, error responses, or client-side code
|
|
48
|
+
- LLM/AI output written to database or used in queries without validation
|
|
49
|
+
- JWT/token comparison using `==` instead of constant-time comparison
|
|
50
|
+
|
|
51
|
+
### Auth & Access Control
|
|
52
|
+
- New API endpoints without auth middleware
|
|
53
|
+
- Missing authorization check (authenticated but not authorized)
|
|
54
|
+
- Admin-only operations accessible to regular users
|
|
55
|
+
- Session fixation or token reuse vulnerabilities
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Pass 2 — INFORMATIONAL (non-blocking)
|
|
60
|
+
|
|
61
|
+
### Conditional Side Effects
|
|
62
|
+
- Code branches on condition but forgets side effect on one branch (e.g., sets status but not associated data)
|
|
63
|
+
- Log messages claiming action happened but action was conditionally skipped
|
|
64
|
+
|
|
65
|
+
### Magic Numbers & String Coupling
|
|
66
|
+
- Bare numeric literals used in multiple files — should be named constants
|
|
67
|
+
- Error message strings used as query filters elsewhere (grep for the string)
|
|
68
|
+
|
|
69
|
+
### Dead Code & Consistency
|
|
70
|
+
- Variables assigned but never read
|
|
71
|
+
- Stale comments describing old behavior after code changed
|
|
72
|
+
- Import/require statements for unused modules
|
|
73
|
+
|
|
74
|
+
### Test Gaps
|
|
75
|
+
- Missing negative-path tests (error cases, validation failures)
|
|
76
|
+
- Assertions on type/status but not side effects (e.g., checks status but not that email was sent)
|
|
77
|
+
- Missing integration tests for security enforcement (auth, rate limiting, access control)
|
|
78
|
+
|
|
79
|
+
### Type Coercion at Boundaries
|
|
80
|
+
- Values crossing language/system boundaries where type could change (string vs number)
|
|
81
|
+
- Hash/digest inputs that don't normalize types before serialization
|
|
82
|
+
|
|
83
|
+
### Performance
|
|
84
|
+
- O(n*m) lookups in views/templates (array search inside loops — use hash/map lookup)
|
|
85
|
+
- Missing pagination on list endpoints returning unbounded results
|
|
86
|
+
- N+1 queries: loading associations inside loops without eager loading
|
|
87
|
+
- Unbounded queries without LIMIT
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Suppressions — DO NOT flag these
|
|
92
|
+
|
|
93
|
+
- Redundancy that aids readability (e.g., `present?` redundant with length check)
|
|
94
|
+
- "Add comment explaining why this threshold was chosen" — thresholds change, comments rot
|
|
95
|
+
- "This assertion could be tighter" when assertion already covers the behavior
|
|
96
|
+
- Consistency-only changes (wrapping a value to match how another constant is guarded)
|
|
97
|
+
- Harmless no-ops (e.g., `.filter()` on array that never contains the filtered value)
|
|
98
|
+
- ANYTHING already addressed in the diff being reviewed — read the FULL diff before commenting
|
|
99
|
+
- Style/formatting issues (use a linter for that)
|
|
100
|
+
- "Consider using X instead of Y" when Y works fine
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Web App Review Checklist (Overlay)
|
|
2
|
+
|
|
3
|
+
Additive to `base.md`. Apply when project has frontend framework (React, Vue, Svelte, Next.js, etc.).
|
|
4
|
+
|
|
5
|
+
## Detection
|
|
6
|
+
|
|
7
|
+
Apply this overlay when any of these are true:
|
|
8
|
+
- `package.json` has `react`, `vue`, `svelte`, `next`, `nuxt`, `angular` dependency
|
|
9
|
+
- Project has `src/pages/`, `src/app/`, `src/components/`, `src/views/` directories
|
|
10
|
+
- HTML/JSX/TSX/Vue files in the diff
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Pass 1 — CRITICAL (additions to base)
|
|
15
|
+
|
|
16
|
+
### XSS
|
|
17
|
+
- `innerHTML` assignment from any non-static source
|
|
18
|
+
- Template literals interpolated into DOM without escaping
|
|
19
|
+
- URL parameters rendered without sanitization
|
|
20
|
+
- `<a href={userInput}>` without protocol validation (javascript: protocol)
|
|
21
|
+
- Server-rendered user content without HTML entity encoding
|
|
22
|
+
|
|
23
|
+
### CSRF
|
|
24
|
+
- State-changing endpoints (POST/PUT/DELETE) without CSRF token verification
|
|
25
|
+
- Cookie-based auth without SameSite attribute
|
|
26
|
+
- Form submissions to external URLs
|
|
27
|
+
|
|
28
|
+
### N+1 Queries (server-rendered views)
|
|
29
|
+
- Database queries inside loops rendering lists
|
|
30
|
+
- Missing eager loading for associations rendered in views/pages
|
|
31
|
+
- Sequential API calls that could be batched
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Pass 2 — INFORMATIONAL (additions to base)
|
|
36
|
+
|
|
37
|
+
### Frontend Performance
|
|
38
|
+
- Inline `<style>` blocks in components re-parsed every render
|
|
39
|
+
- Missing `key` prop on list items
|
|
40
|
+
- Large bundle imports that could be lazy-loaded (e.g., full lodash instead of lodash/get)
|
|
41
|
+
- Images without width/height causing layout shift
|
|
42
|
+
- Missing `loading="lazy"` on below-fold images
|
|
43
|
+
|
|
44
|
+
### Accessibility
|
|
45
|
+
- Interactive elements without keyboard support (onClick without onKeyDown)
|
|
46
|
+
- Missing `alt` text on images
|
|
47
|
+
- Form inputs without associated labels
|
|
48
|
+
- Color-only indicators (no text/icon fallback)
|
|
49
|
+
- Missing ARIA attributes on custom interactive components
|
|
50
|
+
|
|
51
|
+
### Responsive / Layout
|
|
52
|
+
- Fixed pixel widths that break on mobile
|
|
53
|
+
- Missing viewport meta tag
|
|
54
|
+
- Overflow hidden cutting off content on small screens
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-map
|
|
3
|
+
description: Write or update a DDD Context Map in CML (Context Mapper Language).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<what-to-do>
|
|
7
|
+
|
|
8
|
+
Given a Context Map intent, produce or update the single `docs/bounded-contexts/context-map.cml` (one map per system, spanning every BC). The four intent shapes (use these exact labels):
|
|
9
|
+
|
|
10
|
+
- **`BC`** — name, optional `type` / `domainVisionStatement` / `responsibilities`. Adds it to `contains` and appends a `BoundedContext <Name>` declaration.
|
|
11
|
+
- **`peer-context`** — same shape as `BC`, named after an external system. Used for every `external_system` declared on the EventStorming wall.
|
|
12
|
+
- **`relationship`** — upstream BC, downstream BC, shape (Partnership / Shared-Kernel / Upstream-Downstream / Customer-Supplier), role brackets, optional name, optional `{ implementationTechnology, downstreamRights, exposedAggregates }` attributes.
|
|
13
|
+
- **`Aggregate`** — name + owning BC. Adds `Aggregate <Name>` inside the BC's `{ … }` body, creating the body if it was empty. Required when the name appears in any relationship's `exposedAggregates`. Maintain 1:1 sync with the wall JSON: every entry in `aggregates[]` on the BC's `docs/bounded-contexts/{bc}/event-storming.json` (or the general `docs/event-storming.json` before segregation) has a matching `Aggregate <Name>` inside its owning BC, written the same turn.
|
|
14
|
+
|
|
15
|
+
Workflow:
|
|
16
|
+
|
|
17
|
+
1. **Locate or scaffold the file.** If it doesn't exist, scaffold a minimal `ContextMap SystemContextMap { type = SYSTEM_LANDSCAPE state = AS_IS contains <BCs> }` block followed by one `BoundedContext <Name>` declaration per BC in `contains`. Use [example.cml](./example.cml) as a **syntax reference**, not a literal copy — its DDDSample BCs are illustrative.
|
|
18
|
+
2. **Write the requested change.** Per intent shape: add the `contains` entry + `BoundedContext` declaration (`BC` / `peer-context`); add the relationship line (`relationship`); add `Aggregate <Name>` inside the owning BC's body (`Aggregate`). For every BC newly referenced anywhere, append a `BoundedContext <Name>` declaration — without it Xtext linker fails with `Couldn't resolve reference to BoundedContext '<Name>'`.
|
|
19
|
+
3. **Lint.** A PostToolUse hook auto-runs Context Mapper validation on every `.cml` edit. Treat any `ERROR …` line in its output as blocking; `WARNING …` lines (e.g. ACL on Customer-Supplier per Semantic Rule #7) are allowed when intentional.
|
|
20
|
+
4. **Hand-audit.** `cm validate` is necessary but not sufficient — see Limitations below. Audit three things by hand before reporting success: (i) every `exposedAggregates` name lives in the upstream BC of its relationship; (ii) every role bracket combo respects the 10 Semantic Rules; (iii) no Aggregate name is duplicated across BCs unless deliberate.
|
|
21
|
+
5. **Report.** State the line(s) written and PASS/FAIL of `cm validate` (on FAIL, paste only the first `ERROR` line and where to fix). Call out anything the hand-audit flagged.
|
|
22
|
+
|
|
23
|
+
If a piece of the intent is ambiguous (e.g. which side is upstream, which roles to use), ask the caller — don't invent. The skill's job is mechanical correctness, not design judgement.
|
|
24
|
+
|
|
25
|
+
</what-to-do>
|
|
26
|
+
|
|
27
|
+
<supporting-info>
|
|
28
|
+
|
|
29
|
+
## File location
|
|
30
|
+
|
|
31
|
+
`docs/bounded-contexts/context-map.cml` — a single map for the whole system, sitting beside the per-BC folders.
|
|
32
|
+
|
|
33
|
+
## Reference (load lazily by intent shape)
|
|
34
|
+
|
|
35
|
+
The reference is an Obsidian folder with `[[wikilinks]]` between files. Load in tiers — don't front-load everything:
|
|
36
|
+
|
|
37
|
+
- **Always** (first invocation this session):
|
|
38
|
+
- `./reference/Context Map.md` — top-level grammar, relationship arrows, role brackets, attributes.
|
|
39
|
+
- `./reference/Semantic Rules.md` — the 10 combination rules.
|
|
40
|
+
- **When writing a `BC` or `peer-context`** with non-trivial attributes:
|
|
41
|
+
- `./reference/Bounded Context/Bounded Context.md` — attribute docs (`implements`, `refines`, `domainVisionStatement`, `responsibilities`, `type`, `knowledgeLevel`, `businessModel`, `evolution`, `realizes`).
|
|
42
|
+
- **When writing a `relationship`**:
|
|
43
|
+
- `./reference/Bounded Context Relationship/Bounded Context Relationship.md` — per-pattern pages (Partnership, Shared Kernel, Customer-Supplier, OHS, PL, CF, ACL).
|
|
44
|
+
- **When writing an `Aggregate` or setting `exposedAggregates`**:
|
|
45
|
+
- `./reference/Aggregate/Aggregate.md` — Aggregate composition.
|
|
46
|
+
- **When a BC uses `implements` / `refines`**:
|
|
47
|
+
- `./reference/Domain/Domain.md` — Domain / Subdomain framing.
|
|
48
|
+
|
|
49
|
+
## Linting (mandatory before reporting success)
|
|
50
|
+
|
|
51
|
+
Validation runs automatically via the PostToolUse `validate-cml-hook` on every `.cml` edit (Context Mapper CLI, self-bootstrapped from Maven on first run; requires Java 8+).
|
|
52
|
+
|
|
53
|
+
**CML-specific failure modes to recognise:**
|
|
54
|
+
|
|
55
|
+
- `Couldn't resolve reference to BoundedContext '<Name>'` + `The Bounded Context 'null' is not part of the Context Map.` — a name in `contains` or a relationship line has no `BoundedContext <Name>` declaration. Fix: append the missing declaration.
|
|
56
|
+
- `ERROR in null on line N: no viable alternative at input '<token>'` — parse error. Re-read the grammar at the reported line.
|
|
57
|
+
|
|
58
|
+
## Limitations of `cm validate` — hand-audit is required after it passes
|
|
59
|
+
|
|
60
|
+
Confirmed-misses (tested against 6.12.0):
|
|
61
|
+
|
|
62
|
+
| Catches | Misses |
|
|
63
|
+
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| Parse errors with line numbers | Semantic Rule violations from `Semantic Rules.md` (OHS on Customer-Supplier #6, CF on Customer-Supplier #5, ACL/CF/OHS/PL on symmetric relationships #4, etc.) |
|
|
65
|
+
| Linker errors when they fire | Duplicate Aggregate names across different BCs (CML scopes `exposedAggregates` by upstream BC, so duplicates resolve rather than collide — but they're semantically muddled) |
|
|
66
|
+
| Resource-level diagnostics from `cmlResource.getErrors()` | Anything that needs the full Xtext `IResourceValidator` chain (Eclipse/VSCode extension surfaces these; the CLI does not) |
|
|
67
|
+
|
|
68
|
+
After `cm validate` prints "without errors", audit by hand:
|
|
69
|
+
|
|
70
|
+
1. Every `exposedAggregates` name resolves to an Aggregate declared inside the **upstream** BC of that relationship line.
|
|
71
|
+
2. Every role bracket combo is allowed by the 10 Semantic Rules (consult `./reference/Semantic Rules.md`).
|
|
72
|
+
3. No Aggregate name is duplicated across BCs unless deliberate.
|
|
73
|
+
|
|
74
|
+
For deeper validation, open the file in VSCode with the Context Mapper extension installed.
|
|
75
|
+
|
|
76
|
+
## Glossary
|
|
77
|
+
|
|
78
|
+
Same `CONTEXT.md` convention as the EventStorming skills. Challenge BC names against the glossary before writing. If a relationship introduces a novel domain term, add a one-sentence definition in `CONTEXT.md` the same turn.
|
|
79
|
+
|
|
80
|
+
</supporting-info>
|