Agent skill
file-organization-and-structure
Organize routines within files using blank line separation, consider alphabetical ordering when appropriate, and follow C++ standard file structure. Use when organizing source files, when language doesn't support class-based organization, or when editor navigation is limited.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/file-organization-and-structure
SKILL.md
File Organization and Structure
Apply these principles to create well-organized source files.
Routine Separation Within Files
When to apply: When a file contains multiple routines
- Use at least two blank lines to separate each routine from others
- Visual distinction:
- Use two to three blank lines to create visual difference from internal routine spacing
- Blank lines are as effective as asterisk or dash lines, and easier to input and maintain
Routine Ordering Strategy
When to apply: When organizing routines within a file and no stronger principle applies
- Alternative approach: Arrange related routines alphabetically
- Applicable scenarios:
- Programs cannot be decomposed into classes
- Editor doesn't allow easy function lookup
- Advantage: Saves search time
C++ Source File Content Order
When to apply: When organizing C++ source files
Follow this typical order for C++ source file contents:
- File description comment
#includefiles- Constant definitions applicable to multiple classes (if file contains multiple classes)
- Enums applicable to multiple classes (if file contains multiple classes)
- Macro function definitions
- Type definitions applicable to multiple classes (if file contains multiple classes)
- Imported global variables and functions
- Exported global variables and functions
- File-private variables and functions
- Classes, including constant definitions, enums, and type definitions within each class
Result
- Routine boundaries are clearly visible
- File structure follows consistent conventions
- Code is easier to navigate and maintain
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?