fprime-component-implementation
Skill này làm gì
Skill hướng dẫn AI điền nội dung cho các hàm xử lý được sinh ra từ mô hình FPP đã duyệt. Dành cho kỹ sư viết C++ cho thành phần F Prime.
Khi nào nên dùng
- ✓Khi mô hình FPP của một thành phần F Prime đã được duyệt và cần viết mã C++.
- ✓Khi bạn cần điền nội dung cho các hàm xử lý lệnh hoặc port của một thành phần.
- ✓Khi bạn muốn mã C++ tuân theo phong cách và quy tắc thiết kế của F Prime.
Liên kết skill
https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-implementation/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Mô hình FPP đã được duyệt. Bạn có thể viết các hàm xử lý C++ cho thành phần F Prime này không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI triển khai các hàm xử lý được sinh tự động trong chính lớp của thành phần, theo hướng dẫn phong cách và quy tắc thiết kế của F Prime.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Skill: F Prime Component Implementation (C++)
Implementation fills in the handler stubs generated from the FPP model. The autocoder produces base classes with pure-virtual handlers; you implement the derived class.
For the full reference on autocoded functions (port handlers, command handlers, telemetry, events, parameters, initialization), see Autocoded Functions and Component Classes.
Use F Prime design patterns where possible — standard solutions exist for common needs:
- Rate Group Pattern —
docs/user-manual/design-patterns/rate-group.md - Health Checking —
docs/user-manual/design-patterns/health-checking.md - Manager-Worker —
docs/user-manual/design-patterns/manager-worker.md - Application-Manager-Driver —
docs/user-manual/design-patterns/app-man-drv.md - Common Port Patterns —
docs/user-manual/design-patterns/common-port-patterns.md
Follow F Prime Style Guidelines for naming and code style.
Prerequisites
The FPP model must be confirmed (see
fprime-component-design-fpp) and C++ design rules
(fprime-cpp-design, CPP-1 through CPP-37) are mandatory.
The confirmed requirements and FPP model should provide all the
information needed for implementation.
Step-by-Step Process
Step 1 — Generate Implementation Stubs
fprime-util impl
This produces <Component>-template.cpp and <Component>-template.hpp
files. If this is the first time:
mv <Component>-template.cpp <Component>.cpp
mv <Component>-template.hpp <Component>.hpp
If iterating on an existing design, copy new handler stubs from the template into your existing files.
Step 2 — Implement Handlers
Implement all pure-virtual handlers generated from the FPP model. See Autocoded Functions for handler naming conventions, argument types, and the full API provided by the base class.
Key rules to follow during implementation:
- No dynamic memory after construction (CPP-1) — size all arrays at compile time
- Fixed-size types:
U32,FwSizeType, etc. (CPP-3, CPP-28) - No STL containers — use
Fw/DataStructuresor fixed arrays (CPP-22, CPP-25) - No
FW_ASSERTon untrusted inputs (CPP-4) — validate and return an error response instead - All variables initialized (CPP-19)
Fw::Stringoverchar*(CPP-24)- Every command handler must call
cmdResponse_out— omitting it hangs the command in the dispatcher - Events for each command (CPP-37) — add an event that describes what the command did, including the command arguments. This is frequently forgotten and is very useful for recreating what happened.
- One event emission per call site (CPP-36) — never emit the same event with the same argument set from two places; use a distinct event or a site-identifying argument.
- Mark copy/move as deleted for components (CPP-17)
Step 3 — Build and Fix Errors
fprime-util build
Iterate until compilation succeeds. Common issues:
- Missing
#includefor types used in handlers - Incorrect argument types (check the generated base class)
- Missing
cmdResponse_outcall in command handlers
Step 4 — Review Against C++ Design Rules
Before considering implementation complete, verify compliance with
fprime-cpp-design (CPP-1 through CPP-37).
Anti-Patterns
- Using
FW_ASSERTon command arguments or hardware inputs - Forgetting
cmdResponse_out(command will hang in dispatcher) - Command handlers that emit no event describing what the command did (CPP-37)
- The same event emitted from several sites with indistinguishable arguments (CPP-36)
- Using
new/deletein handler code - Using
std::string,std::vector, or other STL containers - Leaving member variables uninitialized
- Implementing behavior not covered by a requirement
Câu hỏi thường gặp
Các hàm xử lý là gì?
Autocoder sinh ra chúng dưới dạng khung sơ khai, và bạn điền hành vi thực tế của thành phần vào đó.
Mã phải tuân theo quy tắc nào?
Skill yêu cầu bắt buộc tuân theo các quy tắc thiết kế C++ của F Prime khi triển khai.
Tôi có thể bỏ qua mô hình FPP không?
Không. Skill yêu cầu mô hình FPP đã được xác nhận trước khi bắt đầu triển khai.
Chi tiết
Mô tả gốc của tác giả
C++ implementation phase of F Prime component development. Guides the agent through implementing handler functions generated from the FPP model. Must follow fprime-cpp-design rules (CPP-1 through CPP-37). Trigger when the FPP model is confirmed and the next step is to write the C++ implementation. Keywords: F Prime, C++, implementation, handler, component, flight software, autocoded.
repo: nasa/fprime
Độ phổ biến
- Sao GitHub
- 12k
- Vị trí xếp hạng
- #11496
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
fprime-cmake-build-system
12kGiúp agent của bạn thêm module, build target và cài đặt nền tảng vào dự án phần mềm bay F Prime thông qua lớp CMake của nó.
fprime-component-design-fpp
12kGiúp agent của bạn chuyển các yêu cầu thành phần F Prime đã được duyệt thành mô hình FPP cho các port, lệnh, sự kiện và telemetry.
fprime-component-development
12kGiúp agent của bạn hướng dẫn một thành phần F Prime qua từng giai đoạn phát triển, từ yêu cầu đến kiểm thử tích hợp.
fprime-component-integration-test
12kGiúp agent của bạn viết các bài kiểm thử tích hợp pytest dùng lại được cho thành phần F Prime, chạy trên một triển khai đang hoạt động.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.