fprime-cpp-design
यह क्या करती है
यह उन C और C++ डिज़ाइन नियमों की सूची देती है जिनका F Prime फ़्लाइट कोड पालन करता है, जैसे स्टार्टअप के बाद डायनामिक मेमोरी से बचना। यह F Prime कोड लिखने वाले इंजीनियरों के लिए है।
कब इस्तेमाल करें
- ✓जब आप किसी F Prime कंपोनेंट में C++ कोड लिखते या बदलते हैं।
- ✓जब आप जानना चाहते हैं कि कौन-से F Prime टाइप और कोडिंग तरीके इस्तेमाल करने हैं।
- ✓जब आप F Prime कोड की समीक्षा करते हैं और किसी टिप्पणी के पीछे का नियम जानना चाहते हैं।
Skill का लिंक
https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-cpp-design/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप जाँच सकते हैं कि यह F Prime C++ फ़ंक्शन फ़्लाइट सॉफ़्टवेयर के डिज़ाइन नियमों का पालन करता है?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI कोड को क्रमांकित डिज़ाइन नियमों से मिलाता है, बताता है कि कौन-सी समस्या किस नियम को तोड़ती है और नियम के अनुसार सुधार सुझाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Skill: F Prime C/C++ design rules
The single source of truth for the C/C++ design rules F Prime flight software is held to. Used in two directions:
- Developer-side. §1 is positive guidance for writing or modifying F Prime C++ code.
- Reviewer-side. §2 gives the finding-class name to use per
rule; §3 gives severity hints. Combine with
.github/skills/triage-classifier/SKILL.md.
External references in §4 are authoritative for their specific clauses; this skill summarizes the rules the agents enforce. Where this skill and an external reference disagree, this skill wins for review purposes.
1. The rules
Rules are grouped by theme. Numbers are stable and may be cited in PR comments and in other agent files.
A. Memory & lifetime
CPP-1 — No dynamic memory after initialization
Allocate all dynamic storage during component initialization or
boot. After init, no new / delete / malloc / free, and no
implicit allocation through STL containers, std::string, or
exception machinery (see CPP-25).
Allowed: pre-sized arrays sized at compile or init time, Fw::Buffer
references to memory owned elsewhere (CPP-2), object pools allocated
once at boot.
// Avoid (allocation post-init)
char* scratch = new char[len];
// Prefer (sized at declaration)
static constexpr U32 SCRATCH_BYTES = 256;
U8 m_scratch[SCRATCH_BYTES];
CPP-2 — Fw::Buffer ownership transfers must close in every branch
Any function receiving an Fw::Buffer must, in every branch
(success, failure, error, early-return), either transfer ownership
out (pass to another component, store in a tracked slot) or
return it to the sender. A dropped Fw::Buffer leaks; a
double-transferred one is a use-after-free.
CPP-17 — Follow Rule of Three / Rule of Five
If a class manages a resource (raw pointer, file handle, externally-
owned memory), implement (or = delete) all of: destructor, copy
constructor, copy assignment, and — under Rule of Five — move
constructor and move assignment. Most F Prime components are not
intended to be copied; mark the copy ops = delete explicitly.
CPP-19 — Initialize all variables
Every variable — member, local, global — has an explicit
initializer. Uninitialized reads are undefined behavior. Prefer
member-initializer lists for class members; use brace-initialization
(Type x{}; or Type x{value};) for locals.
CPP-20 — Destructors are virtual or protected non-virtual
A class meant to be inherited from declares either a virtual
destructor (polymorphic deletion is safe) or a protected
non-virtual destructor (deletion through the base pointer is
prevented).
B. Asserts and untrusted inputs
CPP-4 — FW_ASSERT is for programming errors only
FW_ASSERT is for programmer-controllable invariants —
guaranteed by construction. It is not input validation. Never
FW_ASSERT on a value reachable from:
- A ground command argument (see
.github/skills/fprime-ground-input-tracing/SKILL.md). - A hardware input — packet, register read, port from a driver (see
.github/skills/fprime-hardware-input-tracing/SKILL.md). - Any off-device data crossing a hub / bridge / driver boundary.
Validate untrusted inputs and return the error through the
component's contract (typically a VALIDATION_ERROR command
response, a sized return, or a soft-failure event). The
security-review agent mirrors this as ground-reachable-assert /
hardware-reachable-assert; CPP-4 is the C++-side framing of the
same finding.
C. F Prime types and idioms
CPP-3 — Always use fixed-size numerical types
For numerical fields (integers, floats), always use a fixed-size type unless an external API forces a non-fixed-size type. Fixed-size types are either:
- The explicit fixed-size types:
U8,I8,U16,I16,U32,I32,U64,I64,F32,F64. - The configurable
Fw*types whose width the project pins to a known fixed-size type at config time (e.g.,FwSizeType,FwIndexType).
Bare C/C++ numerical types (int, unsigned, long, size_t,
float, double) are forbidden in F Prime code except at external
API boundaries that require them.
CPP-28 — Prefer configurable Fw* types when range may vary across projects
When the appropriate width for a value depends on the project (e.g.,
buffer sizes, container indices, time tick counts), use the
configurable Fw* type rather than a bare fixed-size type. The
configurable type lets the f
अक्सर पूछे जाने वाले सवाल
क्या कोड स्टार्टअप के बाद मेमोरी आवंटित करता है?
नियम स्टार्टअप के बाद डायनामिक मेमोरी से बचते हैं, इसलिए स्टोरेज का आकार और आवंटन स्टार्टअप के समय तय होता है।
नियम कैसे व्यवस्थित हैं?
वे क्रमांकित हैं और मेमोरी व जीवनकाल जैसे विषयों के अनुसार समूहित हैं।
क्या यह स्टाइल गाइड की जगह लेती है?
नहीं। यह उन नियमों का सार देती है जिन्हें प्रोजेक्ट लागू करता है, और विशेष धाराओं के लिए बाहरी संदर्भों की ओर इशारा करती है।
जानकारी
लेखक का मूल विवरण
Authoritative C/C++ design rules and idioms for F Prime flight software. Use this skill in two directions — as a *developer-side* reference when writing or modifying F Prime C++ code (what idioms to follow, what features to avoid, which F Prime types to prefer), and as a *reviewer-side* reference for finding-class names and severity hints when flagging C/C++ design violations. Trigger on any work that touches F Prime C/C++ source: component implementations, drivers, services, framework types, OSAL code, or unit-test infrastructure. Keywords: F Prime, C++14, FW_ASSERT, Fw::Buffer, Fw::String, J
repo: nasa/fprime
लोकप्रियता
- GitHub स्टार
- 12k
- रैंकिंग में स्थान
- #11500
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
fprime-cmake-build-system
12kयह आपके एजेंट को F Prime फ़्लाइट सॉफ़्टवेयर प्रोजेक्ट की CMake लेयर के ज़रिए मॉड्यूल, बिल्ड टार्गेट और प्लेटफ़ॉर्म सेटिंग जोड़ने में मदद करती है।
fprime-component-design-fpp
12kयह आपके एजेंट को स्वीकृत F Prime कंपोनेंट की आवश्यकताओं को उसके पोर्ट, कमांड, इवेंट और टेलीमेट्री के FPP मॉडल में बदलने में मदद करती है।
fprime-component-development
12kयह आपके एजेंट को F Prime कंपोनेंट को आवश्यकताओं से लेकर इंटीग्रेशन टेस्टिंग तक हर विकास चरण में आगे बढ़ाने में मदद करती है।
fprime-component-implementation
12kयह आपके एजेंट को F Prime कंपोनेंट के जनरेट हुए हैंडलर फ़ंक्शन के पीछे का C++ कोड प्रोजेक्ट के नियमों के अनुसार लिखने में मदद करती है।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।