SuperAPI AI Directory

softcopyright

Coding & development

View repository

Updated 10-15 21:40

About this skill

SoftCopyright - Intelligent Software Copyright Application Material Generation Tool

Overview

When a user needs to apply for software copyright, this skill will automatically complete the following process:

  1. Read user input; if it is a keyword, first search for related content
  2. Analyze the project source code structure and content
  3. Generate detailed software documentation (about 2,000-3,000 words)
  4. Generate a source code document that meets the requirements (60 pages, 50 lines per page)
  5. Export to PDF format for use in software copyright applications

Supported trigger commands

Users can trigger this skill in the following ways:

  • "Help me generate software copyright application materials" - Process the project in the current directory
  • "Generate software documentation" - Generate only the software documentation
  • "Generate source code document" - Generate only the source code document
  • Any keyword - First search for related content, then ask whether to generate software copyright materials

Workflow

Step 1: Understand user intent

First determine the type of user input:

// 检查用户输入类型
if (用户输入包含 "软著" || "著作权") {
  生成类型 = "全部材料"
} else if (用户输入包含 "软件说明书") {
  生成类型 = "说明书"
} else if (用户输入包含 "源代码" || "源码") {
  生成类型 = "源代码文档"
} else if (用户输入是关键词) {
  先搜索相关内容
  询问用户是否生成软著材料
}

Step 2: Confirm project path

// 默认使用当前目录
let projectPath = process.cwd()

// 询问用户确认路径
await confirmProjectPath(projectPath)

Step 3: Use the CLI to generate software copyright materials

It is recommended to use the CLI tool to generate software copyright materials:

# 方式1: 使用关键词触发index.js(交互式)
cd ~/.claude/skills/softcopyright
node scripts/index.js 软著

# 方式2: 使用cli.js直接生成(推荐)
node scripts/cli.js generate --project <项目路径>

# 方式3: 使用快捷命令(最佳体验)
~/.claude/skills/softcopyright/softcopyright-generate --project . --auto-pdf

# 方式4: 技能系统自动调用
用户输入"帮我生成软著" → 自动执行: softcopyright-generate --project . --auto-pdf

This tool will:

  • Automatically scan the project source code
  • Identify source code file types
  • Analyze the project structure and technology stack
  • Generate HTML-format software documentation and source code documents
  • Ask the user whether to automatically open in the browser and print as PDF

Step 4: Generation options

The user can choose:

  1. Generate all materials(Software documentation + source code document)
  2. Generate only the software documentation
  3. Generate only the source code document
  4. View project statistics only

Step 5: Output location

Default output path: <项目目录>/softcopyright-output/

Generated files:

  • 软件说明书_<项目名>_<时间戳>.html
  • 源代码文档_<项目名>_<时间戳>.html

Step 6: Export PDF

There are two ways to convert HTML to PDF:

Method 1: Automatic conversion (recommended)

# 添加--auto-pdf选项
node scripts/cli.js generate --project <项目路径> --auto-pdf
  • Automatically open the HTML in the browser
  • Automatically pop up the print dialog after 3 seconds
  • Select "Save as PDF"

Method 2: Manual conversion

  1. Open the generated HTML file in the browser
  2. Press Cmd+P (macOS) or Ctrl+P (Windows/Linux)
  3. In print settings:
    • Expand "More settings"
    • Check "Headers and footers"
    • Select "Save as PDF"
  4. Save the PDF file

Tool script usage instructions

scanner.js - Source code scanning tool

Scan the project directory and analyze the structure:

node ~/.claude/skills/softcopyright/scripts/scanner.js <项目路径>

Output a JSON file of the project analysis.

doc-generator.js - Software documentation generator

Generate detailed software documentation:

node ~/.claude/skills/softcopyright/scripts/doc-generator.js \
  --type manual \
  --input <项目分析JSON> \
  --template <模板文件> \
  --output <输出PDF路径>

source-exporter.js - Source code document generator

Generate a source code document that meets software copyright requirements:

