Claude-skill-registry docs-stories
Complete CRUD for SDLC documentation (stories, tasks, context retrieval). Use when creating/managing stories, creating/managing tasks, updating task state, or retrieving full context for any user story via index (<3min restoration).
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/docs-stories" ~/.claude/skills/majiayu000-claude-skill-registry-docs-stories && rm -rf "$T"
skills/data/docs-stories/SKILL.mddocs-stories Skill
Purpose
Provide complete CRUD operations for SDLC documentation in the Bestays project. This skill handles all story/task management and context retrieval operations.
Single Interface: Anytime you need to read/write anything about the codebase in terms of documenting, use this skill.
When to Use This Skill
CREATE:
- Creating new user stories
- Creating new tasks for stories
READ:
- Finding stories by domain or keywords
- Listing tasks for a story
- Getting current active task
- Retrieving full context for a user story (via index)
- Finding all files/commits/decisions for a story (via index)
UPDATE:
- Updating task state (NOT_STARTED, IN_PROGRESS, COMPLETED)
- Updating task phase (RESEARCH, PLANNING, IMPLEMENTATION, TESTING, VALIDATION)
- Adding commits to task record
- Adding modified files to task record
- Setting current active task
DELETE:
- Not implemented (stories/tasks are permanent audit trail)
Available Scripts
All scripts located in:
.claude/skills/docs-stories/scripts/
Story Management
story_create.py
- Create New User Story
story_create.pyUsage:
python3 .claude/skills/docs-stories/scripts/story_create.py <domain> <feature> <scope>
Arguments:
: Story category (auth, booking, admin, infrastructure, etc.)domain
: Main feature name (login, signup, dashboard, etc.)feature
: Specific scope (admin, user, validation, etc.)scope
Example:
python3 .claude/skills/docs-stories/scripts/story_create.py auth login admin # Creates: .sdlc-workflow/stories/auth/US-001-auth-login-admin.md
What it does:
- Scans existing stories to find next story number
- Creates story file from template
- Replaces placeholders with provided values
- Returns story ID and file path
story_find.py
- Find Existing Stories
story_find.pyUsage:
python3 .claude/skills/docs-stories/scripts/story_find.py [domain] [--status STATUS]
Arguments:
(optional): Filter by domain (auth, booking, etc.)domain
(optional): Filter by status (READY, IN_PROGRESS, COMPLETED)--status
Examples:
# Find all stories python3 .claude/skills/docs-stories/scripts/story_find.py # Find all auth stories python3 .claude/skills/docs-stories/scripts/story_find.py auth # Find all completed stories python3 .claude/skills/docs-stories/scripts/story_find.py --status COMPLETED # Find completed auth stories python3 .claude/skills/docs-stories/scripts/story_find.py auth --status COMPLETED
What it does:
- Scans
for story files.sdlc-workflow/stories/ - Parses story metadata (status, domain, title)
- Filters by criteria
- Returns list of matching stories
Task Management
task_create.py
- Create New Task
task_create.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_create.py <story_id> <task_number> <semantic_name>
Arguments:
: Parent story ID (e.g., US-001)story_id
: Task number (1, 2, 3, etc.)task_number
: Semantic slug (2-3 words, lowercase, hyphens)semantic_name
Example:
python3 .claude/skills/docs-stories/scripts/task_create.py US-001 1 clerk-mounting # Creates: .claude/tasks/TASK-001/ # With STATE.json: {"story": "US-001", "semantic_name": "clerk-mounting", ...}
What it does:
- Creates task folder at
.claude/tasks/TASK-{number}/ - Creates phase subfolders (research/, planning/, etc.)
- Creates STATE.json with metadata
- Creates README.md from template
- Returns task ID and folder path
task_list.py
- List Tasks for Story
task_list.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_list.py <story_id>
Arguments:
: Story ID to list tasks for (e.g., US-001)story_id
Example:
python3 .claude/skills/docs-stories/scripts/task_list.py US-001 # Returns: # TASK-001 (clerk-mounting): IN_PROGRESS, PLANNING phase # TASK-002 (login-tests): NOT_STARTED, RESEARCH phase
What it does:
- Scans
for tasks with matching story.claude/tasks/ - Reads STATE.json for each task
- Returns list with status and phase
task_get_current.py
- Get Current Active Task
task_get_current.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_get_current.py
Example:
python3 .claude/skills/docs-stories/scripts/task_get_current.py # Returns: TASK-001 (US-001, clerk-mounting)
What it does:
- Checks current git branch for TASK-XXX reference
- Reads task STATE.json
- Returns current task details
task_set_current.py
- Set Current Active Task
task_set_current.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_set_current.py <task_id>
Arguments:
: Task ID to make active (e.g., TASK-001)task_id
Example:
python3 .claude/skills/docs-stories/scripts/task_set_current.py TASK-001 # Switches to task branch or updates tracking
What it does:
- Validates task exists
- Updates tracking (implementation depends on approach)
- Returns confirmation
task_update_state.py
- Update Task Status
task_update_state.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_update_state.py <task_id> <status>
Arguments:
: Task ID (e.g., TASK-001)task_id
: New status (NOT_STARTED, IN_PROGRESS, COMPLETED)status
Example:
python3 .claude/skills/docs-stories/scripts/task_update_state.py TASK-001 IN_PROGRESS # Updates STATE.json: {"status": "IN_PROGRESS", ...}
What it does:
- Reads task STATE.json
- Updates status field
- Updates timestamp
- Writes back to STATE.json
task_update_phase.py
- Update Task Phase
task_update_phase.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_update_phase.py <task_id> <phase>
Arguments:
: Task ID (e.g., TASK-001)task_id
: New phase (RESEARCH, PLANNING, IMPLEMENTATION, TESTING, VALIDATION)phase
Example:
python3 .claude/skills/docs-stories/scripts/task_update_phase.py TASK-001 PLANNING # Updates STATE.json: {"phase": "PLANNING", ...}
What it does:
- Reads task STATE.json
- Updates phase field
- Updates timestamp
- Writes back to STATE.json
task_add_commit.py
- Add Commit to Task Record
task_add_commit.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_add_commit.py <task_id> <commit_hash>
Arguments:
: Task ID (e.g., TASK-001)task_id
: Git commit hashcommit_hash
Example:
python3 .claude/skills/docs-stories/scripts/task_add_commit.py TASK-001 abc123def # Updates STATE.json: {"commits": ["abc123def"], ...}
What it does:
- Reads task STATE.json
- Appends commit hash to commits array
- Writes back to STATE.json
task_add_file_modified.py
- Add Modified File to Task Record
task_add_file_modified.pyUsage:
python3 .claude/skills/docs-stories/scripts/task_add_file_modified.py <task_id> <file_path>
Arguments:
: Task ID (e.g., TASK-001)task_id
: Path to modified file (relative to project root)file_path
Example:
python3 .claude/skills/docs-stories/scripts/task_add_file_modified.py TASK-001 apps/server/core/clerk.py # Updates STATE.json: {"files_modified": ["apps/server/core/clerk.py"], ...}
What it does:
- Reads task STATE.json
- Appends file path to files_modified array (no duplicates)
- Writes back to STATE.json
Context Indexing and Retrieval
context_index.py
- Index All SDLC Artifacts
context_index.pyStatus: To be implemented (US-001D)
Usage:
python3 .claude/skills/docs-stories/scripts/context_index.py [--story-id US-XXX] [--output PATH]
Arguments:
(optional): Index specific story only--story-id
(optional): Output path (default:--output
).sdlc-workflow/.index/sdlc-index.json
Example:
# Index all stories python3 .claude/skills/docs-stories/scripts/context_index.py # Index specific story python3 .claude/skills/docs-stories/scripts/context_index.py --story-id US-001 # Custom output path python3 .claude/skills/docs-stories/scripts/context_index.py --output /tmp/index.json
What it does:
- Scans
for story files.sdlc-workflow/stories/ - Scans
for task folders.claude/tasks/ - Parses git log for commits with story/task references
- Parses file headers for design patterns and trade-offs
- Builds structured JSON index with bidirectional cross-references
- Outputs:
.sdlc-workflow/.index/sdlc-index.json
Index Schema:
{ "metadata": { "generated": "2025-11-07T10:30:00Z", "total_stories": 5, "total_tasks": 12 }, "stories": { "US-001": { "id": "US-001", "title": "Login Flow Validation", "file": ".sdlc-workflow/stories/auth/US-001-...", "tasks": ["TASK-001-file-headers"], "commits": ["abc123"], "implementation_files": ["apps/frontend/tests/..."] } }, "tasks": { "TASK-001-file-headers": { "story": "US-001", "folder": ".claude/tasks/TASK-001/", "decisions": "...", "files_modified": ["..."] } }, "commits": {...}, "files": {...} }
Retrieving Full Context for a Story
Once the index is built, retrieve full context:
Step 1: Read the Index
import json with open('.sdlc-workflow/.index/sdlc-index.json') as f: index = json.load(f)
Step 2: Query by Story ID
story = index['stories']['US-001'] # Returns: title, file, tasks, commits, files, acceptance_criteria
Step 3: Traverse Cross-References
# Get all tasks for story tasks = [index['tasks'][task_id] for task_id in story['tasks']] # Get all commits for story commits = [index['commits'][commit_hash] for commit_hash in story['commits']] # Get all files for story files = [index['files'][file_path] for file_path in story['implementation_files']]
Common Query Templates
Query: "Full context for US-001"
Steps:
- Read index
- Get story metadata (title, acceptance criteria)
- Get all tasks (semantic names, decisions, subagents)
- Get all commits (timeline)
- Get all files (design patterns, trade-offs)
- Format output for readability
Expected Output:
# Full Context: US-001 - Login Flow Validation ## Story - Title: Login Flow Validation - Status: COMPLETED - Acceptance Criteria: - Valid credentials authenticate user - Invalid credentials rejected - E2E tests passing ## Tasks 1. TASK-001-file-headers - Decision: Add file headers with design patterns for instant context - Trade-offs: Maintenance overhead vs clarity - Subagent: dev-backend-fastapi ## Timeline - 2025-10-16: feat: add file headers (abc123) - 2025-10-20: test: add E2E login tests (def456) ## Files Modified - apps/server/core/clerk.py - Design Pattern: Singleton - Architecture Layer: Core Service - Trade-offs: Vendor lock-in vs faster development ## Time to Context: < 3 minutes
Query: "Files changed in US-001"
Steps:
- Read index
- Get story['implementation_files']
- For each file, get metadata (design pattern, layer, trade-offs)
- Format as list
Expected Output:
Files changed in US-001: - apps/server/core/clerk.py (Singleton, Core Service) - apps/server/api/clerk_deps.py (Dependency Injection, API Layer) - apps/frontend/tests/e2e/login.spec.ts (Test, E2E Layer)
Query: "Timeline for US-001"
Steps:
- Read index
- Get story['commits']
- Sort by date
- Format chronologically
Expected Output:
Timeline for US-001: - 2025-10-16 14:30: feat: add file headers to backend deps (abc123) Files: clerk.py, deps.py Task: TASK-001-file-headers - 2025-10-20 10:15: test: add E2E login tests (def456) Files: login.spec.ts Task: TASK-002-login-tests
Query: "Decisions for US-001"
Steps:
- Read index
- Get all tasks for story
- Extract decisions field from each task
- Format as list
Expected Output:
Decisions for US-001: TASK-001-file-headers: - Chose Clerk over Auth0 for authentication - Trade-offs: Vendor lock-in vs faster development - Added file headers with design patterns for instant context TASK-002-login-tests: - Chose Playwright over Cypress for E2E tests - Trade-offs: Newer tool vs more examples available
Query: "Trade-offs for authentication"
Steps:
- Read index
- Search files for "authentication" or "auth" keywords
- Extract trade-offs sections from file headers
- Format as list
Expected Output:
Trade-offs for authentication: apps/server/core/clerk.py (Singleton): - Pro: Shared Clerk client reduces memory usage - Con: Vendor lock-in to Clerk - When to revisit: If Clerk pricing becomes prohibitive apps/server/api/clerk_deps.py (Dependency Injection): - Pro: Easy to mock for testing - Con: Extra indirection layer
Performance Expectations
Indexing:
- Time: < 10 seconds for 20 stories, 50 tasks, 150 commits
- Memory: < 500MB
- Output: < 2MB JSON file
Retrieval:
- Full context for any story: < 3 minutes (vs 30-60 minutes manual)
- Files changed query: < 30 seconds
- Timeline query: < 30 seconds
- Decisions query: < 30 seconds
Integration with Other Skills
sdlc-orchestrator skill:
- Orchestrator uses docs-stories to update task state during phase transitions
- Example: After completing planning phase, orchestrator calls
task_update_phase.py TASK-001 IMPLEMENTATION
planning-quality-gates skill:
- Quality gates reference docs-stories for creating planning artifacts
- Example: Create
via task folder structureplanning/quality-gate-checklist.md
Memory MCP:
- Coordinator loads SDLC patterns from Memory MCP before using docs-stories
- Example: Load "Task Folder System" entity to understand structure
Best Practices
For Coordinators:
- Always use docs-stories for story/task CRUD operations (don't manually create files)
- Update task state after each phase transition
- Run context_index.py periodically (after completing stories)
- Use retrieval queries to restore context in new sessions
For Subagents:
- Read task STATE.json to understand current task context
- Add commits and files_modified after implementation
- Reference task folder for implementation spec and decisions
- Save reports to task folder (subagent-reports/)
For Both:
- Never bypass docs-stories scripts (maintain consistency)
- Always use semantic task names (self-documenting)
- Document decisions and trade-offs in task folders
- Update STATE.json after significant progress
Troubleshooting
Problem:
story_create.py fails with "Not in a project with .claude/"
Solution: Run from project root or any subdirectory containing .claude/
Problem:
task_create.py fails with "Task already exists"
Solution: Use different task number or delete existing task folder
Problem: Index is outdated after new commits Solution: Re-run
context_index.py to rebuild index
Problem: Context retrieval returns no results for recent story Solution: Ensure story file exists and index has been built
Future Enhancements (Out of Scope)
- Delete operations (story/task archival)
- Story/task templates with variants
- Incremental indexing (only scan changed files)
- Web UI for browsing index
- Full-text search across decisions and reports
- Automated index rebuild on git commit (hook)
Skill Version: 1.0 Last Updated: 2025-11-07 Maintained By: Bestays SDLC Team