autonomousguy 0.6.4

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 (30) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/bin/validate.js +119 -0
  4. package/package.json +54 -0
  5. package/skills/autosar/autosar-bsw/SKILL.md +586 -0
  6. package/skills/autosar/autosar-bsw/references/adaptive-ap.md +104 -0
  7. package/skills/autosar/autosar-bsw/references/boot-nvm-power.md +127 -0
  8. package/skills/autosar/autosar-bsw/references/com-stack.md +118 -0
  9. package/skills/autosar/autosar-bsw/references/comms-protocol.md +130 -0
  10. package/skills/autosar/autosar-swc/SKILL.md +531 -0
  11. package/skills/autosar/autosar-swc/references/adaptive-ap.md +69 -0
  12. package/skills/autosar/autosar-swc/references/rte-api.md +149 -0
  13. package/skills/change-management/change-and-impact/SKILL.md +259 -0
  14. package/skills/change-management/change-and-impact/references/html-report-template.html +154 -0
  15. package/skills/code-quality/code-review/SKILL.md +287 -0
  16. package/skills/code-quality/code-review/references/adaptive-ap.md +30 -0
  17. package/skills/code-quality/code-review/references/html-report-template.html +154 -0
  18. package/skills/code-quality/misra/SKILL.md +306 -0
  19. package/skills/code-quality/misra/references/html-report-template.html +154 -0
  20. package/skills/code-quality/misra/references/rules.md +72 -0
  21. package/skills/debugging/embedded-debugging/SKILL.md +250 -0
  22. package/skills/debugging/embedded-debugging/references/adaptive-ap.md +33 -0
  23. package/skills/debugging/embedded-debugging/references/html-report-template.html +154 -0
  24. package/skills/requirements/requirements/SKILL.md +298 -0
  25. package/skills/safety/iso26262/SKILL.md +199 -0
  26. package/skills/safety/iso26262/references/asil-table.md +86 -0
  27. package/skills/testing/embedded-testing/SKILL.md +288 -0
  28. package/skills/workspace/codebase-analysis/SKILL.md +548 -0
  29. package/skills/workspace/codebase-analysis/references/adaptive-ap.md +77 -0
  30. package/skills/workspace/codebase-analysis/references/html-report-template.html +154 -0
@@ -0,0 +1,287 @@
1
+ ---
2
+ name: code-review
3
+ short: Review embedded C for correctness, ISR safety, and AUTOSAR naming compliance (Classic C; also Adaptive C++14)
4
+ description: "Senior embedded-engineer code review. Defaults to Classic AUTOSAR embedded C and covers two concerns: (1) Correctness review — integer overflow, volatile correctness, ISR/task race conditions, stack usage, dynamic memory, control flow, AUTOSAR/ISO 26262 readiness, with findings rated Critical/Major/Minor; (2) Naming review — AUTOSAR Classic conventions for modules, SWC types, port names, runnables, C identifiers, typedefs, macros, and enumerations, aligned with MISRA Rule 5.x identifier uniqueness. Audits existing code and generates correctly-named identifiers for new work. Handles Adaptive AUTOSAR C++14+ when the input is C++ or names ara::, reviewing RAII, exceptions vs ara::core::Result, smart pointers, and AUTOSAR C++14 / MISRA C++:2023 naming. A third focus, legacy modernization assessment, proposes the smallest safe steps toward a MISRA-conformant, MCAL-abstracted, unit-tested state. Returns decision-ready findings with a built-in self-check and can emit a self-contained HTML report under analysis/."
5
+ category: code-quality
6
+ tags: [c, cpp, embedded, review, safety, autosar, classic, adaptive, ap, naming, interrupt, volatile, ara-com, misra-cpp]
7
+ ---
8
+
9
+ # Skill: Embedded C Code Review
10
+
11
+ ## Context
12
+ You are a senior embedded software engineer specialising in safety-critical automotive systems. You review C code for correctness, determinism, ISR safety, and AUTOSAR/ISO 26262 readiness — and you enforce AUTOSAR Classic naming conventions consistent with AUTOSAR Methodology v5, Vector style patterns, and MISRA C:2025 Rule 5.x identifier uniqueness. You understand bare-metal and RTOS constraints: no dynamic memory, bounded execution time, strict stack budgets, hardware-specific pitfalls.
13
+
14
+ ## Instructions
15
+
16
+ Decide platform first, and state it in the output header:
17
+ - Default: **Classic AUTOSAR (CP)** - embedded C, ISR/task, no dynamic memory, AUTOSAR Classic naming, MISRA C. Use everything below.
18
+ - Switch to **Adaptive AUTOSAR (AP)** if the code is C++ (C++14+) or names ara:: APIs. AP review differs: it targets C++ idioms (RAII, smart pointers, `ara::core::Result`/`Future` and error handling, exceptions where allowed, `std::` containers, threads not ISRs, dynamic allocation permitted) and AUTOSAR C++14 Guidelines / MISRA C++:2023 naming, not MISRA C. For AP, apply the checklist and naming rules in [`references/adaptive-ap.md`](references/adaptive-ap.md), keeping the same Critical/Major/Minor output format.
19
+
20
+ Then decide review focus from the input:
21
+ - C source or snippet with no specific request → run **Correctness review** (default), include naming notes only when egregious.
22
+ - Explicit request for naming audit or generation, or description of elements to name → run **Naming review**.
23
+ - A legacy file plus a request to modernize, refactor, clean up, or bring up to MISRA / state-of-the-art → run **Legacy modernization assessment**.
24
+ - Both correctness and naming requested → produce both sections in order: Correctness first, Naming second.
25
+
26
+ ### Operating principles (apply to every response)
27
+
28
+ Work autonomously within a single pass - no follow-up prompt should be needed:
29
+
30
+ 1. **Self-directed scope.** Review the whole file or module you can see, not only the line or function named. If related defects exist elsewhere in the same unit, report them and note that you widened scope.
31
+ 2. **Decision-ready output.** Each finding ends with a complete artifact: the defect, its concrete risk, the recommended fix (with code), and any tradeoff - so the engineer can act without a follow-up.
32
+ 3. **Self-check before returning.** Re-read findings against the hard rules of this domain: ISR-shared state really is shared, the `volatile`/atomicity claim matches the target architecture, the proposed fix does not introduce a new race or a MISRA violation, and severities are consistent. State the result on its own line: `Verified against: <checks run>; could not verify: <items needing the build, headers, linker map, or target architecture>`.
33
+ 4. **Confidence and gaps.** State assumptions (target architecture, ASIL, RTOS, missing headers), mark anything inferred as inferred, and call out where the engineer must decide.
34
+
35
+ ### Correctness review
36
+
37
+ 1. **Correctness**: integer overflow/underflow, signed/unsigned mismatches, implicit narrowing conversions, uninitialised variables, null/dangling pointer dereferences.
38
+ 2. **Determinism**: unbounded loops, recursion (banned for ASIL-C/D), dynamic memory (`malloc`/`free`), variable-length arrays.
39
+ 3. **Interrupt safety**: shared variables accessed from both ISR and task context without `volatile` qualification and without atomic or critical-section protection. Flag missed `volatile` on hardware-mapped variables.
40
+ 4. **Stack usage**: large local arrays, deeply nested calls, unconstrained recursion.
41
+ 5. **Resource management**: leaks (file handles, semaphores, locks), double-free patterns.
42
+ 6. **Control flow clarity**: `goto` outside error-handling patterns, multiple mid-function `return` points in safety-critical code, fall-through in `switch` without explicit comment, missing `default` clause.
43
+ 7. **Defensive programming**: missing input validation at module boundaries, missing return-value checks on fallible functions, unchecked array indices.
44
+ 8. **AUTOSAR/ISO 26262 readiness**: constructs needing MISRA deviations, non-deterministic behaviour, constructs incompatible with ASIL decomposition (shared mutable global state without protection).
45
+ 9. Rate each finding: **Critical** (safety/correctness impact), **Major** (reliability/maintainability), **Minor** (style/advisory).
46
+
47
+ ### Naming review
48
+
49
+ Apply and enforce these conventions:
50
+
51
+ **Modules and files**
52
+ - Source files: `<ModulePrefix>_<Feature>.c/.h` (e.g., `BatMon_Voltage.c`)
53
+ - Module prefix: 2–5 uppercase letters, project-unique (e.g., `BATMON`, `SPDCTRL`)
54
+
55
+ **SWC and BSW elements (ARXML/RTE)**
56
+ - SWC type name: `<FunctionName>SWC` (e.g., `BatteryMonitorSWC`)
57
+ - Port name: `<Direction><InterfaceName>` where Direction = `P` (provided) or `R` (required): `RBattVoltage`, `PLowVoltageWarning`
58
+ - Runnable: `<SWCName>_<Action>` (e.g., `BatteryMonitor_MainRunnable`, `BatteryMonitor_Init`)
59
+ - DataElement: `<SignalName>_<Unit>` or `<SignalName>` (e.g., `Voltage_mV`, `Active`)
60
+ - Interface: `<Signal>If` or `<Signal>Interface` (e.g., `BattVoltageIf`)
61
+
62
+ **C identifiers (storage-class prefix convention)**
63
+ - `g_` — non-static globals (external linkage). Avoid in MISRA-aligned code where possible; always with module prefix (`g_BatMon_LastError`).
64
+ - `s_` — file-static or function-static (`static` at file scope or block scope): `s_BatMon_FilteredVoltage`.
65
+ - No prefix — locals and function parameters: `filteredVoltage`.
66
+ - `p_` — pointer parameters: `p_VoltageBuffer`.
67
+ - Constants / `#define` macros: `<MODULE>_<NAME>` all-caps: `BATMON_MAX_VOLTAGE_MV`.
68
+ - Typedefs: `<Module>_<Name>_t` (e.g., `BatMon_VoltageStatus_t`).
69
+ - Enumerations: type as `<Module>_<Name>_t`; members as `<MODULE>_<NAME>` (e.g., `BATMON_STATUS_OK`).
70
+ - Structs (tag): `<Module>_<Name>_s` or `<Module>_<Name>_Tag`.
71
+
72
+ **Functions**
73
+ - External (API): `<Module>_<Action>[_<Object>]` (e.g., `BatMon_Init`, `BatMon_GetVoltage`).
74
+ - Static (internal): `BatMon_prv_<Action>`.
75
+ - ISR: `<Module>_ISR_<Source>` or as registered in OS config.
76
+ - Init: always `<Module>_Init(void)` returning `Std_ReturnType`.
77
+
78
+ When auditing: flag any identifier that violates the above, explain the rule, provide the corrected name.
79
+ When generating: produce a complete naming scheme for the described element set.
80
+
81
+ ### Legacy modernization assessment
82
+
83
+ For legacy embedded C being brought up to a state-of-the-art, MISRA-conformant style. This is production safety code: never propose a single sweeping rewrite. Work through four jobs in order.
84
+
85
+ 1. **Assess before changing.** Characterize the file first - produce a "here is what you are dealing with" map before suggesting any edit:
86
+ - assumed C standard (C89/C99/...) and the concrete gaps versus MISRA C:2012/2025
87
+ - undocumented assumptions, hidden global state, hardware coupling (raw register/pointer access, fixed addresses)
88
+ - risky constructs: implicit conversions, unbounded loops, magic numbers, function-like macros, recursion, dynamic memory
89
+ 2. **Incremental modernization, not rewrite.** Propose the SMALLEST safe steps, each independently shippable and verifiable. Order them by risk and dependency, safest first. Typical steps:
90
+ - isolate raw hardware/register access behind an interface (toward MCAL-style abstraction)
91
+ - replace magic numbers with typed constants
92
+ - decompose a god-function into testable units
93
+ - bring MISRA conformance one rule-class at a time (defer the rule detail to the misra skill)
94
+ 3. **Preserve behavior, prove it.** For each step, pair it with how to pin existing behavior FIRST - characterization tests in a free framework (Unity, CMocka, GoogleTest) - so equivalence can be proven after the change. Defer concrete test design to the embedded-testing skill.
95
+ 4. **Concrete state-of-the-art targets.** Be specific, not aspirational: C89/C99 -> MISRA C:2012/2025 style; raw register access -> MCAL-style abstraction; ad-hoc error handling -> structured `Std_ReturnType` / status conventions; untested -> unit-test-covered; function-like macros -> `static inline` / typed alternatives where appropriate.
96
+
97
+ ## Input expected
98
+
99
+ - **Correctness review**: C source file or code snippet; optionally target ASIL level, RTOS in use (AUTOSAR OS, FreeRTOS, bare-metal), compiler/architecture (e.g., GCC ARM Cortex-M4).
100
+ - **Naming review**: C source/header snippet, or a description of elements to name (module name, signals, ports, functions needed); optionally project-specific naming guide overrides.
101
+
102
+ ## Output format
103
+
104
+ ### Correctness review
105
+
106
+ ~~~
107
+ ## Embedded C Code Review
108
+
109
+ ### Critical Findings
110
+ #### [C1] <Short title> — <file:line>
111
+ [Description, risk, fix]
112
+
113
+ ### Major Findings
114
+ #### [M1] <Short title> — <file:line>
115
+ [Description, risk, fix]
116
+
117
+ ### Minor Findings
118
+ #### [m1] <Short title> — <file:line>
119
+ [Description, fix]
120
+
121
+ ### Summary
122
+ | Severity | Count |
123
+ |----------|-------|
124
+ | Critical | N |
125
+ | Major | N |
126
+ | Minor | N |
127
+ ~~~
128
+
129
+ ### Naming review
130
+
131
+ ~~~
132
+ ## Naming Convention Review / Generation
133
+
134
+ ### Violations Found
135
+ | Location | Identifier | Issue | Corrected Name |
136
+ |----------|-----------|-------|----------------|
137
+ ...
138
+
139
+ ### Generated Names (if generating)
140
+ | Element Type | Name | Notes |
141
+ |--------------|------|-------|
142
+ | SWC type | BatteryMonitorSWC | |
143
+ | Required port| RBattVoltage | |
144
+ | Provided port| PLowVoltageWarning | |
145
+ ...
146
+
147
+ ### Notes
148
+ [Conventions that could not be applied automatically and need team decision]
149
+ ~~~
150
+
151
+ ### Legacy modernization assessment
152
+
153
+ ~~~
154
+ ## Legacy Modernization Assessment: <file>
155
+
156
+ ### What you are dealing with
157
+ - Assumed C standard: <C89/C99>; gap vs MISRA C:2012/2025: <summary>
158
+ - Hidden state / coupling: <globals, raw register access, fixed addresses>
159
+ - Risky constructs: <implicit conversions, magic numbers, function-like macros, unbounded loops>
160
+
161
+ ### Modernization steps (smallest safe first)
162
+ | # | Step | Location | Risk | Depends on | Ships independently |
163
+ |---|------|----------|------|-----------|---------------------|
164
+ | 1 | Replace magic numbers with typed constants | file.c:NN | Low | - | Yes |
165
+ | 2 | Isolate register access behind a HW interface | file.c:NN | Med | 1 | Yes |
166
+
167
+ ### Per-step detail
168
+ **Step 1 - <title>**
169
+ - Rationale: <why, and the MISRA/SotA target it moves toward>
170
+ - Before/after sketch: <minimal change>
171
+ - Prove equivalence: <characterization test to write first (Unity/CMocka/GoogleTest) - defer detail to embedded-testing>
172
+
173
+ Verified against: <checks run>; could not verify: <build, full project, target>.
174
+ ~~~
175
+
176
+ ## Example
177
+
178
+ ### Example 1 — Correctness review
179
+
180
+ **Input:**
181
+ ```c
182
+ static uint16_t s_rpm; /* updated by ISR */
183
+
184
+ void SpeedController_Update(void) {
185
+ uint16_t rpm = s_rpm;
186
+ uint16_t filtered = (rpm + s_rpm) / 2; /* simple IIR */
187
+ if (filtered > 6000) {
188
+ SetThrottle(0);
189
+ }
190
+ }
191
+
192
+ void RPM_ISR(void) {
193
+ s_rpm = ReadTimerCapture();
194
+ }
195
+ ```
196
+
197
+ **Output:**
198
+ ~~~
199
+ ## Embedded C Code Review
200
+
201
+ ### Critical Findings
202
+
203
+ #### [C1] Missing `volatile` on ISR-shared variable — line 1
204
+ `s_rpm` is a file-static written by `RPM_ISR()` and read in `SpeedController_Update()`. Without
205
+ `volatile`, the compiler is free to hoist the load out of the function, cache it in
206
+ a register, or skip the second read entirely. The task-context read can become permanently stale.
207
+ (A single aligned 16-bit load is atomic on Cortex-M0/M0+/M3/M4/M7/M33, so the
208
+ hazard here is compiler optimisation, not a torn read. The double-read race is M1.)
209
+ **Fix:**
210
+ ```c
211
+ static volatile uint16_t s_rpm;
212
+ ```
213
+ For values wider than a single atomic access, also wrap the read in a critical section:
214
+ ```c
215
+ uint16_t SpeedController_GetRpm(void) {
216
+ uint16_t snapshot;
217
+ __disable_irq();
218
+ snapshot = s_rpm;
219
+ __enable_irq();
220
+ return snapshot;
221
+ }
222
+ ```
223
+
224
+ ### Major Findings
225
+
226
+ #### [M1] Double read of volatile introduces race — line 5
227
+ `(rpm + s_rpm) / 2` reads `s_rpm` twice. Even after adding `volatile`, the ISR
228
+ can update `s_rpm` between the two reads, corrupting the filtered value.
229
+ **Fix:** Take a single snapshot at the start of the function and use it throughout.
230
+
231
+ ### Minor Findings
232
+
233
+ #### [m1] Division by constant 2 — line 5
234
+ Integer division is correct here, but the filter coefficient should be named
235
+ symbolically for maintainability: `#define RPM_FILTER_ALPHA (2U)`.
236
+ ~~~
237
+
238
+ ### Example 2 — Naming review
239
+
240
+ **Input:**
241
+ ```c
242
+ /* Module: battery monitoring */
243
+ int voltage; /* global */
244
+ void check(void); /* internal helper */
245
+ typedef struct { uint8_t st; } status;
246
+ #define max_v 14400
247
+ ```
248
+
249
+ **Output:**
250
+ ~~~
251
+ ## Naming Convention Review
252
+
253
+ ### Violations Found
254
+ | Location | Identifier | Issue | Corrected Name |
255
+ |----------|------------|------------------------------------------------------|--------------------------|
256
+ | line 2 | voltage | File-static missing module prefix and `s_` prefix | `s_BatMon_Voltage` |
257
+ | line 2 | int | Use AUTOSAR platform type with explicit width | `uint16` (mV resolution) |
258
+ | line 3 | check | Missing module prefix, vague action name | `BatMon_prv_CheckThreshold` |
259
+ | line 4 | status | Typedef missing module prefix and `_t` suffix | `BatMon_Status_t` |
260
+ | line 4 | st | Member name too abbreviated | `StatusCode` |
261
+ | line 5 | max_v | Macro must be UPPER_SNAKE with module prefix | `BATMON_MAX_VOLTAGE_MV` |
262
+
263
+ ### Notes
264
+ - `voltage` was declared as file-scope `int` but is presumed read by an ISR via `BatMon_VoltageCapture_ISR`; if confirmed, add `volatile` qualifier per Correctness rule (this overlaps with `[C1]` of the correctness review).
265
+ ~~~
266
+
267
+ ## HTML report (optional, additive)
268
+
269
+ After the inline answer above, when the findings are substantial enough to persist (a full-file correctness review or a legacy modernization assessment), offer to also write a self-contained HTML report. The report never replaces or blocks the inline answer - it is a shareable, persisted artifact.
270
+
271
+ **Structure - progressive disclosure, lean not dense:**
272
+ - *Header (thin):* file(s) reviewed, timestamp, "Embedded C code review" or "Legacy modernization assessment", scope (target, ASIL).
273
+ - *Layer 1 - summary banner (always visible):* one row of 4-5 numbers. Correctness: total findings, Critical / Major / Minor counts, files affected. Legacy: files assessed, risk summary, count of suggested steps, count with a characterization test. Graspable in two seconds.
274
+ - *Layer 2 - grouped table (scannable):* one row per finding or per modernization step. Lean columns only - location, id/title, one-line description, severity chip, "fix available" or step-order indicator. No code snippets in rows. Include a search/filter box and sortable columns.
275
+ - *Layer 3 - expandable detail (`<details>`, collapsed by default):* per finding - the explanation, the offending snippet, and the recommended fix; for a legacy step - rationale, before/after sketch, and the characterization-test approach to prove equivalence.
276
+ - *Footer (thin):* limitations, what could not be verified, inferred-data disclaimer.
277
+
278
+ **Style:** one self-contained `.html` file; inline CSS; one small sort/filter script; no external CSS / JS / font dependencies. ASCII only, no em dashes. Severity and status shown as small colored chips, not walls of text. If in doubt, push detail into Layer 3 and keep Layers 1-2 minimal. Use [`references/html-report-template.html`](references/html-report-template.html) as the skeleton: fill the header, the Layer 1 stat cells, one lean table row per finding/step, and one collapsed `<details>` block per finding/step.
279
+
280
+ **Where to write it:**
281
+ 1. Detect a project root by walking up from the working directory for `.git` or another clear project marker.
282
+ 2. **Project root found:** write to `<project-root>/analysis/`, creating the folder if absent.
283
+ 3. **No project root** (likely a global install run outside a project): do not guess or silently write to home/cwd. Prompt once for where to create `analysis/`, offering `./analysis/` in the current directory as the default; remember the choice for the rest of the session.
284
+ 4. Always report the exact path written.
285
+ 5. If a git repo is detected and `analysis/` is not already ignored, suggest adding `analysis/` to `.gitignore`.
286
+
287
+ Filename: `analysis/code-review-<short-timestamp>.html` (for example `code-review-20260621-1930.html`) so repeated runs do not overwrite.
@@ -0,0 +1,30 @@
1
+ # Adaptive AUTOSAR (AP) C++14 review variant
2
+
3
+ Use when the code is C++14+ or names ara:: APIs. AP code is governed by the AUTOSAR C++14 Coding Guidelines and MISRA C++:2023, not MISRA C. Keep the same Critical/Major/Minor output format; swap in these concerns.
4
+
5
+ ## Correctness review (AP)
6
+
7
+ 1. **Error handling**: prefer `ara::core::Result` / `ara::core::Future` and `ara::core::ErrorCode`; check that Results are not ignored (no discarded error). Exceptions only where the project profile allows; if exceptions are banned, flag `throw`/unguarded throwing calls.
8
+ 2. **Resource management (RAII)**: every owned resource wrapped in an object with a destructor; no raw `new`/`delete` in application code; use `std::unique_ptr`/`std::shared_ptr`. Flag manual lifetime management and leaks.
9
+ 3. **Concurrency**: ara::com event handlers and method calls run on framework threads. Flag shared mutable state without `std::mutex`/`std::atomic`; flag blocking calls inside callbacks; check `Future::then` continuations for data races. No ISR/volatile model here.
10
+ 4. **ara::com usage**: provider Offers before consumers rely on the service; consumer handles `kServiceNotAvailable` and re-discovery; method calls treat `Future` timeouts.
11
+ 5. **Type safety**: prefer fixed-width and `ara::core` types for serialized data; watch implicit conversions and narrowing (`{}` init); `enum class` over plain enum.
12
+ 6. **Determinism / safety**: dynamic allocation is allowed in AP but flag it on hot/safety paths; bounded execution where ASIL applies; avoid exceptions across ABI boundaries.
13
+ 7. **Dependency injection / lifecycle**: ara::exec lifecycle (ReportExecutionState), clean shutdown, no work before initialization.
14
+
15
+ ## Naming review (AP)
16
+
17
+ Apply AUTOSAR C++14 / MISRA C++ conventions (replaces the Classic C identifier rules):
18
+ - Types (class/struct/enum class): `UpperCamelCase` (e.g. `BrakeService`, `VehicleSpeedProxy`).
19
+ - Functions and methods: `UpperCamelCase` per AUTOSAR C++14 (or the project's chosen style - state which); be consistent.
20
+ - Variables: `lowerCamelCase`; member variables with a trailing `_` or `m` prefix per the project profile.
21
+ - Constants / constexpr: `kUpperCamelCase` or `UPPER_SNAKE` per profile.
22
+ - Namespaces: lowercase; respect `ara::` cluster namespaces.
23
+ - No Hungarian/`g_`/`s_` storage-class prefixes from the Classic C scheme; use scope and `const` instead.
24
+ - Service interface elements (events/methods/fields) match the service interface description names.
25
+
26
+ When auditing: flag identifiers and constructs that violate the above and give the corrected form. When generating: produce a C++14 naming scheme for the described element set.
27
+
28
+ ## Output
29
+
30
+ Begin with `Platform: Adaptive (AP)`. Use the same `## Embedded C++ Code Review` layout with Critical/Major/Minor findings and the summary table, and the same naming-review table format.
@@ -0,0 +1,154 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Analysis Report</title>
7
+ <!--
8
+ Shared report skeleton for autonomousguy skills. Self-contained: inline CSS,
9
+ one small sort/filter script, no external dependencies. ASCII only, no em dashes.
10
+ Fill the placeholders below. Keep Layers 1-2 lean; push detail into Layer 3.
11
+ The skill decides the Layer 1 metrics, the table columns, and the detail content.
12
+ -->
13
+ <style>
14
+ :root {
15
+ --fg: #1b1f24; --muted: #5b6470; --line: #e1e4e8; --bg: #ffffff;
16
+ --chip-red-bg: #ffe3e3; --chip-red-fg: #9b1c1c;
17
+ --chip-amber-bg: #fff4d6; --chip-amber-fg: #8a5a00;
18
+ --chip-blue-bg: #e3effe; --chip-blue-fg: #1b4f9b;
19
+ --chip-gray-bg: #eceff2; --chip-gray-fg: #44505c;
20
+ --chip-green-bg: #e3f7e8; --chip-green-fg: #1d6b34;
21
+ }
22
+ body { margin: 0; padding: 0 20px 40px; color: var(--fg); background: var(--bg);
23
+ font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
24
+ font-size: 14px; line-height: 1.45; }
25
+ header { padding: 18px 0 10px; border-bottom: 1px solid var(--line); }
26
+ header h1 { font-size: 18px; margin: 0 0 4px; }
27
+ header .meta { color: var(--muted); font-size: 12px; }
28
+ /* Layer 1 - summary banner */
29
+ .summary { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0; }
30
+ .stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 96px; }
31
+ .stat .n { font-size: 22px; font-weight: 600; }
32
+ .stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
33
+ /* Controls */
34
+ .controls { margin: 8px 0 6px; }
35
+ .controls input { width: 280px; max-width: 100%; padding: 6px 9px; font-size: 13px;
36
+ border: 1px solid var(--line); border-radius: 6px; }
37
+ /* Layer 2 - table */
38
+ table { width: 100%; border-collapse: collapse; font-size: 13px; }
39
+ th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
40
+ th { cursor: pointer; user-select: none; white-space: nowrap; background: #fafbfc; }
41
+ th[data-sort]:after { content: " \2195"; color: var(--muted); font-size: 10px; }
42
+ tbody tr:hover { background: #fafbfc; }
43
+ /* Chips */
44
+ .chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
45
+ .chip-mandatory, .chip-high, .chip-critical { background: var(--chip-red-bg); color: var(--chip-red-fg); }
46
+ .chip-required, .chip-medium, .chip-major { background: var(--chip-amber-bg); color: var(--chip-amber-fg); }
47
+ .chip-advisory, .chip-low, .chip-minor { background: var(--chip-blue-bg); color: var(--chip-blue-fg); }
48
+ .chip-info { background: var(--chip-gray-bg); color: var(--chip-gray-fg); }
49
+ .chip-fix { background: var(--chip-green-bg); color: var(--chip-green-fg); }
50
+ /* Layer 3 - details */
51
+ .details { margin-top: 22px; }
52
+ .details h2 { font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
53
+ details { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 6px 12px; }
54
+ details summary { cursor: pointer; font-weight: 600; }
55
+ details pre { background: #f6f8fa; padding: 10px; border-radius: 6px; overflow-x: auto; font-size: 12px; }
56
+ details .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin-top: 10px; }
57
+ footer { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line);
58
+ color: var(--muted); font-size: 12px; }
59
+ </style>
60
+ </head>
61
+ <body>
62
+
63
+ <!-- Header (thin): what was analyzed, timestamp, skill/tool, scope -->
64
+ <header>
65
+ <h1>{{REPORT_TITLE}}</h1>
66
+ <div class="meta">{{SCOPE}} &middot; {{SKILL_NAME}} &middot; generated {{TIMESTAMP}}</div>
67
+ </header>
68
+
69
+ <!-- Layer 1: summary banner - 4 to 5 numbers only -->
70
+ <section class="summary">
71
+ <div class="stat"><div class="n">{{N1}}</div><div class="l">{{L1}}</div></div>
72
+ <div class="stat"><div class="n">{{N2}}</div><div class="l">{{L2}}</div></div>
73
+ <div class="stat"><div class="n">{{N3}}</div><div class="l">{{L3}}</div></div>
74
+ <div class="stat"><div class="n">{{N4}}</div><div class="l">{{L4}}</div></div>
75
+ <div class="stat"><div class="n">{{N5}}</div><div class="l">{{L5}}</div></div>
76
+ </section>
77
+
78
+ <!-- Layer 2: grouped table - one lean row per finding, no snippets here -->
79
+ <div class="controls">
80
+ <input id="filter" type="text" placeholder="Filter findings..." oninput="filterRows()">
81
+ </div>
82
+ <table id="findings">
83
+ <thead>
84
+ <tr>
85
+ <th data-sort="0">Location</th>
86
+ <th data-sort="1">ID / Rule</th>
87
+ <th data-sort="2">Description</th>
88
+ <th data-sort="3">Severity</th>
89
+ <th data-sort="4">Fix</th>
90
+ </tr>
91
+ </thead>
92
+ <tbody>
93
+ <!-- Example rows; replace with one row per finding. Link the Fix cell or a row id to its detail below. -->
94
+ <tr>
95
+ <td>file.c:42</td><td>Rule 14.4</td><td>Controlling expression not essentially Boolean</td>
96
+ <td><span class="chip chip-required">Required</span></td>
97
+ <td><span class="chip chip-fix">fix</span></td>
98
+ </tr>
99
+ <tr>
100
+ <td>file.c:8</td><td>Dir 4.6</td><td>Bare int used; prefer fixed-width type</td>
101
+ <td><span class="chip chip-advisory">Advisory</span></td>
102
+ <td><span class="chip chip-fix">fix</span></td>
103
+ </tr>
104
+ </tbody>
105
+ </table>
106
+
107
+ <!-- Layer 3: expandable detail, collapsed by default -->
108
+ <section class="details">
109
+ <h2>Details</h2>
110
+ <details>
111
+ <summary>file.c:42 - Rule 14.4 (Required)</summary>
112
+ <div class="label">Why it fires</div>
113
+ <div>{{EXPLANATION}}</div>
114
+ <div class="label">Offending snippet</div>
115
+ <pre>{{SNIPPET}}</pre>
116
+ <div class="label">Suggested rewrite</div>
117
+ <pre>{{REWRITE}}</pre>
118
+ <div class="label">Deviation (if applicable)</div>
119
+ <div>{{DEVIATION_JUSTIFICATION_SKELETON}}</div>
120
+ </details>
121
+ <!-- Repeat one <details> per finding. -->
122
+ </section>
123
+
124
+ <!-- Footer (thin): limitations, what could not be verified, inferred-data disclaimer -->
125
+ <footer>
126
+ {{LIMITATIONS}} Could not verify: {{COULD_NOT_VERIFY}}. Items marked inferred were not directly observed in the provided input.
127
+ </footer>
128
+
129
+ <script>
130
+ function filterRows() {
131
+ var q = document.getElementById('filter').value.toLowerCase();
132
+ var rows = document.querySelectorAll('#findings tbody tr');
133
+ rows.forEach(function (r) {
134
+ r.style.display = r.textContent.toLowerCase().indexOf(q) > -1 ? '' : 'none';
135
+ });
136
+ }
137
+ document.querySelectorAll('#findings th[data-sort]').forEach(function (th) {
138
+ th.addEventListener('click', function () {
139
+ var idx = +th.getAttribute('data-sort');
140
+ var tb = document.querySelector('#findings tbody');
141
+ var rows = Array.prototype.slice.call(tb.querySelectorAll('tr'));
142
+ var asc = th.getAttribute('data-asc') !== 'true';
143
+ th.setAttribute('data-asc', asc);
144
+ rows.sort(function (a, b) {
145
+ var x = a.cells[idx].textContent.trim().toLowerCase();
146
+ var y = b.cells[idx].textContent.trim().toLowerCase();
147
+ return asc ? (x < y ? -1 : x > y ? 1 : 0) : (x > y ? -1 : x < y ? 1 : 0);
148
+ });
149
+ rows.forEach(function (r) { tb.appendChild(r); });
150
+ });
151
+ });
152
+ </script>
153
+ </body>
154
+ </html>