The appearance of various high-performance computing (HPC) systems compels a user to write a code considering the characteristic of each HPC system. To describe the system-dependent information without drastic code modifications, the directive sets such as the OpenMP directive set and the OpenACC directive set are useful. However, a code becomes complex to achieve high performance on various HPC systems because different directive sets are required for each HPC system. Thus, the code maintainability and readability are degraded. This paper proposes a directive generation approach that generates various kinds of directive sets using user-defined rules. Instead of several kinds of directive sets, a user writes a special placeholder that is utilized to specify a unique code pattern where several directives are inserted. Then, the special placeholder triggers generation of appropriate directives for each system using a user-defined rule with a code translation framework Xevolver. Because only special placeholders are inserted in a code, the proposed approach can keep the code maintainability and readability. From the demonstration of translation into three kinds of directive-based implementations, it is clarified that the proposed approach can replace directives into a smaller number of special placeholders. Moreover, it is clarified that the proposed approach can realize high performance portability by generating appropriate directives for each HPC system.