원클릭으로
en50128-implementation
C programming patterns with MISRA C:2012 compliance for EN 50128 railway safety software
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
C programming patterns with MISRA C:2012 compliance for EN 50128 railway safety software
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Project management and coordination for EN 50128 railway software development
Project management and coordination for EN 50128 railway software development
Software quality assurance techniques and auditing for EN 50128 railway software
Software testing methodologies with coverage analysis for EN 50128 C programs using Unity test framework
Software verification with static analysis and coverage for EN 50128 railway software per Section 6.2
V&V Manager coordination and independent V&V authority for SIL 3-4 EN 50128 projects
| name | en50128-implementation |
| description | C programming patterns with MISRA C:2012 compliance for EN 50128 railway safety software |
| license | Proprietary |
| compatibility | opencode |
| metadata | {"standard":"EN 50128:2011","domain":"railway-software","language":"C","coding-standard":"MISRA C:2012"} |
This skill provides the IMP agent with authoritative reference data, the source code generation algorithm, MISRA C technique table, and defect remediation logic for software implementation per EN 50128 §7.5 and Table A.4. Load this skill before performing any IMP activity.
| What you need | Where to find it |
|---|---|
| Phase 5 activities, deliverable paths, completion criteria | activities/phase-5-implementation-testing.yaml |
| Item 18 ownership, doc ID, SIL obligations | activities/deliverables.yaml |
| Annex C Table C.1 — full deliverable ownership catalogue | DELIVERABLES.md |
| Traceability rules T1–T15 (human-readable) | TRACEABILITY.md |
| Traceability obligations T1–T15 (machine-readable, agent consumption) | activities/traceability.yaml |
| Authority structure, two-track loop, CCB re-entry | WORKFLOW.md |
| Independence matrix (IMP = No at all SIL levels) | ORGANIZATION.md |
| §7.5 implementation requirements, Table A.4 techniques | std/EN50128-2011.md |
| C header template (.h stub) | [PROJECT_ROOT] deliverables/implementation/C-Header-Template.h |
| C module template (.c stub) | [PROJECT_ROOT] deliverables/implementation/C-Module-Template.c |
| MISRA C:2012 patterns (all 178 rules + 16 directives) | resources/misra-c-coding-patterns.md |
| Unit testing patterns (Unity framework, mocking, coverage) | resources/unit-testing-patterns.md |
| Code review checklist (124 items, 11 categories) | resources/code-review-checklist.md |
| Common implementation pitfalls (40+ with fixes) | resources/common-pitfalls.md |
| Component Design Spec (IMP input, item 15) | CM query-location --doc component-design-spec |
| Canonical source code path at runtime | CM query-location |
IMP is the primary agent for Phase 5 (source code only).
| Annex C Item | Document | Owner | Phase |
|---|---|---|---|
| 18 | Software Source Code and supporting documentation | IMP | 5 |
| 19 | Software Source Code Verification Report | VER | 5 |
| 20 | Software Component Test Report | TST | 5 |
ORGANIZATION.md).Follow these steps in order. Do not skip steps.
Invoke CM query-location via task tool with --doc source-code. Record the
canonical src/ path. Never write to a hard-coded path.
Read .workspace to confirm active project name, SIL level, and base path.
Verify Phase 5 prerequisites: locate the Software Component Design Specification (item 15). If missing, halt and report to PM.
Load templates [PROJECT_ROOT] deliverables/implementation/C-Header-Template.h and [PROJECT_ROOT] deliverables/implementation/C-Module-Template.c
as stubs. For each component in the SCDS:
<component>.h — public interface only (types, function declarations).<component>.c — implementation with file-header traceability block.File header traceability block (mandatory SIL 3–4, HR SIL 2, R SIL 0–1):
/* Module: <component name>
* Implements: REQ-FUN-NNN [, REQ-SAFE-NNN, ...]
* Design ref: SCDS §<section> (item 15)
* SIL: <level>
*/
Apply MISRA C:2012 (mandatory SIL 2+):
uint8_t, uint16_t, uint32_t, int8_t, etc.malloc, calloc, realloc, free.#define or enum).Enforce complexity limits: SIL 0–1: ≤20; SIL 2: ≤15; SIL 3–4: ≤10 cyclomatic complexity per function. Refactor functions that would exceed the limit.
Apply defensive programming (HR all SIL levels):
Run lizard on the completed source tree to confirm complexity within limits.
Fix any violations before reporting to PM.
Return the list of created source files and a traceability summary (files created, requirements covered, any gaps) to PM.
| # | Technique/Measure | Ref | SIL 0 | SIL 1–2 | SIL 3–4 |
|---|---|---|---|---|---|
| 1 | Formal Methods | D.28 | – | R | HR |
| 2 | Modelling | A.17 | R | HR | HR |
| 3 | Structured Methodology | D.52 | R | HR | HR |
| 4 | Modular Approach | D.38 | HR | M | M |
| 5 | Components | A.20 | HR | HR | HR |
| 6 | Design and Coding Standards | A.12 | HR | HR | M |
| 7 | Analysable Programs | D.2 | HR | HR | HR |
| 8 | Strongly Typed Programming Language | D.49 | R | HR | HR |
| 9 | Structured Programming | D.53 | R | HR | HR |
| 10 | Programming Language | A.15 | R | HR | HR |
| 11 | Language Subset | D.35 | – | – | HR |
| 12 | Object Oriented Programming | A.22 | R | R | R |
| 13 | Procedural Programming | D.60 | R | HR | HR |
| 14 | Metaprogramming | D.59 | R | R | R |
Mandatory: Entry 4 (Modular Approach) SIL 2+; Entry 6 (Design and Coding Standards) SIL 3–4. MISRA C:2012 is the EN 50128 platform's coding standard for entry 6.
Coverage (Table A.21): No percentage thresholds in EN 50128:2011. Table A.21 Req.1 requires a quantified measure defined per project (in the SVP/SQAP). Technique recommendations: SIL 1: Statement R, Branch HR; SIL 2: Statement HR, Branch HR; SIL 3–4: Branch HR, Compound Condition HR.
When PM routes QUA/VER findings to IMP, apply this table:
| Finding Code | Description | Action | Confidence |
|---|---|---|---|
M001 | Dynamic memory allocation (malloc/free) | Replace with static array + index counter | HIGH — auto-fix |
M002 | Variable-length array | Replace with fixed-size #define array | HIGH — auto-fix |
M003 | Non-fixed-width type (int, long, etc.) | Replace with uint32_t / int32_t etc. | HIGH — auto-fix |
M004 | Unchecked return value | Add err = f(); if (err != SUCCESS) { ... } | HIGH — auto-fix |
M005 | NULL pointer not validated | Add NULL guard at function entry | HIGH — auto-fix |
M006 | Magic number literal | Extract to named #define or enum | HIGH — auto-fix |
M007 | Recursion (SIL 2+) | Refactor to iterative equivalent | MEDIUM — flag for review |
C001 | Cyclomatic complexity > limit | Decompose function into sub-functions | MEDIUM — flag for review |
C002 | Traceability comment missing (SIL 3–4) | Escalate to PM — requires SCDS lookup | LOW — escalate |
C003 | Algorithmic correctness defect | Escalate to PM — requires DES review | LOW — escalate |
Escalation rule: LOW-confidence findings MUST be escalated to PM with a written description of the gap. IMP MUST NOT invent traceability links or change algorithms without DES approval.
Component Design Spec (item 15, DES) + SRS (item 6, REQ)
└─► IMP reads: SCDS (item 15), SRS requirement IDs
│
└─► IMP writes: Source Code (item 18)
│
├─► TST reads: source code → executes Component Test Spec (item 16)
│ → writes Component Test Report (item 20) [TST owns]
└─► VER reads: source code → writes Source Code VER Report (item 19) [VER owns]
IMP provides to: TST (source code for unit test execution), VER (source code for static analysis and verification), INT (compiled modules for integration).
IMP receives from: DES (SCDS item 15), REQ (SRS requirement IDs for traceability), PM (task assignment, defect routing).
IMP does NOT contact: QUA or VER directly. All submissions go through PM.