node ~/.claude/skills/softcopyright/scripts/source-exporter.js \
  --input <源码目录> \
  --output <输出PDF路径> \
  --pages 60 \
  --lines-per-page 50

Usage examples

Example 1: Complete software copyright material generation

User: "Help me generate software copyright application materials"

Claude execution flow:

  1. Confirm project path: current directory
  2. Run source code scanning tool
  3. Analyze project structure and tech stack
  4. Generate software manual
  5. Generate source code document
  6. Export PDF file
  7. Show generation results to the user

Example 2: Generate after keyword search

User: "React e-commerce system"

Claude execution flow:

  1. Search for information related to "React e-commerce system"
  2. Display search results
  3. Ask: "Do you need to generate software copyright application materials for the React e-commerce system?"
  4. Execute the complete generation process after user confirmation

Example 3: Generate only the software manual

User: "Help me generate a software manual"

Claude execution flow:

  1. Scan project source code
  2. Analyze project functions
  3. Generate software manual
  4. Export PDF file

Output file specifications

Software manual PDF

  • File name:软件说明书_项目名称_YYYYMMDD.pdf
  • Word count requirement: 2000-3000 words
  • Include all required chapters
  • Professional layout and formatting

Source code document PDF

  • File name:源代码文档_项目名称_YYYYMMDD.pdf
  • Page count requirement: 60 pages (or process all code)
  • Lines per page: no fewer than 50 lines
  • No comments and no copyright information
  • Code continuity guarantee

Software copyright application requirements

Source code document requirements

  1. Page count requirement: Usually requires 20-60 pages
  2. Format requirements: No more than 50 lines of code per page
  3. Comment requirements: All comments need to be removed, keeping only pure code
  4. Header and footer: Need to include the software name and version number
  5. Code continuity: Need to ensure the continuity and completeness of the code

Software manual requirements

  1. Detailed content: About 2000-3000 words
  2. Complete structure: Include all required chapters
  3. Highlight key points: Highlight the originality of the software
  4. Professional description: Use professional technical descriptions

Tech stack

  • Node.js: Main runtime environment
  • PDFKit: PDF document generation
  • glob: File pattern matching
  • commander: CLI argument parsing
  • chalk: Terminal color output
  • inquirer: Interactive command-line interface

Dependency installation

Use nvm to manage the Node.js version:

# 确保使用合适的 Node 版本
nvm use 18

# 安装依赖
cd ~/.claude/skills/softcopyright
npm install

Best practices

  1. Accurate project analysis: Ensure correct identification of project type and tech stack
  2. Detailed and professional content: Generate professional technical descriptions and function explanations
  3. Standard and compliant format: Strictly format according to software copyright application requirements
  4. Friendly user interaction: Provide clear progress prompts and confirmation flow
  5. Document completeness: Ensure the completeness and accuracy of the generated materials

Security Notes

  1. Source Code Security: Do not modify the original source code, only read and analyze it
  2. Privacy Protection: Do not upload source code to external services
  3. Local Processing: All processing is completed locally
  4. User Confirmation: User confirmation is required before important operations

Troubleshooting

Scan Failed

# 检查项目路径
ls -la <项目路径>

# 检查权限
chmod -R 755 <项目路径>

PDF Generation Failed

# 检查依赖安装
cd ~/.claude/skills/softcopyright
npm list

# 重新安装依赖
npm install

Insufficient Memory

For large projects, you can:

  1. Exclude unnecessary directories (node_modules, .git, etc.)
  2. Process source code files in batches
  3. Increase the Node.js memory limit

Development and Extension

To add support for a new file type, edit scripts/scanner.js:

const SUPPORTED_EXTENSIONS = {
  '.rs': {
    'single_line': '//',
    'multi_line': ['/*', '*/'],
    'language': 'rust'
  },
  '.go': {
    'single_line': '//',
    'multi_line': ['/*', '*/'],
    'language': 'go'
  }
}

Version: 1.0.0 Author: peterfei License: MIT