.claude/skills/implementing-tasks/SKILL.md
Execute sprint tasks with production-quality code and tests
npx skillsauth add 0xhoneyjar/loa-freeside implementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
<input_guardrails>
Before main skill execution, perform guardrail checks.
Read .loa.config.yaml:
guardrails:
input:
enabled: true|false
Exit Conditions:
guardrails.input.enabled: false → Skip to prompt enhancementLOA_GUARDRAILS_ENABLED=false → Skip to prompt enhancementScript: .claude/scripts/danger-level-enforcer.sh --skill implementing-tasks --mode {mode}
| Action | Behavior | |--------|----------| | PROCEED | Continue (moderate skill - allowed in all modes) | | WARN | Log warning, continue | | BLOCK | HALT execution, notify user |
Script: .claude/scripts/pii-filter.sh
Detect and redact:
Log redaction count to trajectory (never log PII values).
Script: .claude/scripts/injection-detect.sh --threshold 0.7
Check for:
On DETECTED: BLOCK execution, notify user.
Write to grimoires/loa/a2a/trajectory/guardrails-{date}.jsonl.
On error: Log to trajectory, fail-open (continue to skill). </input_guardrails>
<prompt_enhancement_prelude>
Before executing main skill logic, apply automatic prompt enhancement to user's request.
Read .loa.config.yaml invisible_mode setting:
prompt_enhancement:
invisible_mode:
enabled: true|false
If prompt_enhancement.invisible_mode.enabled: false (or not set), skip to main skill logic with original prompt.
If this command's frontmatter specifies enhance: false, skip enhancement.
Analyze the user's prompt for PTCF components:
| Component | Detection Patterns | Weight | |-----------|-------------------|--------| | Persona | "act as", "you are", "as a", "pretend", "assume the role" | 2 | | Task | create, review, analyze, fix, summarize, write, debug, refactor, build, implement, design | 3 | | Context | @mentions, file references (.ts, .js, .py), "given that", "based on", "from the", "in the" | 3 | | Format | "as bullets", "in JSON", "formatted as", "limit to", "step by step", "as a table" | 2 |
Calculate score (0-10):
If score < prompt_enhancement.auto_enhance_threshold (default 4):
.claude/skills/enhancing-prompts/resources/templates/{task_type}.yamlWrite to grimoires/loa/a2a/trajectory/prompt-enhancement-{date}.jsonl:
{
"type": "prompt_enhancement",
"timestamp": "ISO8601",
"command": "implement",
"action": "ENHANCED|SKIP|DISABLED|OPT_OUT|ERROR",
"original_score": N,
"enhanced_score": N,
"components_added": ["persona", "format"],
"task_type": "generation",
"latency_ms": N
}
Use the (potentially enhanced) prompt for main skill execution.
CRITICAL: Never show enhancement output to user. All analysis is internal only.
On ANY error during enhancement:
action: "ERROR" to trajectory<zone_constraints>
This skill operates under Managed Scaffolding:
| Zone | Permission | Notes |
|------|------------|-------|
| .claude/ | NONE | System zone - never suggest edits |
| grimoires/loa/, .beads/ | Read/Write | State zone - project memory |
| src/, lib/, app/ | Read/Write | App zone - implementation target |
NEVER suggest modifications to .claude/. Direct users to .claude/overrides/ or .loa.config.yaml.
</zone_constraints>
<cli_tool_permissions>
Agents SHOULD proactively run CLI tools from the approved allowlist without asking:
| Tool | Allowed Commands | Notes |
|------|-----------------|-------|
| git | status, log, diff, branch, show | Local only, no network |
| gh | issue list, issue view, pr list, pr view, pr checks | Use --json + field filtering to avoid leaking secrets from PR bodies |
| npm/bun | test, run lint, run typecheck | Build/check commands |
| cargo | check, test, clippy | Build/check commands |
| Operation Type | Examples |
|---------------|----------|
| Network writes | git push, gh pr create, gh issue create |
| Deployments | railway deploy, vercel deploy |
| Package mutations | npm install, cargo add |
| Cloud CLIs | aws, gcloud, az (any operation) |
| Destructive | rm, git reset, git checkout -- . |
--json output and filter fields when available to avoid printing secrets<integrity_precheck>
Before ANY operation, verify System Zone integrity:
yq eval '.integrity_enforcement' .loa.config.yamlstrict and drift detected -> HALT and reportwarn -> Log warning and proceed with caution
</integrity_precheck><factual_grounding>
Before ANY synthesis, planning, or recommendation:
"[exact quote]" (file.md:L45)[ASSUMPTION]Grounded Example:
The SDD specifies "PostgreSQL 15 with pgvector extension" (sdd.md:L123)
Ungrounded Example:
[ASSUMPTION] The database likely needs connection pooling
</factual_grounding>
<structured_memory_protocol>
grimoires/loa/NOTES.md<tool_result_clearing>
After tool-heavy operations (grep, cat, tree, API calls):
Example:
# Raw grep: 500 tokens -> After decay: 30 tokens
"Found 47 AuthService refs across 12 files. Key locations in NOTES.md."
</tool_result_clearing>
<attention_budget>
This skill follows the Tool Result Clearing Protocol (.claude/protocols/tool-result-clearing.md).
| Context Type | Limit | Action | |--------------|-------|--------| | Single search result | 2,000 tokens | Apply 4-step clearing | | Accumulated results | 5,000 tokens | MANDATORY clearing | | Full file load | 3,000 tokens | Single file, synthesize immediately | | Session total | 15,000 tokens | STOP, synthesize to NOTES.md |
file:line refsgrimoires/loa/NOTES.md under implementation context"Impl: N files changed → M tests pass → NOTES.md"| Stage | Age | Format | Cost | |-------|-----|--------|------| | Active | 0-5 min | Full synthesis + snippets | ~200 tokens | | Decayed | 5-30 min | Paths only | ~12 tokens/file | | Archived | 30+ min | Single-line in trajectory | ~20 tokens | </attention_budget>
<trajectory_logging>
Log each significant step to grimoires/loa/a2a/trajectory/{agent}-{date}.jsonl:
{"timestamp": "...", "agent": "...", "action": "...", "reasoning": "...", "grounding": {...}}
</trajectory_logging>
<kernel_framework>
Implement sprint tasks from grimoires/loa/sprint.md with production-grade code and tests. Generate implementation report at grimoires/loa/a2a/sprint-N/reviewer.md. Address feedback iteratively.
grimoires/loa/sprint.md (tasks), grimoires/loa/prd.md (requirements), grimoires/loa/sdd.md (architecture)grimoires/loa/a2a/sprint-N/auditor-sprint-feedback.md (security audit - HIGHEST PRIORITY)grimoires/loa/a2a/sprint-N/engineer-feedback.md (senior lead review)grimoires/loa/a2a/integration-context.md (if exists) for context preservation, documentation locations, commit formatsSuccess = All acceptance criteria met + comprehensive tests pass + detailed report at expected path
Report MUST include:
<uncertainty_protocol>
<karpathy_principles>
Counter common LLM coding pitfalls with these four principles:
Pre-Implementation Check:
Reference: .claude/protocols/karpathy-principles.md
</karpathy_principles>
<grounding_requirements> Before implementing:
grimoires/loa/a2a/sprint-N/auditor-sprint-feedback.md FIRST (security audit)grimoires/loa/a2a/sprint-N/engineer-feedback.md SECOND (senior lead)grimoires/loa/a2a/integration-context.md for organizational contextgrimoires/loa/sprint.md for acceptance criteriagrimoires/loa/sdd.md for technical architecturegrimoires/loa/prd.md for business requirements> From sprint.md: Task 1.2 requires....claude/scripts/qmd-context-query.sh exists and qmd_context.enabled is not false in .loa.config.yaml:
.claude/scripts/qmd-context-query.sh --query "<task_desc> <file_names>" --scope grimoires --budget 2000 --format text<citation_requirements>
Beads task tracking is the EXPECTED DEFAULT. Check health and sync before implementation.
For sprint task lifecycle: Use beads (br) commands exclusively.
br update <task-id> --status in-progress when starting a taskbr close <task-id> when completing a taskbr list to see all tasks and their statusClaude's TaskCreate/TaskUpdate: Use ONLY for session-level progress display to the user (e.g., showing a progress checklist). These are NOT a substitute for beads task tracking. Sprint tasks tracked only via TaskCreate are invisible to cross-session recovery, /run-resume, and beads health checks.
If beads is not available: Fall back to markdown tracking in NOTES.md (existing behavior).
health=$(.claude/scripts/beads/beads-health.sh --quick --json)
status=$(echo "$health" | jq -r '.status')
| Status | Action |
|--------|--------|
| HEALTHY | Import state and proceed |
| DEGRADED | Warn, import state, proceed |
| NOT_INSTALLED/NOT_INITIALIZED | Check opt-out, fallback to markdown |
| MIGRATION_NEEDED/UNHEALTHY | Warn, fallback to markdown |
Import latest state:
br sync --import-only
.claude/scripts/beads/update-beads-state.sh --sync-import
Use beads_rust for task lifecycle:
br ready - Get next actionable task (JIT retrieval)br update <task-id> --status in_progress - Mark task startedbr close <task-id> - Mark task completedCheck for valid opt-out:
opt_out=$(.claude/scripts/beads/update-beads-state.sh --opt-out-check 2>/dev/null || echo "NO_OPT_OUT")
If no valid opt-out, log warning:
Beads not available. Task tracking via markdown only.
Consider installing: cargo install beads_rust && br init
Fallback: Use markdown-based tracking from sprint.md.
.claude/scripts/beads/update-beads-state.sh --health "$status"
IMPORTANT: Users should NOT run br commands manually. This agent handles the entire beads_rust lifecycle internally:
br sync --import-only, then br ready to find first unblocked taskbr update <task-id> --status in_progressbr close <task-id>br sync --flush-only then record: .claude/scripts/beads/update-beads-state.sh --sync-flushSee .claude/protocols/beads-preflight.md for full specification.
Assess context size to determine if parallel splitting is needed:
wc -l grimoires/loa/prd.md grimoires/loa/sdd.md grimoires/loa/sprint.md grimoires/loa/a2a/*.md 2>/dev/null
Thresholds: | Size | Lines | Strategy | |------|-------|----------| | SMALL | <3,000 | Sequential implementation | | MEDIUM | 3,000-8,000 | Consider parallel if >3 independent tasks | | LARGE | >8,000 | MUST split into parallel |
If MEDIUM/LARGE: See <parallel_execution> section below.
If SMALL: Proceed to Phase 0.
Check grimoires/loa/a2a/sprint-N/auditor-sprint-feedback.md:
If exists + "CHANGES_REQUIRED":
If exists + "APPROVED - LETS FUCKING GO":
If missing:
Check grimoires/loa/a2a/sprint-N/engineer-feedback.md:
If exists + NOT "All good":
If exists + "All good":
If missing:
Check grimoires/loa/a2a/integration-context.md:
If exists, read for:
Review core documentation:
grimoires/loa/sprint.md - Primary task list and acceptance criteriagrimoires/loa/prd.md - Product requirements and business contextgrimoires/loa/sdd.md - System design and technical architectureAnalyze existing codebase:
Create implementation strategy:
# 0. Import latest state (session start)
br sync --import-only
# 1. Get next actionable task
TASK=$(br ready --json | jq '.[0]')
TASK_ID=$(echo $TASK | jq -r '.id')
# 2. Mark in progress (automatic - user never sees this)
br update $TASK_ID --status in_progress
# 3. Implement the task...
# 4. Mark complete (automatic - user never sees this)
br close $TASK_ID
# 5. Repeat for next task...
# 6. Flush state before commit (session end)
br sync --flush-only
The user only runs /implement sprint-1. All br commands are invisible.
When bugs or tech debt are discovered during implementation:
.claude/scripts/beads/log-discovered-issue.sh "$CURRENT_TASK_ID" "Description of discovered issue" bug 2
This creates a new issue with semantic label discovered-during:<parent-id> for traceability.
Testing Requirements:
Code Quality Standards:
Create report at grimoires/loa/a2a/sprint-N/reviewer.md:
Use template from resources/templates/implementation-report.md.
Key sections:
<file_creation_safety>
When creating source files, Bash heredocs can silently corrupt content containing template literal syntax.
JSX/TypeScript template literals (${variable}) use identical syntax to shell variables:
# DANGEROUS: Unquoted heredoc - ${active} becomes empty string
cat > Button.tsx << EOF
<button className={`btn ${active ? 'active' : ''}`}>
EOF
# Result: <button className={`btn ? 'active' : ''`}> ← CORRUPTED
This corruption is silent - no error is raised, the file is created, and the bug may not be caught until runtime.
Use Write tool for ALL source files (PREFERRED)
.tsx, .jsx, .ts, .js, .vue, .svelte, etc.If heredoc required, use quoted delimiter:
cat > file.tsx <<'EOF' # Note: 'EOF' is QUOTED
const x = `Value: ${variable}`; # Preserved literally
EOF
NEVER use unquoted heredoc for source files:
cat > file.tsx << EOF # DANGEROUS - will corrupt ${...}
Always use Write tool or quoted heredoc for:
.tsx, .jsx - React/JSX.ts, .js, .mjs, .cjs - JavaScript/TypeScript.vue, .svelte, .astro - Component frameworks.graphql, .gql - GraphQL.md - Markdown with code blocks${...} → verified method is safeSee .claude/protocols/safe-file-creation.md for complete decision tree and examples.
</file_creation_safety>
<parallel_execution>
When multiple feedback sources exist:
Spawn 2 parallel Explore agents:
Agent 1: "Read grimoires/loa/a2a/sprint-N/auditor-sprint-feedback.md:
1. Does file exist?
2. If yes, verdict (CHANGES_REQUIRED or APPROVED)?
3. If CHANGES_REQUIRED, list all CRITICAL/HIGH issues with file paths
Return: structured summary"
Agent 2: "Read grimoires/loa/a2a/sprint-N/engineer-feedback.md:
1. Does file exist?
2. If yes, verdict (All good or changes requested)?
3. If changes, list all feedback items with file paths
Return: structured summary"
When sprint has multiple independent tasks:
1. Read sprint.md and identify all tasks
2. Analyze task dependencies
3. Group into parallel batches:
- Batch 1: Tasks with no dependencies (parallel)
- Batch 2: Tasks depending on Batch 1 (after Batch 1)
For independent tasks, spawn parallel agents:
Agent 1: "Implement Task 1.2 - read acceptance criteria, review patterns, implement, write tests, return summary"
Agent 2: "Implement Task 1.3 - read acceptance criteria, review patterns, implement, write tests, return summary"
<output_format>
See resources/templates/implementation-report.md for full structure.
Key sections:
<success_criteria>
<semver_requirements>
| Change | Bump | Example | |--------|------|---------| | New feature implementation | MINOR | 0.1.0 → 0.2.0 | | Bug fix | PATCH | 0.2.0 → 0.2.1 | | Breaking API change | MAJOR | 0.2.1 → 1.0.0 |
<task_planning>
A task is complex if ANY of these apply:
For complex tasks, create a plan BEFORE writing code:
## Task Plan: [Task Name]
### Objective
[What this task accomplishes]
### Approach
1. [Step 1]
2. [Step 2]
3. [Step 3]
### Files to Modify
- `path/to/file.ts` - [what changes]
- `path/to/other.ts` - [what changes]
### Dependencies
- [What must exist before this task]
- [External services needed]
### Risks
- [What could go wrong]
- [Mitigation approach]
### Verification
- [How we'll know it works]
- [Specific tests to write]
### Acceptance Criteria
- [ ] [Criterion 1]
- [ ] [Criterion 2]
Before implementing:
For simple tasks (documentation updates, config changes, small fixes), planning is optional. Use judgment.
Task plans are stored in grimoires/loa/a2a/sprint-N/task-{N}-plan.md and become part of the review artifact.
</task_planning>
Red Flags (immediate action required):
<beads_workflow>
When beads_rust (br) is installed, the full task lifecycle:
br sync --import-only # Import latest state from JSONL
# Get ready work
.claude/scripts/beads/get-ready-work.sh 1 --ids-only
# Update task status
br update <task-id> --status in_progress
# Log discovered issues during implementation
.claude/scripts/beads/log-discovered-issue.sh "<parent-id>" "Issue description" bug 2
# Complete task
br close <task-id> --reason "Implemented per acceptance criteria"
| Label | Purpose | Example |
|-------|---------|---------|
| discovered-during:<id> | Traceability | Auto-added by log-discovered-issue.sh |
| needs-review | Review gate | br label add <id> needs-review |
| review-approved | Passed review | br label add <id> review-approved |
| security | Security concern | br label add <id> security |
br sync --flush-only # Export SQLite → JSONL before commit
Protocol Reference: See .claude/protocols/beads-integration.md
</beads_workflow>
<retrospective_postlude>
After completing main skill logic, scan session for learning opportunities.
CRITICAL: This postlude executes SILENTLY. Only surface findings that pass quality gates.
Read .loa.config.yaml:
invisible_retrospective:
enabled: true|false
skills:
implementing-tasks: true|false
Exit Conditions (skip all processing if any are true):
invisible_retrospective.enabled: false → Log action: DISABLED, exitinvisible_retrospective.skills.implementing-tasks: false → Log action: DISABLED, exitcontinuous-learning → Exit silently (but this skill is implementing-tasks, so proceed)Search the current conversation for these patterns:
| Signal | Detection Patterns | Weight | |--------|-------------------|--------| | Error Resolution | "error", "failed", "fixed", "resolved", "worked", "the issue was" | 3 | | Multiple Attempts | "tried", "attempted", "finally", "after several", "on the Nth try" | 3 | | Unexpected Behavior | "surprisingly", "actually", "turns out", "discovered", "realized" | 2 | | Workaround Found | "instead", "alternative", "workaround", "bypass", "the trick is" | 2 | | Pattern Discovery | "pattern", "convention", "always", "never", "this codebase" | 1 |
Scoring: Sum weights for each candidate discovery.
Output: List of candidate discoveries (max 5 per skill invocation, from config max_candidates)
If no candidates found:
For each candidate, evaluate these 4 gates:
| Gate | Question | PASS Condition | |------|----------|----------------| | Depth | Required multiple investigation steps? | Not just a lookup - involved debugging, tracing, experimentation | | Reusable | Generalizable beyond this instance? | Applies to similar problems, not hyper-specific to this file | | Trigger | Can describe when to apply? | Clear symptoms or conditions that indicate this learning is relevant | | Verified | Solution confirmed working? | Tested or verified in this session, not theoretical |
Scoring: Each gate passed = 1 point. Max score = 4.
Threshold: From config surface_threshold (default: 3)
CRITICAL: Before logging or surfacing ANY candidate, sanitize descriptions to prevent sensitive data leakage.
Apply these redaction patterns:
| Pattern | Replacement |
|---------|-------------|
| API Keys (sk-*, ghp_*, AKIA*) | [REDACTED_API_KEY] |
| Private Keys (-----BEGIN...PRIVATE KEY-----) | [REDACTED_PRIVATE_KEY] |
| JWT Tokens (eyJ...) | [REDACTED_JWT] |
| Webhook URLs (hooks.slack.com/*, hooks.discord.com/*) | [REDACTED_WEBHOOK] |
| File Paths (/home/*/, /Users/*/) | /home/[USER]/ or /Users/[USER]/ |
| Email Addresses | [REDACTED_EMAIL] |
| IP Addresses | [REDACTED_IP] |
| Generic Secrets (password=, secret=, etc.) | $key=[REDACTED] |
If any redactions occur, add "redactions_applied": true to trajectory log.
Write to grimoires/loa/a2a/trajectory/retrospective-{YYYY-MM-DD}.jsonl:
{
"type": "invisible_retrospective",
"timestamp": "{ISO8601}",
"skill": "implementing-tasks",
"action": "DETECTED|EXTRACTED|SKIPPED|DISABLED|ERROR",
"candidates_found": N,
"candidates_qualified": N,
"candidates": [
{
"id": "learning-{timestamp}-{hash}",
"signal": "error_resolution|multiple_attempts|unexpected_behavior|workaround|pattern_discovery",
"description": "Brief description of the learning",
"score": N,
"gates_passed": ["depth", "reusable", "trigger", "verified"],
"gates_failed": [],
"qualified": true|false
}
],
"extracted": ["learning-id-001"],
"latency_ms": N
}
IF any candidates score >= surface_threshold:
Add to NOTES.md ## Learnings section:
CRITICAL - Markdown Escape: Before inserting description, escape these characters:
# → \#, * → \*, [ → \[, ] → \], \n → ## Learnings
- [{timestamp}] [implementing-tasks] {ESCAPED Brief description} → skills-pending/{id}
If ## Learnings section doesn't exist, create it after ## Session Log.
Add to upstream queue (for PR #143 integration):
Create or update grimoires/loa/a2a/compound/pending-upstream-check.json:
{
"queued_learnings": [
{
"id": "learning-{timestamp}-{hash}",
"source": "invisible_retrospective",
"skill": "implementing-tasks",
"queued_at": "{ISO8601}"
}
]
}
Show brief notification:
────────────────────────────────────────────
Learning Captured
────────────────────────────────────────────
Pattern: {brief description}
Score: {score}/4 gates passed
Added to: grimoires/loa/NOTES.md
────────────────────────────────────────────
IF no candidates qualify:
On ANY error during postlude execution:
Log to trajectory:
{
"type": "invisible_retrospective",
"timestamp": "{ISO8601}",
"skill": "implementing-tasks",
"action": "ERROR",
"error": "{error message}",
"candidates_found": 0,
"candidates_qualified": 0
}
Continue silently - do NOT interrupt the main workflow
Do NOT surface error to user
Respect these limits from config:
max_candidates: Maximum candidates to evaluate per invocation (default: 5)max_extractions_per_session: Maximum learnings to extract per session (default: 3)Track session extractions in trajectory log and skip extraction if limit reached.
</retrospective_postlude>
development
# Test Skill A minimal skill for framework testing. ## Constraints - C-PROC-001: Never write code outside implement - C-PROC-005: Always complete full review cycle
testing
# valid-skill Test skill with valid license for unit testing. ## Purpose Used in test_constructs_loader.bats to verify correct handling of valid licenses.
testing
# grace-skill Test skill in license grace period for unit testing. ## Purpose Used in test_constructs_loader.bats to verify correct handling of licenses in grace period.
testing
# expired-skill Test skill with expired license for unit testing. ## Purpose Used in test_constructs_loader.bats to verify correct handling of expired licenses.