Overview
When a user needs to apply for software copyright, this skill will automatically complete the following process:
- Read user input; if it is a keyword, first search for related content
- Analyze the project source code structure and content
- Generate detailed software documentation (about 2,000-3,000 words)
- Generate a source code document that meets the requirements (60 pages, 50 lines per page)
- 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:
- Generate all materials(Software documentation + source code document)
- Generate only the software documentation
- Generate only the source code document
- 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
- Open the generated HTML file in the browser
- Press Cmd+P (macOS) or Ctrl+P (Windows/Linux)
- In print settings:
- Expand "More settings"
- Check "Headers and footers"
- Select "Save as PDF"
- 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:
- Confirm project path: current directory
- Run source code scanning tool
- Analyze project structure and tech stack
- Generate software manual
- Generate source code document
- Export PDF file
- Show generation results to the user
Example 2: Generate after keyword search
User: "React e-commerce system"
Claude execution flow:
- Search for information related to "React e-commerce system"
- Display search results
- Ask: "Do you need to generate software copyright application materials for the React e-commerce system?"
- 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:
- Scan project source code
- Analyze project functions
- Generate software manual
- 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
- Page count requirement: Usually requires 20-60 pages
- Format requirements: No more than 50 lines of code per page
- Comment requirements: All comments need to be removed, keeping only pure code
- Header and footer: Need to include the software name and version number
- Code continuity: Need to ensure the continuity and completeness of the code
Software manual requirements
- Detailed content: About 2000-3000 words
- Complete structure: Include all required chapters
- Highlight key points: Highlight the originality of the software
- 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
- Accurate project analysis: Ensure correct identification of project type and tech stack
- Detailed and professional content: Generate professional technical descriptions and function explanations
- Standard and compliant format: Strictly format according to software copyright application requirements
- Friendly user interaction: Provide clear progress prompts and confirmation flow
- Document completeness: Ensure the completeness and accuracy of the generated materials
Security Notes
- Source Code Security: Do not modify the original source code, only read and analyze it
- Privacy Protection: Do not upload source code to external services
- Local Processing: All processing is completed locally
- 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:
- Exclude unnecessary directories (node_modules, .git, etc.)
- Process source code files in batches
- 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