SuperAPI AI Directory

output-style-manager

General & other

View repository

Updated 10-15 21:36

About this skill

Output Style Manager

A tool for reading and writing the output style directory, used to operate on output style files.

Directory path

Scope Path
Global ~/.pi/output-styles/
Project .pi/output-styles/

Read styles

Read a single style file

cat ~/.pi/output-styles/<style-name>.md
cat .pi/output-styles/<style-name>.md

List all style files

ls -la ~/.pi/output-styles/
ls -la .pi/output-styles/

Read the active style

cat ~/.pi/output-styles/active.json
cat .pi/output-styles/active.json

Write styles

Create/overwrite a style file

cat > ~/.pi/output-styles/<style-name>.md << 'EOF'
---
name: style-name
description: Style description
keepCodingInstructions: true
---

Your style content here.
EOF

Delete a style file

trash ~/.pi/output-styles/<style-name>.md
trash .pi/output-styles/<style-name>.md

Set the active style

echo '{"name": "style-name"}' > ~/.pi/output-styles/active.json
echo '{"name": "style-name"}' > .pi/output-styles/active.json

Style file format

---
name: my-style
description: My custom output style
keepCodingInstructions: true
---

Your custom output style instructions here.

Frontmatter fields:

  • name(Required): style name
  • description(Optional): style description
  • keepCodingInstructions(Required): true/false

Read examples

Check whether a style exists

test -f ~/.pi/output-styles/<name>.md && echo "exists" || echo "not found"

Read style content (excluding frontmatter)

awk '/^---$/{if(p)exit;p=1;next}p' ~/.pi/output-styles/<name>.md

Parse frontmatter

sed -n '/^---$/,/^---$/p' ~/.pi/output-styles/<name>.md | head -n -1 | tail -n +2

Write examples

Batch create styles

for style in style1 style2 style3; do
  cat > ~/.pi/output-styles/$style.md << EOF
---
name: $style
description: Description for $style
keepCodingInstructions: true
---

Content for $style.
EOF
done

Back up all styles

tar -czf output-styles-backup.tar.gz ~/.pi/output-styles/
tar -czf output-styles-backup.tar.gz .pi/output-styles/

Built-in style list

These styles are defined in the extension code, not in the file system:

Name Description
default Efficiently complete coding tasks
explanatory Explain implementation choices
learning Hands-on practice mode
coding-vibes Energetic coding companion
structural-thinking Structured thinking

CoT chain: semantic recognition and style generation

When the user requests creating an output style but does not explicitly specify style characteristics, use the following CoT chain for semantic recognition and style generation.

Step 1: Semantically recognize user intent

Analyze the user's conversation history and current request to identify the following dimensions:

Dimension Detection indicator Possible values
Language style Expression, tone, wording Formal/casual/lively/serious
Level of detail Reply length, depth of explanation Concise/moderate/detailed
Interaction preference Questioning style, feedback needs Direct/guided/collaborative
Emotional tendency Emotional expression, need for encouragement Neutral/positive/encouraging
Technical depth Terminology usage, level of abstraction Practical/theoretical/balanced
Structural preference Information organization method Free/structured/step-by-step

Recognition method

Example user message analysis:

  • "Help me write a function" → concise, practical, direct
  • "Can you explain in detail why it is written this way?" → detailed, theoretical, guided
  • "I want to learn, let me try it myself" → collaborative, learning-oriented
  • "Hey, bro, help me take a look at this code" → casual, lively, encouraging

Keyword mapping:

Keyword Inferred style
Explain, why, principle explanatory
Learn, practice, try it learning
Concise, fast, direct default
Hey, bro, haha coding-vibes
Architecture, design, modules structural-thinking

Step 2: Match or generate a style

2.1 Match a built-in style

Based on the recognition result, select the best-matching built-in style:

User characteristics Recommended style
Concise, efficient, direct default
Needs explanation and understanding of principles explanatory
Learning-oriented, hands-on practice learning
Relaxed, lively, encouraging coding-vibes
Architecture design, structured thinking structural-thinking

2.2 Generate a custom style

If no built-in style matches, generate one in the following format:

---
name: <生成的风格名称>
description: <基于用户特征生成的描述>
keepCodingInstructions: true
---

<根据识别维度生成的风格指令>

Generation template:

---
name: <风格名称>
description: <一句话描述>
keepCodingInstructions: true
---

<语言风格指令>
<详细程度指令>
<交互偏好指令>
<情感倾向指令>
<技术深度指令>
<结构偏好指令>

Generation example:

---
name: friendly-mentor
description: 友好的导师风格,平衡详细和简洁
keepCodingInstructions: true
---

保持友好和鼓励的语气。
提供清晰的解释,但不过于冗长。
在关键步骤暂停,确认用户理解。
使用简单的类比帮助理解复杂概念。
提供代码示例后,询问是否需要更多细节。

Step 3: Verify style applicability

Verify whether the generated style meets the user's needs:

  • Language style is consistent with the user
  • Level of detail meets expectations
  • Interaction method matches preferences
  • Emotional tone is appropriate
  • Technical depth is appropriate
  • Structure is clear and easy to read

Step 4: Write to the style file

Write the verified style to the file:

cat > ~/.pi/agent/output-styles/<style-name>.md << 'EOF'
---
name: <style-name>
description: <description>
keepCodingInstructions: true
---

<style-content>
EOF

Step 5: Activate and provide feedback

Activate the new style and confirm with the user:

echo '{"name": "<style-name>"}' > ~/.pi/output-styles/active.json

Feedback example:

已为你创建并激活风格 "<style-name>"
描述:<description>
基于你的对话风格,这个风格会:<简要说明>
如需调整,使用 /output-style:edit <style-name>

Complete CoT example

User request

"I want a style that suits me; I like detailed explanations but not too verbose"

CoT processing

Step 1: Semantic recognition

  • Language style: Neutral
  • Level of detail: Detailed but controlled (medium-high)
  • Interaction preference: Guided
  • Emotional tendency: Neutral
  • Technical depth: Balanced
  • Structural preference: Structured

Step 2: Generate style

---
name: balanced-explanatory
description: 平衡的详细解释风格,清晰但不冗长
keepCodingInstructions: true
---

提供清晰的解释说明代码意图。
使用要点列表组织信息。
每个主要步骤后简要说明原因。
避免过度解释显而易见的内容。
关键概念使用类比帮助理解。
保持回复结构化,使用标题分段。

Step 3: Verify

  • ✅ Level of detail matches
  • ✅ Clear structure
  • ✅ Not verbose

Steps 4-5: Write and activate

已为你创建并激活风格 "balanced-explanatory"
描述:平衡的详细解释风格,清晰但不冗长
基于你的对话风格,这个风格会:提供清晰解释但控制长度
如需调整,使用 /output-style:edit balanced-explanatory