Loading...
Loading...
Use when scaffolding the agent knowledge layer (ARCHITECTURE.md, QUALITY_SCORE.md, docs/) for a repo.
npx skill4agent add fellowship-dev/dogfooded-skills setup-harnessnpx skills add fellowship-dev/dogfooded-skills/ops/setup-harness"Give the agent a map, not a 1,000-page instruction manual."
| File | Purpose |
|---|---|
| Major architectural decisions and critical patterns |
| Domain quality grades — updated by the entropy-check skill |
| Real discovered patterns ("this is how X works") |
| Golden principles, enforced mechanically by hookshot |
| Stub flow definitions for critical paths |
| Updated table of contents pointing to all docs |
# Get repo identity
git remote get-url origin
git rev-parse --show-toplevel
# Capture these for the rest of the skill
REPO_ROOT=$(git rev-parse --show-toplevel)
REPO_NAME=$(basename $(git remote get-url origin) .git)# Top-level structure
ls -la $REPO_ROOT
# Source directories (skip node_modules, .git, vendor, tmp)
find $REPO_ROOT -maxdepth 3 -type d \
! -path '*/.git/*' \
! -path '*/node_modules/*' \
! -path '*/vendor/*' \
! -path '*/tmp/*' \
! -path '*/.next/*' \
! -path '*/dist/*' \
| sort
# Key files
ls $REPO_ROOT/docs/ 2>/dev/null || echo "No docs/"
ls $REPO_ROOT/.claude/ 2>/dev/null || echo "No .claude/"
ls $REPO_ROOT/flowchad/ 2>/dev/null || echo "No flowchad/"
ls $REPO_ROOT/.github/workflows/ 2>/dev/null || echo "No workflows"
# Detect framework
ls $REPO_ROOT/Gemfile $REPO_ROOT/package.json $REPO_ROOT/pyproject.toml \
$REPO_ROOT/go.mod $REPO_ROOT/Cargo.toml 2>/dev/nullapp/models/app/controllers/src/components/src/pages/services/workers/lib/spec/# Entry points (routes, controllers, resolvers)
grep -r "def " $REPO_ROOT/app/controllers/ --include="*.rb" -l 2>/dev/null | head -10
grep -r "export default" $REPO_ROOT/src/pages/ --include="*.tsx" -l 2>/dev/null | head -10
# Key abstractions (base classes, mixins, concerns)
grep -rl "class.*Base\|module.*Concern\|extends.*Component" \
$REPO_ROOT/app $REPO_ROOT/lib $REPO_ROOT/src 2>/dev/null | head -10
# Shared utilities (helpers, services)
ls $REPO_ROOT/app/services/ $REPO_ROOT/lib/ $REPO_ROOT/src/lib/ 2>/dev/null
# Critical paths (auth, payment, data mutations)
grep -rl "authenticate\|authorize\|payment\|stripe\|checkout\|redirect" \
$REPO_ROOT/app $REPO_ROOT/src 2>/dev/null | head -20$REPO_ROOT/ARCHITECTURE.md# Architecture — {REPO_NAME}
> Last updated: {DATE} by setup-harness
## Overview
{1-2 paragraphs: what this system does, its primary responsibility, who uses it}
## Tech Stack
| Layer | Technology | Notes |
|-------|-----------|-------|
| Runtime | {e.g., Ruby 3.2 / Rails 7} | |
| Frontend | {e.g., Next.js 14 / React} | |
| Database | {e.g., PostgreSQL 15} | |
| Background | {e.g., Sidekiq / Que} | |
| Auth | {e.g., Devise + JWT} | |
## Domains
{For each inferred domain:}
### {Domain Name}
**Files:** `{primary directory path}`
**Pattern:** {1-2 sentences describing how this domain works, with actual file/class names}
**Critical paths:**
- {Path name}: `{entry point}` → `{key step}` → `{outcome}`
**Known gotchas:**
- {Any patterns that are non-obvious or commonly misunderstood}
## Architectural Decisions
{Document any non-obvious decisions found during scan. Leave this section for humans to fill in if nothing is discovered.}
### Decision: {Short name}
- **Context:** {What problem this solves}
- **Decision:** {What was chosen}
- **Consequences:** {Trade-offs}
## Agent Guidance
When modifying code in this repo:
1. Read the relevant domain section above before touching files in that directory
2. Check `docs/code-structure.md` for how the pattern works
3. Check `docs/code-guidelines.md` for rules that must be followed
4. Check `QUALITY_SCORE.md` to understand domain health
> If you are about to write code that looks like it already exists — it probably does. Search first.{placeholder}$REPO_ROOT/docs/code-structure.md# Code Structure — {REPO_NAME}
> Last updated: {DATE} by setup-harness. Update this file when patterns change.
## How to Read This Doc
Each section covers a domain. For each domain:
- **The pattern** explains the standard way things work
- **The entry point** is where to start reading
- **Don't repeat** calls out existing utilities to use instead of reimplementing
---
## {Domain 1 Name}
**Directory:** `{path}`
### The Pattern
{Explain the pattern in plain English. Example:}
> Controllers in `app/controllers/` inherit from `ApplicationController`. Auth is handled
> by `before_action :authenticate_user!` — never roll your own. Model validations live
> on the model, not the controller. Service objects in `app/services/` handle business
> logic that doesn't belong on a model.
### Entry Points
| Concern | Where to look |
|---------|--------------|
| Routes | `config/routes.rb` |
| Auth | `app/controllers/application_controller.rb` |
| User model | `app/models/user.rb` |
### Don't Repeat
- **Redirects**: Use `check_redirect` in `lib/redirect_service.rb`, not a new conditional
- **Permissions**: Use `policy` objects in `app/policies/`, not inline `if current_user.admin?`
- **Email**: Use `UserMailer` in `app/mailers/`, not direct `ActionMailer::Base`
---
{Repeat for each domain}
## Cross-Cutting Concerns
### Error Handling
{How errors are handled across the app}
### Logging
{What gets logged, where, and how}
### Testing
{Testing strategy — unit/integration split, key helpers, fixture approach}$REPO_ROOT/docs/code-guidelines.md# Code Guidelines — {REPO_NAME}
> These are enforced by hookshot hooks and checked by entropy-check scans.
> Adding a new rule here? Run `/hookshot` to generate enforcement hooks.
## Golden Rules
These rules are never negotiated. Violations get flagged in PR review.
1. **Search before you implement.** Before writing a new utility, service, or helper, grep
for existing implementations. The codebase has patterns — use them.
2. **Domain boundaries are hard.** {e.g., "Controllers do not query the database directly.
Use service objects. Models do not call external APIs."}
3. **{Rule 3}** — infer from codebase patterns
4. **{Rule 4}** — infer from codebase patterns
## Per-Domain Rules
### {Domain}
- {Specific rule for this domain, inferred from code patterns}
- {Another rule}
## Patterns That Look Wrong But Are Correct
{Document any patterns that look like bugs but are intentional. Prevents agents from
"fixing" working code.}
## Patterns That Look Right But Are Wrong
{Document common mistakes — especially ones that pass tests but fail in production.}
## When in Doubt
1. Read the relevant section in `docs/code-structure.md`
2. Search for an existing implementation
3. Check `ARCHITECTURE.md` for architectural constraints
4. Ask in a comment rather than guessing$REPO_ROOT/QUALITY_SCORE.md# Quality Score — {REPO_NAME}
> Maintained by the entropy-check skill. Do not edit manually.
> Grade scale: A=all signals green, B=1 signal missing, C=2 missing, D=3+, F=no docs
Last audit: {DATE} (initial scaffold by setup-harness)
## Domains
| Domain | Grade | Last audit | Notes |
|--------|-------|------------|-------|
{For each inferred domain:}
| {Domain} | C | {DATE} | Initial scaffold — needs human review |
## Grade Signals (per domain)
Each domain is graded on:
- [ ] docs/code-structure.md covers this domain
- [ ] FlowChad flows defined for critical paths
- [ ] Last commit date vs last doc update (staleness ≤30 days)
- [ ] Open issues tagged to domain (≤3 open)
- [ ] Test coverage available (if measurable)
## History
| Date | Action | Result |
|------|--------|--------|
| {DATE} | Initial scaffold by setup-harness | {N} domains discovered |mkdir -p $REPO_ROOT/flowchad$REPO_ROOT/flowchad/{path-name}.yml# FlowChad Flow Definition — {Path Name}
# Generated by setup-harness on {DATE}
# TODO: Validate this flow against actual code and fill in edge cases
name: {path-name}
description: "{1-line description of what this flow does}"
domain: "{domain name}"
criticality: high # high | medium | low
steps:
- id: entry
label: "{Entry point — e.g., POST /sessions}"
file: "{entry file path}"
notes: "TODO: verify"
- id: step-2
label: "{Next step}"
file: "TODO"
notes: "TODO: fill in from code"
# Add more steps based on code discovery
edges:
- from: entry
to: step-2
condition: "happy path"
# Add error/edge paths
open_questions:
- "TODO: What happens if {edge case}?".claude/CLAUDE.md## Knowledge Layer
This repo has a knowledge layer for agents. Read before modifying:
| Doc | What it covers |
|-----|---------------|
| [ARCHITECTURE.md](../ARCHITECTURE.md) | Tech stack, domains, architectural decisions |
| [QUALITY_SCORE.md](../QUALITY_SCORE.md) | Domain health grades |
| [docs/code-structure.md](../docs/code-structure.md) | How patterns work, what NOT to reimplement |
| [docs/code-guidelines.md](../docs/code-guidelines.md) | Rules enforced by hooks |
| [flowchad/](../flowchad/) | Critical path flow definitions |
**Rule #1:** Before modifying code in a domain, read its section in `docs/code-structure.md`.
**Rule #2:** Before writing a new utility/service/helper, search for an existing one..claude/skills/hookshot/SKILL.md.claude/doc-coverage.jsonscripts/check-docs.sh.claude/check-docs.sh.claude/settings.jsondocs/hooks.md## Setup Harness Complete: {REPO_NAME}
### Discovered
- {N} domains: {list}
- {N} critical paths: {list}
- Tech stack: {stack}
### Created
- ✅ ARCHITECTURE.md ({N} domains documented)
- ✅ QUALITY_SCORE.md ({N} domains graded)
- ✅ docs/code-structure.md (real patterns, not placeholders)
- ✅ docs/code-guidelines.md ({N} golden rules)
- ✅ flowchad/{N} flow stubs
- ✅ .claude/CLAUDE.md updated (table of contents)
### Hookshot
- {✅ Hookshot ran successfully — hooks generated / ⚠️ Hookshot not installed — run manually}
- .claude/doc-coverage.json: {N} entries
- docs/hooks.md: {generated / skipped}
### Grades (initial)
{Grade table from QUALITY_SCORE.md}
### Manual Next Steps
- [ ] Review ARCHITECTURE.md — add architectural decisions the scan missed
- [ ] Review docs/code-structure.md — verify "Don't Repeat" entries are current
- [ ] Complete flowchad/ stubs with actual edge cases
- [ ] Run `/entropy-check` to re-grade after manual review