
init-risk-knowledge
by atman-33
AI-driven risk assessment knowledge base for web application development. Enables GitHub Copilot to identify potential high-risk issues through structured incident records, domain-specific risks, and security vulnerabilities.
SKILL.md
name: init-risk-knowledge description: Initialize the risk knowledge base repository by removing sample data and creating a clean structure. Use when setting up this repository for a new project. Creates .examples/ directory with sample files for reference while cleaning the main structure. This is a one-time operation for initial project setup.
Initialize Risk Knowledge Repository
One-time initialization script to prepare the risk knowledge base for a new project by archiving sample data and creating a clean structure.
When to Use
- Initial project setup: When forking or cloning this repository for a new project
- Starting fresh: When you want to replace all sample data with your own content
- Clean slate: After reviewing examples and ready to build your own knowledge base
NOT for:
- Cleaning up test data in an active project (use git/manual deletion)
- Resetting after adding your own content (not reversible)
- Multiple executions (runs only once)
What It Does
Archives Sample Data
Moves sample content to .examples/ directory for reference:
domains/auth/ → .examples/domains/auth/
domains/payment/ → .examples/domains/payment/
domains/batch-processing/ → .examples/domains/batch-processing/
incidents/*.md → .examples/incidents/*.md
Cleans Main Structure
- domains/: Becomes empty directory
- incidents/: Becomes empty directory
- common-risks/*.md: Templates with headings only
- indexes/knowledge-map.yml: Reset to empty definitions list
Preserves
.claude/skills/: All management skills.github/: Copilot configurationREADME.md: Documentation.examples/: Created with archived samples
Usage
Basic Usage
python3 .claude/skills/init-risk-knowledge/scripts/init_repository.py
Interactive mode with confirmation prompt.
Advanced Options
# Skip confirmation prompt
python3 .claude/skills/init-risk-knowledge/scripts/init_repository.py --force
# Dry run (show what would happen)
python3 .claude/skills/init-risk-knowledge/scripts/init_repository.py --dry-run
Script Workflow
- Pre-check: Verify
.examples/doesn't exist (prevent multiple runs) - Inventory: List all files to be archived
- Confirmation: Ask user to proceed (unless
--force) - Archive: Move samples to
.examples/ - Clean: Empty
domains/andincidents/ - Template: Replace
common-risks/content with structure only - Reset: Initialize
knowledge-map.ymlwith empty list - Validate: Run validation to ensure clean state
- Guide: Display next steps
After Initialization
The script displays guidance for next steps:
✓ Repository initialized successfully!
Samples archived to .examples/ directory.
Next steps:
1. Review examples: ls -la .examples/
2. Add your first domain: python3 .claude/skills/manage-risk-knowledge/scripts/add_domain.py
3. Customize common-risks/ for your project
4. Update README.md with project-specific information
Resources:
- Templates: .claude/skills/manage-risk-knowledge/references/templates.md
- Examples: .examples/
- Management: .claude/skills/manage-risk-knowledge/SKILL.md
Safety Features
Single Execution
Script exits with error if .examples/ already exists:
ERROR: .examples/ directory already exists.
This script is for initial setup only and has already been run.
If you want to reset completely, delete .examples/ first (NOT recommended).
For ongoing maintenance, use git or manual file management.
Validation
Runs validate_knowledge.py after initialization to ensure clean state.
Dry Run
Use --dry-run to preview changes without modifying files.
Common-Risks Templates
Each common risk file is templated with this structure:
# Security Risks
Cross-cutting security risk patterns applicable to all domains.
## 1. SQL Injection
**Risk**:
(Add description here)
**Causes**:
- (Add causes here)
**Severity**:
(Critical/High/Medium/Low)
---
## 2. (Add Risk Name)
**Risk**:
(Add description here)
...
Users can edit these templates directly or reference .examples/common-risks/ for ideas.
Knowledge Map Reset
indexes/knowledge-map.yml is reset to:
# Copilot Knowledge Map
# Define keyword-based routing for domains
definitions: []
# Example entry:
# - domain_name: "Your Domain Name"
# description: "Brief description"
# keywords:
# - "keyword1"
# - "keyword2"
# related_files:
# common_risks:
# - "common-risks/security.md"
# domain_knowledge:
# - "domains/your-domain/spec.md"
# - "domains/your-domain/risks.md"
Troubleshooting
Already Initialized
If you see the error about .examples/ existing:
Option 1 (Recommended): Keep current state and manage with git
# Add your content normally
python3 .claude/skills/manage-risk-knowledge/scripts/add_domain.py
Option 2 (Destructive): Complete reset
# Backup if needed
cp -r .examples .examples.backup
# Remove and re-run
rm -rf .examples
python3 .claude/skills/init-risk-knowledge/scripts/init_repository.py
Validation Errors
If validation fails after initialization, check:
- File permissions
- Disk space
- YAML syntax in knowledge-map.yml
Run validation manually:
python3 .claude/skills/manage-risk-knowledge/scripts/validate_knowledge.py
References
- Detailed guide:
references/initialization-guide.md - Management skill:
../manage-risk-knowledge/SKILL.md - Templates:
../manage-risk-knowledge/references/templates.md
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
1ヶ月以内に更新
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon

